use of org.wildfly.swarm.microprofile.openapi.api.OpenApiConfig in project wildfly-swarm by wildfly-swarm.
the class ApimanManagerApiDeploymentTest method testApimanManagerWAR.
@Test
public void testApimanManagerWAR() throws Exception {
File warFile = Maven.resolver().resolve("io.apiman:apiman-manager-api-war:war:1.3.1.Final").withoutTransitivity().asSingleFile();
WildFlyConfigBuilder cfgBuilder = new WildFlyConfigBuilder();
cfgBuilder.addDefaultSources();
Config cfg = cfgBuilder.build();
Archive archive = ShrinkWrap.createFromZipFile(JAXRSArchive.class, warFile);
OpenApiConfig config = new OpenApiConfig(cfg);
OpenApiDocument.INSTANCE.reset();
OpenApiDeploymentProcessor processor = new OpenApiDeploymentProcessor(config, archive);
processor.process();
new OpenApiServletContextListener().contextInitialized(null);
String actual = OpenApiSerializer.serialize(OpenApiDocument.INSTANCE.get(), Format.JSON);
String expected = loadResource(getClass().getResource("testApimanManagerWAR.expected.json"));
// System.out.println(actual);
assertJsonEquals(expected, actual);
}
use of org.wildfly.swarm.microprofile.openapi.api.OpenApiConfig in project wildfly-swarm by wildfly-swarm.
the class OpenApiDeploymentProcessorTest method doTest.
/**
* Common test method.
* @throws Exception
*/
protected void doTest(Class modelReaderClass, String staticResource, boolean disableAnnotationScanning, Class filterClass, String expectedResource) throws Exception {
System.setProperty(OASConfig.SCAN_DISABLE, "" + disableAnnotationScanning);
System.setProperty(OASConfig.MODEL_READER, modelReaderClass != null ? modelReaderClass.getName() : "");
System.setProperty(OASConfig.FILTER, filterClass != null ? filterClass.getName() : "");
TestConfig cfg = new TestConfig();
OpenApiConfig config = new OpenApiConfig(cfg);
Archive archive = archive(staticResource);
OpenApiDocument.INSTANCE.reset();
OpenApiDeploymentProcessor processor = new OpenApiDeploymentProcessor(config, archive);
processor.process();
new OpenApiServletContextListener(cfg).contextInitialized(null);
String actual = OpenApiSerializer.serialize(OpenApiDocument.INSTANCE.get(), Format.JSON);
String expected = loadResource(getClass().getResource(expectedResource));
assertJsonEquals(expected, actual);
}
use of org.wildfly.swarm.microprofile.openapi.api.OpenApiConfig in project wildfly-swarm by wildfly-swarm.
the class ApimanManagerApiDeploymentTest method testApimanGatewayWAR.
@Test
public void testApimanGatewayWAR() throws Exception {
File warFile = Maven.resolver().resolve("io.apiman:apiman-gateway-platforms-war-wildfly8-api:war:1.3.1.Final").withoutTransitivity().asSingleFile();
WildFlyConfigBuilder cfgBuilder = new WildFlyConfigBuilder();
cfgBuilder.addDefaultSources();
Config cfg = cfgBuilder.build();
Archive archive = ShrinkWrap.createFromZipFile(JAXRSArchive.class, warFile);
OpenApiConfig config = new OpenApiConfig(cfg);
OpenApiDocument.INSTANCE.reset();
OpenApiDeploymentProcessor processor = new OpenApiDeploymentProcessor(config, archive);
processor.process();
new OpenApiServletContextListener().contextInitialized(null);
String actual = OpenApiSerializer.serialize(OpenApiDocument.INSTANCE.get(), Format.JSON);
String expected = loadResource(getClass().getResource("testApimanGatewayWAR.expected.json"));
// System.out.println(actual);
assertJsonEquals(expected, actual);
}
Aggregations