Java Code Examples for org.wildfly.swarm.jaxrs.JAXRSArchive#add()
The following examples show how to use
org.wildfly.swarm.jaxrs.JAXRSArchive#add() .
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: AdvertiseAndTagByMainTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment(testable = false) public static Archive<?> createDeployment() throws Exception { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.add(EmptyAsset.INSTANCE, "nothing"); deployment.as(TopologyArchive.class).advertise(serviceName, asList(tag1, tag2)); deployment.addAllDependencies(); return deployment; }
Example 2
Source File: SwaggerArchivePreparerTest.java From thorntail with Apache License 2.0 | 5 votes |
@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"); }
Example 3
Source File: SwaggerArchivePreparerTest.java From thorntail with Apache License 2.0 | 5 votes |
@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"); }
Example 4
Source File: DefaultApplicationDeploymentProcessor.java From thorntail with Apache License 2.0 | 5 votes |
private void addGeneratedApplication(JAXRSArchive archive) { String name = "org.wildfly.swarm.generated.WildFlySwarmDefaultJAXRSApplication"; String path = "WEB-INF/classes/" + name.replace('.', '/') + ".class"; byte[] generatedApp; try { generatedApp = DefaultApplicationFactory.create(name, applicationPath.get()); archive.add(new ByteArrayAsset(generatedApp), path); archive.addHandlers(new ApplicationHandler(archive, path)); } catch (IOException e) { e.printStackTrace(); } }