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