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");
}
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);
}
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);
}
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;
}
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;
}
Aggregations