@BeforeClass(alwaysRun = true)
  public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    baseUrl = getStorePublisherUrl();
    AutomationContext automationContext =
        new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.TENANT_ADMIN);
    adminUserName = automationContext.getContextTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getContextTenant().getTenantAdmin().getPassword();
    String resourceLocation = getResourceLocation();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient =
        new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    providerName = currentUserName.split("@")[0];
    resourcePath = GADGET_REGISTRY_BASE_PATH + providerName + "/" + assetName + "/" + VERSION;
    LCNotificationSubject += resourcePath;
    updateNotificationSubject += resourcePath;
    smtpPropertyLocation = resourceLocation + SMTP_PROPERTY_FILE;

    // Update user profiles through Admin console
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
    ESUtil.setupUserProfile(driver, baseUrl, currentUserName, FIRST_NAME, LAST_NAME, EMAIL);
    // login to publisher & add a new gadget
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, assetName, VERSION, "", "", "");
  }
 public List<String> getUserList(String tenantDomain) throws XPathExpressionException {
   // according to the automation xml the super tenant no has to be accessed explicitly
   List<String> userList = new ArrayList<String>();
   AutomationContext automationContext = new AutomationContext();
   int numberOfUsers;
   String superTenantReplacement = AutomationXpathConstants.TENANTS;
   if (tenantDomain.equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
     superTenantReplacement = AutomationXpathConstants.SUPER_TENANT;
   }
   numberOfUsers =
       automationContext
           .getConfigurationNodeList(
               String.format(
                   AutomationXpathConstants.USER_NODE, superTenantReplacement, tenantDomain))
           .getLength();
   for (int i = 0; i < numberOfUsers; i++) {
     String userKey =
         automationContext
             .getConfigurationNodeList(
                 String.format(
                     AutomationXpathConstants.USERS_NODE, superTenantReplacement, tenantDomain))
             .item(0)
             .getChildNodes()
             .item(i)
             .getAttributes()
             .getNamedItem(AutomationXpathConstants.KEY)
             .getNodeValue();
     userList.add(userKey);
   }
   return userList;
 }
コード例 #3
0
 protected void init(TestUserMode testUserMode) throws Exception {
   dasServer = new AutomationContext("DAS", testUserMode);
   loginLogoutClient = new LoginLogoutClient(dasServer);
   backendURL = dasServer.getContextUrls().getBackEndUrl();
   webAppURL = dasServer.getContextUrls().getWebAppURL();
   userInfo = dasServer.getContextTenant().getContextUser();
 }
  @BeforeClass(alwaysRun = true)
  public void startUp() throws Exception {

    appMServer =
        new AutomationContext(AppmTestConstants.APP_MANAGER, TestUserMode.SUPER_TENANT_ADMIN);

    appCreator = appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.APP_CREATOR);
    adminUser = appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.ADMIN);
    appProvider = appCreator.getUserName();

    backEndUrl = appMServer.getContextUrls().getWebAppURLHttps();
    appmPublisherRestClient = new APPMPublisherRestClient(backEndUrl);
    User appCreator =
        appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.APP_CREATOR);
    appmPublisherRestClient.login(appCreator.getUserName(), appCreator.getPassword());

    // Create test web applications
    creatorDeleteAppTestAppId = createWebApp(creatorDeleteAppTest);
    adminDeleteAppTestAppId = createWebApp(adminDeleteAppTest);
    publisherDeleteAppTestAppId = createWebApp(publisherDeleteAppTest);
    appmPublisherRestClient.logout();

    // Promote lifecycle state in to "Unpublished" state
    appmPublisherRestClient.login(adminUser.getUserName(), adminUser.getPassword());
    changeLifeCycleStateIntoUnpublished(creatorDeleteAppTestAppId);
    changeLifeCycleStateIntoUnpublished(adminDeleteAppTestAppId);
    changeLifeCycleStateIntoUnpublished(publisherDeleteAppTestAppId);
  }
 @DataProvider
 public Object[][] validUserModeDataProvider() throws Exception {
   User adminUser = appMServer.getSuperTenant().getTenantAdmin();
   User appCreator = appMServer.getSuperTenant().getTenantUser("AppCreator");
   return new Object[][] {
     new Object[] {adminUser.getUserName(), adminUser.getPassword(), app1Uuid},
     new Object[] {appCreator.getUserName(), appCreator.getPassword(), app2Uuid}
   };
 }
  @DataProvider
  public static Object[][] validUserModeDataProvider() throws Exception {

    User appCreator =
        appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.APP_CREATOR);
    User adminUser = appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.ADMIN);
    return new Object[][] {
      new Object[] {appCreator.getUserName(), appCreator.getPassword(), creatorDeleteAppTestAppId},
      new Object[] {adminUser.getUserName(), adminUser.getPassword(), adminDeleteAppTestAppId}
    };
  }
コード例 #7
0
  @SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
  @BeforeClass(alwaysRun = true)
  public void testWebApplicationDeploymentAndAccessibility() throws Exception {

    AutomationContext superTenantContext =
        new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
    String superAdminSession = new LoginLogoutClient(superTenantContext).login();
    tenantManagementServiceClient =
        new TenantManagementServiceClient(
            superTenantContext.getContextUrls().getBackEndUrl(), superAdminSession);

    carbonHome = System.getProperty(ServerConstants.CARBON_HOME);
  }
コード例 #8
0
  public static LoginPage getPage(WebDriver driver, AutomationContext appMServer, LoginTo loginTo)
      throws IOException, XPathExpressionException {
    if (loginTo == LoginTo.PUBLISHER) {
      driver.get(appMServer.getContextUrls().getWebAppURLHttps() + PUBLISHER_LOGIN_URI);
    } else {
      driver.get(appMServer.getContextUrls().getWebAppURLHttps() + STORE_LOGIN_URI);
    }

    if (page == null || page.driver != driver) {
      page = new LoginPage(driver, appMServer);
    }
    return page;
  }
コード例 #9
0
  @BeforeClass(alwaysRun = true)
  public void startUp() throws Exception {
    AutomationContext appMServer =
        new AutomationContext(AppmTestConstants.APP_MANAGER, TestUserMode.SUPER_TENANT_ADMIN);
    backEndUrl = appMServer.getContextUrls().getWebAppURLHttps();
    appmPublisherRestClient = new APPMPublisherRestClient(backEndUrl);

    adminUser = appMServer.getSuperTenant().getTenantAdmin();
    userName = adminUser.getUserName();
    password = adminUser.getPassword();

    appmPublisherRestClient.login(userName, password);
  }
コード例 #10
0
ファイル: StormTestCase.java プロジェクト: ayash/product-cep
  private void configureNode(AutomationContext node) throws Exception {
    String backendURL = node.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(node);
    String loggedInSessionCookie = loginLogoutClient.login();
    eventReceiverAdminServiceClient =
        configurationUtil.getEventReceiverAdminServiceClient(backendURL, loggedInSessionCookie);
    eventPublisherAdminServiceClient =
        configurationUtil.getEventPublisherAdminServiceClient(backendURL, loggedInSessionCookie);
    eventProcessorAdminServiceClient =
        configurationUtil.getEventProcessorAdminServiceClient(backendURL, loggedInSessionCookie);
    eventStreamManagerAdminServiceClient =
        configurationUtil.getEventStreamManagerAdminServiceClient(
            backendURL, loggedInSessionCookie);

    log.info("Adding stream definitions");
    defineStreams();
    log.info("Adding event receiver analyticsWso2EventReceiver");
    addEventReceiver("analyticsWso2EventReceiver.xml");
    log.info("Adding event receiver stockQuoteWso2EventReceiver");
    addEventReceiver("stockQuoteWso2EventReceiver.xml");
    log.info("Adding event publisher fortuneCompanyWSO2EventPublisher");
    addEventPublisher("fortuneCompanyWSO2EventPublisher.xml");
    log.info("Adding execution plan");
    addExecutionPlan("PreprocessStats.siddhiql");
  }
 @DataProvider
 public Object[][] inValidUserModeDataProvider() throws Exception {
   User appPublisher = appMServer.getSuperTenant().getTenantUser("AppPublisher");
   return new Object[][] {
     new Object[] {appPublisher.getUserName(), appPublisher.getPassword(), app3Uuid}
   };
 }
  @BeforeClass(alwaysRun = true)
  public void startUp() throws Exception {
    appMServer =
        new AutomationContext(AppmTestConstants.APP_MANAGER, TestUserMode.SUPER_TENANT_ADMIN);
    backEndUrl = appMServer.getContextUrls().getWebAppURLHttps();
    appmPublisherRestClient = new APPMPublisherRestClient(backEndUrl);
    User appCreator = appMServer.getSuperTenant().getTenantUser("AppCreator");
    appCreatorUserName = appCreator.getUserName();
    appCreatorPassword = appCreator.getPassword();
    // Login to publisher by AppCreator user.
    appmPublisherRestClient.login(appCreatorUserName, appCreatorPassword);

    // Multiple web apps are created for multiple users.
    app1Uuid = createWebApp("1");
    app2Uuid = createWebApp("2");
    app3Uuid = createWebApp("3");
  }
コード例 #13
0
 public PPaaSIntegrationTest() throws Exception {
   ppaasAutomationCtx =
       new AutomationContext("PPAAS", "ppaas-001", TestUserMode.SUPER_TENANT_ADMIN);
   adminUsername =
       ppaasAutomationCtx.getConfigurationValue(
           "/automation/userManagement/superTenant/tenant/admin/user/userName");
   adminPassword =
       ppaasAutomationCtx.getConfigurationValue(
           "/automation/userManagement/superTenant/tenant/admin/user/password");
   restClient =
       new RestClient(
           ppaasAutomationCtx.getContextUrls().getWebAppURL(),
           ppaasAutomationCtx.getContextUrls().getWebAppURLHttps(),
           adminUsername,
           adminPassword);
   String mockIaaSEndpoint = ppaasAutomationCtx.getContextUrls().getWebAppURL() + "/mock-iaas/api";
   mockIaasApiClient = new IntegrationMockClient(mockIaaSEndpoint);
   log.info("Mock IaaS endpoint URL: " + mockIaaSEndpoint);
 }
 @DataProvider
 public static Object[][] inValidUserModeDataProvider() throws Exception {
   User appPublisher =
       appMServer.getSuperTenant().getTenantUser(AppmTestConstants.TestUsers.APP_PUBLISHER);
   return new Object[][] {
     new Object[] {
       appPublisher.getUserName(), appPublisher.getPassword(), publisherDeleteAppTestAppId
     }
   };
 }
 public void deleteUsers() throws Exception {
   String tenantAdminSession;
   AutomationContext automationContext =
       new AutomationContext(productGroupName, instanceName, TestUserMode.SUPER_TENANT_ADMIN);
   UserManagementClient userManagementClient;
   for (String tenants : tenantsList) {
     String superTenantReplacement = AutomationXpathConstants.TENANTS;
     if (tenants.equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
       superTenantReplacement = AutomationXpathConstants.SUPER_TENANT;
     }
     backendURL = automationContext.getContextUrls().getBackEndUrl();
     tenantAdminSession =
         login(
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.ADMIN_USER_USERNAME,
                     superTenantReplacement,
                     tenants)),
             tenants,
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.ADMIN_USER_PASSWORD,
                     superTenantReplacement,
                     tenants)),
             backendURL,
             UrlGenerationUtil.getManagerHost(automationContext.getInstance()));
     userManagementClient = new UserManagementClient(backendURL, tenantAdminSession);
     List<String> userList = getUserList(tenants);
     for (String user : userList) {
       boolean isUserAddedAlready =
           userManagementClient
               .getUserList()
               .contains(
                   automationContext.getConfigurationValue(
                       String.format(
                           AutomationXpathConstants.TENANT_USER_USERNAME,
                           superTenantReplacement,
                           tenants,
                           user)));
       if (isUserAddedAlready) {
         if (!user.equals(FrameworkConstants.ADMIN_ROLE)) {
           userManagementClient.deleteUser(
               automationContext.getConfigurationValue(
                   String.format(
                       AutomationXpathConstants.TENANT_USER_USERNAME,
                       superTenantReplacement,
                       tenants,
                       user)));
           log.info(user + " user deleted successfully");
         }
       }
     }
   }
 }
 public List<String> getTenantsDomainList() throws XPathExpressionException {
   List<String> tenantDomain = new ArrayList<String>();
   tenantDomain.add(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME);
   AutomationContext automationContext = new AutomationContext();
   int numberOfTenants =
       automationContext
           .getConfigurationNodeList(AutomationXpathConstants.TENANTS_NODE)
           .item(0)
           .getChildNodes()
           .getLength();
   for (int i = 0; i < numberOfTenants; i++) {
     tenantDomain.add(
         automationContext
             .getConfigurationNodeList(AutomationXpathConstants.TENANTS_NODE)
             .item(0)
             .getChildNodes()
             .item(i)
             .getAttributes()
             .getNamedItem(AutomationXpathConstants.DOMAIN)
             .getNodeValue());
   }
   return tenantDomain;
 }
コード例 #17
0
ファイル: StormTestCase.java プロジェクト: ayash/product-cep
  @BeforeClass(alwaysRun = true)
  public void init() throws Exception {
    super.init();
    automationContext = new AutomationContext("CEP", TestUserMode.SUPER_TENANT_ADMIN);
    instanceMap = automationContext.getProductGroup().getInstanceMap();
    contextMap = new HashMap<String, AutomationContext>();

    if (instanceMap != null && instanceMap.size() > 0) {
      for (Map.Entry<String, Instance> entry : instanceMap.entrySet()) {
        String instanceKey = entry.getKey();
        contextMap.put(
            instanceKey,
            new AutomationContext("CEP", instanceKey, TestUserMode.SUPER_TENANT_ADMIN));
        log.info(instanceKey);
      }
    }
    log.info("Cluster instance loading");
  }
コード例 #18
0
  /**
   * Prepare environment for tests.
   *
   * @throws XPathExpressionException
   * @throws LoginAuthenticationExceptionException
   * @throws IOException
   * @throws XMLStreamException
   * @throws URISyntaxException
   * @throws SAXException
   * @throws AutomationUtilException
   */
  @BeforeClass(alwaysRun = true)
  public void init()
      throws XPathExpressionException, LoginAuthenticationExceptionException, IOException,
          XMLStreamException, URISyntaxException, SAXException, AutomationUtilException {
    super.initCluster(TestUserMode.SUPER_TENANT_ADMIN);

    AutomationContext automationContext1 = getAutomationContextWithKey("mb002");
    AutomationContext automationContext2 = getAutomationContextWithKey("mb003");
    hostNode1 = automationContext1.getInstance().getHosts().get("default");
    hostNode2 = automationContext2.getInstance().getHosts().get("default");
    portInNode1 = Integer.parseInt(automationContext1.getInstance().getPorts().get("amqp"));
    portInNode2 = Integer.parseInt(automationContext2.getInstance().getPorts().get("amqp"));
    topicAdminClient =
        new TopicAdminClient(
            automationContext1.getContextUrls().getBackEndUrl(), super.login(automationContext1));

    super.initAndesAdminClients();
  }
コード例 #19
0
 protected void init(TestUserMode userMode) throws Exception {
   automationContext = new AutomationContext("GREG", userMode);
   backendURL = automationContext.getContextUrls().getBackEndUrl();
 }
コード例 #20
0
 protected void init(String domainKey, String instance, String userKey) throws Exception {
   dasServer = new AutomationContext("DAS", instance, domainKey, userKey);
   loginLogoutClient = new LoginLogoutClient(dasServer);
   backendURL = dasServer.getContextUrls().getBackEndUrl();
   webAppURL = dasServer.getContextUrls().getWebAppURL();
 }
コード例 #21
0
 protected void initPublisher(
     String productGroupName, String instanceName, TestUserMode userMode, String userKey)
     throws XPathExpressionException {
   automationContext = new AutomationContext(productGroupName, instanceName, userMode);
   backendURL = automationContext.getContextUrls().getBackEndUrl();
 }
コード例 #22
0
 protected String getBackendURL() throws XPathExpressionException {
   return automationContext.getContextUrls().getBackEndUrl();
 }
コード例 #23
0
 protected String getServiceURL() throws XPathExpressionException {
   return automationContext.getContextUrls().getServiceUrl();
 }
コード例 #24
0
 protected void init(TestUserMode userMode) throws XPathExpressionException {
   automationContext = new AutomationContext("CARBON", userMode);
   contextUrls = automationContext.getContextUrls();
 }
 public void populateUsers() throws Exception {
   String tenantAdminSession;
   UserManagementClient userManagementClient;
   AutomationContext automationContext =
       new AutomationContext(productGroupName, instanceName, TestUserMode.SUPER_TENANT_ADMIN);
   backendURL = automationContext.getContextUrls().getBackEndUrl();
   sessionCookie = automationContext.login();
   tenantStub = new TenantManagementServiceClient(backendURL, sessionCookie);
   // tenants is the domain of the tenants elements
   for (String tenants : tenantsList) {
     if (!tenants.equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
       tenantStub.addTenant(
           tenants,
           automationContext.getConfigurationValue(
               String.format(
                   AutomationXpathConstants.ADMIN_USER_PASSWORD,
                   AutomationXpathConstants.TENANTS,
                   tenants)),
           automationContext.getConfigurationValue(
               String.format(
                   AutomationXpathConstants.ADMIN_USER_USERNAME,
                   AutomationXpathConstants.TENANTS,
                   tenants)),
           FrameworkConstants.TENANT_USAGE_PLAN_DEMO);
     }
     log.info("Start populating users for " + tenants);
     String superTenantReplacement = AutomationXpathConstants.TENANTS;
     if (tenants.equals(FrameworkConstants.SUPER_TENANT_DOMAIN_NAME)) {
       superTenantReplacement = AutomationXpathConstants.SUPER_TENANT;
     }
     tenantAdminSession =
         login(
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.ADMIN_USER_USERNAME,
                     superTenantReplacement,
                     tenants)),
             tenants,
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.ADMIN_USER_PASSWORD,
                     superTenantReplacement,
                     tenants)),
             backendURL,
             UrlGenerationUtil.getManagerHost(automationContext.getInstance()));
     // here we populate the user list of the current tenant
     List<String> userList = getUserList(tenants);
     userManagementClient = new UserManagementClient(backendURL, tenantAdminSession);
     for (String tenantUsername : userList) {
       System.out.println(userManagementClient.getUserList().size());
       boolean isUserAddedAlready =
           userManagementClient
               .getUserList()
               .contains(
                   automationContext.getConfigurationValue(
                       String.format(
                           AutomationXpathConstants.TENANT_USER_USERNAME,
                           superTenantReplacement,
                           tenants,
                           tenantUsername)));
       if (!isUserAddedAlready) {
         userManagementClient.addUser(
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.TENANT_USER_USERNAME,
                     superTenantReplacement,
                     tenants,
                     tenantUsername)),
             automationContext.getConfigurationValue(
                 String.format(
                     AutomationXpathConstants.TENANT_USER_PASSWORD,
                     superTenantReplacement,
                     tenants,
                     tenantUsername)),
             new String[] {FrameworkConstants.ADMIN_ROLE},
             null);
         log.info("Populated " + tenantUsername);
       } else {
         if (!tenantUsername.equals(ExtensionCommonConstants.ADMIN_USER)) {
           log.info(tenantUsername + " is already in " + tenants);
         }
       }
     }
   }
 }