protected void buildTenantDetails(TestUserMode userMode) throws Exception { AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, userMode); tenantDetails = automationContext.getContextTenant(); } }
protected String getStorePublisherUrl() throws XPathExpressionException { return UrlGenerationUtil.getWebAppURL(esContext.getContextTenant(), esContext.getInstance()).split("\\/t\\/") [0]; } }
/** * Get current test user's password according to the automation context * * @throws XPathExpressionException */ protected String getCurrentPassword() throws XPathExpressionException { return mbServer.getContextTenant().getContextUser().getPassword(); }
/** * Return the admin user name of current context tenant * @return admin name as a String * @throws XPathExpressionException */ protected String getAdminUserName() throws XPathExpressionException { return mbServer.getContextTenant().getTenantAdmin().getUserName(); }
/** * Get current test user's Username according to the automation context * * @throws XPathExpressionException */ protected String getCurrentUserName() throws XPathExpressionException { return mbServer.getContextTenant().getContextUser().getUserName(); }
/** * 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(); }
protected String getWebAppURL() throws XPathExpressionException { return UrlGenerationUtil.getWebAppURL(esContext.getContextTenant(), esContext.getInstance()); }
public RepositoryAdminClient(String backendURL, AutomationContext automationContext) throws AxisFault, XPathExpressionException { String endPoint = backendURL + serviceName; repositoryAdminServiceStub = new RepositoryAdminServiceStub(endPoint); AuthenticateStubUtil.authenticateStub(automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword(), repositoryAdminServiceStub); }
public FeatureManagementUtil(List<FeatureInfo> featureList, AutomationContext automationContext) throws Exception { this.automationContext = automationContext; featureInfos = featureList.toArray(new FeatureInfo[featureList.size()]); backendURL = automationContext.getContextUrls().getBackEndUrl(); loginLogoutUtil = new LoginLogoutUtil(); String sessionCookie = loginLogoutUtil.login( automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword().toCharArray(), backendURL); repositoryAdminClient = new RepositoryAdminClient(backendURL, automationContext); featureAdminClient = new FeatureAdminClient(backendURL, sessionCookie); }
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; }
/** * Log in to a Carbon server * * @return The session cookie on successful login * @throws LoginAuthenticationExceptionException, IOException, XMLStreamException, * URISyntaxException, SAXException, XPathExpressionException */ public String login() throws LoginAuthenticationExceptionException, IOException, XMLStreamException, URISyntaxException, SAXException, XPathExpressionException { String userName; userName = automationContext.getContextTenant().getContextUser().getUserName(); return loginClient.login(userName, automationContext.getContextTenant().getContextUser().getPassword() , automationContext.getInstance().getHosts().get("default")); }
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); }
protected void init(String tenantKey, String userKey) throws Exception { esContext = new AutomationContext(ESIntegrationTestConstants.ES_PRODUCT_NAME, "es002", tenantKey, userKey); 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 = tenantInfo.getContextUser(); }
public Registry getGovernanceRegistry (Registry registry, AutomationContext automationContext) throws Exception { Registry governance = null; TestFrameworkUtils.setKeyStoreProperties(automationContext); System.setProperty("carbon.repo.write.mode", "true"); try { governance = GovernanceUtils.getGovernanceUserRegistry(registry, automationContext.getContextTenant().getContextUser().getUserName()); } catch (Exception e) { handleException("Failed to instantiate governance registry instance ", e); } return governance; }
public boolean isFeatureInstalled() throws Exception { sessionCookie = loginLogoutUtil.login( automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword().toCharArray(), backendURL); featureAdminClient = new FeatureAdminClient(backendURL, sessionCookie); FeatureWrapper[] featuresWrappers = featureAdminClient.getInstalledFeatures(); boolean isInstalledFeatureFound = false; Arrays.asList(featuresWrappers); int length = featuresWrappers.length; for (FeatureWrapper featureWrapper : featuresWrappers) { Feature feature = featureWrapper.getWrappedFeature(); for (FeatureInfo featureInfo : featureInfos) { if (featureInfo.getFeatureID().equals(feature.getFeatureID()) && featureInfo.getFeatureVersion().equals(feature.getFeatureVersion())) { log.info("installed feature found " + feature.getFeatureID()); isInstalledFeatureFound = true; break; } } } return isInstalledFeatureFound; } }
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 {
public WSRegistryServiceClient getWSRegistry (AutomationContext automationContext) throws Exception { System.setProperty("carbon.repo.write.mode", "true"); WSRegistryServiceClient registry = null; ConfigurationContext configContext; String axis2Repo = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "client"; String axis2Conf = FrameworkPathUtil.getSystemResourceLocation() + "axis2config" + File.separator + "axis2_client.xml"; TestFrameworkUtils.setKeyStoreProperties(automationContext); try { configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem(axis2Repo, axis2Conf); configContext.setProperty(HTTPConstants.CONNECTION_TIMEOUT, TIME_OUT_VALUE); log.info("Group ConfigurationContext Timeout " + configContext.getServiceGroupContextTimeoutInterval()); registry = new WSRegistryServiceClient( automationContext.getContextUrls().getBackEndUrl(), automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword(), configContext); log.info("WS Registry Created - Login Successful"); } catch (Exception e) { handleException("Failed instantiate WSRegistry client instance ", e); } return registry; }
/** * @param path path of the collection or resource to be subscribed * @return true if a new property is added to the collection or resource, * false otherwise * @throws Exception */ private boolean update(String path) throws Exception { jmxClient = new JMXClient(); jmxClient.connect(automationContext.getContextTenant().getContextUser().getUserName(), automationContext.getContextTenant().getContextUser().getPassword()); jmxClient.registerNotificationListener("at path " + path + " was updated."); PropertiesAdminServiceClient propertiesAdminServiceClient = new PropertiesAdminServiceClient( backEndUrl, sessionCookie); // update by adding a property propertiesAdminServiceClient.setProperty(path, "TestProperty", "TestValue"); ResourceAdminServiceClient resourceAdminServiceClient = new ResourceAdminServiceClient( backEndUrl, sessionCookie); boolean status = jmxClient.getNotifications(); return resourceAdminServiceClient.getProperty(path, "TestProperty").equals("TestValue") && status; }
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(); }
public void setInfoRolesAndUsers(String adminUserKey) throws LoginAuthenticationExceptionException, RemoteException, XPathExpressionException { //todo - // FrameworkProperties isProperties = FrameworkFactory.getFrameworkProperties(ProductConstant.IS_SERVER_NAME); AutomationContext isContext = new AutomationContext("IS", "is", "carbon.supper", adminUserKey); Tenant userAdminDetails = isContext.getContextTenant(); sessionCookie = login(userAdminDetails.getContextUser().getUserName(), userAdminDetails.getContextUser().getPassword(), isContext.getContextUrls().getBackEndUrl()); userAdminStub = new UserManagementClient(isContext.getContextUrls().getBackEndUrl(), sessionCookie); }