-
1. Re: Add src/main/java to webarchive
alrubinger Oct 21, 2013 4:31 AM (in response to max010)1 of 1 people found this helpfulUnfortunately, you cannot add a source directory for "addPackages", as this works off bytecode available to the ClassLoader.
Recommend:
addPackages(boolean recursive,
Filter<ArchivePath> filter,
Package... packages)
...implement a Filter to pass through any packages with your desired prefix.
S,ALR
-
2. Re: Add src/main/java to webarchive
max010 Oct 24, 2013 4:04 PM (in response to alrubinger)Thanks for the suggestion Andrew. This is instead what I did:
@RunWith(Arquillian.class)
public class AccountUnitTest {
@Deployment
public static WebArchive createDeployment() {
File[] libs = Maven.resolver()
.loadPomFromFile("pom.xml")
.resolve("org.apache.commons:commons-email:1.2",
"org.apache.lucene:lucene-analyzers-common:4.3.0",
"org.apache.sanselan:sanselan-incubator:0.97")
.withTransitivity().asFile();
WebArchive war = ShrinkWrap
.create(WebArchive.class, "test.war")
.addPackages(true, "com.package.ejb.account")
.addPackages(true, "com.package.ejb.entity")
.addPackages(true, "com.package.ejb.compositekeys")
.addPackages(true, "com.package.ejb.view")
.addPackages(true, "com.package.ejb.indexing")
.addPackages(true, "com.package.ejb.comment")
.addPackages(true, "com.package.ejb.systemkeys")
.addPackages(true, "com.package.ejb.mail")
.addAsLibraries(libs)
.addAsResource(new File("src/main/resources/META-INF/persistence.xml"), "META-INF/persistence.xml")
.addAsWebInfResource("jbossas-ds.xml")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
war.writeTo(System.err, org.jboss.shrinkwrap.api.formatter.Formatters.VERBOSE);
System.err.println();
return war;
}
/*@PersistenceContext(unitName = "myapp")
EntityManager em;
@Inject
UserTransaction utx;*/
@EJB(mappedName="java:global/test/AccountBean!com.package.ejb.account.AccountLocal")
AccountLocal accountLocal;
@Test
public void findUser(){
UserValue user = accountLocal.findUser("admin");
boolean userFound = false;
if(user != null) {
userFound = true;
}
Assert.assertTrue(userFound);
}
The test runs OK but I cannot debug while running the test. I need to figure out how to Debug as JUnit test from Eclipse, and stop at a breakpoint. In order for the test to run I start a JBoss 7.1.2 container.
Any suggestions?
Thanks
-
3. Re: Add src/main/java to webarchive
alrubinger Oct 29, 2013 3:43 AM (in response to max010)For debugging, consider that you'll have two VMs; the client VM which launches the test and the server VM which contains the running JBossAS7 instance. @see for example: