/** * Get value passing xpath * * @param xPath expression * @return value * @throws XPathExpressionException */ protected static String getPropertyValue(String xPath) throws XPathExpressionException { return context.getConfigurationValue(xPath); }
public static String getTrustStorePassword() throws XPathExpressionException { return instance.context.getConfigurationValue("//truststore/password/text()"); }
public static String getExecutionEnvironment() throws XPathExpressionException { return instance.context.getConfigurationValue("//executionEnvironment"); }
private String getTenantAdminUsername(String tenantType, String tenant) throws XPathExpressionException { return automationContext.getConfigurationValue( String.format(AutomationXpathConstants.ADMIN_USER_USERNAME, tenantType, tenant)); }
private String getTenantUserUsername(String tenantType, String tenant, String tenantUser) throws XPathExpressionException { return automationContext.getConfigurationValue( String.format(AutomationXpathConstants.TENANT_USER_USERNAME, tenantType, tenant, tenantUser)); }
private char[] getTenantUserPassword(String tenantType, String tenant, String tenantUser) throws XPathExpressionException { return automationContext.getConfigurationValue( String.format(AutomationXpathConstants.TENANT_USER_PASSWORD, tenantType, tenant, tenantUser)).toCharArray(); }
private char[] getTenantAdminPassword(String tenantType, String tenant) throws XPathExpressionException { return automationContext.getConfigurationValue( String.format(AutomationXpathConstants.ADMIN_USER_PASSWORD, tenantType, tenant)).toCharArray(); }
public static int getServiceDeploymentDelay() { try { return Integer.parseInt(instance.context.getConfigurationValue("//deploymentDelay")); } catch (XPathExpressionException e) { log.error("Error reading deploymentDelay from automation.xml", e); log.warn("Service deployment Delay configuration not found. Running with default value " + "30000" + " mils"); } //if there is an error, setting to default value 30000 milliseconds return 30000; }
/** * Get database connection. * @return database connection * @throws XPathExpressionException * @throws ClassNotFoundException * @throws SQLException */ public static Connection getConnection() throws XPathExpressionException, ClassNotFoundException, SQLException { AutomationContext automationContext = new AutomationContext("MB_Cluster", TestUserMode.SUPER_TENANT_ADMIN); String url = automationContext.getConfigurationValue("//datasources/datasource[@name=\'mbCluster\']/url"); String username = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/username"); String password = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/password"); String driverName = automationContext.getConfigurationValue ("//datasources/datasource[@name=\'mbCluster\']/driverClassName"); Class.forName(driverName); Connection conn = DriverManager.getConnection(url, username, password); return conn; } }
public static String getKeyStoreLocation() throws XPathExpressionException { return getResourceLocation() + File.separator + instance.context.getConfigurationValue("//keystore/fileName/text()"); }
public static String getKeyStoreType() throws XPathExpressionException { return getResourceLocation() + File.separator + instance.context.getConfigurationValue("//keystore/type/text()"); }
public static String getKeyStorePassword() throws XPathExpressionException { return getResourceLocation() + File.separator + instance.context.getConfigurationValue("//keystore/password/text()"); }
public static String getTrustStoreType() throws XPathExpressionException { return getResourceLocation() + File.separator + instance.context.getConfigurationValue("//truststore/type/text()"); }
public static String getTrustStoreLocation() throws XPathExpressionException { return getResourceLocation() + File.separator + instance.context.getConfigurationValue("//truststore/fileName/text()"); }
/** * Get the data source information from the automation configuration file * * @param dataSourceName - Data source name given in the configuration file * @return DataSourceInformation - Information about the data source. * @throws XPathExpressionException - Throws if an exception occurred when getting data for configuration file */ public static DataSourceBean getDataSourceInformation(String dataSourceName) throws XPathExpressionException { AutomationContext automationContext = new AutomationContext(CarbonIntegrationConstants.PRODUCT_GROUP, CarbonIntegrationConstants.INSTANCE, ContextXpathConstants.SUPER_TENANT, ContextXpathConstants.SUPER_ADMIN); String URL = automationContext.getConfigurationValue(String.format( CarbonIntegrationConstants.CONTEXT_XPATH_DATA_SOURCE + "/url", dataSourceName)); String userName = automationContext.getConfigurationValue(String.format( CarbonIntegrationConstants.CONTEXT_XPATH_DATA_SOURCE + "/username", dataSourceName)); char[] passWord = automationContext.getConfigurationValue(String.format( CarbonIntegrationConstants.CONTEXT_XPATH_DATA_SOURCE + "/password", dataSourceName)).toCharArray(); String driverClassName = automationContext.getConfigurationValue(String.format( CarbonIntegrationConstants.CONTEXT_XPATH_DATA_SOURCE + "/driverClassName", dataSourceName)); return new DataSourceBean(URL, userName, passWord, driverClassName); }
databasePassword = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD); jdbcUrl = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL); jdbcDriver = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DRIVER_CLASS_NAME); databaseUser = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
databasePassword = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD); jdbcUrl = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL); jdbcDriver = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DRIVER_CLASS_NAME); databaseUser = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
autoContext.getConfigurationValue("//keystore/fileName/text()"); String securityPolicyPath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "security" + File.separator
public void initiate() { try { if (getParameters().get(ExtensionCommonConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionCommonConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0"); } serverManager = new ESServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = getAutomationContext().getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { handleException("Error while initiating test environment", e); } }
public void sendRobust(String userName, String password, String endpointReference, String operation, OMElement payload, int securityScenarioNo) throws AxisFault, XPathExpressionException, FileNotFoundException, XMLStreamException { if (securityScenarioNo == 1) { Assert.assertTrue(endpointReference.startsWith("https:"), "Endpoint reference should be https"); } AutomationContext autoContext = new AutomationContext(); String keyPath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + autoContext.getConfigurationValue("//keystore/fileName/text()"); String securityPolicyPath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "security" + File.separator + "policies" + File.separator + "scenario" + securityScenarioNo + "-policy.xml"; ServiceClient sc = getServiceClient(userName, password, endpointReference, operation, securityPolicyPath, "wso2carbon", "wso2carbon", keyPath, "wso2carbon"); try { sc.sendRobust(payload); log.info("Request Sent"); } finally { sc.cleanupTransport(); } }