-
1. Re: The 1.0.2.Final Testable class: are there any limitations on its use?
aslak Oct 2, 2012 2:14 PM (in response to john.genoese)Your reading the EAR from disk pr Test Class @Deployment?
Sounds very strange that the Marked WAR would only be understood the first time..
Could you provide some code that shows how you are doing it, would make it easier to understand why it might happen.
-
2. Re: The 1.0.2.Final Testable class: are there any limitations on its use?
john.genoese Oct 3, 2012 11:37 AM (in response to aslak)Thank you for responding. I apologize in advance for this inordinately-sized post.
The approach I took in building integration tests for a given App module was
- Create an integration test base class to contain the @Deployment method and other commonly needed utilities for composing Integration tests for the module at hand
- Create an ArchiveUtil class to wrap the entire procedure of creating the EAR file. This class in constructed in such a way as to include the current PID in the name of the EAR. The class will look for an EAR by that name on the filesystem. If it finds it, it loads it using the wonderful ShrinkWrap::createFromZipFile(). Otherwise it builds the EAR in the normal ShrinkWrap way and writes it out using the wonderful EnterpriseArchive::as( ZipExporter.class ).exportTo().
- Have the base class use said ArchiveUtil to return the EAR
- Compose all Integration tests extending said base class.
Attached are:
ArchiveUtil.java : the archive util referenced abwove
jboss.log: the log output in its entirety
TestSuite.txt: TestNG output.
testng-results.xml: documents that one test class passed and the next failed; the rest were skipped.
Here's the EAR written to the filesystem:
[jgenoese@mdr:/tmp/x] [bash:53] Wed Oct 03 11:05:07
$:jar -tvf ../test-procedures-69275.ear | grep -v "lib\/"
72470 Wed Oct 03 10:23:30 EDT 2012 test.war
41360 Wed Oct 03 10:23:30 EDT 2012 waipt-lockbox-war-0.1.war
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/
330 Wed Oct 03 10:23:30 EDT 2012 META-INF/jboss-deployment-structure.xml
620 Wed Oct 03 10:23:30 EDT 2012 META-INF/waimap-ds.xml
Here's the relevant content of test.war:
[jgenoese@mdr:/tmp/x] [bash:67] Wed Oct 03 11:08:32
$:jar -tvf test.war | grep -v "\/classes"
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/arquillian.ArchiveUnderTest
0 Wed Oct 03 10:23:30 EDT 2012 WEB-INF/
565 Wed Oct 03 10:23:30 EDT 2012 WEB-INF/beans.xml
Here's the relevant content of the war NOT under test:
[jgenoese@mdr:/tmp/x] [bash:69] Wed Oct 03 11:10:58
$:jar -tvf waipt-lockbox-war-0.1.war | grep -v "\/classes"
343 Wed Oct 03 10:23:30 EDT 2012 index.html
0 Wed Oct 03 10:23:30 EDT 2012 WEB-INF/
286 Wed Oct 03 10:23:30 EDT 2012 WEB-INF/beans.xml
1086 Wed Oct 03 10:23:30 EDT 2012 WEB-INF/web.xml
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/maven/
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/maven/org.memoriesdreamsandreflections/
0 Wed Oct 03 10:23:30 EDT 2012 META-INF/maven/org.memoriesdreamsandreflections/waipt-lockbox-war/
132 Wed Oct 03 10:23:30 EDT 2012 META-INF/maven/org.memoriesdreamsandreflections/waipt-lockbox-war/pom.properties
9476 Wed Oct 03 10:23:30 EDT 2012 META-INF/maven/org.memoriesdreamsandreflections/waipt-lockbox-war/pom.xml
127 Wed Oct 03 10:23:30 EDT 2012 META-INF/MANIFEST.MF
-
testng-results.xml 39.8 KB
-
jboss.log.zip 27.3 KB
-
ArchiveUtil.java.zip 2.4 KB
-
testng-results.xml 39.9 KB
-
3. Re: The 1.0.2.Final Testable class: are there any limitations on its use?
john.genoese Oct 4, 2012 9:12 PM (in response to john.genoese)Further experimentation yields results that strongly suggest a definite issue with use of Testable, or with its use in Arquillian internals.
When I add the following lines to my ArchiveUtil after retrieving the EAR file from the filesystem, the "can not determine which to enrich" failure no longer occurs.
WebArchive l_wa = l_ea.getAsType( WebArchive.class, ArchivePaths.create("test.war") );
Assert.assertTrue( Testable.isArchiveToTest( l_wa ), "No testable archive" ) ;
Commenting them out causes the failure to reappear.
The attachment "ArchiveUtilExtended.java" is the new source replacing ArchiveUtil.java above.
So my answer thusfar is as follows:
1. YES there is a limitation in the use of the Testable class, when deploying a filesystem-based EAR. The cause of the limitation is as yet unknown.
2. An effective workaround for use of Testable with filesystem-based EARs is to manually invoke Testable::isArchiveToTest() on the testable WAR. This appears to mitigate whatever the issue is. The reason why the workaround is effective is as yet unknown.
-
ArchiveUtilExtended.java.zip 2.2 KB
-