Search in sources :

Example 6 with ByteArrayAsset

use of org.jboss.shrinkwrap.api.asset.ByteArrayAsset in project wildfly-swarm by wildfly-swarm.

the class SwaggerArchivePreparerTest method testWithSwaggerConfInWebInfClasses.

@Test
public void testWithSwaggerConfInWebInfClasses() {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addResource(MyResource.class);
    archive.addResource(MyOtherResource.class);
    archive.add(new ByteArrayAsset("packages: com.myapp.mysubstuff".getBytes()), "WEB-INF/classes/META-INF/swarm.swagger.conf");
    SwaggerArchivePreparer preparer = new SwaggerArchivePreparer(archive);
    preparer.process();
    SwaggerArchive swaggerArchive = archive.as(SwaggerArchive.class);
    assertThat(swaggerArchive.getResourcePackages()).containsOnly("com.myapp.mysubstuff");
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) SwaggerArchive(org.wildfly.swarm.swagger.SwaggerArchive) Test(org.junit.Test)

Example 7 with ByteArrayAsset

use of org.jboss.shrinkwrap.api.asset.ByteArrayAsset in project camunda-bpm-platform by camunda.

the class MigrationContextSwitchClassesTest method modelAsAsset.

protected static Asset modelAsAsset(BpmnModelInstance modelInstance) {
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
    Bpmn.writeModelToStream(byteStream, modelInstance);
    byte[] bytes = byteStream.toByteArray();
    return new ByteArrayAsset(bytes);
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 8 with ByteArrayAsset

use of org.jboss.shrinkwrap.api.asset.ByteArrayAsset in project camunda-bpm-platform by camunda.

the class MigrationContextSwitchBeansTest method modelAsAsset.

protected static Asset modelAsAsset(BpmnModelInstance modelInstance) {
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
    Bpmn.writeModelToStream(byteStream, modelInstance);
    byte[] bytes = byteStream.toByteArray();
    return new ByteArrayAsset(bytes);
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 9 with ByteArrayAsset

use of org.jboss.shrinkwrap.api.asset.ByteArrayAsset in project wildfly by wildfly.

the class EarClassPath3TestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    WebArchive war = ShrinkWrap.create(WebArchive.class);
    JavaArchive libJar = ShrinkWrap.create(JavaArchive.class);
    libJar.addClasses(TestAA.class, EarClassPath3TestCase.class);
    libJar.addAsManifestResource(new ByteArrayAsset("Class-Path: ../../../cp.jar\n".getBytes(StandardCharsets.UTF_8)), "MANIFEST.MF");
    war.addAsLibraries(libJar);
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
    ear.addAsModule(war);
    JavaArchive earLib = ShrinkWrap.create(JavaArchive.class, "cp.jar");
    earLib.addClass(TestBB.class);
    ear.addAsModule(earLib);
    earLib = ShrinkWrap.create(JavaArchive.class, "cp.jar");
    earLib.addClass(TestBB.class);
    ear.addAsModule(earLib);
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 10 with ByteArrayAsset

use of org.jboss.shrinkwrap.api.asset.ByteArrayAsset in project wildfly by wildfly.

the class EarClassPathTransitiveClosureTestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    WebArchive war = ShrinkWrap.create(WebArchive.class);
    JavaArchive libJar = ShrinkWrap.create(JavaArchive.class);
    libJar.addClasses(TestAA.class, EarClassPathTransitiveClosureTestCase.class);
    war.addAsLibraries(libJar);
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
    ear.addAsModule(war);
    JavaArchive earLib = ShrinkWrap.create(JavaArchive.class, "earLib.jar");
    earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: ../cp1.jar\n".getBytes(StandardCharsets.UTF_8)), "MANIFEST.MF");
    ear.addAsLibraries(earLib);
    earLib = ShrinkWrap.create(JavaArchive.class, "cp1.jar");
    earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: cp2.jar\n".getBytes(StandardCharsets.UTF_8)), "MANIFEST.MF");
    ear.addAsModule(earLib);
    earLib = ShrinkWrap.create(JavaArchive.class, "cp2.jar");
    earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: a/b/c\n".getBytes(StandardCharsets.UTF_8)), "MANIFEST.MF");
    earLib.addClass(TestBB.class);
    ear.addAsModule(earLib);
    ear.add(new StringAsset("Hello World"), "a/b/c", "testfile.file");
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

ByteArrayAsset (org.jboss.shrinkwrap.api.asset.ByteArrayAsset)24 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)11 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 Deployment (org.jboss.arquillian.container.test.api.Deployment)8 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)6 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)5 InputStream (java.io.InputStream)4 Index (org.jboss.jandex.Index)4 IndexWriter (org.jboss.jandex.IndexWriter)4 Indexer (org.jboss.jandex.Indexer)4 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)4 File (java.io.File)3 WildFlySwarmManifest (org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest)3 JAXRSArchive (org.wildfly.swarm.jaxrs.JAXRSArchive)3 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 URL (java.net.URL)2 Properties (java.util.Properties)2 Attributes (java.util.jar.Attributes)2 Manifest (java.util.jar.Manifest)2