public void runSuccessCase() {
log.debug("Running switch mediator SuccessCase ");
StockQuoteClient stockQuoteClient = new StockQuoteClient();
OMElement result = null;
LogViewerStub logViewerStub = null;
try {
AuthenticateStub authenticateStub = new AuthenticateStub();
ConfigServiceAdminStub configServiceAdminStub = new ConfigServiceAdminStub("https://" + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTPS_PORT + "/services/ConfigServiceAdmin");
authenticateStub.authenticateAdminStub(configServiceAdminStub, sessionCookie);
ArtifactReader artifactReader = new ArtifactReader();
logViewerStub = new LogViewerStub("https://" + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTPS_PORT + "/services/LogViewer");
authenticateStub.authenticateAdminStub(logViewerStub, sessionCookie);
OMElement omElement = artifactReader.getOMElement(SwitchMediatorTest.class.getResource("/switch.xml").getPath());
configServiceAdminStub.updateConfiguration(omElement);
if (FrameworkSettings.STRATOS.equalsIgnoreCase("false")) {
result = stockQuoteClient.stockQuoteClientforProxy("http://" + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTP_PORT, null, "IBM");
} else if (FrameworkSettings.STRATOS.equalsIgnoreCase("true")) {
result = stockQuoteClient.stockQuoteClientforProxy("http://" + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTP_PORT + "/services/" + FrameworkSettings.TENANT_NAME + "/", null, "IBM");
}
log.info(result);
} catch (Exception e) {
e.printStackTrace();
log.error("switch mediator doesn't work : " + e.getMessage());
}
try {
GetLogs getLogs = new GetLogs();
getLogs.setKeyword("mediator");
GetLogsResponse getLogsResponse = logViewerStub.getLogs(getLogs);
LogMessage[] logMessages = getLogsResponse.get_return();
if (!logMessages[logMessages.length - 1].getLogMessage().contains(searchWord)) {
log.error("Switch Mediator doesn't work");
Assert.fail("Switch Mediator doesn't work");
}