org.wso2.carbon.automation.engine.context.AutomationContext Java Examples

The following examples show how to use org.wso2.carbon.automation.engine.context.AutomationContext. 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: StoreAndForwardWithEmptyMessageBodyTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void init() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    String dbPassword = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    String dbUser = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    String databaseName =
            System.getProperty("basedir") + File.separator + "target" + File.separator + "testdb_store"
                    + new Random().nextInt();
    JDBC_URL = JDBC_URL + databaseName + ";DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE";
    h2DatabaseManager = new H2DataBaseManager(JDBC_URL, dbUser, dbPassword);
    h2DatabaseManager.executeUpdate(
            "CREATE TABLE IF NOT EXISTS JDBC_MESSAGE_STORE(\n" + "indexId BIGINT(20) NOT NULL AUTO_INCREMENT,\n"
                    + "msg_id VARCHAR(200) NOT NULL ,\n" + "message BLOB NOT NULL,\n" + "PRIMARY KEY ( indexId )\n"
                    + ")");
    carbonLogReader = new CarbonLogReader();
}
 
Example #2
Source File: ESBJAVA4630RabbitMQMultipleListenerTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    configurationManagerAxis2 =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File customAxisConfigAxis2 = new File(getESBResourceLocation() + File.separator +
                                          "axis2config" + File.separator + "axis2.xml");
    configurationManagerAxis2.applyConfiguration(customAxisConfigAxis2);
    super.init();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();
    //This is to stop existing rabbitMQ server instances
    rabbitMQServer.stop();
    rabbitMQServer.start();
    Assert.assertTrue(rabbitMQServer.isRabbitMQStarted(90), "Failed to start rabbitMQ server properly within given timeout");
    initRabbitMQBroker();
    loadESBConfigurationFromClasspath("/artifacts/ESB/rabbitmq/multipleListner/RabbitMQMultipleListnerProxy.xml");
    proxyServiceAdminClient = new ProxyServiceAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
Example #3
Source File: InboundEPWithNonWorkerManager.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager =
            new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfigurationWithoutRestart(new File(FULL_RESOURCE_PATH + "axis2.xml"));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + HAWTBUF).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_BROKER).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + ACTIVEMQ_CLIENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_J2EE_MANAGEMENT).toURI()));
    serverConfigurationManager.copyToComponentLib
            (new File(getClass().getResource(JAR_LOCATION + File.separator + GERONIMO_JMS).toURI()));
    serverConfigurationManager.restartGracefully();
    super.init();
    addInboundEndpoint(esbUtils.loadResource(RELATIVE_RESOURCE_PATH + "JMSEndpoint.xml"));
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
Example #4
Source File: MBPlatformBaseTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Create automation context objects for every node in config
 *
 * @param userMode User mode for which the automation context should use
 * @throws XPathExpressionException
 */
protected void initCluster(TestUserMode userMode) throws XPathExpressionException {
    contextMap = new HashMap<String, AutomationContext>();
    AutomationContext automationContext = new AutomationContext("MB_Cluster", userMode);
    log.info("Cluster instance loading");
    Map<String, Instance> instanceMap = automationContext.getProductGroup().getInstanceMap();

    if (instanceMap != null && instanceMap.size() > 0) {
        for (Map.Entry<String, Instance> entry : instanceMap.entrySet()) {
            String instanceKey = entry.getKey();
            contextMap.put(instanceKey, new AutomationContext("MB_Cluster", instanceKey, userMode));
            log.info(instanceKey);
        }
    }

    stack = new Stack<String>();

}
 
Example #5
Source File: RDBMSConnectionManager.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: StormTestCase.java    From product-cep with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    automationContext = new AutomationContext("CEP", TestUserMode.SUPER_TENANT_ADMIN);
    instanceMap = automationContext.getProductGroup().getInstanceMap();
    contextMap = new HashMap<String, AutomationContext>();

    if (instanceMap != null && instanceMap.size() > 0) {
        for (Map.Entry<String, Instance> entry : instanceMap.entrySet()) {
            String instanceKey = entry.getKey();
            contextMap.put(instanceKey, new AutomationContext("CEP", instanceKey,
                                                              TestUserMode.SUPER_TENANT_ADMIN));
            log.info(instanceKey);
        }
    }
    log.info("Cluster instance loading");

}
 
Example #7
Source File: HumanTaskCreationTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {

    init();  //init master class
    bpelPackageManagementClient = new BpelPackageManagementClient(backEndUrl, sessionCookie);
    humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
    requestSender = new RequestSender();
    initialize();

    //initialize HT Client API for Clerk1 user
    AutomationContext clerk1AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
            FrameworkConstants.SUPER_TENANT_KEY, "clerk1");
    LoginLogoutClient clerk1LoginLogoutClient = new LoginLogoutClient(clerk1AutomationContext);
    String clerk1SessionCookie = clerk1LoginLogoutClient.login();

    clerk1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, clerk1SessionCookie);

    //initialize HT Client API for Manager1 user
    AutomationContext manager1AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
            FrameworkConstants.SUPER_TENANT_KEY, "manager1");
    LoginLogoutClient manager1LoginLogoutClient = new LoginLogoutClient(manager1AutomationContext);
    String manager1SessionCookie = manager1LoginLogoutClient.login();
    manager1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, manager1SessionCookie);
}
 
Example #8
Source File: Sample265TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    pathToVfsDir = getClass().getResource(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "synapseconfig"
                    + File.separator + "vfsTransport" + File.separator).getPath(); // change this to get samba path

    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    super.init();

    File outFolder = new File(pathToVfsDir + "test" + File.separator + "out" + File.separator);
    File inFolder = new File(pathToVfsDir + "test" + File.separator + "in" + File.separator);
    File originalFolder = new File(pathToVfsDir + "test" + File.separator + "original" + File.separator);
    File failureFolder = new File(pathToVfsDir + "test" + File.separator + "failure" + File.separator);
    assertTrue(outFolder.mkdirs(), "file folder not created");
    assertTrue(inFolder.mkdirs(), "file folder not created");
    assertTrue(originalFolder.mkdirs(), "file folder not created");
    assertTrue(failureFolder.mkdirs(), "file folder not created");
    assertTrue(outFolder.exists(), "File folder doesn't exists");
    assertTrue(inFolder.exists(), "File folder doesn't exists");
    assertTrue(originalFolder.exists(), "File folder doesn't exists");
    assertTrue(failureFolder.exists(), "File folder doesn't exists");
}
 
Example #9
Source File: StreamingXpathExceptionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File sourceFile = new File(
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "ESB" + File.separator
                    + "streamingxpath" + File.separator + "synapse.properties");
    serverManager.applyConfiguration(sourceFile);
    super.init();
    String relativePath = "artifacts" + File.separator + "ESB" + File.separator + "streamingxpath" + File.separator
            + "StreamingException.xml";
    ESBTestCaseUtils util = new ESBTestCaseUtils();
    OMElement proxyConfig = util.loadResource(relativePath);

    try {
        addProxyService(proxyConfig);
    } catch (Exception ignore) {
        exceptionCaught = true;
    }

}
 
Example #10
Source File: SequenceStatisticsTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
protected void initialize() throws Exception {
    //Starting the thrift port to listen to statistics events
    thriftServer = new ThriftServer("Wso2EventTestCase", 7612, true);
    thriftServer.start(7612);
    log.info("Thrift Server is Started on port 7612");

    //Changing synapse configuration to enable statistics and tracing
    ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "StatisticTestResources" + File.separator
                    + "deployment.toml"));
    super.init();
    thriftServer.waitToReceiveEvents(20000); //waiting for esb to send artifact config data to the thriftserver
}
 
Example #11
Source File: JMXSubscription.java    From product-es with Apache License 2.0 6 votes vote down vote up
/**
 * @param path      path of the collection or resource to be subscribed
 * @param eventType event to be subscribed
 * @return true if the required jmx notification is generated for
 *         subscription, false otherwise
 * @throws Exception
 */
public boolean init(String path, String eventType, AutomationContext autoContext)
        throws Exception {

    automationContext = autoContext;
    backEndUrl = automationContext.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    sessionCookie = loginLogoutClient.login();
    userName = automationContext.getContextTenant().getContextUser().getUserName();

    if (userName.contains("@")){
        userNameWithoutDomain = userName.substring(0, userName.indexOf('@'));
    }
    else {
        userNameWithoutDomain = userName;
    }

    boolean result = JMXSubscribe(path, eventType) && update(path) && getJMXNotification();
    clean(path);
    return result;
}
 
Example #12
Source File: ManagementConsoleSubscription.java    From product-es with Apache License 2.0 6 votes vote down vote up
/**
 * Subscribe for management console notifications and receive the
 * notification
 *
 * @param path      path of the resource or collection
 * @param eventType event type to be subscribed
 * @param env       ManageEnvironment
 * @param userInf   UserInfo
 * @return true if the subscription is succeeded and notification is
 *         received, false otherwise
 * @throws Exception
 */
public static boolean init(String path, String eventType, AutomationContext autoContext)
        throws Exception {

    automationContext = autoContext;
    backEndUrl = automationContext.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    sessionCookie = loginLogoutClient.login();
    userName = automationContext.getContextTenant().getContextUser().getUserName();

    if (userName.contains("@"))
        userNameWithoutDomain = userName.substring(0, userName.indexOf('@'));
    else
        userNameWithoutDomain = userName;

    boolean result = (addRole() && consoleSubscribe(path, eventType) && update(path) && getNotification(path));
    clean(path);
    return result;
}
 
Example #13
Source File: ESPublisherSubscriptionTestCase.java    From product-es with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true, enabled = true)
public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName().split("@")[0];
    currentUserPwd = userInfo.getPassword();
    baseUrl = getWebAppURL();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME,
            TestUserMode.SUPER_TENANT_ADMIN);
    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName().split("@")[0];
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName,
            adminUserPwd);
    resourcePath = GADGET_REGISTRY_BASE_PATH + currentUserName + "/" + assetName + "/" + ASSET_VERSION;

    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
}
 
Example #14
Source File: LogMediatorLevelsAndCategoryTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    serverConfigurationManager = new ServerConfigurationManager(context);
    serverConfigurationManager.applyMIConfiguration(new File(getESBResourceLocation() + "/other/" + "log4j2.properties"));
    serverConfigurationManager.restartMicroIntegrator();
    init();
    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    //allow time for log reader to start
    Thread.sleep(1000);

    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("LogMediatorLevelAndCategoryTestProxy"), null,
                    "WSO2");
    Assert.assertTrue(response.toString().contains("WSO2"), "Did not receive the expected response");
}
 
Example #15
Source File: Sample265TestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    pathToVfsDir = getClass().getResource(File.separator + "artifacts" + File.separator + "ESB" +
            File.separator + "synapseconfig" + File.separator +
            "vfsTransport" + File.separator).getPath(); // change this to get samba path

    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfiguration(new File(pathToVfsDir + File.separator + "axis2.xml"));
    super.init();

    File outFolder = new File(pathToVfsDir + "test" + File.separator + "out" + File.separator);
    File inFolder = new File(pathToVfsDir + "test" + File.separator + "in" + File.separator);
    File originalFolder = new File(pathToVfsDir + "test" + File.separator + "original" + File.separator);
    File failureFolder = new File(pathToVfsDir + "test" + File.separator + "failure" + File.separator);
    assertTrue(outFolder.mkdirs(), "file folder not created");
    assertTrue(inFolder.mkdirs(), "file folder not created");
    assertTrue(originalFolder.mkdirs(), "file folder not created");
    assertTrue(failureFolder.mkdirs(), "file folder not created");
    assertTrue(outFolder.exists(), "File folder doesn't exists");
    assertTrue(inFolder.exists(), "File folder doesn't exists");
    assertTrue(originalFolder.exists(), "File folder doesn't exists");
    assertTrue(failureFolder.exists(), "File folder doesn't exists");
}
 
Example #16
Source File: ESPublisherTenantNotificationTestCase.java    From product-es with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init(userMode);
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    baseUrl = getStorePublisherUrl();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.TENANT_ADMIN);
    adminUserName = automationContext.getContextTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getContextTenant().getTenantAdmin().getPassword();
    String resourceLocation = getResourceLocation();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    providerName = currentUserName.split("@")[0];
    resourcePath = GADGET_REGISTRY_BASE_PATH + providerName + "/" + assetName + "/" + VERSION;
    LCNotificationSubject += resourcePath;
    updateNotificationSubject += resourcePath;
    smtpPropertyLocation = resourceLocation + SMTP_PROPERTY_FILE;

    //Update user profiles through Admin console
    ESUtil.loginToAdminConsole(driver, baseUrl, adminUserName, adminUserPwd);
    ESUtil.setupUserProfile(driver, baseUrl, currentUserName, FIRST_NAME, LAST_NAME, EMAIL);
    //login to publisher & add a new gadget
    ESUtil.login(driver, baseUrl, PUBLISHER_APP, currentUserName, currentUserPwd);
    AssetUtil.addNewAsset(driver, baseUrl, ASSET_TYPE, assetName, VERSION, "", "", "");
}
 
Example #17
Source File: DBLookupMediatorTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    String DB_PASSWORD = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    String JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    String DB_USER = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    String databasePath = getDBPath("testdb_dblookup");
    JDBC_URL = JDBC_URL + databasePath + ";AUTO_SERVER=TRUE";
    h2DatabaseManager = new H2DataBaseManager(JDBC_URL, DB_USER, DB_PASSWORD);
    h2DatabaseManager.executeUpdate("CREATE TABLE IF NOT EXISTS company(price double, name varchar(20))");
    super.init();
}
 
Example #18
Source File: JMSInboundTransportTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
protected void init() throws Exception {
	super.init();
	serverConfigurationManager =
			new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
	OMElement synapse =
			esbUtils.loadResource("/artifacts/ESB/jms/inbound/transport/jms_transport_proxy_service.xml");
	updateESBConfiguration(JMSEndpointManager.setConfigurations(synapse));
	inboundAdminClient = new InboundAdminClient(context.getContextUrls().getBackEndUrl(),getSessionCookie());
}
 
Example #19
Source File: DBReportMediatorTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    AutomationContext automationContext = new AutomationContext();
    String DB_USER = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_USER_NAME);
    String DB_PASSWORD = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_DB_PASSWORD);
    String JDBC_URL = automationContext.getConfigurationValue(XPathConstants.DATA_SOURCE_URL);
    String databasePath = getDBPath("testdb_dbreport");

    JDBC_URL = JDBC_URL + databasePath + ";AUTO_SERVER=TRUE";
    h2DataBaseManager = new H2DataBaseManager(JDBC_URL, DB_USER, DB_PASSWORD);
    h2DataBaseManager.executeUpdate("CREATE TABLE company(price double, name varchar(20))");
    super.init();
}
 
Example #20
Source File: CCOMMONS8SetTenantDomainTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init() throws Exception {
    super.init();
    regTestContext = new AutomationContext("ESB", "esbsRegTest", TestUserMode.SUPER_TENANT_ADMIN);

    startupParameterMap = new HashMap<String, String>();
    startupParameterMap.put("-DportOffset", "230");

    String backEndRegUrl = "https://" + context.getInstance().getHosts().get("default") + ":" + context.getInstance().getPorts().get("https") + "/registry";

    changeRegistryFile(getClass().getResource(COMMON_FILE_LOCATION + "registry-template.xml").getPath(), backEndRegUrl);

    testServerManager = new TestServerManager(regTestContext, null, startupParameterMap) {

        public void configureServer() throws AutomationFrameworkException {

            try {
                File sourceFile = new File(getClass().getResource(COMMON_FILE_LOCATION + "registry.xml").getPath());

                //copying registry.xml file to conf folder
                FileManager.copyFile(sourceFile, this.getCarbonHome() + File.separator + "repository" + File.separator + "conf" + File.separator + "registry.xml");
            } catch (IOException e) {
                throw new AutomationFrameworkException(e.getMessage(), e);
            }
        }
    };

}
 
Example #21
Source File: DeactivatedCappMPBehaviourOnRestartTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    axis2Server = new SampleAxis2Server("test_axis2_server_9001.xml");
    axis2Server.deployService(SampleAxis2Server.SIMPLE_STOCK_QUOTE_SERVICE);
    axis2Server.start();
}
 
Example #22
Source File: BrokerServerExtension.java    From product-iots with Apache License 2.0 5 votes vote down vote up
@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 #23
Source File: TestUtils.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public static CarbonTestServerManager getNode(int offset, Map<String, String> additionalParams)
        throws XPathExpressionException {

    HashMap<String, String> startupParameters = new HashMap<>();
    startupParameters.put("-DportOffset", String.valueOf(offset));
    startupParameters.put("startupScript", "micro-integrator");
    additionalParams.forEach(startupParameters::put);
    return new CarbonTestServerManager(new AutomationContext(), System.getProperty("carbon.zip"),
                                       startupParameters);
}
 
Example #24
Source File: RegistryUserCreator.java    From product-es with Apache License 2.0 5 votes vote down vote up
public void setInfoRolesAndUsers(String  adminUserKey)
            throws LoginAuthenticationExceptionException, RemoteException,
                   XPathExpressionException {
        //todo -
//        FrameworkProperties isProperties = FrameworkFactory.getFrameworkProperties(ProductConstant.IS_SERVER_NAME);
        AutomationContext isContext = new AutomationContext("IS", "is", "carbon.supper", adminUserKey);
        Tenant userAdminDetails = isContext.getContextTenant();
        sessionCookie = login(userAdminDetails.getContextUser().getUserName(), userAdminDetails.getContextUser().getPassword(),
                              isContext.getContextUrls().getBackEndUrl());
        userAdminStub = new UserManagementClient(isContext.getContextUrls().getBackEndUrl(), sessionCookie);


    }
 
Example #25
Source File: ESBJAVA3770DropLargePayloadsPreventESBFromOOMTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "passthru" + File.separator + "transport" + File.separator
                    + "ESBJAVA3770" + File.separator + "deployment.toml"));
}
 
Example #26
Source File: ForceMessageValidationTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Add force.xml.message.validation and force.json.message.validation properties to passthru-http.properties, and
 * deploy synapse configurations.
 *
 * @throws Exception
 */
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));

    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation().replace("//", "/") + File.separator + "passthru" + File.separator + "transport"
                    + File.separator + "forceMessageValidation" + File.separator + "deployment.toml"));
    super.init();

    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
}
 
Example #27
Source File: ESRegisterUserTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
    super.init();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    userManagementClient = new UserManagementClient(backendURL, userInfo.getUserName(), userInfo.getPassword());

    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
}
 
Example #28
Source File: MBPlatformBaseTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Give a random AMQP broker URL.
 *
 * @return Broker URL in host:port format (E.g "127.0.0.1:5672")
 * @throws XPathExpressionException if an error occurs while retrieving values from the configuration
 */
protected InetSocketAddress getRandomAMQPBrokerAddress() throws XPathExpressionException {
    String randomInstanceKey = getRandomMBInstance();
    AutomationContext tempContext = getAutomationContextWithKey(randomInstanceKey);

    String host = tempContext.getInstance().getHosts().get("default");
    int port = Integer.parseInt(tempContext.getInstance().getPorts().get("amqp"));
    return new InetSocketAddress(host, port);
}
 
Example #29
Source File: Axis2ServerStartupTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeTest(alwaysRun = true)
public void deployServices() throws Exception {

    if (TestConfigurationProvider.isIntegration()) {
        axis2Server1 = new SampleAxis2Server("test_axis2_server_9009.xml");
        axis2Server1.start();
        axis2Server1.deployService(ESBTestConstant.STUDENT_REST_SERVICE);
        axis2Server1.deployService(ESBTestConstant.SIMPLE_AXIS2_SERVICE);
        axis2Server1.deployService(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE);

    } else {
        asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE;
        String serviceFilePath = TestConfigurationProvider.getResourceLocation("AXIS2")
                                 + File.separator + "aar" + File.separator + serviceName + ".aar";
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        String sessionCookie = new LoginLogoutClient(asContext).login();
        deployer.deployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                , serviceName, serviceFilePath, deploymentDelay);

        String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE;
        String studentServiceFilePath = TestConfigurationProvider.getResourceLocation("AXIS2")
                                        + File.separator + "aar" + File.separator + studentServiceName + ".aar";
        deployer.deployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                , studentServiceName, studentServiceFilePath, deploymentDelay);

    }
}
 
Example #30
Source File: TestConfigurationProvider.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private TestConfigurationProvider() {
    try {
        context = new AutomationContext();
    } catch (XPathExpressionException e) {
        log.error("Loading Automation Configuration failed", e);
    }
}