Java Code Examples for org.wildfly.swarm.jaxrs.JAXRSArchive#setWebXML()

The following examples show how to use org.wildfly.swarm.jaxrs.JAXRSArchive#setWebXML() . 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: ProvidersMergingTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
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 2
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@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 4
Source File: DefaultApplicationDeploymentProcessorTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@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();
}