Echtzeitsysteme / java-refactoring-ttc

Object-oriented Refactoring of Java Programs using Graph Transformation (TTC'2015)
0 stars 0 forks source link

The java program does not contain the class "ParentClass". #17

Closed GerardPaligot closed 9 years ago

GerardPaligot commented 9 years ago

I have always a problem with the execution of sources generated after the refactoring. I'm trying to execute the test case pub_pum1_1_paper1 and I create a JUnit test case which make the exactly same assert of your test (and the test case is green) but, when ARTE would like to execute the generated sources, it didn't find sources.

For information, I generate sources in the folder specified in createProgramGraph (like confirmed there) and I print sources on synchronizeChanges method and this is the output of the test case:

execute --test pub_pum1_1_paper1                                   

####################################################################
####################   Executing public tests.  ####################
####################################################################

Executing test case: "pub_pum1_1_paper1"
    Description:
        PUM-POS: (paper1) Pull-up of two classes into a parent class.

SUCCESS: The java program has been compiled.

    Output of execution before refactoring:
        c1:Hello World
        c1:Hello World
        c1:Hello World
        c2:Hello World
        c2:Hello World
        c2:Hello World

sssssssssssssss Triggering Program Graph Generation ssssssssssssssss
avr. 21, 2015 4:31:22 PM fr.inria.SpoonTtc createProgramGraph
INFOS: parse /var/folders/yd/kdk6_3wn4fvc71sblyjpgnn80000gn/T/tmp_ttc/paper-example01
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

ssssssssssssss  Triggering Pull-Up Method Refactoring ssssssssssssss
avr. 21, 2015 4:31:22 PM fr.inria.SpoonTtc applyPullUpMethod
INFOS: apply pull up method
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

ssssssssssss  Triggering Synchronization with Java Code ssssssssssss
avr. 21, 2015 4:31:22 PM fr.inria.SpoonTtc synchronizeChanges
INFOS: will print to /var/folders/yd/kdk6_3wn4fvc71sblyjpgnn80000gn/T/tmp_ttc/paper-example01
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

FAILURE: The java program does not contain the class "ParentClass".

    Output of execution after refactoring:
Erreur : impossible de trouver ou charger la classe principale example01.ChildClass1

FAILURE: The program does not run proper.

--------------------------------------------------------------------
FAILURE: Test case "pub_pum1_1_paper1" has not been executed successfully.
The solution needed 0,005 seconds for execution. 
--------------------------------------------------------------------

####################################################################
####################  Summary of test results.  ####################
####################################################################

The test case "pub_pum1_1_paper1" was executed with status "FAILURE".

Summary of the test results:
+ 0 % of the test cases were executed successfull
? 0 % of the test cases ended in a warning but were still successful.
- 100 % of the test cases resulted in a failure.
SvenPeldszus commented 9 years ago

Can you please print the contents of the paper-example01\src\ and if still existent the paper-example01\src\example01 folder after the propagation of the changes.

Maybe you are deleting the java files from the src folder and are moving them to the java project directory. ARTE is only searching in the src folder.

GerardPaligot commented 9 years ago

Do you talk about /var/folders/yd/kdk6_3wn4fvc71sblyjpgnn80000gn/T/tmp_ttc/paper-example01 ? If yes, this directory doesn't exist before and after the test case.

SvenPeldszus commented 9 years ago

Yes, this is a temporal copy, which is created before the test and directly deleted after the test.

E.g. in the synchronizeChanges() method you can access it.

GerardPaligot commented 9 years ago

So I mustn't print my sources refactored at this place?

SvenPeldszus commented 9 years ago

You have to print your refactored sources at this place but they are only kept until the test case has been executed.

At the moment I am interested which files are there available after your refactoring.

You can only list them before synchronize() returns as in the test case "pub_pum1_1_paper1" after the call of synchronize() ARTE performs static checks, tries to compile and execute the program and then deletes everything.

GerardPaligot commented 9 years ago

Ok, so I generated sources on a personal directory (~/Documents/paper-examples01) and files generated are:

paper-example01
  + example01
    + ChildClass1.java
    + ChildClass2.java
    + ParentClass.java

But you said that sources must to be generated in a src folder in paper-example01 directory. So, should I modify your location given in createProgramGraph to generate sources in a src folder? For me, ARTE should give me directly the good folder.

SvenPeldszus commented 9 years ago

Yes, the structure of the java projects is oriented on standard eclipse projects. We require always a src folder. This simplifies the handling of e.g external. libraries in jar files for us.

In the example the structure has to be:

paper-example01
  +src
    + example01
      + ChildClass1.java
      + ChildClass2.java
      + ParentClass.java
GerardPaligot commented 9 years ago

Ok, that was that. Everything works fine when I modify the program location to generate in a src folder. Thanks.