protected void init(TestUserMode userMode) throws XPathExpressionException/*, AutomationUtilException*/ { automationContext = new AutomationContext(CarbonIntegrationConstants.PRODUCT_GROUP, userMode); contextUrls = automationContext.getContextUrls(); /*loginLogoutClient = new LoginLogoutClient(automationContext); sessionCookie = loginLogoutClient.login(); backendURL = automationContext.getContextUrls().getBackEndUrl(); userInfo = automationContext.getContextTenant().getContextUser(); } protected String getServiceUrl(String serviceName) throws XPathExpressionException { return automationContext.getContextUrls().getServiceUrl() + "/" + serviceName;*/ }
/** * Returns MQTT port based on automation.xml configurations * @throws XPathExpressionException */ protected Integer getAMQPPort() throws XPathExpressionException { return Integer.parseInt(mbServer.getInstance().getPorts().get("amqp")); } }
/** * Get database connection. * @return database connection * @throws XPathExpressionException * @throws ClassNotFoundException * @throws SQLException */ public static Connection getConnection() throws XPathExpressionException, ClassNotFoundException, SQLException { AutomationContext automationContext = new AutomationContext("MB_Cluster", TestUserMode.SUPER_TENANT_ADMIN); String url = automationContext.getConfigurationValue("//datasources/datasource[@name=\'mbCluster\']/url"); String username = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/username"); String password = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/password"); String driverName = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/driverClassName"); Class.forName(driverName); Connection conn = DriverManager.getConnection(url, username, password); return conn; } }
protected void buildTenantDetails(TestUserMode userMode) throws Exception { AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, userMode); tenantDetails = automationContext.getContextTenant(); } }
protected void init(TestUserMode testUserMode) throws Exception { storeContext = new AutomationContext("es", "store", testUserMode); publisherContext = new AutomationContext("es", "publisher", testUserMode); automationContext = new AutomationContext("es",testUserMode); loginLogoutClient = new LoginLogoutClient(automationContext); sessionCookie = loginLogoutClient.login(); backendURL = automationContext.getContextUrls().getBackEndUrl(); webAppURL = automationContext.getContextUrls().getWebAppURL(); userInfo = automationContext.getContextTenant().getContextUser(); }
new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.AM_STORE_INSTANCE, userMode); storeUrls = new APIMURLBean(storeContext.getContextUrls()); new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.AM_PUBLISHER_INSTANCE, userMode); publisherUrls = new APIMURLBean(publisherContext.getContextUrls()); new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.AM_GATEWAY_MGT_INSTANCE, userMode); gatewayUrlsMgt = new APIMURLBean(gatewayContextMgt.getContextUrls()); new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.AM_GATEWAY_WRK_INSTANCE, userMode); gatewayUrlsWrk = new APIMURLBean(gatewayContextWrk.getContextUrls()); keyManagerContext = new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.AM_KEY_MANAGER_INSTANCE, userMode); keyMangerUrl = new APIMURLBean(keyManagerContext.getContextUrls()); backEndServer = new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME, APIMIntegrationConstants.BACKEND_SERVER_INSTANCE, userMode); backEndServerUrl = new APIMURLBean(backEndServer.getContextUrls()); executionMode = gatewayContextMgt.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); user = storeContext.getContextTenant().getContextUser(); superTenantKeyManagerContext = new AutomationContext(APIMIntegrationConstants.AM_PRODUCT_GROUP_NAME,
public ServerAdminClient(AutomationContext automationContext) throws AxisFault, XPathExpressionException { String endPoint = automationContext.getContextUrls().getBackEndUrl() + serviceName; serverAdminStub = new ServerAdminStub(endPoint); AuthenticateStubUtil.authenticateStub(automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword(), serverAdminStub); }
@BeforeClass(alwaysRun = true) public void init() throws XPathExpressionException, IOException, LoginAuthenticationExceptionException { AutomationContext automationContext = new AutomationContext(); ip = automationContext.getDefaultInstance().getHosts().get("default"); port = automationContext.getDefaultInstance().getPorts().get("https"); AuthenticatorClient authenticationAdminClient = new AuthenticatorClient(automationContext.getContextUrls().getBackEndUrl()); webappAdminStub = new WebappAdminStub(automationContext.getContextUrls().getBackEndUrl() + "WebappAdmin"); AuthenticateStubUtil.authenticateStub(authenticationAdminClient.login( automationContext.getSuperTenant(). getTenantAdmin().getUserName(), automationContext.getSuperTenant(). getTenantAdmin().getPassword(), automationContext.getDefaultInstance().getHosts().get("default")), webappAdminStub); result.setMatchKey("specsResult"); appList = getWebApplist(""); jaggeryAppList(); endpointList(); }
protected String getWebSocketAPIInvocationURL(String apiContext, String version) throws XPathExpressionException { String url = gatewayContextWrk.getContextUrls().getServiceUrl().replace("/services", ""). replace("http", "ws"); url = url.substring(0, url.lastIndexOf(":") + 1) + (inboundWebSocketPort + portOffset) + "/" + apiContext + "/" + version; return url; }
@BeforeSuite(alwaysRun = true) public void initialize() throws XPathExpressionException, AxisFault { AutomationContext autoContext = new AutomationContext(); logViewerClient = new LogViewerClient(autoContext.getContextUrls().getBackEndUrl(), autoContext.getSuperTenant().getTenantAdmin().getUserName(), autoContext.getSuperTenant().getTenantAdmin().getPassword()); }
public synchronized void restartGracefully() throws AutomationFrameworkException { try { int httpsPort = defaultHttpsPort + portOffset; //considering the port offset String backendURL = automationContext.getContextUrls().getSecureServiceUrl().replaceAll("(:\\d+)", ":" + httpsPort); User superUser = automationContext.getSuperTenant().getTenantAdmin(); ClientConnectionUtil.sendGraceFullRestartRequest(backendURL, superUser.getUserName() , superUser.getPassword()); } catch (XPathExpressionException e) { throw new AutomationFrameworkException("restart failed", e); } long time = System.currentTimeMillis() + DEFAULT_START_STOP_WAIT_MS; while (!inputStreamHandler.getOutput().contains(SERVER_SHUTDOWN_MESSAGE) && System.currentTimeMillis() < time) { // wait until server shutdown is completed } time = System.currentTimeMillis(); while (System.currentTimeMillis() < time + 5000) { //wait for port to close } try { ClientConnectionUtil.waitForPort( Integer.parseInt(automationContext.getInstance().getPorts().get("https")), automationContext.getInstance().getHosts().get("default")); ClientConnectionUtil.waitForLogin(automationContext); } catch (XPathExpressionException e) { throw new AutomationFrameworkException("Connection attempt to carbon server failed", e); } }
/** * Get value passing xpath * * @param xPath expression * @return value * @throws XPathExpressionException */ protected static String getPropertyValue(String xPath) throws XPathExpressionException { return context.getConfigurationValue(xPath); }
protected void init() throws Exception { automationContext = new AutomationContext("DSS", "dss001", TestUserMode.SUPER_TENANT_ADMIN); }
protected String getStorePublisherUrl() throws XPathExpressionException { return UrlGenerationUtil.getWebAppURL(esContext.getContextTenant(), esContext.getInstance()).split("\\/t\\/") [0]; } }
String backendURL = automationContext.getContextUrls().getBackEndUrl(); TenantManagementServiceClient tenantManagementServiceClient = new TenantManagementServiceClient(backendURL, sessionCookie); tenantAdminPassword, backendURL, UrlGenerationUtil.getManagerHost(automationContext.getInstance()));
protected String getSessionCookie(AutomationContext context) throws RemoteException, XPathExpressionException, LoginAuthenticationExceptionException { AuthenticatorClient authenticationAdminClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl()); String sessionCookie = authenticationAdminClient.login(automationContext.getSuperTenant(). getTenantAdmin().getUserName(), automationContext.getSuperTenant(). getTenantAdmin().getPassword(), automationContext.getDefaultInstance().getHosts().get("default")); return sessionCookie; }
/** * Get the password of admin user of current context tenant * @return password as a String * @throws XPathExpressionException */ protected String getAdminPassword() throws XPathExpressionException { return mbServer.getContextTenant().getTenantAdmin().getPassword(); }
String url = null; try { url = automationContext.getContextUrls().getBackEndUrl(); } catch (XPathExpressionException e) { throw new AutomationFrameworkException("Get context failed", e); ClientConnectionUtil.sendForcefulShutDownRequest( backendURL, automationContext.getSuperTenant().getContextUser().getUserName(), automationContext.getSuperTenant().getContextUser().getPassword()); } catch (AutomationFrameworkException e) { throw new AutomationFrameworkException("Get context failed", e);
public RemoteRegistry getRemoteRegistry (AutomationContext automationContext) throws Exception { RemoteRegistry registry = null; TestFrameworkUtils.setKeyStoreProperties(automationContext); System.setProperty("carbon.repo.write.mode", "true"); try { registry = new RemoteRegistry(new URL( UrlGenerationUtil.getRemoteRegistryURL(automationContext.getDefaultInstance())), automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword()); } catch (Exception e) { handleException("Failed to initialized remote registry instance ", e); } return registry; }
protected void init(TestUserMode userType) throws Exception { esContext = new AutomationContext("ES", userType); automationContext = esContext; LoginLogoutClient loginLogoutClient = new LoginLogoutClient(esContext); sessionCookie = loginLogoutClient.login(); //return the current tenant as the userType(TestUserMode) tenantInfo = esContext.getContextTenant(); //return the user information initialized with the system userInfo = automationContext.getContextTenant().getContextUser(); backendURL = automationContext.getContextUrls().getBackEndUrl(); webAppURL = automationContext.getContextUrls().getWebAppURL(); storeContext = new AutomationContext("ES", "store", userType); publisherContext = new AutomationContext("ES", "publisher", userType); } protected void init(String tenantKey, String userKey) throws Exception {