Java Code Examples for org.wso2.carbon.integration.common.utils.LoginLogoutClient

The following examples show how to use org.wso2.carbon.integration.common.utils.LoginLogoutClient. These examples are extracted from open source projects. 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
@AfterTest(alwaysRun = true)
public void unDeployServices() throws Exception {
    if (axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        if (TestConfigurationProvider.isPlatform() && asContext != null) {
            int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
            String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE;
            String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE;
            ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
            String sessionCookie = new LoginLogoutClient(asContext).login();
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie, serviceName,
                    deploymentDelay);
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie,
                    studentServiceName, deploymentDelay);

        }
    }
}
 
Example 2
@AfterTest(alwaysRun = true)
public void unDeployServices()
        throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException,
        URISyntaxException, SAXException, XMLStreamException, AutomationUtilException {
    if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = "SecureStockQuoteServiceScenario";
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext);
        for (int i = 1; i < 9; i++) {
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login(),
                    serviceName + i, deploymentDelay);
        }

    }
}
 
Example 3
Source Project: product-ei   Source File: HumanTaskCreationTestCase.java    License: 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 4
Source Project: product-ei   Source File: PurgeMessagesTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Revert changed configuration, purge and delete the queue.
 *
 * @throws XPathExpressionException
 * @throws IOException
 */
@AfterClass()
public void cleanup() throws Exception {
    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient =
            new AndesAdminClient(super.backendURL, sessionCookie);

    andesAdminClient.deleteQueue(TEST_QUEUE_PURGE);
    andesAdminClient.deleteQueue(DLCQueueUtils.identifyTenantInformationAndGenerateDLCString(TEST_QUEUE_PURGE));

    loginLogoutClientForAdmin.logout();
    //Revert back to original configuration.
    super.serverManager.restoreToLastConfiguration(true);

}
 
Example 5
/**
 * This method will restore all the configurations back. Following configurations will be restored. 1.
 * AndesAckWaitTimeOut system property. 2. Delete all destination created in the test case. 3. Restore default
 * broker.xml and restart server.
 *
 * @throws IOException
 * @throws AutomationUtilException
 * @throws AndesAdminServiceBrokerManagerAdminException
 * @throws LogoutAuthenticationExceptionException
 */
@AfterClass()
public void tearDown() throws IOException, AutomationUtilException, AndesAdminServiceBrokerManagerAdminException,
        LogoutAuthenticationExceptionException {
    if (StringUtils.isBlank(defaultAndesAckWaitTimeOut)) {
        System.clearProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);
    } else {
        System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, defaultAndesAckWaitTimeOut);
    }

    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient = new AndesAdminClient(super.backendURL, sessionCookie);

    andesAdminClient.deleteQueue("firstMessageInvalidOnlyPerAckQueue");
    andesAdminClient.deleteQueue("allUnacknowledgePerAckQueue");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgePerAckQueue");
    andesAdminClient.deleteQueue("firstFewUnacknowledgePerAckQueue");
    andesAdminClient.deleteQueue("unacknowledgeMiddleMessagePerAckQueue");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgeQueuePerAckMultiple");
    andesAdminClient.deleteQueue("allAcknowledgeMultiplePerAckQueue");
    loginLogoutClientForAdmin.logout();

    //Revert back to original configuration.
    super.serverManager.restoreToLastConfiguration(true);
}
 
Example 6
Source Project: product-ei   Source File: TopicUserAuthorizationTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Admin add subscription to topic and subscribe.
 * Admin unsubscribe from topic after receiving expected message count
 * Delete topic admin created
 * User1 create topic with the same name
 *
 * Expected results - User1 must be able to successfully create and subscribe to topic
 *
 * @throws AndesClientConfigurationException
 * @throws NamingException
 * @throws JMSException
 * @throws AndesClientException
 * @throws XPathExpressionException
 * @throws IOException
 */
@Test(groups = {"wso2.mb", "topic"})
public void performTopicPermissionWithAdminCreateAndUnscribe()
        throws AndesClientConfigurationException, NamingException, JMSException, AndesClientException,
        XPathExpressionException, IOException, AutomationUtilException, AndesEventAdminServiceEventAdminException {
    // "superAdmin" refers to the admin
    this.createPublishSubscribeAndUnsubscribeFromUser("superAdmin", "authTopic10");

    // delete topic admin created
    LoginLogoutClient loginLogoutClientForUser = new LoginLogoutClient(this.automationContext);
    String sessionCookie = loginLogoutClientForUser.login();
    TopicAdminClient topicAdminClient =
            new TopicAdminClient(this.backendURL, sessionCookie);
    topicAdminClient.removeTopic("authTopic10");

    // user1 subscribe with same topic name where previously created, unsubscribe and deleted by admin
    this.createPublishSubscribeAndUnsubscribeFromUser("authUser1", "authTopic10");
}
 
Example 7
Source Project: product-ei   Source File: TopicUserAuthorizationTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Deleting the topics that were created.
 *
 * @throws XPathExpressionException
 * @throws LoginAuthenticationExceptionException
 * @throws IOException
 * @throws XMLStreamException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws AndesEventAdminServiceEventAdminException
 * @throws LogoutAuthenticationExceptionException
 */
@AfterClass()
public void cleanUpTopics()
        throws XPathExpressionException, LoginAuthenticationExceptionException, IOException,
        XMLStreamException, URISyntaxException, SAXException,
        AndesEventAdminServiceEventAdminException,
        LogoutAuthenticationExceptionException, AutomationUtilException {
    LoginLogoutClient loginLogoutClientForUser = new LoginLogoutClient(this.automationContext);
    String sessionCookie = loginLogoutClientForUser.login();
    TopicAdminClient topicAdminClient =
            new TopicAdminClient(this.backendURL, sessionCookie);
    topicAdminClient.removeTopic("authTopic1");
    topicAdminClient.removeTopic("authTopic2");
    topicAdminClient.removeTopic("authTopic3");
    topicAdminClient.removeTopic("authTopic4");
    topicAdminClient.removeTopic("authTopic5");
    topicAdminClient.removeTopic("authTopic6");
    topicAdminClient.removeTopic("authTopic7");
    topicAdminClient.removeTopic("authTopic8");
    topicAdminClient.removeTopic("authTopic9");

    loginLogoutClientForUser.logout();

}
 
Example 8
Source Project: product-ei   Source File: TopicUserAuthorizationTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Assigning consuming publishing permissions of a topic to a role.
 *
 * @param topicName   The topic name
 * @param permissions New permissions for the role. can be publish, consume.
 * @throws XPathExpressionException
 * @throws IOException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 * @throws LogoutAuthenticationExceptionException
 * @throws UserAdminUserAdminException
 */
public void updateTopicRoleConsumePublishPermission(String topicName,
                                                    TopicRolePermission permissions)
        throws XPathExpressionException, IOException, URISyntaxException, SAXException,
        XMLStreamException, LoginAuthenticationExceptionException,
        AndesAdminServiceBrokerManagerAdminException,
        LogoutAuthenticationExceptionException,
        UserAdminUserAdminException,
        AndesEventAdminServiceEventAdminException, AutomationUtilException {

    LoginLogoutClient loginLogoutClientForUser = new LoginLogoutClient(automationContext);
    String sessionCookie = loginLogoutClientForUser.login();
    TopicAdminClient topicAdminClient =
            new TopicAdminClient(backendURL, sessionCookie);
    topicAdminClient.updatePermissionForTopic(topicName, permissions);
    loginLogoutClientForUser.logout();
}
 
Example 9
/**
 * Deleting the topics that were created.
 *
 * @throws XPathExpressionException
 * @throws LoginAuthenticationExceptionException
 * @throws IOException
 * @throws XMLStreamException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws AndesEventAdminServiceEventAdminException
 * @throws LogoutAuthenticationExceptionException
 */
@AfterClass()
public void cleanUpTopics()
        throws XPathExpressionException, LoginAuthenticationExceptionException, IOException,
        XMLStreamException, URISyntaxException, SAXException,
        AndesEventAdminServiceEventAdminException,
        LogoutAuthenticationExceptionException, AutomationUtilException {
    LoginLogoutClient loginLogoutClientForUser = new LoginLogoutClient(this.automationContext);
    String sessionCookie = loginLogoutClientForUser.login();
    TopicAdminClient topicAdminClient =
            new TopicAdminClient(this.backendURL, sessionCookie);
    topicAdminClient.removeTopic("authTopic1");
    topicAdminClient.removeTopic("authTopic2");
    topicAdminClient.removeTopic("authTopic3");

    loginLogoutClientForUser.logout();

}
 
Example 10
Source Project: product-ei   Source File: QueueUserAuthorizationTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Deleting the queues that were created.
 *
 * @throws IOException
 * @throws XPathExpressionException
 * @throws LogoutAuthenticationExceptionException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 */
@AfterClass()
public void cleanUpQueues()
        throws IOException, XPathExpressionException,
        LogoutAuthenticationExceptionException, URISyntaxException, SAXException,
        XMLStreamException, LoginAuthenticationExceptionException,
        AndesAdminServiceBrokerManagerAdminException, AutomationUtilException {
    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient =
            new AndesAdminClient(super.backendURL, sessionCookie);

    andesAdminClient.deleteQueue("authQueue1");
    andesAdminClient.deleteQueue("authQueue2");
    andesAdminClient.deleteQueue("authQueue3");
    andesAdminClient.deleteQueue("authQueue4");
    andesAdminClient.deleteQueue("authQueue5");
    andesAdminClient.deleteQueue("authQueue6");
    andesAdminClient.deleteQueue("authQueue7");
    andesAdminClient.deleteQueue("authQueue8");
    andesAdminClient.deleteQueue("authQueue9");

    loginLogoutClientForAdmin.logout();
}
 
Example 11
Source Project: product-ei   Source File: QueueUserAuthorizationTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Assigning consuming publishing permissions of a queue to a role.
 *
 * @param queueName   The queue name
 * @param permissions New permissions for the role. can be publish, consume.
 * @throws XPathExpressionException
 * @throws IOException
 * @throws URISyntaxException
 * @throws SAXException
 * @throws XMLStreamException
 * @throws LoginAuthenticationExceptionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 * @throws LogoutAuthenticationExceptionException
 * @throws UserAdminUserAdminException
 */
public void updateQueueRoleConsumePublishPermission(String queueName,
                                                    QueueRolePermission permissions)
        throws XPathExpressionException, IOException, URISyntaxException, SAXException,
        XMLStreamException, LoginAuthenticationExceptionException,
        AndesAdminServiceBrokerManagerAdminException,
        LogoutAuthenticationExceptionException,
        UserAdminUserAdminException, AutomationUtilException {

    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient =
            new AndesAdminClient(super.backendURL, sessionCookie);
    andesAdminClient.updatePermissionForQueue(queueName, permissions);
    loginLogoutClientForAdmin.logout();
}
 
Example 12
Source Project: product-ei   Source File: AMQPSessionRecoverTestCase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Revert changed configuration, purge and delete the queue.
 *
 * @throws XPathExpressionException on an issue reading XPATH elements in config
 * @throws IOException on an file issue reading with config files
 */
@AfterClass()
public void cleanup() throws Exception {
    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient =
            new AndesAdminClient(super.backendURL, sessionCookie);

    andesAdminClient.deleteQueue(TEST_SESSION_RECOVER_WITHOUT_ACK);
    andesAdminClient.deleteQueue(TEST_SESSION_RECOVER_WITH_ACK);
    andesAdminClient.deleteQueue(TEST_SESSION_RECOVER_AND_DLC);

    loginLogoutClientForAdmin.logout();
    //Revert back to original configuration.
    super.serverManager.restoreToLastConfiguration(true);

}
 
Example 13
@BeforeClass(alwaysRun = true)
public void serviceDeployment() throws Exception {

    super.init();
    serverConfigurationManager = new ServerConfigurationManager(dssContext);
    serverConfigurationManager.copyToComponentLib(new File(getResourceLocation() + File.separator + "jar" + File.separator
                                                           + "roleRetriever-1.0.0.jar"));
    serverConfigurationManager.restartForcefully();
    
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(dssContext);
    sessionCookie = loginLogoutClient.login();

    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateEmailUsersTable.sql"));
    deployService(serviceName,
            createArtifact(getResourceLocation() + File.separator + "dbs" + File.separator
                    + "rdbms" + File.separator + "h2" + File.separator
                    + serviceName + ".dbs", sqlFileLis));

    serviceEndPoint = getServiceUrlHttp(serviceName);

}
 
Example 14
Source Project: product-ei   Source File: Axis2ServerStartupTestCase.java    License: Apache License 2.0 6 votes vote down vote up
@AfterTest(alwaysRun = true)
public void unDeployServices() throws Exception {
    if (axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        if (TestConfigurationProvider.isPlatform() && asContext!=null) {
            int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
            String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE;
            String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE;
            ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
            String sessionCookie = new LoginLogoutClient(asContext).login();
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                    , serviceName, deploymentDelay);
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie
                    , studentServiceName, deploymentDelay);

        }
    }
}
 
Example 15
@AfterTest(alwaysRun = true)
public void unDeployServices()
        throws IOException, LoginAuthenticationExceptionException, ExceptionException,
        XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException {
    if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = "SecureStockQuoteServiceScenario";
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext);
        for (int i = 1; i < 9; i++) {
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login()
                    , serviceName + i, deploymentDelay);
        }

    }
}
 
Example 16
Source Project: product-cep   Source File: HTTPXMLMessageTestCase.java    License: 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);

    try {
        String warFilePath = FrameworkPathUtil.getSystemResourceLocation() +
                             "artifacts" + File.separator + "CEP" + File.separator + "war"
                             + File.separator;

        webAppDirectoryPath = FrameworkPathUtil.getCarbonHome() + File.separator + "repository" + File.separator +
                              "deployment" + File.separator + "server" + File.separator + "webapps" + File.separator;
        FileManager.copyResourceToFileSystem(warFilePath + webAppFileName, webAppDirectoryPath, webAppFileName);
        Thread.sleep(5000);
    } catch (Exception e) {
        throw new RemoteException("Exception caught when deploying the war file into CEP server", e);
    }

    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 17
Source Project: product-cep   Source File: StormTestCase.java    License: Apache License 2.0 6 votes vote down vote up
private void configureNode(AutomationContext node) throws Exception {
    String backendURL = node.getContextUrls().getBackEndUrl();
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(node);
    String loggedInSessionCookie = loginLogoutClient.login();
    eventReceiverAdminServiceClient = configurationUtil.getEventReceiverAdminServiceClient(backendURL, loggedInSessionCookie);
    eventPublisherAdminServiceClient = configurationUtil.getEventPublisherAdminServiceClient(backendURL, loggedInSessionCookie);
    eventProcessorAdminServiceClient = configurationUtil.getEventProcessorAdminServiceClient(backendURL, loggedInSessionCookie);
    eventStreamManagerAdminServiceClient = configurationUtil.getEventStreamManagerAdminServiceClient(backendURL, loggedInSessionCookie);

    log.info("Adding stream definitions");
    defineStreams();
    log.info("Adding event receiver analyticsWso2EventReceiver");
    addEventReceiver("analyticsWso2EventReceiver.xml");
    log.info("Adding event receiver stockQuoteWso2EventReceiver");
    addEventReceiver("stockQuoteWso2EventReceiver.xml");
    log.info("Adding event publisher fortuneCompanyWSO2EventPublisher");
    addEventPublisher("fortuneCompanyWSO2EventPublisher.xml");
    log.info("Adding execution plan");
    addExecutionPlan("PreprocessStats.siddhiql");
}
 
Example 18
Source Project: product-es   Source File: JMXSubscription.java    License: 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 19
Source Project: product-es   Source File: ManagementConsoleSubscription.java    License: 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 20
/**
 * Create a ServerConfigurationManager
 *
 * @param productGroup product group name
 * @param userMode     user mode
 */
public ServerConfigurationManager(String productGroup, TestUserMode userMode)
        throws AutomationUtilException, XPathExpressionException, MalformedURLException {
    this.autoCtx = new AutomationContext(productGroup, userMode);
    this.loginLogoutClient = new LoginLogoutClient(autoCtx);
    this.backEndUrl = autoCtx.getContextUrls().getBackEndUrl();
    this.port = new URL(backEndUrl).getPort();
    this.hostname = new URL(backEndUrl).getHost();
}
 
Example 21
/**
 * Create a ServerConfigurationManager
 *
 * @param autoCtx automation context
 * @throws XPathExpressionException
 */
public ServerConfigurationManager(AutomationContext autoCtx)
        throws AutomationUtilException, XPathExpressionException, MalformedURLException {
    this.loginLogoutClient = new LoginLogoutClient(autoCtx);
    this.autoCtx = autoCtx;
    this.backEndUrl = autoCtx.getContextUrls().getBackEndUrl();
    this.port = new URL(backEndUrl).getPort();
    this.hostname = new URL(backEndUrl).getHost();
}
 
Example 22
@BeforeClass(alwaysRun = true)
public void serviceDeployment() throws Exception {

    super.init();
    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateEmailUsersTable.sql"));
    deployService(serviceName, createArtifact(
            getResourceLocation() + File.separator + "samples" + File.separator + "dbs" + File.separator + "rdbms"
                    + File.separator + serviceName + ".dbs", sqlFileLis));

    backendUrl = dssContext.getContextUrls().getBackEndUrl();

    /* login to the server as super user and add user with email user name for the test case */
    userManagementClient = new UserManagementClient(backendUrl, sessionCookie);

    userManagementClient.addRole("sampleRole", new String[] {}, new String[] { "admin" });
    userManagementClient
            .addUser("[email protected]", "test123", new String[] { "sampleRole" }, "emailUserProfile");

    serverConfigurationManager = new ServerConfigurationManager(dssContext);
    serverConfigurationManager.copyToComponentLib(new File(
            getResourceLocation() + File.separator + "jar" + File.separator + "msgContextHandler-1.0.0.jar"));

    String carbonHome = System.getProperty("carbon.home");
    File sourceFile = new File(
            getResourceLocation() + File.separator + "serverConfigs" + File.separator + "axis2.xml");
    File destinationFile = new File(
            carbonHome + File.separator + "conf" + File.separator + "axis2" + File.separator + "axis2.xml");

    serverConfigurationManager
            .applyConfiguration(sourceFile, destinationFile);//this will restart the server as well
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(dssContext);
    sessionCookie = loginLogoutClient.login();

    serviceEndPoint = getServiceUrlHttp(serviceName);

}
 
Example 23
@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 24
@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 25
@BeforeTest(alwaysRun = true)
public void deployServices()
        throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException,
        XMLStreamException, SAXException, URISyntaxException, AutomationUtilException {

    if (TestConfigurationProvider.isIntegration()) {
        axis2Server1 = new SampleAxis2Server("test_axis2_server_9007.xml");
        axis2Server1.deployService("SecureStockQuoteServiceScenario1");
        axis2Server1.start();

        axis2Server1.deployService("SecureStockQuoteServiceScenario2");
        axis2Server1.deployService("SecureStockQuoteServiceScenario3");
        axis2Server1.deployService("SecureStockQuoteServiceScenario4");
        axis2Server1.deployService("SecureStockQuoteServiceScenario5");
        axis2Server1.deployService("SecureStockQuoteServiceScenario6");
        axis2Server1.deployService("SecureStockQuoteServiceScenario7");
        axis2Server1.deployService("SecureStockQuoteServiceScenario8");
        //        axis2Server1.deployService("SecureStockQuoteServiceScenario9");
        //        axis2Server1.deployService("SecureStockQuoteServiceScenario10");

    } else {
        AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = "SecureStockQuoteServiceScenario";
        String serviceFilePath =
                TestConfigurationProvider.getResourceLocation("AXIS2") + File.separator + "aar" + File.separator
                        + serviceName;
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext);
        for (int i = 1; i < 9; i++) {
            deployer.deployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login(),
                    serviceName + i, serviceFilePath + i + ".aar", deploymentDelay);
        }
    }
}
 
Example 26
Source Project: product-ei   Source File: BPSIntegrationUiBaseTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void init() throws Exception {
    ssServer = new AutomationContext(PRODUCT_GROUP_NAME, TestUserMode.SUPER_TENANT_ADMIN);
    loginLogoutClient = new LoginLogoutClient(ssServer);
    sessionCookie = loginLogoutClient.login();
    backendURL = ssServer.getContextUrls().getBackEndUrl();
    this.driver = BrowserManager.getWebDriver();
}
 
Example 27
Source Project: product-ei   Source File: BPSIntegrationUiBaseTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void init(TestUserMode testUserMode) throws Exception {
    ssServer = new AutomationContext(PRODUCT_GROUP_NAME, testUserMode);
    loginLogoutClient = new LoginLogoutClient(ssServer);
    sessionCookie = loginLogoutClient.login();
    backendURL = ssServer.getContextUrls().getBackEndUrl();
    this.driver = BrowserManager.getWebDriver();
}
 
Example 28
Source Project: product-ei   Source File: BPSMasterTest.java    License: 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 29
Source Project: product-ei   Source File: BPSMasterTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void init() throws Exception {
    bpsServer = new AutomationContext("BPS", TestUserMode.SUPER_TENANT_ADMIN);
    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 30
Source Project: product-ei   Source File: BPSMasterTest.java    License: Apache License 2.0 5 votes vote down vote up
protected void init(String domainKey, String userKey) throws Exception {
    bpsServer = new AutomationContext("BPS", "bpsServerInstance0001", domainKey, userKey);
    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);
}