-
1. Re: How to add a folder and its files to the test file in Arquillian?
aslak Sep 20, 2011 12:00 PM (in response to hibernator_11)If your using a newer version of Arquillian and Shrinkwrap, you should be able to simply do:
ShrinkWrap.create(WebArchive.class)
.addAsWebResources(new File("src/main/webapp"))
As long as a File is pointing to a Directory, it should be included as a whole
-
2. Re: How to add a folder and its files to the test file in Arquillian?
hibernator_11 Sep 22, 2011 7:06 AM (in response to aslak)Hi,
I am using the last version of Arquillian 5.alpha and i do not have this method
.addAsWebResources(new File("src/main/webapp"))
I have .addAsWebResources(Package, String) and i do not think that this is what i want. I need to use a folder and its content...
Thanks in advance.
-
3. Re: How to add a folder and its files to the test file in Arquillian?
aslak Sep 22, 2011 9:10 AM (in response to hibernator_11)1 of 1 people found this helpfulUpgrade to Arquillian Core 1.0.0.CR5
http://community.jboss.org/wiki/MigrationToArquillian100CR1
And use the Arquillian Core BOM dependencyManagement import, https://gist.github.com/1154075
-
4. Re: How to add a folder and its files to the test file in Arquillian?
mokelet Sep 26, 2011 7:46 AM (in response to aslak)Hi,
My Arquillian Version is 1.0.0.CR5. Shrinkwrap is 1.0.0-beta-5 and the descriptors are 1.1.0-beta-1.
I can't execute the methode .addAsWebResources(File file). I have only a few addAsWebResource(...) and one addAsWebResources but with the parameters Package and String.
In the Javadoc of Shrinkwrap I can't find this methode, too.
Can sb help me?
Thanks.
-
5. Re: How to add a folder and its files to the test file in Arquillian?
hibernator_11 Sep 26, 2011 8:02 AM (in response to mokelet)Hi,
As you see in the Aslak Knutsen's post, I think that you have to change to the new Arquillian version.
I have not done this because i didn't have time...may be by the end of this week I try to change my arquillian version...
have fun!
-
6. Re: How to add a folder and its files to the test file in Arquillian?
mokelet Sep 26, 2011 8:09 AM (in response to hibernator_11)Hi,
I have arquillian version 1.0.0.CR5 as recommended by Mr. Knutsen. And I can't find a newer Version in the repository.
-
7. Re: How to add a folder and its files to the test file in Arquillian?
hibernator_11 Sep 26, 2011 8:11 AM (in response to mokelet)Well in this case i don't know..let's wait to Mr. Knutsen response....
I'll try to do it this week and i'll let you know my results..
-
8. Re: How to add a folder and its files to the test file in Arquillian?
aslak Sep 26, 2011 8:33 AM (in response to hibernator_11)Sorry, i thought this was fixed... https://issues.jboss.org/browse/SHRINKWRAP-247
addAsResource(file) adds directory content, but not addAsWebResource
-
9. Re: How to add a folder and its files to the test file in Arquillian?
sampel Sep 28, 2011 9:31 AM (in response to hibernator_11)Hi there,
im gg cc partner and i change the version of Arquillin as Aslak Knusten sayd but now i have new question. We need to add some jars using maven, we was adding it with DependencyResolver until now:
addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class).artifact("com.google.code.gson:gson:1.7.1").resolveAsFiles())
But after change the arquillian version, the class DependencyResolver and MavenDependencyResolver have disappeared from the shrinkwrap library contained in arquillian.
I try tu include the dependencies of these classes directly in my project but i obtain this error during the tests:
Could not load specified implementation class from sun.misc.Launcher$AppClassLoader@61e63e3d: org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl
What im doing bad?
thanks!
-
10. Re: How to add a folder and its files to the test file in Arquillian?
sampel Sep 29, 2011 4:22 AM (in response to hibernator_11)Hi there,
i discover whats wrong, i needed to add the shrinkwrap-resolver-impl-maven dependecy
anyway i have another problem after the version upgrade, the ejb3 inyection in the arquillian test does not work, but its out of topic. i will create another topic.
thanks a lot!
-
11. Re: How to add a folder and its files to the test file in Arquillian?
bcn Apr 4, 2012 1:53 PM (in response to aslak)Hi,
I try to include all the WEB-INF of the main project. Using version 1.0.0.CR7, I try the workaround mentioned in the shrinkwrap bug. To compile, I use:
war.merge(ShrinkWrap.create(ExplodedImporter.class).importDirectory("src/main/webapp/WEB-INF").as(GenericArchive.class),"/WEB-INF");
but I get:
java.lang.RuntimeException: No property value found for key extension
at org.jboss.shrinkwrap.impl.base.ExtensionWrapper.getProperty(ExtensionWrapper.java:61)
at org.jboss.shrinkwrap.impl.base.ServiceExtensionLoader.getExtensionFromExtensionMapping(ServiceExtensionLoader.java:178)
at org.jboss.shrinkwrap.api.ArchiveFactory.create(ArchiveFactory.java:105)
at org.jboss.shrinkwrap.api.ShrinkWrap.create(ShrinkWrap.java:157)
Thanks!
-
12. Re: How to add a folder and its files to the test file in Arquillian?
alrubinger Apr 4, 2012 6:49 PM (in response to bcn)This RuntimeException looks like it could be a bug; I'd like to get that fixed up. Would you care to add a test case to the suite showing the problem?
https://community.jboss.org/wiki/ShrinkWrapDevelopmentAndContribution
S,
ALR
-
13. Re: How to add a folder and its files to the test file in Arquillian?
bcn Apr 5, 2012 8:26 AM (in response to alrubinger)I can file a bug if you wish.
-
14. Re: How to add a folder and its files to the test file in Arquillian?
bcn Apr 5, 2012 12:40 PM (in response to bcn)To add the files manually I do:
File dir = new File("src/main/webapp/WEB-INF");
addFiles(war, dir);
private static void addFiles(WebArchive war, File dir) throws Exception {
if (!dir.isDirectory()) {
throw new Exception("not a directory");
}
for (File f : dir.listFiles()) {
if (f.isFile()) {
war.addAsWebResource(f, f.getPath().replace("\\", "/").substring("src/main/webapp/".length()));
} else {
addFiles(war, f);
}
}
}