public SubscriberKeyMgtClient(String backendServerURL, String username, String password) throws Exception { try { AuthenticationAdminStub authenticationAdminStub = new AuthenticationAdminStub(null, backendServerURL + "AuthenticationAdmin"); ServiceClient authAdminServiceClient = authenticationAdminStub._getServiceClient(); authAdminServiceClient.getOptions().setManageSession(true); authenticationAdminStub.login(username, password, new URL(backendServerURL).getHost()); ServiceContext serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext(); String authenticatedCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING); if (log.isDebugEnabled()) { log.debug( "Authentication Successful with AuthenticationAdmin. " + "Authenticated Cookie ID : " + authenticatedCookie); } subscriberServiceStub = new APIKeyMgtSubscriberServiceStub(null, backendServerURL + "APIKeyMgtSubscriberService"); ServiceClient client = subscriberServiceStub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); options.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, authenticatedCookie); } catch (Exception e) { String errorMsg = "Error when instantiating SubscriberKeyMgtClient."; log.error(errorMsg, e); throw e; } }
public static void StatisticsAdmin() { try { String serviceName = "StatisticsAdmin"; StatisticsAdminStub statisticsAdminStub; String backEndUrl = "https://localhost:9443/services/"; String endPoint = backEndUrl + "/services/" + serviceName; statisticsAdminStub = new StatisticsAdminStub(endPoint); // Authenticate Your stub from sessionCooke ServiceClient serviceClient; Options option; serviceClient = statisticsAdminStub._getServiceClient(); option = serviceClient.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); SystemStatistics stat = statisticsAdminStub.getSystemStatistics(); System.out.println("Host :" + stat.getServerName()); System.out.println("Server Start Time :" + stat.getServerStartTime()); System.out.println("System Up Time :" + stat.getSystemUpTime()); System.out.print(stat.getUsedMemory().getValue() + stat.getUsedMemory().getUnit() + " of "); System.out.println( stat.getTotalMemory().getValue() + stat.getTotalMemory().getUnit() + " memory used"); } catch (Exception e) { System.out.println(e.getMessage()); } }
/** * Login to the API gateway as an admin * * @return A session cookie string * @throws AxisFault if an error occurs while logging in */ private String login(Environment environment) throws AxisFault { String user = environment.getUserName(); String password = environment.getPassword(); String serverURL = environment.getServerURL(); if (serverURL == null || user == null || password == null) { throw new AxisFault("Required API gateway admin configuration unspecified"); } String host; try { host = new URL(serverURL).getHost(); } catch (MalformedURLException e) { throw new AxisFault("API gateway URL is malformed", e); } AuthenticationAdminStub authAdminStub = new AuthenticationAdminStub(null, serverURL + "AuthenticationAdmin"); ServiceClient client = authAdminStub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); try { authAdminStub.login(user, password, host); ServiceContext serviceContext = authAdminStub._getServiceClient().getLastOperationContext().getServiceContext(); return (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING); } catch (RemoteException e) { throw new AxisFault("Error while contacting the authentication admin services", e); } catch (LoginAuthenticationExceptionException e) { throw new AxisFault("Error while authenticating against the API gateway admin", e); } }
@edu.umd.cs.findbugs.annotations.SuppressWarnings( value = "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS", justification = "It is required to set two options on the Options object") public APIKeyValidatorClient() throws APISecurityException { APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration(); String serviceURL = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_URL); username = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_USERNAME); password = config.getFirstProperty(APIConstants.API_KEY_VALIDATOR_PASSWORD); if (serviceURL == null || username == null || password == null) { throw new APISecurityException( APISecurityConstants.API_AUTH_GENERAL_ERROR, "Required connection details for the key management server not provided"); } try { ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); keyValidationServiceStub = new APIKeyValidationServiceStub(ctx, serviceURL + "APIKeyValidationService"); ServiceClient client = keyValidationServiceStub._getServiceClient(); Options options = client.getOptions(); options.setTimeOutInMilliSeconds(TIMEOUT_IN_MILLIS); options.setProperty(HTTPConstants.SO_TIMEOUT, TIMEOUT_IN_MILLIS); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIMEOUT_IN_MILLIS); options.setCallTransportCleanup(true); options.setManageSession(true); } catch (AxisFault axisFault) { throw new APISecurityException( APISecurityConstants.API_AUTH_GENERAL_ERROR, "Error while initializing the API key validation stub", axisFault); } }
private ServiceClient getRESTEnabledServiceClient(String trpUrl, String addUrl, String operation) throws AxisFault { ServiceClient serviceClient = getServiceClient(trpUrl, addUrl, operation); serviceClient.getOptions().setProperty("enableREST", "true"); return serviceClient; }
public APIKeyValidatorClient() throws APISecurityException { APIManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration(); String serviceURL = config.getFirstProperty(APIConstants.API_KEY_MANAGER_URL); username = config.getFirstProperty(APIConstants.API_KEY_MANAGER_USERNAME); password = config.getFirstProperty(APIConstants.API_KEY_MANAGER_PASSWORD); if (serviceURL == null || username == null || password == null) { throw new APISecurityException( APISecurityConstants.API_AUTH_GENERAL_ERROR, "Required connection details for the key management server not provided"); } try { clientStub = new APIKeyValidationServiceStub(null, serviceURL + "APIKeyValidationService"); ServiceClient client = clientStub._getServiceClient(); Options options = client.getOptions(); options.setTimeOutInMilliSeconds(TIMEOUT_IN_MILLIS); options.setProperty(HTTPConstants.SO_TIMEOUT, TIMEOUT_IN_MILLIS); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIMEOUT_IN_MILLIS); options.setCallTransportCleanup(true); options.setManageSession(true); } catch (AxisFault axisFault) { throw new APISecurityException( APISecurityConstants.API_AUTH_GENERAL_ERROR, "Error while initializing the API key validation stub", axisFault); } }
/** * Checks the validity of a execution plan * * @param executionPlan * @return boolean */ public boolean validateExecutionPlan(String executionPlan) { ServiceClient serviceClient; Options options; String result = null; try { String sessionCookie = login(); EventProcessorAdminServiceStub eventProcessorAdminServiceStub = new EventProcessorAdminServiceStub( policyDeployerConfiguration.getServiceUrl() + "EventProcessorAdminService"); serviceClient = eventProcessorAdminServiceStub._getServiceClient(); options = serviceClient.getOptions(); options.setManageSession(true); options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie); result = eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan); } catch (RemoteException e) { return false; } catch (MalformedURLException e) { return false; } catch (LoginAuthenticationExceptionException e) { return false; } if ("success".equalsIgnoreCase(result)) { return true; } return false; }
@Override public String getDecision(String userName, String resource, String action, String[] env) throws Exception { String decision; // authenticate for every request. we need to decide this TODO if (authenticate()) { try { String serviceURL = backEndServerURL + "EntitlementService"; EntitlementServiceStub stub = new EntitlementServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(HTTPConstants.COOKIE_STRING, authCookie); decision = getStatus(stub.getDecisionByAttributes(userName, resource, action, env)); stub.cleanup(); } catch (Exception e) { log.error("Error occurred while policy evaluation", e); throw e; } } else { log.error("User can not be authenticated to evaluate the entitlement query"); throw new Exception("User can not be authenticated to evaluate the entitlement query"); } return decision; }
/** * 1. Check validity of execution plan 2. If execution plan exist with same name edit it 3. Else * deploy new execution plan * * @param name Name of execution plan * @param executionPlan execution query plan * @param sessionCookie session cookie to use established connection * @throws RemoteException */ private void deploy(String name, String executionPlan, String sessionCookie) throws RemoteException { ServiceClient serviceClient; Options options; EventProcessorAdminServiceStub eventProcessorAdminServiceStub = new EventProcessorAdminServiceStub( policyDeployerConfiguration.getServiceUrl() + "EventProcessorAdminService"); serviceClient = eventProcessorAdminServiceStub._getServiceClient(); options = serviceClient.getOptions(); options.setManageSession(true); options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie); eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan); ExecutionPlanConfigurationDto[] executionPlanConfigurationDtos = eventProcessorAdminServiceStub.getAllActiveExecutionPlanConfigurations(); boolean isUpdateRequest = false; if (executionPlanConfigurationDtos != null) { for (ExecutionPlanConfigurationDto executionPlanConfigurationDto : executionPlanConfigurationDtos) { if (executionPlanConfigurationDto.getName().trim().equals(name)) { eventProcessorAdminServiceStub.editActiveExecutionPlan(executionPlan, name); isUpdateRequest = true; break; } } } if (!isUpdateRequest) { eventProcessorAdminServiceStub.deployExecutionPlan(executionPlan); } }
public static void main(String[] args) throws Exception { WebappAdminStub stub = null; try { String cookie = authenticate(username, password); if (cookie == null) { System.err.println("Error authenticating user : "******"WebappAdmin"); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); // build webapp data WebappUploadData data = getUploadData(inputStream, webappName, webappVersion); // upload the war file stub.uploadWebapp(new WebappUploadData[] {data}); System.out.println("Successfully uploaded the webapp"); } finally { if (stub != null) { try { stub.cleanup(); } catch (Exception ignore) { } } } }
public ManageGenericArtifactServiceClient(ServletConfig config, HttpSession session) throws RegistryException { String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); epr = backendServerURL + "ManageGenericArtifactService"; try { stub = new ManageGenericArtifactServiceStub(configContext, epr); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault axisFault) { String msg = "Failed to initiate ManageGenericArtifactServiceClient. " + axisFault.getMessage(); log.error(msg, axisFault); throw new RegistryException(msg, axisFault); } }
public static void ServiceAdmin() { try { String serviceName = "ServiceAdmin"; ServiceAdminStub stub; String backEndUrl = "https://localhost:9443/services"; String endPoint = backEndUrl + "/services/" + serviceName; stub = new ServiceAdminStub(endPoint); // Authenticate Your stub from sessionCooke ServiceClient serviceClient; Options option; serviceClient = stub._getServiceClient(); option = serviceClient.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); System.out.println(stub.getNumberOfActiveServices()); // System.out.println(stub.isUserValid("admin", "user")); } catch (Exception e) { System.out.println(e.getMessage()); } // ServiceAdminLibrary li = new ServiceAdminLibrary(); // try { // li.initServiceAdmin(); // System.out.println(li.getNumberOfActiveServices()); // li.AssertgetNumberOfActiveServices(4); // } catch (Exception e) { // System.out.println(e.getMessage()); // } }
public static void UserAdmin() { try { String serviceName = "UserAdmin"; UserAdminStub statisticsAdminStub; String backEndUrl = "https://localhost:9443/services/"; String endPoint = backEndUrl + "/services/" + serviceName; statisticsAdminStub = new UserAdminStub(endPoint); // Authenticate Your stub from sessionCooke ServiceClient serviceClient; Options option; serviceClient = statisticsAdminStub._getServiceClient(); option = serviceClient.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); UserRealmInfo stat = statisticsAdminStub.getUserRealmInfo(); System.out.println(stat.getAdminRole()); System.out.println(stat.getAdminUser()); System.out.println(stat.getEveryOneRole()); } catch (Exception e) { System.out.println(e.getMessage()); } }
public BAMToolBoxDeployerClient( String cookie, String backEndServerURL, ConfigurationContext configCtx) throws AxisFault { String serviceURL = backEndServerURL + BAMToolBoxService; stub = new BAMToolboxDepolyerServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public IdentityProviderClient( String cookie, String backendServerURL, ConfigurationContext configCtx) throws AxisFault { String serviceURL = backendServerURL + "IdentityProviderAdminService"; stub = new IdentityProviderAdminServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public MediationStatisticsClient( ConfigurationContext configCtx, String backendServerURL, String cookie) throws AxisFault { String serviceURL = backendServerURL + "MediationStatisticsAdmin"; stub = new MediationStatisticsAdminStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public ServerRoleManagerClient( ConfigurationContext configCtx, String backendServerURL, String cookie) throws java.lang.Exception { String serviceURL = backendServerURL + "ServerRolesManager"; stub = new ServerRolesManagerStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
/** * Log into the API gateway as an admin, and initialize the specified client stub using the * established authentication session. This method will also set some timeout values and enable * session management on the stub so that it can be successfully used for any subsequent admin * service invocations. * * @param stub A client stub to be setup * @throws AxisFault if an error occurs when logging into the API gateway */ protected void setup(Stub stub, Environment environment) throws AxisFault { String cookie = login(environment); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); options.setTimeOutInMilliSeconds(15 * 60 * 1000); options.setProperty(HTTPConstants.SO_TIMEOUT, 15 * 60 * 1000); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 15 * 60 * 1000); options.setManageSession(true); options.setProperty(HTTPConstants.COOKIE_STRING, cookie); }
public ReportTemplateClient( ConfigurationContext configCtx, String backendServerURL, String cookie) throws Exception { String serviceURL = backendServerURL + "ReportTemplateAdmin"; stub = new ReportTemplateAdminStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options options = client.getOptions(); options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); options.setManageSession(true); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public ReportResourceSupplierClient( String cookie, String backEndServerURL, ConfigurationContext configCtx) throws AxisFault { String serviceURL = backEndServerURL + "ReportingResourcesSupplier"; stub = new ReportingResourcesSupplierStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public CAAdminServiceClient( String cookie, String backendServerURL, ConfigurationContext configCtx, Locale locale) throws AxisFault { String serviceURL = backendServerURL + "CAAdminService"; bundle = ResourceBundle.getBundle(BUNDLE, locale); stub = new CAAdminServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public GadgetServerSocialDataMgtServiceClient( String cookie, String backendServerURL, ConfigurationContext configCtx, Locale locale) throws AxisFault { String serviceURL = backendServerURL + "GadgetServerSocialDataMgtService"; stub = new GadgetServerSocialDataMgtServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
@BeforeClass(groups = {"wso2.cep"}) public void login() throws Exception { ClientConnectionUtil.waitForPort(9443); String loggedInSessionCookie = util.login(); cepAdminServiceStub = new CEPAdminServiceStub("https://localhost:9443/services/CEPAdminService"); ServiceClient client = cepAdminServiceStub._getServiceClient(); Options options = client.getOptions(); options.setManageSession(true); options.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, loggedInSessionCookie); }
public SummaryDimensionDSClient( String cookie, String backendServerURL, ConfigurationContext configCtx) throws BAMException { try { String serviceURL = ClientUtil.getBackendEPR(backendServerURL, BAM_SUMMARY_GENERATION_DS); summaryGenerationDSStub = new BAMSummaryGenerationDSStub(configCtx, serviceURL); } catch (Exception e) { throw new BAMException(e.getMessage(), e); } ServiceClient client = summaryGenerationDSStub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); }
public OMElement sendSimpleStockQuoteSoap12(String trpUrl, String addUrl, String symbol) throws AxisFault { ServiceClient serviceClient = getServiceClient(trpUrl, addUrl); serviceClient .getOptions() .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); try { return buildResponse(serviceClient.sendReceive(createStandardRequest(symbol))); } finally { serviceClient.cleanupTransport(); } }
protected AnalyticsProcessorAdminServiceStub getAnalyticsProcessorStub() throws Exception { ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null); String loggedInSessionCookie = getSessionCookie(); AnalyticsProcessorAdminServiceStub analyticsStub = new AnalyticsProcessorAdminServiceStub(configContext, backendURL + ANALYTICS_SERVICE_NAME); ServiceClient client = analyticsStub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty( org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, loggedInSessionCookie); return analyticsStub; }
public IdentityManagementClient(String cookie, String url, ConfigurationContext configContext) throws Exception { try { stub = new UserIdentityManagementServiceStub( configContext, url + "UserIdentityManagementService"); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { handleException(e.getMessage(), e); } }
private boolean authenticateRemotely( String username, String password, String applicationName, AppFactoryConfiguration configuration) { try { String EPR = configuration.getFirstProperty("ServerUrls.AppFactory") + "RepositoryAuthenticationService"; // Create a service client ServiceClient client = new ServiceClient(); // Set the endpoint address client.getOptions().setTo(new EndpointReference(EPR)); client.getOptions().setAction("hasAccess"); CarbonUtils.setBasicAccessSecurityHeaders(username, password, client); // Make the request and get the response String payload = " <p:hasAccess xmlns:p=\"http://service.mgt.repository.appfactory.carbon.wso2.org\">\n" + " <!--0 to 1 occurrence-->\n" + " <xs:username xmlns:xs=\"http://service.mgt.repository.appfactory.carbon.wso2.org\">" + username + "</xs:username>\n" + " <!--0 to 1 occurrence-->\n" + " <xs:applicationId xmlns:xs=\"http://service.mgt.repository.appfactory.carbon.wso2.org\">" + applicationName + "</xs:applicationId>\n" + " </p:hasAccess>"; OMElement result = client.sendReceive( new StAXOMBuilder(new ByteArrayInputStream(payload.getBytes())).getDocumentElement()); Iterator iterator = result.getChildElements(); if (iterator.hasNext()) { OMElement object = (OMElement) iterator.next(); if (object.getText().equals("true")) { return true; } } } catch (AxisFault e) { e.printStackTrace(); } catch (XMLStreamException e) { } return false; }
public static void main(String[] args) throws AxisFault { ConfigurationContext cc = ConfigurationContextFactory.createConfigurationContextFromFileSystem( args[0], args[1] + "/axis2.xml"); OMElement payload = createPayLoad(); ServiceClient serviceclient = new ServiceClient(cc, null); Options opts = new Options(); opts.setTo(new EndpointReference(args[2] + "/RMProxy")); opts.setAction("urn:add"); opts.setUseSeparateListener(true); opts.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); serviceclient.setOptions(opts); serviceclient.engageModule("Mercury"); serviceclient.engageModule("addressing"); for (int i = 0; i < 4; i++) { try { OMElement response = serviceclient.sendReceive(payload); System.out.println(response); } catch (RemoteException e) { e.printStackTrace(); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } // Setting the last message serviceclient.getOptions().setProperty("MercuryLastMessage", Constants.VALUE_TRUE); try { OMElement response = serviceclient.sendReceive(payload); } catch (RemoteException e) { e.printStackTrace(); } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } cc.getListenerManager().stop(); }
private void runStubBased() throws Exception { String targetEndpoint = toEPR; ConfigurationContext configurationContext = generateConfigContext(); RMInteropServiceStub stub = new RMInteropServiceStub(configurationContext, targetEndpoint); ServiceClient stubServiceClient = stub._getServiceClient(); String acksToAddress = stubServiceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress(); setUpOptions(stubServiceClient.getOptions(), acksToAddress); Ping ping = new Ping(); ping.setText("ping1"); stub.ping(ping); ping = new Ping(); ping.setText("ping2"); stub.ping(ping); ping = new Ping(); ping.setText("ping3"); stub.ping(ping); SequenceReport sequenceReport = null; boolean complete = false; while (!complete) { sequenceReport = SandeshaClient.getOutgoingSequenceReport(stubServiceClient); if (sequenceReport != null && sequenceReport.getCompletedMessages().size() == 3) complete = true; else { try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } } } Thread.sleep(3000); SandeshaClient.terminateSequence(stubServiceClient); Thread.sleep(6000); stub._getServiceClient().cleanup(); }