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

The following examples show how to use org.wso2.carbon.automation.engine.context.TestUserMode. 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: ESBJAVA4631PreserveHTTPHeadersTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public void init() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    /*
     * If test run in external distributed deployment you need to copy
     * following configFiles/preserveContentType/passthru-http.properties resource
     */

    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "passthru" + File.separator + "transport" + File.separator
                    + "preserveheaders" + File.separator + "passthru-http.properties"));
    super.init();
    wireServer = new WireMonitorServer(8992);
}
 
Example #2
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 #3
Source File: POXOverServletTransportTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "synapseconfig"
                    + File.separator + "servletTransport" + File.separator + "soap_2_pox.xml");
    httpServer = new SimpleHttpServer(8098, new Properties());
    httpServer.start();
    Thread.sleep(5000);

    interceptor = new TestRequestInterceptor();
    httpServer.getRequestHandler().setInterceptor(interceptor);

}
 
Example #4
Source File: EventingSampleTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true, enabled = false)
public void initialize() throws Exception {
    super.init();
    String resourceFileLocation;
    feedURL = "https://mail.google.com/mail/feed/atom";
    mailCountBeforeTestStart = getMailCount(feedURL);
    modifiedTime = getModifiedTime(feedURL);
    eventingSampleStub = new EventingSampleStub(serverEpr);
    serverEpr = getServiceUrlHttp(serviceName);

    //        productCode = "code" + System.currentTimeMillis();
    productCode = "999";

    updateAxis2_ClientXML();
    new ServerConfigurationManager("DSS", TestUserMode.SUPER_TENANT_ADMIN).restartGracefully();

    super.init();
    resourceFileLocation = getResourceLocation();
    deployService(serviceName, new DataHandler(
            new URL("file:///" + resourceFileLocation + File.separator + "samples" + File.separator + "dbs"
                    + File.separator + "rdbms" + File.separator + "EventingSample.dbs")));
    log.info(serviceName + " uploaded");
}
 
Example #5
Source File: RabbitMQSenderConnectionRecoveryTestCase.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();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();

    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();

    loadESBConfigurationFromClasspath("/artifacts/ESB/rabbitmq/transport/rabbitmq_endpoint_proxy.xml");

}
 
Example #6
Source File: CarbonMetricsTestCase.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(TestUserMode.SUPER_TENANT_ADMIN);
    serverManager = new ServerConfigurationManager(cepServer);
    serverManager.applyConfiguration(
            new File(getTestArtifactLocation() + CEPIntegrationTestConstants.RELATIVE_PATH_TO_TEST_ARTIFACTS +
                    ARTIFACTS_FOLDER + File.separator + "carbon.xml"),
            new File(ServerConfigurationManager.getCarbonHome() + File.separator + "repository" + File.separator +
                    "conf" + File.separator + "carbon.xml"),
            true,
            true);

    sessionCookie = getSessionCookie();
    eventSimulatorAdminServiceClient = configurationUtil
            .getEventSimulatorAdminServiceClient(backendURL, sessionCookie);
    eventStreamManagerAdminServiceClient = configurationUtil
            .getEventStreamManagerAdminServiceClient(backendURL, sessionCookie);
    eventPublisherAdminServiceClient = configurationUtil
            .getEventPublisherAdminServiceClient(backendURL, sessionCookie);
    eventReceiverAdminServiceClient = configurationUtil
            .getEventReceiverAdminServiceClient(backendURL, sessionCookie);
    eventProcessorAdminServiceClient = configurationUtil
            .getEventProcessorAdminServiceClient(backendURL, sessionCookie);
}
 
Example #7
Source File: StratosIntegrationTest.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
public StratosIntegrationTest() {
    try {
        stratosAutomationCtx = new AutomationContext("STRATOS", "stratos-001", TestUserMode.SUPER_TENANT_ADMIN);
        adminUsername = stratosAutomationCtx
                .getConfigurationValue("/automation/userManagement/superTenant/tenant/admin/user/userName");
        adminPassword = stratosAutomationCtx
                .getConfigurationValue("/automation/userManagement/superTenant/tenant/admin/user/password");

        // Do not rely on automation context for context URLs since ports are dynamically picked
        stratosBackendURL = StratosServerExtension.getStratosTestServerManager().getWebAppURL();
        stratosSecuredBackendURL = StratosServerExtension.getStratosTestServerManager().getWebAppURLHttps();
        restClient = new RestClient(stratosBackendURL, stratosSecuredBackendURL, adminUsername, adminPassword);
        mockIaasApiClient = new MockIaasApiClient(stratosBackendURL + "/mock-iaas/api");
        // initialize topology handler before running the tests
        TopologyHandler.getInstance();
    } catch (Exception e) {
        throw new RuntimeException("Could not initialize StratosIntegrationTest", e);
    }
}
 
Example #8
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 #9
Source File: ESSelfSignUpTestCase.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(TestUserMode.SUPER_TENANT_ADMIN);
    currentUserName = userInfo.getUserName();
    currentUserPwd = userInfo.getPassword();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    wait = new WebDriverWait(driver, MAX_WAIT_TIME);
    driver.get(baseUrl + MANAGEMENT_CONSOLE_URL);
    driver.findElement(By.id("txtUserName")).clear();
    driver.findElement(By.id("txtUserName")).sendKeys(currentUserName);
    driver.findElement(By.id("txtPassword")).clear();
    driver.findElement(By.id("txtPassword")).sendKeys(currentUserPwd);
    driver.findElement(By.xpath("//input[@value='Sign-in']")).click();

}
 
Example #10
Source File: TopicClusterTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Prepare environment for tests.
 *
 * @throws XPathExpressionException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws IOException
 */
@BeforeClass(alwaysRun = true)
public void init()
        throws XPathExpressionException, URISyntaxException, SAXException, XMLStreamException,
        LoginAuthenticationExceptionException, IOException, AutomationUtilException {

    super.initCluster(TestUserMode.SUPER_TENANT_ADMIN);

    automationContextForMB2 = getAutomationContextWithKey("mb002");
    automationContextForMB3 = getAutomationContextWithKey("mb003");

    topicAdminClientForMB2 = new TopicAdminClient(automationContextForMB2.getContextUrls().getBackEndUrl(),
      super.login(automationContextForMB2));

    topicAdminClientForMB3 = new TopicAdminClient(automationContextForMB3.getContextUrls().getBackEndUrl(),
      super.login(automationContextForMB3));
}
 
Example #11
Source File: ESStoreSearchGadgetListTestCase.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();
    driver = new ESWebDriver(BrowserManager.getWebDriver());
    baseUrl = getWebAppURL();
    adminUserName = userInfo.getUserName();
    adminUserPwd = userInfo.getPassword();
    acceptNextAlert = true;
    wait = new WebDriverWait(driver, MAX_DRIVER_WAIT_TIME_SEC);
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME,
            TestUserMode.SUPER_TENANT_ADMIN);
    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
    backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName,
            adminUserPwd);
    driver.get(baseUrl + "/" + STORE_APP);
}
 
Example #12
Source File: RabbitMQReceiverConnectionRecoveryTestCase.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();

    rabbitMQServer = RabbitMQTestUtils.getRabbitMQServerInstance();
    sender = new RabbitMQProducerClient("localhost", 5672, "guest", "guest");
    consumer = new RabbitMQConsumerClient("localhost");

    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();

    logViewer = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

    loadESBConfigurationFromClasspath("/artifacts/ESB/rabbitmq/transport/rabbitmq_consumer_proxy.xml");
}
 
Example #13
Source File: EagerLoadingTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
protected void startServerWithEagerLoading() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_USER);
    serverManager = new ServerConfigurationManager(context);
    AutomationContext autoContext = new AutomationContext();
    // upload a faulty sequence which refer registry resource doesn't exists
    FileUtils.copyFileToDirectory(new File(FrameworkPathUtil.getSystemResourceLocation() +
                                           "/artifacts/ESB/eager/loading/ESBJAVA3602-FaultySeq.xml"),
                                  getSynapseDeploymentDir());

    File carbonXml = new File(FrameworkPathUtil.getSystemResourceLocation() +
                              "/artifacts/ESB/eager/loading/ESBJAVA3602Carbon.xml");
    serverManager.applyConfiguration(carbonXml, getCarbonXmlFile());
    super.init(TestUserMode.TENANT_ADMIN);
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());

}
 
Example #14
Source File: DurableTopicSubscriptionTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Prepare environment for tests.
 *
 * @throws XPathExpressionException
 * @throws LoginAuthenticationExceptionException
 * @throws IOException
 * @throws XMLStreamException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws AutomationUtilException
 */
@BeforeClass(alwaysRun = true)
public void init() throws XPathExpressionException, LoginAuthenticationExceptionException, IOException,
        XMLStreamException, URISyntaxException, SAXException, AutomationUtilException {
    super.initCluster(TestUserMode.SUPER_TENANT_ADMIN);

    AutomationContext automationContext1 = getAutomationContextWithKey("mb002");
    AutomationContext automationContext2 = getAutomationContextWithKey("mb003");
    hostNode1 = automationContext1.getInstance().getHosts().get("default");
    hostNode2 = automationContext2.getInstance().getHosts().get("default");
    portInNode1 = Integer.parseInt(automationContext1.getInstance().getPorts().get("amqp"));
    portInNode2 = Integer.parseInt(automationContext2.getInstance().getPorts().get("amqp"));
    topicAdminClient = new TopicAdminClient(automationContext1.getContextUrls().getBackEndUrl(),
            super.login(automationContext1));

    super.initAndesAdminClients();
}
 
Example #15
Source File: CustomMappingTestCase.java    From product-cep with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    String loggedInSessionCookie = getSessionCookie();

    eventSimulatorAdminServiceClient = configurationUtil.getEventSimulatorAdminServiceClient(
            backendURL, loggedInSessionCookie);
    eventStreamManagerAdminServiceClient = configurationUtil.getEventStreamManagerAdminServiceClient(
            backendURL, loggedInSessionCookie);
    eventPublisherAdminServiceClient = configurationUtil.getEventPublisherAdminServiceClient(
            backendURL, loggedInSessionCookie);
    logViewerClient = new LogViewerClient(backendURL, loggedInSessionCookie);
    eventProcessorAdminServiceClient = configurationUtil.getEventProcessorAdminServiceClient(
            backendURL, loggedInSessionCookie);
    resourceServiceClient = configurationUtil.getResourceServiceClient(
            backendURL, loggedInSessionCookie);

    //Add StreamDefinition
    String inputStreamDefinitionAsString = getJSONArtifactConfiguration(samplePath,
            "org.wso2.event.sensor.stream_1.0.0.json");
    String outputStreamDefinitionAsString = getJSONArtifactConfiguration(samplePath,
            "org.wso2.event.statistics.stream_1.0.0.json");
    eventStreamManagerAdminServiceClient.addEventStreamAsString(inputStreamDefinitionAsString);
    eventStreamManagerAdminServiceClient.addEventStreamAsString(outputStreamDefinitionAsString);

    // Add execution plan
    String executionPlan = getExecutionPlanFromFile(samplePath, "ArbitraryMapExecutionPlan.siddhiql");
    eventProcessorAdminServiceClient.addExecutionPlan(executionPlan);
}
 
Example #16
Source File: RedeliveryDelayTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Initializing test case.
 *
 * @throws XPathExpressionException
 */
@BeforeClass(alwaysRun = true)
public void init() throws XPathExpressionException, IOException, AutomationUtilException, ConfigurationException {
    super.init(TestUserMode.SUPER_TENANT_USER);

    // Updating the redelivery attempts to 1 to speed up the test case.
    super.serverManager = new ServerConfigurationManager(automationContext);
    String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" +
                                        File.separator + "broker" + File.separator + "conf" + File.separator +
                                        "broker.xml";
    ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath);

    // Changing "maximumRedeliveryAttempts" value to "1" in broker.xml
    configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1");
    // Restarting server
    configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager);

    // Get current "AndesAckWaitTimeOut" system property.
    defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);

    // Setting system property "AndesAckWaitTimeOut" for andes
    System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "0");

    // Get current "AndesRedeliveryDelay" system property.
    defaultAndesRedeliveryDelay = System.getProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY);

    System.setProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY, "10000");
}
 
Example #17
Source File: PublisherLoginTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@DataProvider
    private static TestUserMode[][] userModeProvider() {
        return new TestUserMode[][]{
                new TestUserMode[]{TestUserMode.SUPER_TENANT_ADMIN}
//                new TestUserMode[]{TestUserMode.TENANT_USER},
        };
    }
 
Example #18
Source File: ESBJAVA4883SynapseHandlerBlockingCallTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyConfiguration(new File(getESBResourceLocation() + File.separator + "passthru" +
            File.separator + "transport" + File.separator + "ESBJAVA4883" + File.separator + "synapse-handlers.xml"));
    super.init();
    verifyProxyServiceExistence("SynapseHandlerTestProxy");
    logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie());
    logViewerClient.clearLogs();
}
 
Example #19
Source File: ESBPOXSecurityGetMethodTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@Test(groups = {"wso2.esb"}, description = "test pox security with user credentials",
      dependsOnMethods = "testGetQuote")
public void testGetQuoteByUser() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_USER);
    applySecurity("1", SERVICE_NAME, getUserRole()[0]);
    String securedRestURL = getProxyServiceURLHttps(SERVICE_NAME) + "/getSimpleQuote";
    HttpsResponse response = HttpsURLConnectionClient.getWithBasicAuth(securedRestURL, "symbol=IBM",
                                                                       userInfo.getUserName(), userInfo.getPassword());
    assertTrue(response.getData().contains(":name>IBM Company</"),
               "getQuote doesn't return expected values");
    assertTrue(response.getData().contains(":symbol>IBM</"),
               "getQuote doesn't return expected values");
}
 
Example #20
Source File: RegistryConfiguratorTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
public void serverRestart() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    sessionCookie = new LoginLogoutClient(automationContext).login();
    resourceAdminServiceClient =
            new ResourceAdminServiceClient(backendURL, sessionCookie);

}
 
Example #21
Source File: NonAdminUserCreationTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeTest(alwaysRun = true)
public void addNonAdminUser() throws Exception {
    AutomationContext esbContext = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    String sessionCookie = new LoginLogoutClient(esbContext).login();
    ResourceAdminServiceClient resourceAdmin = new ResourceAdminServiceClient(
            esbContext.getContextUrls().getBackEndUrl(), sessionCookie);
    UserManagementClient userManagementClient = new UserManagementClient(
            esbContext.getContextUrls().getBackEndUrl(), sessionCookie);

    //done this change due to a bug in UM - please refer to carbon dev mail
    // "G-Reg integration test failures due to user mgt issue."
    String[] permissions = { "/permission/admin/configure/", "/permission/admin/login", "/permission/admin/manage/",
            "/permission/admin/monitor", "/permission/protected" };

    if (!userManagementClient.roleNameExists(ROLE_NAME)) {
        userManagementClient.addRole(ROLE_NAME, null, permissions);
        resourceAdmin.addResourcePermission("/", ROLE_NAME, "3", "1");
        resourceAdmin.addResourcePermission("/", ROLE_NAME, "2", "1");
        resourceAdmin.addResourcePermission("/", ROLE_NAME, "4", "1");
        resourceAdmin.addResourcePermission("/", ROLE_NAME, "5", "1");
    }

    userManagementClient.addUser("nonadminuser", "password", new String[] { ROLE_NAME }, null);
    //check user creation
    nonAdminUser = new User();
    nonAdminUser.setUserName("nonadminuser");
    nonAdminUser.setPassword("password");

}
 
Example #22
Source File: RestResourceStoreSearchTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@DataProvider
    private static TestUserMode[][] userModeProvider() {
        return new TestUserMode[][]{
                new TestUserMode[]{TestUserMode.SUPER_TENANT_ADMIN}
//                new TestUserMode[]{TestUserMode.TENANT_USER},
        };
    }
 
Example #23
Source File: ESStoreAnonCategorySortingTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
    AutomationContext automationContext = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    adminUserName = automationContext.getSuperTenant().getTenantAdmin().getUserName();
    adminUserPwd = automationContext.getSuperTenant().getTenantAdmin().getPassword();
    String backendURL = automationContext.getContextUrls().getBackEndUrl();
    resourceAdminServiceClient = new ResourceAdminServiceClient(backendURL, adminUserName, adminUserPwd);
    resourceAdminServiceClient.deleteResource(resourcePath);
    driver.quit();
}
 
Example #24
Source File: ResponseAfterNttpEnabledTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    super.init();
    toUrl = getBackEndServiceUrl(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE);
    serverConfigurationManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
 URL url = getClass().getResource(separator + "artifacts" + separator + "ESB" + separator
                                  + "synapseconfig" + separator + "nhttp_transport" + separator
                                  + "nhttp.properties");
 File srcFile = new File(url.getPath());
 serverConfigurationManager.applyConfiguration(srcFile);
 super.init();
    loadESBConfigurationFromClasspath(separator + "artifacts" + separator + "ESB" + separator + "synapseconfig" +
                                      separator + "nhttp_transport" + separator + "response_nhttp_synapse.xml");
}
 
Example #25
Source File: PPaaSIntegrationTest.java    From product-private-paas with Apache License 2.0 5 votes vote down vote up
public PPaaSIntegrationTest() throws Exception {
    ppaasAutomationCtx = new AutomationContext("PPAAS", "ppaas-001", TestUserMode.SUPER_TENANT_ADMIN);
    adminUsername = ppaasAutomationCtx
            .getConfigurationValue("/automation/userManagement/superTenant/tenant/admin/user/userName");
    adminPassword = ppaasAutomationCtx
            .getConfigurationValue("/automation/userManagement/superTenant/tenant/admin/user/password");
    restClient = new RestClient(ppaasAutomationCtx.getContextUrls().getWebAppURL(),
            ppaasAutomationCtx.getContextUrls().getWebAppURLHttps(), adminUsername, adminPassword);
    String mockIaaSEndpoint = ppaasAutomationCtx.getContextUrls().getWebAppURL() + "/mock-iaas/api";
    mockIaasApiClient = new IntegrationMockClient(mockIaaSEndpoint);
    log.info("Mock IaaS endpoint URL: " + mockIaaSEndpoint);
}
 
Example #26
Source File: AuthenticationServiceTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@Test(groups = "wso2.es")
public void loginTest() throws Exception{
 System.out.println("Call Login test");
    esContext = new AutomationContext(
      ESIntegrationTestConstants.ES_PRODUCT_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(esContext);
    sessionCookie = loginLogoutClient.login();
    Assert.assertTrue(sessionCookie.contains("JSESSIONID="), "JSESSIONID= not found");
}
 
Example #27
Source File: BPSMasterTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
protected void init(TestUserMode testUserMode) throws Exception {
    bpsServer = new AutomationContext("BPS", testUserMode);
    loginLogoutClient = new LoginLogoutClient(bpsServer);
    sessionCookie = loginLogoutClient.login();
    backEndUrl = bpsServer.getContextUrls().getBackEndUrl();
    serviceUrl = bpsServer.getContextUrls().getServiceUrl();
    bpelUploaderClient = new BpelUploaderClient(backEndUrl, sessionCookie);
    humanTaskUploaderClient = new HumanTaskUploaderClient(backEndUrl, sessionCookie);
    bpmnUploaderClient = new BPMNUploaderClient(backEndUrl, sessionCookie);
}
 
Example #28
Source File: CappTestCase.java    From product-cep with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    serverManager = new ServerConfigurationManager(cepServer);


    String loggedInSessionCookie = new LoginLogoutClient(cepServer).login();
    eventProcessorAdminServiceClient = configurationUtil.getEventProcessorAdminServiceClient(backendURL, loggedInSessionCookie);
    eventStreamManagerAdminServiceClient = configurationUtil.getEventStreamManagerAdminServiceClient(backendURL, loggedInSessionCookie);
    eventReceiverAdminServiceClient = configurationUtil.getEventReceiverAdminServiceClient(backendURL, loggedInSessionCookie);
    eventPublisherAdminServiceClient = configurationUtil.getEventPublisherAdminServiceClient(backendURL, loggedInSessionCookie);
}
 
Example #29
Source File: RegistryConfiguratorTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
public void serverRestart() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    sessionCookie = new LoginLogoutClient(automationContext).login();
    resourceAdminServiceClient =
            new ResourceAdminServiceClient(backendURL, sessionCookie);

}
 
Example #30
Source File: GregRestResourceAssociationTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@DataProvider
    private static TestUserMode[][] userModeProvider() {
        return new TestUserMode[][]{
                new TestUserMode[]{TestUserMode.SUPER_TENANT_ADMIN}
//                new TestUserMode[]{TestUserMode.TENANT_USER},
        };
    }