Java Code Examples for org.jboss.shrinkwrap.api.spec.WebArchive#addAsWebResource()
The following examples show how to use
org.jboss.shrinkwrap.api.spec.WebArchive#addAsWebResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeploymentArchiveUtils.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create standard WAR archive for deployment testing * * @param archiveName Name of archive * @param content Context of page.html file * @return Return created {@link File} instance */ public static File createWarArchive(String archiveName, String content) { WebArchive war = ShrinkWrap.create(WebArchive.class, archiveName); war.addAsWebResource(new StringAsset(content), "page.html"); final String tempDir = TestSuiteEnvironment.getTmpDir(); File file = new File(tempDir, war.getName()); new ZipExporterImpl(war).exportTo(file, true); return file; }
Example 2
Source File: DeploymentArchiveUtils.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create enterprise EAR archive for deployment testing * * @param archiveName Name of archive * @param content Context of page.html file * @return Return created {@link File} instance */ public static File createEnterpriseArchive(String archiveName, String subArchiveName, String content) { WebArchive war = ShrinkWrap.create(WebArchive.class, archiveName); war.addAsWebResource(new StringAsset(content), "page.html"); final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, subArchiveName); ear.add(war, new BasicPath("/"), ZipExporter.class); final String tempDir = TestSuiteEnvironment.getTmpDir(); File file = new File(tempDir, ear.getName()); new ZipExporterImpl(ear).exportTo(file, true); return file; }
Example 3
Source File: Deployments.java From oxAuth with MIT License | 5 votes |
private static void addFiles(WebArchive war, File dir) { final File[] files = dir.listFiles(); if (files == null) return; for (File f : files) { if (f.isFile()) { war.addAsWebResource(f, f.getPath().replace("\\", "/").substring("src/main/webapp/".length())); } else { addFiles(war, f); } } }
Example 4
Source File: ChannelTestBase.java From appengine-tck with Apache License 2.0 | 5 votes |
@Deployment public static WebArchive getDeployment() { TestContext context = new TestContext(); context.setAppEngineWebXmlFile("channel-appengine-web.xml"); context.setWebXmlFile("channel-web.xml"); WebArchive war = getTckDeployment(context); war.addClasses(ChannelTestBase.class, PresenceServlet.class); war.addAsWebResource("channelPage.jsp"); war.addAsWebResource("channelEcho.jsp"); return war; }
Example 5
Source File: RequestLogsTest.java From appengine-tck with Apache License 2.0 | 5 votes |
@Deployment public static WebArchive getDeployment() { WebArchive war = getDefaultDeployment(newTestContext()); war.addAsWebResource("doNothing.jsp", "index.jsp"); war.addAsWebResource("doNothing.jsp", "index2.jsp"); war.addAsWebResource("throwException.jsp", "index3.jsp"); war.addAsWebResource("storeTestData.jsp"); war.addAsWebResource("currentTimeUsec.jsp"); return war; }
Example 6
Source File: AhcWSSIntegrationTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Deployment public static WebArchive createdeployment() { WebArchive archive = ShrinkWrap.create(WebArchive.class, "ahc-wss-test.war"); archive.addClasses(WebSocketServerEndpoint.class); archive.addAsResource("ahc/application.keystore", "application.keystore"); archive.addAsWebResource("ahc/websocket.js", "websocket.js"); archive.addAsWebResource("ahc/index.jsp", "index.jsp"); archive.addAsWebInfResource("ahc/web.xml", "web.xml"); return archive; }
Example 7
Source File: ServletTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static Archive<?> war() { final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "batchee-gui.war") .addAsWebInfResource(new StringAsset( Descriptors.create(WebAppDescriptor.class) .metadataComplete(true) .createListener() .listenerClass(CreateSomeJobs.class.getName()) .up() .createFilter() .filterName("JBatch Private Filter") .filterClass(JBatchServletInitializer.PrivateFilter.class.getName()) .up() .createServlet() .servletName("JBatch") .servletClass(JBatchController.class.getName()) .loadOnStartup(1) .up() .createFilterMapping() .filterName("JBatch Private Filter") .urlPattern("/*") .up() .createServletMapping() .servletName("JBatch") .urlPattern("/jbatch/*") .up() .exportAsString()), "web.xml") // GUI .addPackages(true, JBatchController.class.getPackage()) // test data to create some job things to do this test .addPackage(CreateSomeJobs.class.getPackage()) .addAsWebInfResource("META-INF/batch-jobs/init.xml", "classes/META-INF/batch-jobs/init.xml"); for (final String resource : Arrays.asList("layout.jsp", "jobs.jsp", "job-instances.jsp", "step-executions.jsp", "css/bootstrap.min.3.0.0.css", "js/bootstrap.min.3.0.0.js")) { webArchive.addAsWebResource("META-INF/resources/internal/batchee/" + resource, "internal/batchee/" + resource); } return webArchive; }
Example 8
Source File: StaticFilesTestBase.java From appengine-tck with Apache License 2.0 | 4 votes |
protected static WebArchive createFile(WebArchive archive, String path) { return archive.addAsWebResource(new StringAsset("This is " + path), path); }
Example 9
Source File: NettyIntegrationTest.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Deployment public static WebArchive createDeployment() { final WebArchive archive = ShrinkWrap.create(WebArchive.class, "camel-netty-test.war"); archive.addAsWebResource("netty/netty-camel-context.xml"); return archive; }
Example 10
Source File: Simple2ExampleTest.java From appengine-tck with Apache License 2.0 | 3 votes |
/** * Every test needs to define public static method * with @Deployment and returning Arquillian Archive type. * <p/> * You can add or override some of the default deployment resources. * e.g. here we add jsp page which is only used in this test * * @return deployment archive */ @Deployment public static WebArchive getDeployment() { WebArchive war = getDefaultDeployment(); war.addAsWebResource("examplePage.jsp"); return war; }