This content has been marked as final.
Show 2 replies
-
1. Re: how to migrate seamtests (seam 2.2.2) to arquillian?
vata2999 May 15, 2016 1:41 AM (in response to magnoferreira)I'm using Seam 2.2Final with Arquillian. you can find it here https://github.com/omidp/seam
@RunWith(Arquillian.class) public class CriticalPathTest extends JUnitSeamTest { @Deployment() @OverProtocol("Servlet 3.0") public static WebArchive seamDeployment() { WebArchive archive = simpleSeamDeployment(); archive.addPackages(true, "org.project.model"); archive.addAsResource("nativeQueries.xml"); return archive; } @Test public void testCPM() throws Exception { new ComponentTest() { @Override protected void testComponents() throws Exception { EntityManager em = Component.getInstance("entityManager"); //your test logic } }.run(); } public static WebArchive simpleSeamDeployment() { InputStream is = DeploymentResolver.class.getResourceAsStream("jboss-deployment-structure-test.txt"); String deploymentContent = TestUtil.readFile(is); //woodstox xml parser clean up deploymentContent = deploymentContent.replaceAll("[\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F]", ""); WebArchive war = ShrinkWrap.create(WebArchive.class, "web-test.war"); war.addAsWebInfResource(new StringAsset(deploymentContent), "jboss-deployment-structure.xml"); war.addAsResource("seam.properties").addAsResource("components.properties"); war.addAsWebInfResource("WEB-INF/components.xml", "components.xml").addAsWebInfResource("WEB-INF/pages.xml", "pages.xml"); war.addAsWebInfResource("WEB-INF/web.xml", "web.xml"); war.addAsResource("META-INF/persistence.xml"); war.addAsResource("META-INF/ejb-jar.xml"); File[] resolveAsFiles = DependencyResolvers.use(MavenDependencyResolver.class).includeDependenciesFromPom("pom_test.xml") .scope("compile").goOffline().resolveAsFiles(); for (File file : resolveAsFiles) { System.out.println(file.getName()); } war.addAsLibraries(resolveAsFiles); for (ArchivePath path : war.getContent().keySet()) { if (path.get().contains("jboss-seam-ui")) { war.delete(path); break; } } System.out.println(war.toString()); return war; } }
-
2. Re: how to migrate seamtests (seam 2.2.2) to arquillian?
magnoferreira Jul 5, 2016 3:39 PM (in response to vata2999)Thanks, that really helped me.
After overriding some classes from your 2.2.3 seam version,
I also followed this tip jboss - arquillian + shrinkwrap + seam: how to create deployment package - Stack Overflow
and that worked.