Search in sources :

Example 16 with ByteArrayAsset

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

the class TestFoxPlatformClientAsEjbModule_twoPasAsLib method twoPasAsLib.

/**
 * Deployment layout
 *
 * test-application.ear
 *    |-- lib /
 *        |-- processes1.jar
 *          |-- META-INF/processes.xml
 *          |-- org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml
 *        |-- processes2.jar
 *          |-- META-INF/processes.xml
 *          |-- org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml
 *
 *    |-- fox-platform-client.jar  <<===============================||
 *                                                                  ||  Class-Path reference
 *    |-- test.war (contains the test-class but also processes)     ||
 *        |-- META-INF/MANIFEST.MF =================================||
 *        |-- WEB-INF/beans.xml
 *        |-- + test classes
 */
@Deployment
public static EnterpriseArchive twoPasAsLib() {
    JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "processes1.jar").addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml").addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa1.xml", "META-INF/processes.xml");
    JavaArchive processArchive2Jar = ShrinkWrap.create(JavaArchive.class, "processes.jar").addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml").addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa2.xml", "META-INF/processes.xml");
    JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient();
    WebArchive testJar = ShrinkWrap.create(WebArchive.class, "client-test.war").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").setManifest(new ByteArrayAsset(("Class-Path: " + foxPlatformClientJar.getName() + "\n").getBytes())).addClass(AbstractFoxPlatformIntegrationTest.class).addClass(TestFoxPlatformClientAsEjbModule_twoPasAsLib.class);
    return ShrinkWrap.create(EnterpriseArchive.class, "twoPasAsLib.ear").addAsLibrary(processArchive1Jar).addAsLibrary(processArchive2Jar).addAsModule(foxPlatformClientJar).addAsModule(testJar).addAsLibrary(DeploymentHelper.getEngineCdi());
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 17 with ByteArrayAsset

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

the class IntegrationTestDeployment method getLoopyArchive.

private JavaArchive getLoopyArchive() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "loopy.jar").addClasses(SampleExecutionFactory.class).addAsManifestResource(new ByteArrayAsset(SampleExecutionFactory.class.getName().getBytes()), ArchivePaths.create("services/org.teiid.translator.ExecutionFactory"));
    jar.addAsManifestResource(new ByteArrayAsset("Dependencies: org.jboss.teiid.translator.loopback\n".getBytes()), ArchivePaths.create("MANIFEST.MF"));
    return jar;
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 18 with ByteArrayAsset

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

the class ServiceClientProcessor method process.

@Override
public void process() {
    Collection<ClassInfo> serviceClients = index.getKnownDirectImplementors((DotName.createSimple(ServiceClient.class.getName())));
    serviceClients.forEach(info -> {
        String name = info.name().toString() + "_generated";
        String path = "WEB-INF/classes/" + name.replace('.', '/') + ".class";
        archive.as(JAXRSArchive.class).add(new ByteArrayAsset(ClientServiceFactory.createImpl(name, info)), path);
    });
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) ServiceClient(org.wildfly.swarm.client.jaxrs.ServiceClient) JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) ClassInfo(org.jboss.jandex.ClassInfo)

Example 19 with ByteArrayAsset

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

the class DeploymentIndexTest method createIndexAsset.

private Asset createIndexAsset(Class<?>... classes) throws IOException {
    Indexer indexer = new Indexer();
    for (Class<?> clazz : classes) {
        try (InputStream stream = DeploymentIndexTest.class.getClassLoader().getResourceAsStream(clazz.getName().replace(".", "/") + ".class")) {
            if (stream != null) {
                indexer.index(stream);
            }
        }
    }
    Index index = indexer.complete();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    new IndexWriter(out).write(index);
    return new ByteArrayAsset(out.toByteArray());
}
Also used : Indexer(org.jboss.jandex.Indexer) ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) IndexWriter(org.jboss.jandex.IndexWriter) InputStream(java.io.InputStream) Index(org.jboss.jandex.Index) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 20 with ByteArrayAsset

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

the class SwaggerArchivePreparerTest method testWithSwaggerConfInRoot.

@Test
public void testWithSwaggerConfInRoot() {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addResource(MyResource.class);
    archive.addResource(MyOtherResource.class);
    archive.add(new ByteArrayAsset("packages: com.myapp.mysubstuff".getBytes()), "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)

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