@DataProvider
 public Object[][] inValidUserModeDataProvider() throws Exception {
   User appPublisher = appMServer.getSuperTenant().getTenantUser("AppPublisher");
   return new Object[][] {
     new Object[] {appPublisher.getUserName(), appPublisher.getPassword(), app3Uuid}
   };
 }
 @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
     }
   };
 }
  @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);
  }
  @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");
  }
  @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}
    };
  }
  public String createWebApp(String appName) throws Exception {

    PolicyGroup defaultPolicyGroup = WebAppUtil.createDefaultPolicy();
    HttpResponse response = appmPublisherRestClient.addPolicyGroup(defaultPolicyGroup);
    String policyId = WebAppUtil.getPolicyId(response);
    List<WebAppResource> webAppResources = WebAppUtil.createDefaultResources(policyId);
    WebApp webApp =
        WebAppUtil.createBasicWebApp(
            appCreator.getUserName(),
            appName,
            contextPrefix + appName,
            appVersion,
            "http://wso2.com/",
            webAppResources);
    appmPublisherRestClient.createWebApp(webApp);
    return webApp.getAppId();
  }