Java Code Examples for org.jboss.shrinkwrap.api.ShrinkWrap#create()
The following examples show how to use
org.jboss.shrinkwrap.api.ShrinkWrap#create() .
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: EventStorePersistenceJPATest.java From JEEventStore with MIT License | 6 votes |
@Deployment public static EnterpriseArchive deployment() { EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear"); DefaultDeployment.addDependencies(ear, "org.jeeventstore:jeeventstore-persistence-jpa", false); ear.addAsModule(ShrinkWrap.create(JavaArchive.class, "ejb.jar") .addAsManifestResource(new File("src/test/resources/META-INF/beans.xml")) .addAsManifestResource(new File("src/test/resources/META-INF/persistence.xml")) .addAsManifestResource(new File( "src/test/resources/META-INF/ejb-jar-EventStorePersistenceJPATest.xml"), "ejb-jar.xml") .addClass(XMLSerializer.class) .addClass(TestUTF8Utils.class) .addClass(PersistenceTestHelper.class) .addPackage(AbstractPersistenceTest.class.getPackage()) .addPackage(EventStorePersistenceJPA.class.getPackage()) ); return ear; }
Example 2
Source File: SwarmExecutor.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 6 votes |
public SwarmExecutor withModules(final List<Path> moduleDirs) { if (this.executable != null && this.executable instanceof ExecutableJar) { throw new RuntimeException("Cannot use modules with an executable jar"); } final File moduleJar = new File(System.getProperty("java.io.tmpdir"), "swarm-module-overrides.jar"); final JavaArchive moduleArchive = ShrinkWrap.create(JavaArchive.class); boolean modulesAdded = false; for (Path moduleDir : moduleDirs) { if (moduleDir.toFile().exists()) { moduleArchive.addAsResource(moduleDir.toFile(), "modules"); modulesAdded = true; } } if (modulesAdded) { moduleArchive.as(ZipExporter.class) .exportTo(moduleJar, true); withClasspathEntry(moduleJar.toPath()); } return this; }
Example 3
Source File: StaticContentContextRootDeploymentTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static Archive getSecond() throws Exception { WARArchive deployment = ShrinkWrap.create(WARArchive.class); deployment.setContextRoot("/static"); deployment.staticContent(); return deployment; }
Example 4
Source File: SimpleLoginConfigTest.java From thorntail with Apache License 2.0 | 5 votes |
protected static WARArchive initDeployment() { WARArchive deployment = ShrinkWrap.create(WARArchive.class); deployment.addClass(ApplicationScopedSubjectExposingResource.class); deployment.addClass(SimpleLoginConfigApplication.class); deployment.addAsResource(new ClassLoaderAsset("keys/public-key.pem"), "public-key.pem"); return deployment; }
Example 5
Source File: LocalFileSystemRulesDbClientTest.java From ipst with Mozilla Public License 2.0 | 5 votes |
@Before public void setUp() throws Exception { JavaArchive archive = ShrinkWrap.create(JavaArchive.class); fileSystem = ShrinkWrapFileSystems.newFileSystem(archive); dbDir = fileSystem.getPath("db"); SecurityRuleSerializerLoaderMock loader = new SecurityRuleSerializerLoaderMock(); loader.addSerializer(new SecurityRuleSerializerMock()); rulesDbClient = new LocalFileSystemRulesDbClient(dbDir, loader); }
Example 6
Source File: TraceResolverOnDeploymentTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment public static Archive createDeployment() throws Exception { WARArchive deployment = ShrinkWrap.create(WARArchive.class); // on real world deployments, these parts would come from a dependency of the target application deployment.addClass(MockTracerResolver.class); deployment.addPackage(MockTracer.class.getPackage()); deployment.addAsServiceProvider(TracerResolver.class, MockTracerResolver.class); // this is a simple servlet, that we can hit with our tests deployment.addClass(SimpleServlet.class); deployment.addClass(AsyncServlet.class); return deployment; }
Example 7
Source File: CDISpringContextInjectionTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Deployment public static JavaArchive createDeployment() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class); archive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); archive.addAsResource("cdi/camel-context.xml"); archive.addClasses(RouteBuilderG.class); return archive; }
Example 8
Source File: TransformerSubsystemTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@BeforeClass public static void createLegacyJars() throws IOException { JavaArchive legacySubsystemArchive = ShrinkWrap.create(JavaArchive.class, "legacy-archive-transformers.jar"); legacySubsystemArchive.addPackage(VersionedExtension2.class.getPackage()); StreamExporter exporter = legacySubsystemArchive.as(ZipExporter.class); Files.deleteIfExists(LEGACY_ARCHIVE); exporter.exportTo(LEGACY_ARCHIVE.toFile()); }
Example 9
Source File: WebXmlContainerTest.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testContextParamOnFileWebXML() throws Exception { WARArchive archive = ShrinkWrap.create(WARArchive.class); archive.setWebXML(new File("src/test/resources/web.xml")); archive.addContextParam("myParam", "myValue"); }
Example 10
Source File: S3IntegrationTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Deployment public static JavaArchive deployment() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "aws-s3-tests.jar"); archive.addClasses(S3ClientProducer.class, S3Utils.class, BasicCredentialsProvider.class, AWSUtils.class); archive.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); return archive; }
Example 11
Source File: SpringRouteBuilderScanTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Deployment public static JavaArchive createdeployment() { final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "spring-routebuilder-tests"); archive.addAsResource("spring/context-scanC-camel-context.xml"); archive.addClasses(ScannedComponentSpringRouteBuilder.class); return archive; }
Example 12
Source File: JsfIT.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testFractionMatchingMETAINF() throws Exception { JARArchive archive = ShrinkWrap.create(JARArchive.class); archive.addAsResource("META-INF/faces-config.xml"); FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer(); final File out = Files.createTempFile(archive.getName(), ".war").toFile(); out.deleteOnExit(); archive.as(ZipExporter.class).exportTo(out, true); analyzer.source(out); assertThat(analyzer.detectNeededFractions() .stream() .filter(fd -> fd.getArtifactId().equals("jsf")) .count()).isEqualTo(1); }
Example 13
Source File: PrincipalLeakTest.java From thorntail with Apache License 2.0 | 5 votes |
protected static WARArchive initDeployment() { WARArchive deployment = ShrinkWrap.create(WARArchive.class); deployment.addClass(SubjectExposingResource.class); deployment.addClass(TestApplication.class); deployment.addAsManifestResource(new ClassLoaderAsset("keys/public-key.pem"), "/MP-JWT-SIGNER"); return deployment; }
Example 14
Source File: HostmapDeploymentContributorTest.java From knox with Apache License 2.0 | 4 votes |
@Test public void testDeployment() throws IOException { WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" ); UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl(); Map<String,String> providerParams = new HashMap<>(); providerParams.put( "test-host-external", "test-host-internal" ); Provider provider = new Provider(); provider.setEnabled( true ); provider.setName( "hostmap" ); provider.setParams( providerParams ); DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class ); EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rewriteRules ).anyTimes(); EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes(); EasyMock.replay( context ); HostmapDeploymentContributor contributor = new HostmapDeploymentContributor(); assertThat( contributor.getRole(), is("hostmap") ); assertThat( contributor.getName(), is( "static" ) ); // Just make sure it doesn't blow up. contributor.contributeFilter( null, null, null, null, null ); // Just make sure it doesn't blow up. contributor.initializeContribution( context ); contributor.contributeProvider( context, provider ); HostmapFunctionDescriptor funcDesc = rewriteRules.getFunction( "hostmap" ); assertThat( funcDesc.config(), is( "/WEB-INF/hostmap.txt" ) ); Node node = webArchive.get( "/WEB-INF/hostmap.txt" ); String asset = IOUtils.toString( node.getAsset().openStream(), StandardCharsets.UTF_8 ); assertThat( asset, containsString( "test-host-external=test-host-internal" ) ); // Just make sure it doesn't blow up. contributor.finalizeContribution( context ); }
Example 15
Source File: MetricsIntegrationTest.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class, "camel-metrics-tests.jar"); }
Example 16
Source File: WarBuilder.java From zstack with Apache License 2.0 | 4 votes |
public void build() { WebArchive war = ShrinkWrap.create(WebArchive.class, "zstack.war"); war.setWebXML(new File("src/test/resources/webapp/WEB-INF/web.xml")); war.addAsWebInfResource(new File("src/test/resources/webapp/WEB-INF/zstack-servlet-context.xml"), "classes/zstack-servlet-context.xml"); new ZipExporterImpl(war).exportTo(new File(Utils.getPathUtil().join(warExportedToPath, war.getName())), true); }
Example 17
Source File: EJBRemoteArquillianTest.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static Archive createDeployment() { JARArchive deployment = ShrinkWrap.create(JARArchive.class); deployment.add(EmptyAsset.INSTANCE, "nothing"); return deployment; }
Example 18
Source File: TopologyWebAppArquillianTest.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static Archive createDeployment() { JARArchive deployment = ShrinkWrap.create(JARArchive.class); deployment.add(EmptyAsset.INSTANCE, "nothing"); return deployment; }
Example 19
Source File: ManagementArquillianTest.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static Archive createDeployment() { JARArchive deployment = ShrinkWrap.create(JARArchive.class); deployment.add(EmptyAsset.INSTANCE, "nothing"); return deployment; }
Example 20
Source File: JCAArquillianTest.java From ARCHIVE-wildfly-swarm with Apache License 2.0 | 4 votes |
@Deployment(testable = false) public static Archive createDeployment() { JARArchive deployment = ShrinkWrap.create(JARArchive.class); deployment.add(EmptyAsset.INSTANCE, "nothing"); return deployment; }