castor

Test the templates using MasterTestSuite

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1.2.1
  • Fix Version/s: 1.2
  • Component/s: XML tests
  • Labels:
    None
  • Number of attachments :
    7
  1. patch.2047.20070726.maven-plugins.txt
    26/Jul/07 10:12 AM
    8 kB
    Matthias Epheser
  2. patch.c2047.20070724.txt
    23/Jul/07 5:24 PM
    4 kB
    Matthias Epheser
  3. patch.c2047.20070726.xmlctf.txt
    26/Jul/07 10:30 AM
    3 kB
    Matthias Epheser
  4. patch.c2047.20070816.txt
    16/Jul/07 12:20 AM
    2 kB
    Matthias Epheser
  5. patch.c2047.20070921.txt
    21/Sep/07 5:16 AM
    17 kB
    Matthias Epheser
  6. patch.c2047.20070922.txt
    22/Sep/07 7:59 AM
    18 kB
    Matthias Epheser

Activity

Hide
Matthias Epheser added a comment -

Createtd some small quickfix to use the xmlctf with maven. So it's easier for me to test, just have to "mvn install" the codegen module and run "mvn antrun:ant" in the xmlctf module.

Show
Matthias Epheser added a comment - Createtd some small quickfix to use the xmlctf with maven. So it's easier for me to test, just have to "mvn install" the codegen module and run "mvn antrun:ant" in the xmlctf module.
Hide
Matthias Epheser added a comment -

Tested the source generation using the templates, all tests completed successfully.

Show
Matthias Epheser added a comment - Tested the source generation using the templates, all tests completed successfully.
Hide
Werner Guttmann added a comment -

Looks like you have to talk me through parts of this in detail ... .

Show
Werner Guttmann added a comment - Looks like you have to talk me through parts of this in detail ... .
Hide
Werner Guttmann added a comment -

Hmm, looking at the POM addition, is there a way to remove the dependency on the JVM (5.0) local to your filesystem, and make this more generic ?

Show
Werner Guttmann added a comment - Hmm, looking at the POM addition, is there a way to remove the dependency on the JVM (5.0) local to your filesystem, and make this more generic ?
Hide
Werner Guttmann added a comment -

The patch is relative to xmlctf .. .

Show
Werner Guttmann added a comment - The patch is relative to xmlctf .. .
Hide
Werner Guttmann added a comment -

I'd love to commit this, but without a resolution for the JVM issue mentioned above ... this won't be possible.

Show
Werner Guttmann added a comment - I'd love to commit this, but without a resolution for the JVM issue mentioned above ... this won't be possible.
Hide
Matthias Epheser added a comment -

I did some refactoring today, replacing the antRun code with a maven plugin. This plugin cis integrated into the xmlctf as follows:

<plugin>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor-xmlctf-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>text</goal>
</goals>
</execution>
</executions>
</plugin>

now the suite can be run using

mvn test -Dcastor.xmlctf.root=tests/MasterTestSuite/

see patch patch.c2047.20070724.txt for details (patch is relative to xmlctf)
i also attached the plugin: xmlctf-maven-plugin.zip

Show
Matthias Epheser added a comment - I did some refactoring today, replacing the antRun code with a maven plugin. This plugin cis integrated into the xmlctf as follows: <plugin> <groupId>org.codehaus.castor</groupId> <artifactId>castor-xmlctf-plugin</artifactId> <executions> <execution> <phase>test</phase> <goals> <goal>text</goal> </goals> </execution> </executions> </plugin> now the suite can be run using mvn test -Dcastor.xmlctf.root=tests/MasterTestSuite/ see patch patch.c2047.20070724.txt for details (patch is relative to xmlctf) i also attached the plugin: xmlctf-maven-plugin.zip
Hide
Matthias Epheser added a comment -

this patch moves the xmlctf-run-mojo to the new trunk/maven-plugins project
it currently contains only one goal: xmlctf-run-text

the file patch.c2047.20070826.xmlctf.txt attached to this issue explains how to integrate the plugin into the test phase of the xmlctf module

Show
Matthias Epheser added a comment - this patch moves the xmlctf-run-mojo to the new trunk/maven-plugins project it currently contains only one goal: xmlctf-run-text the file patch.c2047.20070826.xmlctf.txt attached to this issue explains how to integrate the plugin into the test phase of the xmlctf module
Hide
Matthias Epheser added a comment -

reposting this patch changing the filename (it's still july )

this patch moves the xmlctf-run-mojo to the new trunk/maven-plugins project
it currently contains only one goal: xmlctf-run-text

the file patch.c2047.20070726.xmlctf.txt attached to this issue explains how to integrate the plugin into the test phase of the xmlctf module

Show
Matthias Epheser added a comment - reposting this patch changing the filename (it's still july ) this patch moves the xmlctf-run-mojo to the new trunk/maven-plugins project it currently contains only one goal: xmlctf-run-text the file patch.c2047.20070726.xmlctf.txt attached to this issue explains how to integrate the plugin into the test phase of the xmlctf module
Hide
Matthias Epheser added a comment -

patch relative to trunk/xmlcft

this patch adds the castor xmlctf testRunner plugin to the test phase

in addition: the oro dependency is temporarily added because the connection to the parent pom is disabled

the config looks like this:

<plugin>
<groupId>org.codehaus.castor</groupId>
<artifactId>maven-plugins</artifactId>
<executions>
<execution>
<phase>test</phase>
<configuration>
<!-- testRoot may be overridden using systemproperty -Dcastor.xmlctf.testRoot -->
<testRoot>./tests/MasterTestSuite</testRoot>
<verbose>false</verbose>
<printStack>false</printStack>
</configuration>
<goals>
<goal>xmlctf-run-text</goal>
</goals>
</execution>
</executions>
</plugin>

Show
Matthias Epheser added a comment - patch relative to trunk/xmlcft this patch adds the castor xmlctf testRunner plugin to the test phase in addition: the oro dependency is temporarily added because the connection to the parent pom is disabled the config looks like this: <plugin> <groupId>org.codehaus.castor</groupId> <artifactId>maven-plugins</artifactId> <executions> <execution> <phase>test</phase> <configuration> <!-- testRoot may be overridden using systemproperty -Dcastor.xmlctf.testRoot --> <testRoot>./tests/MasterTestSuite</testRoot> <verbose>false</verbose> <printStack>false</printStack> </configuration> <goals> <goal>xmlctf-run-text</goal> </goals> </execution> </executions> </plugin>
Hide
Werner Guttmann added a comment -

I have moved all framework code of the XML CTF test suite to a new Maven module (xmlctf-framework). It should now be possible to resolve the cyclic references between the modules xmlctf and the new maven-plugins module.

Show
Werner Guttmann added a comment - I have moved all framework code of the XML CTF test suite to a new Maven module (xmlctf-framework). It should now be possible to resolve the cyclic references between the modules xmlctf and the new maven-plugins module.
Hide
Matthias Epheser added a comment -

I moved the plugin code to the new folder structure. We now have 3 modules:

  • maven-plugins: the castor maven plugins, currently only including xmlctf-runner
  • xmlctf-framework: the code to create junit tests out of xml test descriptors
  • xmlctf: includes the testsuite in the tests/ folder

first, build the current castor checkout modules, if they are not already in your repo:
"mvn install" in castor (root dir), codegen, xmlctf-framework and maven-plugins

Running the tests:

  • "cd xmlctf"
  • "mvn test" (-> runs all tests in tests/MasterTestSuite)
  • "mvn test Dcastor.xmlctf.root=tests/MasterTestSuite/mapping/configurableFieldHandler/" (> runs a custom testRoot)
  • use the maven -X or --debug to enable verbose output and stacktraces
Show
Matthias Epheser added a comment - I moved the plugin code to the new folder structure. We now have 3 modules:
  • maven-plugins: the castor maven plugins, currently only including xmlctf-runner
  • xmlctf-framework: the code to create junit tests out of xml test descriptors
  • xmlctf: includes the testsuite in the tests/ folder
first, build the current castor checkout modules, if they are not already in your repo: "mvn install" in castor (root dir), codegen, xmlctf-framework and maven-plugins Running the tests:
  • "cd xmlctf"
  • "mvn test" (-> runs all tests in tests/MasterTestSuite)
  • "mvn test Dcastor.xmlctf.root=tests/MasterTestSuite/mapping/configurableFieldHandler/" (> runs a custom testRoot)
  • use the maven -X or --debug to enable verbose output and stacktraces
Hide
Werner Guttmann added a comment -

I am getting exceptions, namely 'Failed to find compile method'.

Show
Werner Guttmann added a comment - I am getting exceptions, namely 'Failed to find compile method'.
Hide
Werner Guttmann added a comment -

Any idea why ?

Show
Werner Guttmann added a comment - Any idea why ?
Hide
Werner Guttmann added a comment -

I am getting those when executing 'mvn test' in xmlctf - after building the SNAPSHOT JARs for everything else.

Show
Werner Guttmann added a comment - I am getting those when executing 'mvn test' in xmlctf - after building the SNAPSHOT JARs for everything else.
Hide
Matthias Epheser added a comment -

this exception is thrown in the SunJavaCompiler. It means that it is unable to find the compilie method "compile" in class "com.sun.tools.javac.Main".

So I think your problem is that tools.jar is not added correctly to your testClasspath. This is currently achieved by:

classpath += System.getProperty("java.home") + "/lib/tools.jar:";

this ispired by the CTFRun script, where it says:

CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar

it works fine for me on unix (mac).

you can run mvn test with the -X property, then the classpath is printet out before test execution. Please check the path to the tools.jar in the debug message: "DEBUG classpath for sourcegenerator is: ..."

Show
Matthias Epheser added a comment - this exception is thrown in the SunJavaCompiler. It means that it is unable to find the compilie method "compile" in class "com.sun.tools.javac.Main". So I think your problem is that tools.jar is not added correctly to your testClasspath. This is currently achieved by: classpath += System.getProperty("java.home") + "/lib/tools.jar:"; this ispired by the CTFRun script, where it says: CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar it works fine for me on unix (mac). you can run mvn test with the -X property, then the classpath is printet out before test execution. Please check the path to the tools.jar in the debug message: "DEBUG classpath for sourcegenerator is: ..."
Hide
Werner Guttmann added a comment -

Matthias, here's the output you asked for

[DEBUG] classpath for sourcegenerator is:\bin\j2sdk1.4.2_11\jre/lib/tools.jar:
D:\dev\maven\repository\org\codehaus\castor\castor-codegen\1.1.3-SNAPSHOT\castor-codegen-1.1.3-SNAPSHOT.jar:
D:\dev\maven\repository\org\codehaus\castor\castor\1.1.3-SNAPSHOT\castor-1.1.3-SNAPSHOT.jar:
[snipped]

What's surprising is that there's a reference to tools.jar that is wrong, as it includes /jre/. I just crossed-checked, and my JAVA_HOME is set to

D:\bin\j2sdk1.4.2_11\

only. So where does the 'jre-infix' come from ?

Show
Werner Guttmann added a comment - Matthias, here's the output you asked for [DEBUG] classpath for sourcegenerator is:\bin\j2sdk1.4.2_11\jre/lib/tools.jar: D:\dev\maven\repository\org\codehaus\castor\castor-codegen\1.1.3-SNAPSHOT\castor-codegen-1.1.3-SNAPSHOT.jar: D:\dev\maven\repository\org\codehaus\castor\castor\1.1.3-SNAPSHOT\castor-1.1.3-SNAPSHOT.jar: [snipped] What's surprising is that there's a reference to tools.jar that is wrong, as it includes /jre/. I just crossed-checked, and my JAVA_HOME is set to D:\bin\j2sdk1.4.2_11\ only. So where does the 'jre-infix' come from ?
Hide
Matthias Epheser added a comment -

new patch now extends the mojo to look in ${java.home}/lib/tools.jar AND ${java.home}..//lib/tools.jar

In addition, the user can overwrite the absolute path to tools.jar using the "pathToTools" property in the pluging configuration section.

Show
Matthias Epheser added a comment - new patch now extends the mojo to look in ${java.home}/lib/tools.jar AND ${java.home}..//lib/tools.jar In addition, the user can overwrite the absolute path to tools.jar using the "pathToTools" property in the pluging configuration section.
Hide
Werner Guttmann added a comment -

Still having the same problem despite your changes, with classpath being ....

[DEBUG] classpath for sourcegenerator is:D:\bin\j2sdk1.4.2_11\jre/lib/tools.jar:
D:\bin\j2sdk1.4.2_11\jre/../lib/tools.jar:D:\dev\maven\repository\org\codehaus\c
astor\castor-codegen\1.1.3-SNAPSHOT\castor-codegen-1.1.3-SNAPSHOT.jar:D:\dev\mav
en\repository\org\codehaus\castor\castor\1.1.3-SNAPSHOT\castor-1.1.3-SNAPSHOT.ja
r:D:\dev\maven\repository\avalon-framework\avalon-framework\4.1.3\avalon-framewo
rk-4.1.3.jar:D:\dev\maven\repository\junit\junit\3.8.1\junit-3.8.1.jar:D:\dev\ma
ven\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar:D:\de
v\maven\repository\javax\servlet\servlet-api\2.3\servlet-api-2.3.jar:D:\dev\mave
n\repository\org\codehaus\castor\castor-testsuite-xml-framework\1.1.3-SNAPSHOT\c
astor-testsuite-xml-framework-1.1.3-SNAPSHOT.jar:D:\dev\maven\repository\ant\ant
\1.6\ant-1.6.jar:D:\dev\maven\repository\xerces\xerces\1.4.0\xerces-1.4.0.jar:D:
\dev\maven\repository\logkit\logkit\1.0.1\logkit-1.0.1.jar:D:\dev\maven\reposito
ry\log4j\log4j\1.2.13\log4j-1.2.13.jar:

As you can see, the second entry now point to an existing tools.jar. Still, the compiler moans that there's no compiler on the classpath.

Show
Werner Guttmann added a comment - Still having the same problem despite your changes, with classpath being ....
[DEBUG] classpath for sourcegenerator is:D:\bin\j2sdk1.4.2_11\jre/lib/tools.jar:
D:\bin\j2sdk1.4.2_11\jre/../lib/tools.jar:D:\dev\maven\repository\org\codehaus\c
astor\castor-codegen\1.1.3-SNAPSHOT\castor-codegen-1.1.3-SNAPSHOT.jar:D:\dev\mav
en\repository\org\codehaus\castor\castor\1.1.3-SNAPSHOT\castor-1.1.3-SNAPSHOT.ja
r:D:\dev\maven\repository\avalon-framework\avalon-framework\4.1.3\avalon-framewo
rk-4.1.3.jar:D:\dev\maven\repository\junit\junit\3.8.1\junit-3.8.1.jar:D:\dev\ma
ven\repository\commons-logging\commons-logging\1.1\commons-logging-1.1.jar:D:\de
v\maven\repository\javax\servlet\servlet-api\2.3\servlet-api-2.3.jar:D:\dev\mave
n\repository\org\codehaus\castor\castor-testsuite-xml-framework\1.1.3-SNAPSHOT\c
astor-testsuite-xml-framework-1.1.3-SNAPSHOT.jar:D:\dev\maven\repository\ant\ant
\1.6\ant-1.6.jar:D:\dev\maven\repository\xerces\xerces\1.4.0\xerces-1.4.0.jar:D:
\dev\maven\repository\logkit\logkit\1.0.1\logkit-1.0.1.jar:D:\dev\maven\reposito
ry\log4j\log4j\1.2.13\log4j-1.2.13.jar:
As you can see, the second entry now point to an existing tools.jar. Still, the compiler moans that there's no compiler on the classpath.
Hide
Werner Guttmann added a comment -

Btw, can you please remove all Java 5.0 artefacts, as @Override annotations, and in pom.xml, can you please set <source> and <target> elemenst to values of 1.4 ?

Show
Werner Guttmann added a comment - Btw, can you please remove all Java 5.0 artefacts, as @Override annotations, and in pom.xml, can you please set <source> and <target> elemenst to values of 1.4 ?
Hide
Werner Guttmann added a comment -

Matthias, can you suggest anything to move things forward ?

Show
Werner Guttmann added a comment - Matthias, can you suggest anything to move things forward ?
Hide
Werner Guttmann added a comment -

Matthias, what would you need from me to assess the problem in detail ?

Show
Werner Guttmann added a comment - Matthias, what would you need from me to assess the problem in detail ?

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: