History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CASTOR-2047
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Matthias Epheser
Reporter: Matthias Epheser
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
castor
CASTOR-1972

Test the templates using MasterTestSuite

Created: 16/Jul/07 12:16 AM   Updated: 14/Mar/08 06:41 AM
Component/s: XML tests
Affects Version/s: 1.1.2.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.2047.20070726.maven-plugins.txt (8 kb)
2. Text File patch.c2047.20070724.txt (4 kb)
3. Text File patch.c2047.20070726.xmlctf.txt (3 kb)
4. Text File patch.c2047.20070816.txt (2 kb)
5. Text File patch.c2047.20070921.txt (17 kb)
6. Text File patch.c2047.20070922.txt (18 kb)
7. Zip Archive xmlctf-maven-plugin.zip (3 kb)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Matthias Epheser - 16/Jul/07 12:20 AM
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.

Matthias Epheser - 16/Jul/07 12:21 AM
Tested the source generation using the templates, all tests completed successfully.

Werner Guttmann - 22/Jul/07 01:47 PM
Looks like you have to talk me through parts of this in detail ... .

Werner Guttmann - 22/Jul/07 01:49 PM
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 ?

Werner Guttmann - 23/Jul/07 05:28 AM
The patch is relative to xmlctf .. .

Werner Guttmann - 23/Jul/07 04:35 PM
I'd love to commit this, but without a resolution for the JVM issue mentioned above ... this won't be possible.

Matthias Epheser - 23/Jul/07 05:23 PM
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


Matthias Epheser - 26/Jul/07 10:10 AM
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


Matthias Epheser - 26/Jul/07 10:12 AM
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


Matthias Epheser - 26/Jul/07 10:30 AM
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>


Werner Guttmann - 11/Sep/07 06:18 AM
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.

Matthias Epheser - 21/Sep/07 05:16 AM
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

Werner Guttmann - 21/Sep/07 04:54 PM
I am getting exceptions, namely 'Failed to find compile method'.

Werner Guttmann - 21/Sep/07 04:54 PM
Any idea why ?

Werner Guttmann - 21/Sep/07 04:55 PM
I am getting those when executing 'mvn test' in xmlctf - after building the SNAPSHOT JARs for everything else.

Matthias Epheser - 22/Sep/07 03:25 AM
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: ..."


Werner Guttmann - 22/Sep/07 05:19 AM
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 ?


Matthias Epheser - 22/Sep/07 07:59 AM
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.


Werner Guttmann - 22/Sep/07 10:38 AM
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.


Werner Guttmann - 22/Sep/07 10:38 AM
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 ?

Werner Guttmann - 01/Jan/08 02:52 PM
Matthias, can you suggest anything to move things forward ?

Werner Guttmann - 10/Jan/08 02:48 AM
Matthias, what would you need from me to assess the problem in detail ?