org.wso2.carbon.automation.extensions.ExtensionConstants Java Examples
The following examples show how to use
org.wso2.carbon.automation.extensions.ExtensionConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 6 votes |
/** * This method is called for starting a Carbon server in preparation for execution of a * TestSuite * <p/> * Add the @BeforeSuite TestNG annotation in the method overriding this method * @param server : The server which needs to be start. * @return The CARBON_HOME * @throws java.io.IOException If an error occurs while copying the deployment artifacts into the * Carbon server */ public String startServer(String server) throws AutomationFrameworkException, IOException, XPathExpressionException { if(carbonHome == null) { if (carbonZip == null) { carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION); } if (carbonZip == null) { throw new IllegalArgumentException("carbon zip file cannot find in the given location"); } carbonHome = carbonServer.setUpCarbonHome(carbonZip) + "/" + server; configureServer(); } log.info("Carbon Home - " + carbonHome ); if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { this.portOffset = 0; } carbonServer.startServerUsingCarbonHome(carbonHome, commandMap); return carbonHome; }
Example #2
Source File: TestServerManager.java From product-ei with Apache License 2.0 | 6 votes |
/** * This method is called for starting a Carbon server in preparation for execution of a * TestSuite * <p/> * Add the @BeforeSuite TestNG annotation in the method overriding this method * * @return The CARBON_HOME * @throws IOException If an error occurs while copying the deployment artifacts into the * Carbon server */ public String startServer() throws AutomationFrameworkException, IOException, XPathExpressionException { if (carbonHome == null) { if (carbonZip == null) { carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION); } if (carbonZip == null) { throw new IllegalArgumentException("carbon zip file cannot find in the given location"); } carbonHome = carbonServer.setUpCarbonHome(carbonZip); configureServer(); } log.info("Carbon Home - " + carbonHome); if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { this.portOffset = 0; } if (commandMap.get("runtimePath") != null) { this.runtimePath = commandMap.get("runtimePath"); } carbonServer.startServerUsingCarbonHome(carbonHome, commandMap); return carbonHome; }
Example #3
Source File: CarbonServerExtension.java From micro-integrator with Apache License 2.0 | 5 votes |
public void initiate() { try { getParameters().putIfAbsent(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0"); serverManager = new TestServerManager(getAutomationContext(), null, getParameters()) { }; executionEnvironment = getAutomationContext().getConfigurationValue( ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { handleException("Error while initiating test environment", e); } }
Example #4
Source File: IOTServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void onExecutionStart() throws AutomationFrameworkException { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer("core"); log.info(carbonHome); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { handleException("Fail to start carbon server ", e); } }
Example #5
Source File: IOTServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() throws AutomationFrameworkException { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if(getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "0"); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { handleException("Error while initiating test environment", e); } }
Example #6
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 5 votes |
public CustomTestServerManager(AutomationContext context, String carbonZip, Map<String, String> commandMap) { carbonServer = new CarbonServerManagerExtension(context); this.carbonZip = carbonZip; if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { throw new IllegalArgumentException("portOffset value must be set in command list"); } this.commandMap = commandMap; }
Example #7
Source File: AnalyticsServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void onExecutionStart() throws AutomationFrameworkException { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer("analytics"); log.info(carbonHome); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { handleException("Fail to start carbon server ", e); } }
Example #8
Source File: AnalyticsServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() throws AutomationFrameworkException { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if(getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "2"); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { handleException("Error while initiating test environment", e); } }
Example #9
Source File: BrokerServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void onExecutionStart() throws AutomationFrameworkException { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer("broker"); log.info(carbonHome); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { handleException("Fail to start carbon server ", e); } }
Example #10
Source File: BrokerServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() throws AutomationFrameworkException { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if(getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "3"); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { handleException("Error while initiating test environment", e); } }
Example #11
Source File: IOTServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void onExecutionStart() { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer("core"); log.info(carbonHome); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); // Need to give time for the apis to be added to the synapse configurations. Thread.sleep(30000); } } catch (Exception e) { throw new RuntimeException("Fail to start carbon server ", e); } }
Example #12
Source File: IOTServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, IOT_CORE_PORT_OFFSET); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { throw new RuntimeException("Error while initiating test environment", e); } }
Example #13
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 5 votes |
public CustomTestServerManager(AutomationContext context, String carbonZip, Map<String, String> commandMap) { carbonServer = new CarbonServerManagerExtension(context); this.carbonZip = carbonZip; if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { throw new IllegalArgumentException("portOffset value must be set in command list"); } this.commandMap = commandMap; }
Example #14
Source File: AnalyticsServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, ANALYTICS_PORT_OFFSET); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { throw new RuntimeException("Error while initiating test environment", e); } }
Example #15
Source File: BrokerServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void onExecutionStart() { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer("broker"); log.info(carbonHome); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { throw new RuntimeException("Fail to start carbon server ", e); } }
Example #16
Source File: BrokerServerExtension.java From product-iots with Apache License 2.0 | 5 votes |
@Override public void initiate() { try { automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER); if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) { getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, BROKER_PORT_OFFSET); } serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters()); executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT); } catch (XPathExpressionException e) { throw new RuntimeException("Error while initiating test environment", e); } }
Example #17
Source File: TestServerManager.java From product-ei with Apache License 2.0 | 5 votes |
public TestServerManager(AutomationContext context, String carbonZip, Map<String, String> commandMap) { carbonServer = new CarbonServerManager(context); this.carbonZip = carbonZip; if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { throw new IllegalArgumentException("portOffset value must be set in command list"); } this.commandMap = commandMap; }
Example #18
Source File: CarbonServerExtension.java From product-ei with Apache License 2.0 | 5 votes |
public void onExecutionStart() { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer(); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { handleException("Fail to start carbon server ", e); } }
Example #19
Source File: CarbonServerManager.java From product-ei with Apache License 2.0 | 5 votes |
private int getPortOffsetFromCommandMap(Map<String, String> commandMap) { if (commandMap.containsKey(ExtensionConstants.PORT_OFFSET_COMMAND)) { return Integer.parseInt(commandMap.get( ExtensionConstants.PORT_OFFSET_COMMAND)); } else { return 0; } }
Example #20
Source File: TestServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * This method is called for starting a Carbon server in preparation for execution of a * TestSuite * <p/> * Add the @BeforeSuite TestNG annotation in the method overriding this method * * @return The CARBON_HOME * @throws IOException If an error occurs while copying the deployment artifacts into the * Carbon server */ public String startServer(String deploymentDirectory, String registryDir) throws AutomationFrameworkException, IOException { if (carbonHome == null) { setUpCarbonHome(deploymentDirectory, registryDir); } log.info("Carbon Home - " + carbonHome); if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { this.portOffset = 0; } carbonServer.startServerUsingCarbonHome(carbonHome, commandMap); return carbonHome; }
Example #21
Source File: TestServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
TestServerManager(AutomationContext context, String carbonZip, Map<String, String> commandMap) { carbonServer = new CarbonServerManager(context); this.carbonZip = carbonZip; if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { throw new IllegalArgumentException("portOffset value must be set in command list"); } this.commandMap = commandMap; }
Example #22
Source File: CarbonServerExtension.java From micro-integrator with Apache License 2.0 | 5 votes |
public void onExecutionStart() { try { if (executionEnvironment.equalsIgnoreCase(ExecutionEnvironment.STANDALONE.name())) { String carbonHome = serverManager.startServer(); System.setProperty(ExtensionConstants.CARBON_HOME, carbonHome); } } catch (Exception e) { handleException("Fail to start carbon server ", e); } }
Example #23
Source File: CarbonServerManager.java From micro-integrator with Apache License 2.0 | 5 votes |
private int getPortOffsetFromCommandMap(Map<String, String> commandMap) { int portOffset = 0; if (commandMap.containsKey(ExtensionConstants.PORT_OFFSET_COMMAND)) { portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.PORT_OFFSET_COMMAND)); } System.setProperty("port.offset", Integer.toString(portOffset)); return portOffset; }
Example #24
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 4 votes |
public CustomTestServerManager(AutomationContext context, int portOffset) { carbonServer = new CarbonServerManagerExtension(context); this.portOffset = portOffset; commandMap.put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, String.valueOf(portOffset)); }
Example #25
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 4 votes |
/** * This method is called for starting a Carbon server in preparation for execution of a * TestSuite * <p/> * Add the @BeforeSuite TestNG annotation in the method overriding this method * * @param server : The server which needs to be start. * @return The CARBON_HOME * @throws IOException If an error occurs while copying the deployment artifacts into the * Carbon server */ public synchronized String startServer(String server) throws AutomationFrameworkException, IOException, XPathExpressionException, InterruptedException { if (carbonHome == null) { if (carbonZip == null) { carbonZip = System.getProperty(FrameworkConstants.SYSTEM_PROPERTY_CARBON_ZIP_LOCATION); } if (carbonZip == null) { throw new IllegalArgumentException("carbon zip file cannot find in the given location"); } String extractedDir = getExistingExtractedDir(); if (server.equalsIgnoreCase("core")) { if (extractedDir == null) { carbonHome = carbonServer.setUpCarbonHome(carbonZip); } else { carbonHome = extractedDir; } // Deploy the plugins. String[] cmdArray = new String[] { "mvn", "clean", "install", "-f", "device-plugins-deployer.xml"}; Runtime.getRuntime().exec(cmdArray, null, new File(carbonHome + File.separator + "samples")); Thread.sleep(15000); } else if (server.equalsIgnoreCase("analytics") || server.equalsIgnoreCase("broker")) { if (extractedDir == null) { carbonHome = carbonServer.setUpCarbonHome(carbonZip) + File.separator + "wso2" + File.separator + server; } else { carbonHome = extractedDir + File.separator + "wso2" + File.separator + server; } } else { throw new IllegalArgumentException("Unsupported server type provided - " + server); } configureServer(); } log.info("Carbon Home - " + carbonHome); if (commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) != null) { this.portOffset = Integer.parseInt(commandMap.get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND)); } else { this.portOffset = 0; } carbonServer.startServerUsingCarbonHome(carbonHome, commandMap); return carbonHome; }
Example #26
Source File: TestServerManager.java From product-ei with Apache License 2.0 | 4 votes |
public TestServerManager(AutomationContext context, int portOffset) { carbonServer = new CarbonServerManager(context); this.portOffset = portOffset; commandMap.put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, String.valueOf(portOffset)); }
Example #27
Source File: CustomTestServerManager.java From product-iots with Apache License 2.0 | 4 votes |
public CustomTestServerManager(AutomationContext context, int portOffset) { carbonServer = new CarbonServerManagerExtension(context); this.portOffset = portOffset; commandMap.put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, String.valueOf(portOffset)); }
Example #28
Source File: StratosServerExtension.java From attic-stratos with Apache License 2.0 | 4 votes |
private void startStratosServer(int activeMQDynamicPort) throws AutomationFrameworkException { try { log.info("Setting up Stratos server..."); AutomationContext stratosAutomationCtx = new AutomationContext("STRATOS", "stratos-001", TestUserMode.SUPER_TENANT_ADMIN); String stratosInitPortOffsetStr = getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND); if (stratosInitPortOffsetStr == null) { throw new AutomationFrameworkException("Port offset not found in automation.xml"); } int stratosInitPortOffset = Integer.parseInt(stratosInitPortOffsetStr); int stratosInitSecurePort = Util.STRATOS_DEFAULT_SECURE_PORT + stratosInitPortOffset; int stratosInitPort = Util.STRATOS_DEFAULT_PORT + stratosInitPortOffset; int thriftInitPort = Util.THRIFT_DEFAULT_PORT + stratosInitPortOffset; int thriftInitSecurePort = Util.THRIFT_DEFAULT_SECURE_PORT + stratosInitPortOffset; int rmiRegistryPort = Util.STRATOS_DEFAULT_RMI_REGISTRY_PORT + stratosInitPortOffset; int rmiServerPort = Util.STRATOS_DEFAULT_RMI_SERVER_PORT + stratosInitPortOffset; while (!Util.isPortAvailable(stratosInitPort) || !Util.isPortAvailable(stratosInitSecurePort) || !Util.isPortAvailable(thriftInitPort) || !Util.isPortAvailable(thriftInitSecurePort) || !Util.isPortAvailable(rmiRegistryPort) || !Util.isPortAvailable(rmiServerPort)) { stratosInitPortOffset++; stratosInitSecurePort++; stratosInitPort++; thriftInitPort++; thriftInitSecurePort++; rmiRegistryPort++; rmiServerPort++; } getParameters() .put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, String.valueOf(stratosInitPortOffset)); stratosTestServerManager = new StratosTestServerManager(stratosAutomationCtx, System.getProperty(Util.CARBON_ZIP_KEY), getParameters()); stratosTestServerManager.setStratosDynamicPort(stratosInitPort); stratosTestServerManager.setStratosSecureDynamicPort(stratosInitSecurePort); stratosTestServerManager.setThriftDynamicPort(thriftInitPort); stratosTestServerManager.setThriftSecureDynamicPort(thriftInitSecurePort); stratosTestServerManager.setActiveMQDynamicPort(activeMQDynamicPort); stratosTestServerManager.setWebAppURL("http://localhost:" + stratosInitPort); stratosTestServerManager.setWebAppURLHttps("https://localhost:" + stratosInitSecurePort); log.info("Stratos server dynamic port offset: " + stratosTestServerManager.getPortOffset()); log.info("Stratos dynamic backend URL: " + stratosTestServerManager.getWebAppURL()); log.info("Stratos secure dynamic backend URL: " + stratosTestServerManager.getWebAppURLHttps()); long time3 = System.currentTimeMillis(); String carbonHome = stratosTestServerManager.startServer(); assertNotNull(carbonHome, "CARBON_HOME is null"); // checking whether mock iaas component is ready. If it is ready, all the components are activated. mockIaasApiClient = new MockIaasApiClient(stratosTestServerManager.getWebAppURL() + MOCK_IAAS_API_EP); while (!StratosServerExtension.mockIaasApiClient.isMockIaaSReady()) { log.info("Waiting for mock service to be initialized..."); Thread.sleep(1000); } long time4 = System.currentTimeMillis(); log.info(String.format("Stratos server started in %d sec", (time4 - time3) / 1000)); } catch (Exception e) { throw new AutomationFrameworkException("Could not start Stratos server", e); } }