-
1. Re: arquillian in the enterprise world
kpiwko Feb 26, 2013 1:38 PM (in response to cremersstijn)Hi Stijn,
yes, this is possible. You need a combination of ShrinkWrap and ShrinkWrap Maven Resolver:
Like here:
https://community.jboss.org/wiki/HowToIAddMavenArtifactsToMyShrinkWrapArchives
real-life example is here:
We are working on more guides and MavenImporter for ShrinkWrap that would do the tough work for you.
Keep testing,
Karel
-
2. Re: arquillian in the enterprise world
cremersstijn Feb 27, 2013 2:31 PM (in response to kpiwko)Let say I want to test my ear file. I can create a shrinkwrap EarArchive based on my pom dependency if my test is in another module, but are my test classes also included in that EarArchive?
The problem is the same as mentioned here:http://stackoverflow.com/questions/14713129/how-to-add-test-classes-to-an-imported-ear-file-and-run-server-side-with-arquill
This was my code to create the deployment.
@Deployment(testable = true)
public static Archive<?> createDeployment() {
return ShrinkWrap
.create(ZipImporter.class, "test.ear")
.importFrom(new File("simple-webservice-ear-1.0.0-SNAPSHOT.ear"))
.as(EnterpriseArchive.class);
}Or should i create my deployment in other way?
Thanks!
-
3. Re: arquillian in the enterprise world
brentdouglas Mar 11, 2013 8:54 PM (in response to cremersstijn)Hi Stijn,
I recently (yesterday) managed to get arquillian working on a largish project. The problem I had with the method you describe above is that in my case that made each of my tests take ~2 minutes to run. Also as my app is in 2 parts (an ear and a seperate war) I was unable to get tests to work against my war.
Have a look at https://github.com/machinecode-io/sphinx which is a pretty basic arquillian extension that should allow you to do what you are looking for and does not require you to bundle your ear with your tests. You can deploy as many archives as you require before running your tests which only need to contain your test classes. If you decide to take a look at it and run into any problems please let me know.
Brent
-
4. Re: arquillian in the enterprise world
shaundass Mar 13, 2013 9:11 PM (in response to brentdouglas)Hi Brent,
I tried the method given by you on git hub. It can not find the appropriate sphinx jar. Can you help me?
There is one more question. The EAR file which contains all the dependencies, should be placed in the same place where pom is placed, right ?
Thanks in advance for any help further.
-
5. Re: arquillian in the enterprise world
brentdouglas Mar 13, 2013 10:43 PM (in response to shaundass)Hi Shashank,
To get the jar you can either check that project out from github and build it yourself with `mvn install` or alternatively you can add this snippet to either your projects pom.xml or your setttings.xml
<repositories> <repository> <id>machinecode-repository</id> <name>MachineCode Repository</name> <url>http://repository.machinecode.io/nexus/content/repositories/machinecode</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </snapshots> </repository> <repository> <id>machinecode-snapshots</id> <name>MachineCode Snapshots</name> <url>http://repository.machinecode.io/nexus/content/repositories/machinecode-snapshots</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </snapshots> </repository> </repositories>
With the ear path, so long as the path-to-archive element in sphinx.xml points to a copy of your ear you'll be right. I move them all into a directory before running my tests as a convenience and to save having relative paths to my other modules build directories which would look like `../../resources/target/resources.ear`.
Brent
-
6. Re: arquillian in the enterprise world
shaundass Mar 14, 2013 5:39 PM (in response to brentdouglas)Hi Brent,
Thanks for the update. I did accordingly. Now I am not getting sphinx error. But something real strange is going on. When I look into my maven dependencies I dont find any jar like sphinx core. Why do you think that could happen?
If i run my test case ignoring the above fact, I am getting contextRoot must not be null error. After a bit of googling i found that it is an arquillian error for Glassfish-remote-3.1(https://issues.jboss.org/browse/ARQ-1232).
They have fixed it in december 2012 but no update for glassfish-remote is found after March 2012.
But I have a doubt, Perhaps a bit out of context but I thought to ask.
My question is , When I am using my EAR file, I expect to access the classes of the jar files without including the jars that are present in the EAR in my pom.xml as dependency. Am I wrong somewhere ?
I ask this as it gives me compile time error when i remove the dependencies of the jars from pom that are already present in the EAR
Any help is greatly appreciated.
-
7. Re: arquillian in the enterprise world
brentdouglas Mar 14, 2013 6:16 PM (in response to shaundass)Hi Shashank,
I am not sure, I'd really need to look at your pom to see what's going on there. Re galssfish, I have no experience with it but I did try for a fair while to get my app to use as7-remote with no success, I think I was getting a similar error as, even though I was bundling my tests into a jar, arquillian was munging it into a war somehow. I gave up and now use as7-managed with connectToRunningServer set to true. Not sure if there is a similar module for glassfish though.
You will need to have test scoped pom dependencies on your ear classes. Sphinx will add manifest dependencies for you but maven will still need dependencies to build your test classes.
Brent
-
8. Re: arquillian in the enterprise world
aslak Mar 14, 2013 7:30 PM (in response to brentdouglas)We're aiming to have more 'full application' support coming in Arquillian 2.0. Support for multiple tests pr deployment for instance.
For those who are brave could try this extension (a hack to get multiple tests pr deployment):
https://gist.github.com/aslakknutsen/3975179
(ps. no guarantees ;)
-
9. Re: arquillian in the enterprise world
brentdouglas Mar 14, 2013 8:14 PM (in response to aslak)Hi Aslak,
What sort of timeframe are we looking at for Arquillian 2.0?
Brent
-
10. Re: arquillian in the enterprise world
aslak Mar 15, 2013 7:10 AM (in response to brentdouglas)Brent, this year