use of ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf in project X-Road by nordic-institute.
the class RestMetadataServiceHandlerTest method init.
/**
* Init data for tests
*/
@Before
public void init() {
GlobalConf.reload(new TestSuiteGlobalConf());
KeyConf.reload(new TestSuiteKeyConf());
ServerConf.reload(new TestSuiteServerConf() {
@Override
public DescriptionType getDescriptionType(ServiceId service) {
return DescriptionType.OPENAPI3;
}
@Override
public String getServiceDescriptionURL(ServiceId service) {
if (SUBSYSTEM_FOR_JSON_FILE.equals(service.getSubsystemCode())) {
return "http://localhost:9858/petstore.json";
} else if (SUBSYSTEM_FOR_UNSUPPORTED_YAML_FILE.equals(service.getSubsystemCode())) {
return "http://localhost:9858/openapi_incompatible_version.yaml";
} else {
return "http://localhost:9858/petstore.yaml";
}
}
});
httpClientMock = mock(HttpClient.class);
mockRequest = mock(HttpServletRequest.class);
mockResponse = mock(HttpServletResponse.class);
mockProxyMessage = mock(ProxyMessage.class);
mockServer = new WireMockServer(options().port(MOCK_SERVER_PORT));
mockServer.stubFor(WireMock.any(urlPathEqualTo("/petstore.json")).willReturn(aResponse().withBodyFile("petstore.json")));
mockServer.stubFor(WireMock.any(urlPathEqualTo("/petstore.yaml")).willReturn(aResponse().withBodyFile("petstore.yaml")));
mockServer.start();
}
use of ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf in project X-Road by nordic-institute.
the class MetadataHandlerTest method init.
/**
* Init common data for tests
*/
@Before
public void init() {
GlobalConf.reload(new TestSuiteGlobalConf());
KeyConf.reload(new TestSuiteKeyConf());
httpClientMock = mock(HttpClient.class);
mockRequest = mock(HttpServletRequest.class);
mockResponse = mock(HttpServletResponse.class);
}
use of ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf in project X-Road by nordic-institute.
the class ProxyMonitorServiceHandlerTest method init.
/**
* Init data for tests
*/
@Before
public void init() throws IOException {
GlobalConf.reload(new TestSuiteGlobalConf() {
@Override
public String getInstanceIdentifier() {
return EXPECTED_XR_INSTANCE;
}
});
KeyConf.reload(new TestSuiteKeyConf());
ServerConf.reload(new TestSuiteServerConf() {
@Override
public SecurityServerId getIdentifier() {
return DEFAULT_OWNER_SERVER;
}
});
mockRequest = mock(HttpServletRequest.class);
mockProxyMessage = mock(ProxyMessage.class);
when(mockProxyMessage.getSoapContentType()).thenReturn(MimeTypes.TEXT_XML_UTF8);
}
use of ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf in project X-Road by nordic-institute.
the class MetadataServiceHandlerTest method init.
/**
* Init data for tests
*/
@Before
public void init() throws IOException {
GlobalConf.reload(new TestSuiteGlobalConf());
KeyConf.reload(new TestSuiteKeyConf());
ServerConf.reload(new TestSuiteServerConf());
httpClientMock = mock(HttpClient.class);
mockRequest = mock(HttpServletRequest.class);
mockResponse = mock(HttpServletResponse.class);
mockServletOutputStream = new MetaserviceTestUtil.StubServletOutputStream();
when(mockResponse.getOutputStream()).thenReturn(mockServletOutputStream);
mockProxyMessage = mock(ProxyMessage.class);
when(mockProxyMessage.getSoapContentType()).thenReturn(MimeTypes.TEXT_XML_UTF8);
this.mockServer = new WireMockServer(options().port(WSDL_SERVER_PORT));
}
use of ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf in project X-Road by nordic-institute.
the class ProxyMonitorServiceHandlerMetricsTest method init.
/**
* Init data for tests
*/
@Before
public void init() throws IOException {
GlobalConf.reload(new TestSuiteGlobalConf() {
@Override
public String getInstanceIdentifier() {
return EXPECTED_XR_INSTANCE;
}
});
KeyConf.reload(new TestSuiteKeyConf());
ServerConf.reload(new TestSuiteServerConf() {
@Override
public SecurityServerId getIdentifier() {
return DEFAULT_OWNER_SERVER;
}
});
mockRequest = mock(HttpServletRequest.class);
mockProxyMessage = mock(ProxyMessage.class);
when(mockProxyMessage.getSoapContentType()).thenReturn(MimeTypes.TEXT_XML_UTF8);
}
Aggregations