@Deployment public static WebArchive buildDeployment() { WebArchive war = ShrinkWrap.create( WebArchive.class ) .setManifest( "org/hibernate/test/wf/ddl/manifest.mf" ) .addClass( WildFlyDdlEntity.class ) // .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml") .addAsResource( new StringAsset( persistenceXml().exportAsString() ), PERSISTENCE_XML_RESOURCE_NAME ) .addAsResource( "org/hibernate/test/wf/ddl/log4j.properties", "log4j.properties" ); System.out.println( war.toString(true) ); return war; }
System.out.println(war.toString(true));
@Deployment public static Archive<?> createDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class).addClasses(Foo.class); System.out.println(war.toString(true)); return war; }
public WarDeployable build() { File warFile = new File(workingDir, name + ".war"); WebArchive war = ShrinkWrap.create(WebArchive.class, name + ".war"); packages.forEach(war::addPackage); war.setWebXML(new File(webXml)); war.addAsLibraries(dependencies); LOG.debug("Built WAR Deployable: {}", war.toString(true)); war.as(ZipExporter.class).exportTo(warFile, true); return new WarDeployable(warFile); }
@After public void ls() { System.out.println("test@jboss:/$ ls -l " + archive.getName()); System.out.println(archive.toString(true)); }
public static WebArchive createDeploymentForDistribution(String distFile) throws Exception { WebArchive webArchive = ShrinkWrap.create(WebArchive.class); JarFile jar = new JarFile(distFile); JarEntry entry; Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements() && (entry = entries.nextElement()) != null) { if (!entry.isDirectory()) { webArchive.add(getAsset(jar, entry), entry.getName()); } } webArchive.addClass(FullDistributionTest.class); System.out.println("Generated web archive"); System.out.println("*******************************"); System.out.println(webArchive.toString(true)); System.out.println("*******************************"); return webArchive; }
public WarDeployment(String archiveName, Package[] pkgs, boolean show) { ArchivePath metaInf = ArchivePaths.create("META-INF"); WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName); for(Package pkg : pkgs) { archive.addPackage(pkg); } File sourceMetaInf = getSourceMetaInfDir(archiveName); addFiles(archive, sourceMetaInf, metaInf); File sourceWebInf = getSourceWebInfDir(archiveName); if (sourceWebInf != null) { addWebFiles(archive, sourceWebInf, ArchivePaths.create("WEB-INF")); } System.out.println(archive.toString(show)); realArchive = createArchive(archive); }
@Override protected void handleWebArchive(WebArchive war) { Node node = war.get(WEB_XML_PATH); if (node == null) { throw new IllegalStateException("No web.xml in .war: " + war.toString(true)); } war.addClass(GetLoginUrlServlet.class); WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(node.getAsset().openStream()); war.delete(WEB_XML_PATH); // delete first, so we can re-add webXml.servlet(UserLogin.USER_LOGIN_SERVLET_PATH + "-servlet", GetLoginUrlServlet.class.getName(), new String[]{"/" + UserLogin.USER_LOGIN_SERVLET_PATH}); war.setWebXML(new StringAsset(webXml.exportAsString())); } }
@Test public void shouldBeAbleToExportArchive() throws Exception { String content = ShrinkWrap .create(WebArchive.class, "test.jar") .addAsResource(new File("src/test/resources/tooling/arquillian.xml"), ArchivePaths.create("resource.xml")) .addAsResource("tooling/arquillian.xml", ArchivePaths.create("resource2.xml")) .addAsResource(new File("src/test/resources/tooling/arquillian.xml").toURI().toURL(), ArchivePaths.create("resource3.xml")).addClass(ToolingDeploymentFormatterTestCase.class) .addAsServiceProvider(Service.class, ServiceImpl.class) .addAsLibrary(ShrinkWrap.create(JavaArchive.class, "test.jar").addClass(ToolingDeploymentFormatter.class)) .toString(new ToolingDeploymentFormatter(getClass())); // TODO: do some output Assertions.. Assert.assertNotNull(content); System.out.println(content); }
@Test public void shouldBeAbleToExportArchive() throws Exception { String content = ShrinkWrap .create(WebArchive.class, "test.jar") .addAsResource(new File("src/test/resources/tooling/arquillian.xml"), ArchivePaths.create("resource.xml")) .addAsResource("tooling/arquillian.xml", ArchivePaths.create("resource2.xml")) .addAsResource(new File("src/test/resources/tooling/arquillian.xml").toURI().toURL(), ArchivePaths.create("resource3.xml")).addClass(ToolingDeploymentFormatterTestCase.class) .addAsServiceProvider(ServiceLoader.class, DynamicServiceLoader.class) .addAsLibrary(ShrinkWrap.create(JavaArchive.class, "test.jar").addClass(ToolingDeploymentFormatter.class)) .toString(new ToolingDeploymentFormatter(getClass())); // TODO: do some output Assertions.. Assert.assertNotNull(content); System.out.println(content); } }
@Test public void shouldBeAbleToExportArchive() throws Exception { String content = ShrinkWrap .create(WebArchive.class, "test.jar") .addAsResource(new File("src/test/resources/tooling/arquillian.xml"), ArchivePaths.create("resource.xml")) .addAsResource("tooling/arquillian.xml", ArchivePaths.create("resource2.xml")) .addAsResource(new File("src/test/resources/tooling/arquillian.xml").toURI().toURL(), ArchivePaths.create("resource3.xml")).addClass(ToolingDeploymentFormatterTestCase.class) .addAsServiceProvider(Service.class, ServiceImpl.class) .addAsLibrary(ShrinkWrap.create(JavaArchive.class, "test.jar").addClass(ToolingDeploymentFormatter.class)) .toString(new ToolingDeploymentFormatter(getClass())); // TODO: do some output Assertions.. Assert.assertNotNull(content); System.out.println(content); }
/** * Create a CDI aware base web application archive * @return the base base web application archive * @throws IOException - on resource failure */ @Deployment(testable=true) public static WebArchive createDeployment() throws IOException { URL publicKey = UnsecuredPingTest.class.getResource("/publicKey.pem"); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, "UnsecuredPingTest.war") .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, "/publicKey.pem") .addClass(UnsecuredPingEndpoint.class) .addClass(UnsecureTCKApplication.class) .addAsWebInfResource("beans.xml", "beans.xml"); System.out.printf("WebArchive: %s\n", webArchive.toString(true)); return webArchive; }
/** * Create a CDI aware base web application archive * @return the base base web application archive * @throws IOException - on resource failure */ @Deployment(testable=true) public static WebArchive createDeployment() throws IOException { URL publicKey = PrincipalInjectionTest.class.getResource("/publicKey.pem"); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, "PrincipalInjectionTest.war") .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, "/publicKey.pem") .addClass(PrincipalInjectionEndpoint.class) .addClass(TCKApplication.class) .addAsWebInfResource("beans.xml", "beans.xml"); System.out.printf("WebArchive: %s\n", webArchive.toString(true)); return webArchive; }
/** * Create a CDI aware base web application archive * @return the base base web application archive * @throws IOException - on resource failure */ @Deployment(testable=true) public static WebArchive createDeployment() throws IOException { URL publicKey = JsonValueInjectionTest.class.getResource("/publicKey.pem"); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, "JsonValueInjectionTest.war") .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, "/publicKey.pem") .addClass(JsonValuejectionEndpoint.class) .addClass(TCKApplication.class) .addAsWebInfResource("beans.xml", "beans.xml"); System.out.printf("WebArchive: %s\n", webArchive.toString(true)); return webArchive; }
/** * Create a CDI aware base web application archive * @return the base base web application archive * @throws IOException - on resource failure */ @Deployment(testable = true) public static WebArchive createDeployment() throws IOException { URL publicKey = RequiredClaimsTest.class.getResource("/publicKey.pem"); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, "RequiredClaimsTest.war") .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, "/publicKey.pem") .addClass(RequiredClaimsEndpoint.class) .addClass(TCKApplication.class) .addAsWebInfResource("beans.xml", "beans.xml"); System.out.printf("WebArchive: %s\n", webArchive.toString(true)); return webArchive; }
/** * Create a CDI aware base web application archive * @return the base base web application archive * @throws IOException - on resource failure */ @Deployment(testable=true) public static WebArchive createDeployment() throws IOException { URL publicKey = RolesAllowedTest.class.getResource("/publicKey.pem"); WebArchive webArchive = ShrinkWrap .create(WebArchive.class, "RolesAllowedTest.war") .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME) .addAsResource(publicKey, "/publicKey.pem") .addClass(RolesEndpoint.class) .addClass(TCKApplication.class) .addAsWebInfResource("beans.xml", "beans.xml") ; System.out.printf("WebArchive: %s\n", webArchive.toString(true)); return webArchive; }
@Deployment public static WebArchive createDeployment() { File[] libs = Maven.resolver() .loadPomFromFile("pom.xml").resolve("org.kie:kie-spring", "com.google.protobuf:protobuf-java") .withTransitivity().asFile(); WebArchive drools = ShrinkWrap.create(WebArchive.class) .addAsLibraries(libs) .addAsResource("spring/sample.drl") .addAsResource(APL_CONTEXT) .addAsResource("META-INF/maven/pom.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); System.out.println(drools.toString(true)); return drools; }
@Deployment public static WebArchive createDeployment() { File[] libs = Maven.resolver() .loadPomFromFile("pom.xml").resolve("org.drools:drools-compiler", "com.google.protobuf:protobuf-java") .withTransitivity().asFile(); JavaArchive kjar = ShrinkWrap.create(JavaArchive.class) .addClass(TestFactDeclaredInJar.class) .addAsResource("basic/sample.drl") .addAsResource("META-INF/kmodule.xml") .addAsResource("META-INF/maven/pom.properties"); WebArchive drools = ShrinkWrap.create(WebArchive.class) .addAsLibraries(libs) .addAsLibrary(kjar) .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); System.out.println(drools.toString(true)); return drools; }
/** * Deployment to be tested; will be manually deployed/undeployed * such that we can configure the server first * * @return */ @Deployment(managed = false, name = DEPLOYMENT_NAME) public static WebArchive getApplicationDeployment() { final File[] subethamailandDeps = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.subethamail:subethasmtp").withoutTransitivity().asFile(); final WebArchive war = ShrinkWrap.create(WebArchive.class).addAsLibraries(subethamailandDeps). addClasses(SMTPMailService.class, MailMessageBuilder.class, SMTPMailServiceConstants.class, SMTPMessageConsumer.class, SMTPServerService.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsWebInfResource("META-INF/geekseek-smtp-queue-jms.xml") .addClass(ManagementClient.class); System.out.println(war.toString(true)); return war; }
@Deployment public static WebArchive createDeployment() { File[] libs = Maven.resolver() .loadPomFromFile("pom.xml").resolve("org.drools:drools-compiler", "com.google.protobuf:protobuf-java") .withTransitivity().asFile(); WebArchive drools = ShrinkWrap.create(WebArchive.class) .addAsLibraries(libs) .addClass(TestFactDeclaredInJar.class) .addAsResource("basic/sample.drl") .addAsResource("META-INF/kmodule.xml") .addAsResource("META-INF/maven/pom.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); System.out.println(drools.toString(true)); return drools; }