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

The following examples show how to use org.wso2.carbon.integration.common.utils.LoginLogoutClient. 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: QueueUserAuthorizationTestCase.java    From product-ei with 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 #2
Source File: PurgeMessagesTestCase.java    From product-ei with 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 #3
Source File: Axis2ServerStartupTestCase.java    From product-ei with 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 #4
Source File: DS1111UserRoleExtensionTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: PerMessageAcknowledgementsTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * 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 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 #7
Source File: Axis2ServerStartupWithSecuredServices.java    From product-ei with Apache License 2.0 6 votes vote down vote up
@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 #8
Source File: HTTPXMLMessageTestCase.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);

    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 #9
Source File: StormTestCase.java    From product-cep with 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 #10
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 #11
Source File: Axis2ServerStartupWithSecuredServices.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@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 #12
Source File: SubTopicUserAuthorizationTestCase.java    From product-ei with 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");

    loginLogoutClientForUser.logout();

}
 
Example #13
Source File: QueueUserAuthorizationTestCase.java    From product-ei with 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 #14
Source File: TopicUserAuthorizationTestCase.java    From product-ei with 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 #15
Source File: TopicUserAuthorizationTestCase.java    From product-ei with 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 #16
Source File: Axis2ServerStartupTestCase.java    From micro-integrator with 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 #17
Source File: TopicUserAuthorizationTestCase.java    From product-ei with 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 #18
Source File: AMQPSessionRecoverTestCase.java    From product-ei with 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 #19
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 #20
Source File: DS1063EmailUsernameTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@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 #21
Source File: DSSIntegrationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
protected void init(TestUserMode userType) throws Exception {
//        dssContext = new AutomationContext("DSS", "dss01", "carbon.supper", "admin");
        dssContext = new AutomationContext(PRODUCT_NAME, userType);
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(dssContext);
        sessionCookie = loginLogoutClient.login();
        //return the current tenant as the userType(TestUserMode)
        tenantInfo = dssContext.getContextTenant();
        //return the user information initialized with the system
        userInfo = tenantInfo.getContextUser();

    }
 
Example #22
Source File: Axis2ServerStartupWithSecuredServices.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@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 #23
Source File: ServerConfigurationManager.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * 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 #24
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 #25
Source File: ESIntegrationTest.java    From product-es with Apache License 2.0 5 votes vote down vote up
protected void init(String tenantKey, String userKey) throws Exception {

        esContext = new AutomationContext(ESIntegrationTestConstants.ES_PRODUCT_NAME, "es002",
                tenantKey, userKey);
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(esContext);
        sessionCookie = loginLogoutClient.login();
        //return the current tenant as the userType(TestUserMode)
        tenantInfo = esContext.getContextTenant();
        //return the user information initialized with the system
        userInfo = tenantInfo.getContextUser();

    }
 
Example #26
Source File: ESIntegrationBaseTest.java    From product-es with Apache License 2.0 5 votes vote down vote up
protected void init(TestUserMode testUserMode) throws Exception {

        storeContext = new AutomationContext("es", "store", testUserMode);
        publisherContext = new AutomationContext("es", "publisher", testUserMode);
        automationContext = new AutomationContext("es",testUserMode);
        loginLogoutClient = new LoginLogoutClient(automationContext);
        sessionCookie = loginLogoutClient.login();
        backendURL = automationContext.getContextUrls().getBackEndUrl();
        webAppURL = automationContext.getContextUrls().getWebAppURL();
        userInfo = automationContext.getContextTenant().getContextUser();
    }
 
Example #27
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 #28
Source File: ESIntegrationTest.java    From product-es with Apache License 2.0 5 votes vote down vote up
protected void init(TestUserMode userType) throws Exception {

        esContext = new AutomationContext("ES", userType);
        automationContext = esContext;
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(esContext);
        sessionCookie = loginLogoutClient.login();
        //return the current tenant as the userType(TestUserMode)
        tenantInfo = esContext.getContextTenant();
        //return the user information initialized with the system
        userInfo = automationContext.getContextTenant().getContextUser();
        backendURL = automationContext.getContextUrls().getBackEndUrl();
        webAppURL = automationContext.getContextUrls().getWebAppURL();
        storeContext = new AutomationContext("ES", "store", userType);
        publisherContext = new AutomationContext("ES", "publisher", userType);
    }
 
Example #29
Source File: ArtifactUploadClientTestCase.java    From product-es with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init()
           throws XPathExpressionException, IOException, URISyntaxException, SAXException,
           XMLStreamException, LoginAuthenticationExceptionException, AutomationUtilException {

	esContext = new AutomationContext(ESIntegrationTestConstants.ES_PRODUCT_NAME,
	                                  TestUserMode.SUPER_TENANT_ADMIN);
	LoginLogoutClient loginLogoutClient = new LoginLogoutClient(esContext);
	sessionCookie = loginLogoutClient.login();
	carbonHome = System.getProperty("carbon.home");
	esUser = esContext.getContextTenant().getContextUser().getUserName();
	esPwd = esContext.getContextTenant().getContextUser().getPassword();
	esHost = esContext.getDefaultInstance().getHosts().get("default");
	esPort = esContext.getDefaultInstance().getPorts().get("https");
}
 
Example #30
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);

}