Search in sources :

Example 1 with WebXMLReader

use of io.swagger.jaxrs.config.WebXMLReader in project swagger-core by swagger-api.

the class SwaggerContextServiceTest method initializeAndGetConfigBasedOnPath.

@Test(description = "should add SwaggerConfig to SwaggerConfigLocator map with keys path-based keys")
public void initializeAndGetConfigBasedOnPath() {
    stubWithPathBasedConfigInitParam();
    new SwaggerContextService().withServletConfig(servletConfig1).withBasePath("/url1").initConfig();
    new SwaggerContextService().withServletConfig(servletConfig2).withBasePath("url2").initConfig();
    assertTrue(SwaggerConfigLocator.getInstance().getConfig(CONFIG_ID_PREFIX + "/url1/") instanceof WebXMLReader);
    assertTrue(SwaggerConfigLocator.getInstance().getConfig(CONFIG_ID_PREFIX + "/url2/") instanceof WebXMLReader);
    verify(servletConfig1, times(1)).getInitParameter(eq(USE_PATH_BASED_CONFIG));
    verify(servletConfig2, times(1)).getInitParameter(eq(USE_PATH_BASED_CONFIG));
}
Also used : SwaggerContextService(io.swagger.jaxrs.config.SwaggerContextService) WebXMLReader(io.swagger.jaxrs.config.WebXMLReader) Test(org.testng.annotations.Test)

Aggregations

SwaggerContextService (io.swagger.jaxrs.config.SwaggerContextService)1 WebXMLReader (io.swagger.jaxrs.config.WebXMLReader)1 Test (org.testng.annotations.Test)1