Java Code Examples for org.wildfly.swarm.jaxrs.JAXRSArchive#addClass()
The following examples show how to use
org.wildfly.swarm.jaxrs.JAXRSArchive#addClass() .
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: FractionUsageAnalyzerTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test public void testFractionMatching() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MyResource.class); FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer(); final File out = Files.createTempFile(archive.getName(), ".war").toFile(); archive.as(ZipExporter.class).exportTo(out, true); analyzer.source(out); assertThat(analyzer.detectNeededFractions() .stream() .filter(fd -> fd.getArtifactId().equals("jaxrs")) .count()) .isEqualTo(1); out.delete(); }
Example 2
Source File: FractionUsageAnalyzerTest.java From thorntail with Apache License 2.0 | 6 votes |
@Test public void testExplodedFractionMatching() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MyResource.class); FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer(); File dirFile = TempFileManager.INSTANCE.newTempDirectory("fractionusagetest", null); archive.as(ExplodedExporter.class).exportExplodedInto(dirFile); analyzer.source(dirFile); assertThat(analyzer.detectNeededFractions() .stream() .filter(fd -> fd.getArtifactId().equals("jaxrs")) .count()) .isEqualTo(1); }
Example 3
Source File: SWARM_513Test.java From thorntail with Apache License 2.0 | 6 votes |
@Deployment(testable = true) public static Archive createDeployment() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource("project-test-defaults-path.yml"); assertThat(url).isNotNull(); File projectDefaults = new File(url.toURI()); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "myapp.war"); deployment.addResource(TicketEndpoint.class); deployment.addClass(Ticket.class); deployment.addClass(Tickets.class); deployment.addClass(TicketDTO.class); deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence.xml", SWARM_513Test.class.getClassLoader()), "classes/META-INF/persistence.xml"); deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/import.sql", SWARM_513Test.class.getClassLoader()), "classes/META-INF/import.sql"); deployment.addAsResource(projectDefaults, "/project-defaults.yml"); return deployment; }
Example 4
Source File: Main.java From thorntail with Apache License 2.0 | 5 votes |
public static void main(String... args) throws Exception { swarm = new Swarm(args); swarm.start(); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "myapp.war"); deployment.addClass(MyResource.class); deployment.setContextRoot("rest"); deployment.addAllDependencies(); swarm.deploy(deployment); }
Example 5
Source File: KeycloakMicroprofileJwtWithoutJsonTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment public static Archive<?> createDeployment() { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "test.war"); deployment.addClass(SecuredApplication.class); deployment.addClass(SecuredResource.class); deployment.addAsResource("project-no-keycloak-json.yml", "project-defaults.yml"); return deployment; }
Example 6
Source File: KeycloakMicroprofileJwtTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment public static Archive<?> createDeployment() { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "test.war"); deployment.addClass(SecuredApplication.class); deployment.addClass(SecuredResource.class); deployment.addAsWebInfResource("keycloak.json"); deployment.addAsResource("project-defaults.yml"); return deployment; }
Example 7
Source File: JWTAndOpentracingIntegrationTest.java From thorntail with Apache License 2.0 | 5 votes |
protected static JAXRSArchive initDeployment() { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.addClass(JWTTestResource.class); deployment.addClass(TestApplication.class); deployment.addAsManifestResource(new ClassLoaderAsset("keys/public-key.pem"), "/MP-JWT-SIGNER"); return deployment; }
Example 8
Source File: AdvertiseAndTagByAnnotationTest.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.addClass(TaggedAdvertiser.class); deployment.addClass(UntaggedAdvertiser.class); deployment.addAllDependencies(); return deployment; }
Example 9
Source File: TopologyArquillianTest.java From thorntail with Apache License 2.0 | 5 votes |
@Deployment public static Archive createDeployment() { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.addClass(MyApplication.class); deployment.addClass(MyResource.class); return deployment; }
Example 10
Source File: ProvidersMergingTest.java From thorntail with Apache License 2.0 | 5 votes |
protected static JAXRSArchive initDeployment() { JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.addClass(ProvidersMergingResource.class); deployment.addClass(CustomJaxrsProvider.class); deployment.setWebXML("web-with-user-provider.xml"); deployment.addClass(TestApplication.class); deployment.addAsManifestResource(new ClassLoaderAsset("keys/public-key.pem"), "/MP-JWT-SIGNER"); return deployment; }
Example 11
Source File: DefaultApplicationDeploymentProcessorTest.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testApplicationPathAnnotation_DirectlyInArchive() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MySampleApplication.class); DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive); processor.process(); Node generated = archive.get(PATH); assertThat(generated).isNull(); }
Example 12
Source File: DefaultApplicationDeploymentProcessorTest.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testWebXmlApplicationServletMappingPresent() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MyResource.class); archive.setWebXML(new StringAsset( "<web-app><servlet-mapping><servlet-name>Faces Servlet</servlet-name><url-pattern>*.jsf</url-pattern></servlet-mapping><servlet-mapping><servlet-name>javax.ws.rs.core.Application</servlet-name><url-pattern>/foo/*</url-pattern></servlet-mapping></web-app>")); DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive); processor.process(); Node generated = archive.get(PATH); assertThat(generated).isNull(); }
Example 13
Source File: DefaultApplicationDeploymentProcessorTest.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testWebXmlApplicationServletMappingAbsent() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MyResource.class); archive.setWebXML(new StringAsset("<web-app><display-name>Foo</display-name></web-app>")); DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive); processor.applicationPath.set("/api-test"); // Simulate the behavior of loading the project defaults. processor.process(); Node generated = archive.get(PATH); assertThat(generated).isNotNull(); }
Example 14
Source File: DefaultApplicationDeploymentProcessorTest.java From thorntail with Apache License 2.0 | 5 votes |
@Test public void testMalformedWebXmlApplicationServletMappingAbsent() throws Exception { JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class); archive.addClass(MyResource.class); archive.setWebXML(new StringAsset("blablabla")); DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive); processor.applicationPath.set("/api-test"); // Simulate the behavior of loading the project defaults. processor.process(); Node generated = archive.get(PATH); assertThat(generated).isNotNull(); }
Example 15
Source File: App.java From drools-workshop with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Container container = new Container(); container.start(); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.setContextRoot("/api"); deployment.addResource(ShoppingCartService.class); deployment.addResource(ShoppingCartServiceImpl.class); deployment.addClass(HttpStatusExceptionHandler.class); deployment.addClass(BusinessException.class); deployment.addAllDependencies(); container.deploy(deployment); }
Example 16
Source File: App.java From drools-workshop with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Container container = new Container(); container.start(); JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); deployment.setContextRoot("/cep"); deployment.addResource(TransactionEventService.class); deployment.addResource(TransactionEventServiceImpl.class); deployment.addClass(HttpStatusExceptionHandler.class); deployment.addClass(BusinessException.class); deployment.addAllDependencies(); container.deploy(deployment); }