@Deployment public static WebArchive createTestArchive() { return baseDeployment(FACES_WEB_XML) .add(CHARLIE_XHTML, "charlie.xhtml") .addAsWebInfResource(EMPTY_FACES_CONFIG_XML, "faces-config.xml") .addClass(Chicken.class); }
.add(new ClassLoaderAsset("runtime/tomcat/context.xml"), "META-INF/context.xml") .addPackages(true, "org.camunda.bpm.engine.rest");
@Deployment public static WebArchive createTestArchive() { return ShrinkWrap.create(WebArchive.class).addClass(BeansXmlAlternativeLocationTest.class) .add(new BeansXml(), "WEB-INF/classes/META-INF/beans.xml"); }
.addAsResource(publicKey, "/publicKey4k.pem") .add(new StringAsset(token), "MP-JWT") .addClass(PublicKeyEndpoint.class) .addClass(TCKApplication.class)
@Deployment public static Archive<?> createTestArchive() { String mp3AbsolutePath = SongUploaderWarArchiveWithTikaIT.class.getClassLoader() .getResource( "org/hibernate/search/test/bridge/tika/mysong.mp3" ) .getFile(); //Possibly broken on Windows? WebArchive war = ShrinkWrap .create( WebArchive.class, SongUploaderWarArchiveWithTikaIT.class.getSimpleName() + ".war" ) .addClasses( SongUploaderWarArchiveWithTikaIT.class, Song.class, SongUploader.class, Resources.class, Mp3TikaMetadataProcessor.class ) .addAsResource( persistenceXml(), "META-INF/persistence.xml" ) .addAsResource( new StringAsset( PROPERTY_KEY + "=" + mp3AbsolutePath ), CONFIGURATION_PROPERTIES_RESOURCENAME ) .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" ) .add( tikaDependenciesManifest(), "META-INF/MANIFEST.MF" ) ; return war; }
@Deployment public static WebArchive getDeployment() { TestContext context = new TestContext().setWebXmlFile("rpc-web.xml"); WebArchive war = getDefaultDeployment(context); war.addClasses(RpcEndpoint.class, TestData.class); war.add(new ClassLoaderAsset("xindex.html"), "index.html"); war.add(new ClassLoaderAsset("js/base.js"), "js/base.js"); war.addAsWebInfResource("rpcendpoint-v1-rest.discovery"); war.addAsWebInfResource("rpcendpoint-v1-rpc.discovery"); return war; }
@Deployment public static Archive getDeployment() { TestContext context = new TestContext(); context.setWebXmlFile("uf-web.xml"); WebArchive war = getTckDeployment(context); war.addClasses(URLFetchTestBase.class); war.addPackage(FetchServlet.class.getPackage()); war.add(new StringAsset("<html><body>Google AppEngine TCK</body></html>"), "index.html"); return war; }
public static WebArchive createDeployment(String packageName) throws IOException { WebArchive war = createPortletDeployment(packageName); Node node = war.get("WEB-INF/portlet.xml"); ArchivePath path = node.getPath(); String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8); s = s.replace("<portlet-info>", "<resource-bundle>bundle</resource-bundle>" + "<portlet-info>"); war.delete(path); war.add(new StringAsset(s), path); war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties"); return war; }
@Deployment public static WebArchive createTestArchive() { return ShrinkWrap.create(WebArchive.class).addClasses(ConflictingBeansXmlTest.class, Foo.class, VerifyExtension.class) .add(new BeansXml(), "WEB-INF/classes/META-INF/beans.xml").add(new BeansXml().alternatives(Foo.class), "WEB-INF/beans.xml") .addAsServiceProvider(Extension.class, VerifyExtension.class); }
.addAsResource(publicKey, "/publicKey4k.pem") .add(new StringAsset(token), "MP-JWT") .addClass(PublicKeyEndpoint.class) .addClass(TCKApplication.class)
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 static WebArchive createDeployment(String packageName) throws IOException { WebArchive war = createPortletDeployment(packageName); Node node = war.get("WEB-INF/portlet.xml"); ArchivePath path = node.getPath(); String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8); s = s.replace("<portlet-info>", "<resource-bundle>bundle</resource-bundle>" + "<portlet-info>"); war.delete(path); war.add(new StringAsset(s), path); war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties"); return war; }
.addAsResource(publicKey, "/publicKey4k.pem") .add(new StringAsset(token), "MP-JWT") .addClass(PublicKeyEndpoint.class) .addClass(TCKApplication.class)
@Deployment public static WebArchive getDeployment() { TestContext context = new TestContext(); context.setWebXmlFile("web-error-page.xml"); WebArchive war = getTckDeployment(context); war.addClass(Exceptions.class); war.add(new StringAsset(content), "error.html"); return war; }
public static WebArchive createDeployment(String packageName) throws IOException { WebArchive war = createServletDeployment(true, packageName); Node node = war.get("/WEB-INF/web.xml"); ArchivePath path = node.getPath(); String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8); s = s.replace("<async-supported>true</async-supported>", "<init-param><param-name>juzu.resource_bundle</param-name><param-value>bundle</param-value></init-param>" + "<async-supported>true</async-supported>"); war.delete(path); war.add(new StringAsset(s), path); war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties"); return war; }
/** * Archive -> WAR -> Archive -> WAR. SHRINKWRAP-444 */ @Test public void testExportImportExport() { // Preconditions final File target = new File("target"); final File testClasses = new File(target, "test-classes"); final File hsqldbJar = new File(testClasses, "hsqldb.jar"); Assert.assertTrue("test JAR must exist to run this test", hsqldbJar.exists() && !hsqldbJar.isDirectory()); final File file1 = new File(target, "testExportImportExport1.war"); final File file2 = new File(target, "testExportImportExport2.war"); final WebArchive webArchive = ShrinkWrap.create(WebArchive.class).add(new FileAsset(hsqldbJar), "/WEB-INF/lib/hsqldb.jar"); webArchive.as(ZipExporter.class).exportTo(file1, true); // when final WebArchive webArchive2 = ShrinkWrap.createFromZipFile(WebArchive.class, file1); webArchive2.as(ZipExporter.class).exportTo(file2, true); // then compare sizes Assert.assertEquals(file1.length(), file2.length()); }
.addAsResource(publicKey, "/publicKey4k.pem") .add(new StringAsset(token), "MP-JWT") .addClass(PublicKeyEndpoint.class) .addClass(TCKApplication.class)
public static WebArchive createDeployment(String packageName) throws IOException { WebArchive war = createServletDeployment(true, packageName); Node node = war.get("/WEB-INF/web.xml"); ArchivePath path = node.getPath(); String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8); s = s.replace("<async-supported>true</async-supported>", "<init-param><param-name>juzu.resource_bundle</param-name><param-value>bundle</param-value></init-param>" + "<async-supported>true</async-supported>"); war.delete(path); war.add(new StringAsset(s), path); war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties"); return war; }