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"); } } } } }