Java Code Examples for org.wso2.carbon.integration.common.utils.LoginLogoutClient#login()

The following examples show how to use org.wso2.carbon.integration.common.utils.LoginLogoutClient#login() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: BPSMasterTest.java    From product-ei with 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);
}
 
Example 8
Source File: BPSIntegrationUiBaseTest.java    From product-ei with 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 9
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 10
Source File: HumanTaskCoordinationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Setup
 *
 * @throws Exception
 */
private void setupTestClients() throws Exception {
	init();
	requestSender.waitForProcessDeployment(backEndUrl + HumanTaskTestConstants.CLAIM_APPROVAL_PROCESS_SERVICE);
	requestSender.waitForProcessDeployment(backEndUrl + HumanTaskTestConstants.CLAIM_SERVICE);
	log.info("BPEL and Humantask services are up and running");
	// Need to re-initialize since we have restarted the server
	bpelPackageManagementClient = new BpelPackageManagementClient(backEndUrl, sessionCookie);
	humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
	instanceManagementClient = new BpelInstanceManagementClient(backEndUrl, sessionCookie);
	log.info("Server setting up completed ...!!!");
	serverConfigurationManager = new ServerConfigurationManager(bpsServer);

	//initialize HT Client API for Clerk1 and manager1 user
	AutomationContext clerk1AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY,
			                      HumanTaskTestConstants.CLERK1_USER);
	LoginLogoutClient clerk1LoginLogoutClient = new LoginLogoutClient(clerk1AutomationContext);
	String clerk1SessionCookie = clerk1LoginLogoutClient.login();
	clerk1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, clerk1SessionCookie);

	AutomationContext manager1AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY,
			                      HumanTaskTestConstants.MANAGER1_USER);
	LoginLogoutClient manager1LoginLogoutClient = new LoginLogoutClient(manager1AutomationContext);
	String manager1SessionCookie = manager1LoginLogoutClient.login();
	manager1HumanTaskClientApiClient = new HumanTaskClientApiClient(backEndUrl, manager1SessionCookie);

}
 
Example 11
Source File: DLCQueueTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the number of messages in the DLC queue.
 *
 * @return The number of messages.
 * @throws AutomationUtilException
 * @throws RemoteException
 * @throws LogoutAuthenticationExceptionException
 * @throws AndesAdminServiceBrokerManagerAdminException
 */
private long getDLCMessageCount() throws AutomationUtilException, RemoteException,
        LogoutAuthenticationExceptionException, AndesAdminServiceBrokerManagerAdminException {
    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(mbServer);
    String sessionCookie = loginLogoutClientForAdmin.login();
    AndesAdminClient andesAdminClient = new AndesAdminClient(backendURL, sessionCookie);
    long messageCount = andesAdminClient.getDlcQueue().getMessageCount();
    loginLogoutClientForAdmin.logout();

    return messageCount;
}
 
Example 12
Source File: RedeliveryDelayTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
/**
 * This method will restore all the configurations back.
 * Following configurations will be restored.
 * 1. AndesAckWaitTimeOut system property.
 * 2. AndesRedeliveryDelay system property.
 * 3. Deleted all destination created in this test class.
 * 4. Restore default broker.xml and restart server.
 *
 * @throws IOException
 * @throws AutomationUtilException
 */
@AfterClass()
public void tearDown()
        throws IOException, AutomationUtilException, LogoutAuthenticationExceptionException,
        AndesAdminServiceBrokerManagerAdminException {
    if (StringUtils.isBlank(defaultAndesAckWaitTimeOut)) {
        System.clearProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY);
    } else {
        System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, defaultAndesAckWaitTimeOut);
    }

    if (StringUtils.isBlank(defaultAndesRedeliveryDelay)) {
        System.clearProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY);
    } else {
        System.setProperty(AndesClientConstants.ANDES_REDELIVERY_DELAY_PROPERTY, defaultAndesRedeliveryDelay);
    }

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

    andesAdminClient.deleteQueue("firstMessageInvalidOnlyQueue");
    andesAdminClient.deleteQueue("firstMessageInvalidOnlyReceiverQueue");
    andesAdminClient.deleteQueue("multipleUnacknowledgeQueue");
    andesAdminClient.deleteQueue("multipleUnacknowledgeReceiverQueue");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgeQueue");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgeReceiverQueue");
    andesAdminClient.deleteQueue("firstFewUnacknowledgeQueue");
    andesAdminClient.deleteQueue("firstFewUnacknowledgeReceiverQueue");
    andesAdminClient.deleteQueue("unacknowledgeMiddleMessageQueue");
    andesAdminClient.deleteQueue("unacknowledgeMiddleMessageReceiverQueue");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgeMessageListenerForMultiple");
    andesAdminClient.deleteQueue("oneByOneUnacknowledgeMessageReceiverForMultipleQueue");
    loginLogoutClientForAdmin.logout();

    //Revert back to original configuration.
    super.serverManager.restoreToLastConfiguration(true);
}
 
Example 13
Source File: TestBase.java    From product-iots with Apache License 2.0 4 votes vote down vote up
protected String getSessionCookie() throws Exception {
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    return loginLogoutClient.login();
}
 
Example 14
Source File: HumanTaskPeopleAssignment.java    From product-ei with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
	init();  //init master class
	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();

	clerk1Client = new HumanTaskClientApiClient(backEndUrl, clerk1SessionCookie);


	//initialize HT Client API for Clerk2 user
	AutomationContext clerk2AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
			FrameworkConstants.SUPER_TENANT_KEY, "clerk2");
	LoginLogoutClient clerk2LoginLogoutClient = new LoginLogoutClient(clerk2AutomationContext);
	String clerk2SessionCookie = clerk2LoginLogoutClient.login();

	clerk2Client = new HumanTaskClientApiClient(backEndUrl, clerk2SessionCookie);


	//initialize HT Client API for Clerk3 user
	AutomationContext clerk3AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
			FrameworkConstants.SUPER_TENANT_KEY, "clerk3");
	LoginLogoutClient clerk3LoginLogoutClient = new LoginLogoutClient(clerk3AutomationContext);
	String clerk3SessionCookie = clerk3LoginLogoutClient.login();

	clerk3Client = new HumanTaskClientApiClient(backEndUrl, clerk3SessionCookie);

	//initialize HT Client API for Clerk4 user
	AutomationContext clerk4AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY, "clerk4");
	LoginLogoutClient clerk4LoginLogoutClient = new LoginLogoutClient(clerk4AutomationContext);
	String clerk4SessionCookie = clerk4LoginLogoutClient.login();

	clerk4Client = new HumanTaskClientApiClient(backEndUrl, clerk4SessionCookie);

	//initialize HT Client API for Clerk5 user
	AutomationContext clerk5AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY, "clerk5");
	LoginLogoutClient clerk5LoginLogoutClient = new LoginLogoutClient(clerk5AutomationContext);
	String clerk5SessionCookie = clerk5LoginLogoutClient.login();

	clerk5Client = new HumanTaskClientApiClient(backEndUrl, clerk5SessionCookie);

	//initialize HT Client API for Clerk6 user
	AutomationContext clerk6AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY, "clerk6");
	LoginLogoutClient clerk6LoginLogoutClient = new LoginLogoutClient(clerk6AutomationContext);
	String clerk6SessionCookie = clerk6LoginLogoutClient.login();

	clerk6Client = new HumanTaskClientApiClient(backEndUrl, clerk6SessionCookie);

	//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();
	manager1Client = new HumanTaskClientApiClient(backEndUrl, manager1SessionCookie);

	//initialize HT Client API for Manager2 user
	AutomationContext manager2AutomationContext =
			new AutomationContext("BPS", "bpsServerInstance0001", FrameworkConstants.SUPER_TENANT_KEY, "manager2");
	LoginLogoutClient manager2LoginLogoutClient = new LoginLogoutClient(manager2AutomationContext);
	String manager2SessionCookie = manager2LoginLogoutClient.login();
	manager2Client = new HumanTaskClientApiClient(backEndUrl, manager2SessionCookie);

	//initialize HT Client API for Manager3 user
	AutomationContext manager3AutomationContext = new AutomationContext("BPS", "bpsServerInstance0001",
			FrameworkConstants.SUPER_TENANT_KEY, "manager3");
	LoginLogoutClient manager3LoginLogoutClient = new LoginLogoutClient(manager3AutomationContext);
	String manager3SessionCookie = manager3LoginLogoutClient.login();
	manager3Client = new HumanTaskClientApiClient(backEndUrl, manager3SessionCookie);
}
 
Example 15
Source File: TenantDeleteQueueTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
/**
 * Following steps are done by a tenant user
 * 1. Create a queue.
 * 2. Delete the queue.
 * 3. Recreate a queue with same name.
 * 4. Delete the queue.
 *
 * @throws IOException
 * @throws AndesClientConfigurationException
 * @throws JMSException
 * @throws NamingException
 * @throws AndesClientException
 */
@Test(groups = "wso2.mb")
public void performCreateDeleteQueueTenantTestCase() throws Exception {
    AutomationContext userAutomationContext = new AutomationContext("MB", TestUserMode.TENANT_USER);

    LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(userAutomationContext);
    String sessionCookie = loginLogoutClientForAdmin.login();
    String backEndUrl = userAutomationContext.getContextUrls().getBackEndUrl();

    AndesAdminClient andesAdminClient = new AndesAdminClient(backEndUrl, sessionCookie);

    userAutomationContext.getContextTenant().getContextUser().getUserName();

    andesAdminClient.createQueue("deleteTenantQueue");

    andesAdminClient.deleteQueue(userAutomationContext.getContextTenant().getDomain() + "/deleteTenantQueue");

    AndesClientUtils.sleepForInterval(5000);

    andesAdminClient.createQueue("deleteTenantQueue");

    andesAdminClient.deleteQueue(userAutomationContext.getContextTenant().getDomain() + "/deleteTenantQueue");

    loginLogoutClientForAdmin.logout();
}
 
Example 16
Source File: MultiTenantDurableTopicTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
/**
 * Test case 1
 * 1. Start a Durable subscriber from a normal tenant (Not super tenant)
 * (Topic - topictenant1.com/durableTenantTopic)
 * 2. Send 200 messages to the the topic
 * 3. Durable subscriber should receive all 200 messages
 *
 * @throws AndesClientConfigurationException
 * @throws JMSException
 * @throws NamingException
 * @throws IOException
 * @throws AndesClientException
 */
@Test(groups = "wso2.mb", description = "Single Tenant Test case")
public void performSingleTenantMultipleUserDurableTopicTestCase()
        throws AndesClientConfigurationException, JMSException, NamingException, IOException,
        AndesClientException, XPathExpressionException, URISyntaxException, SAXException,
        LoginAuthenticationExceptionException, XMLStreamException, LogoutAuthenticationExceptionException,
        AndesAdminServiceBrokerManagerAdminException, AndesEventAdminServiceEventAdminException, AutomationUtilException {

    String destinationName = "topictenant1.com/durableTenantTopic";

    int sendMessageCount = 200;
    int expectedMessageCount = 200;

    // Creating a consumer client configuration
    AndesJMSConsumerClientConfiguration adminConsumerConfig =
            new AndesJMSConsumerClientConfiguration(getAMQPPort(), "admin!topictenant1.com", "admin",
                    ExchangeType.TOPIC, destinationName);
    adminConsumerConfig.setUnSubscribeAfterEachMessageCount(expectedMessageCount);
    adminConsumerConfig.setPrintsPerMessageCount(expectedMessageCount / 10L);
    adminConsumerConfig.setDurable(true, "topictenant1.com/multitenant1");
    adminConsumerConfig.setAsync(false);

    // Creating clients
    AndesClient adminConsumerClient = new AndesClient(adminConsumerConfig, true);
    adminConsumerClient.startClient();


    // Add permission to the created role to be able to publish/subscribe
    TopicRolePermission topicRolePermission = new TopicRolePermission();
    topicRolePermission.setRoleName(PUBLISHER_ROLE);
    topicRolePermission.setAllowedToSubscribe(true);
    topicRolePermission.setAllowedToPublish(true);

    // Get the automation context for the tenant
    AutomationContext tenantContext = new AutomationContext("MB", "mb001", "topictenant1", "topictenantuser1");


    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(tenantContext);
    String sessionCookie = loginLogoutClient.login();

    TopicAdminClient topicAdminClient =
            new TopicAdminClient(super.backendURL, sessionCookie);

    // Update permissions for the destination queue to be able to publish/subscribe from topictenantuser1
    topicAdminClient.updatePermissionForTopic(destinationName, topicRolePermission);
    loginLogoutClient.logout();

    // Creating a publisher client configuration
    AndesJMSPublisherClientConfiguration tenantPublisherConfig =
            new AndesJMSPublisherClientConfiguration(getAMQPPort(), "topictenantuser1!topictenant1.com",
                 "topictenantuser1", ExchangeType.TOPIC, destinationName);
    tenantPublisherConfig.setNumberOfMessagesToSend(sendMessageCount);
    tenantPublisherConfig.setPrintsPerMessageCount(sendMessageCount / 10L);

    AndesClient tenantPublisherClient = new AndesClient(tenantPublisherConfig, true);
    tenantPublisherClient.startClient();

    AndesClientUtils
            .waitForMessagesAndShutdown(adminConsumerClient, AndesClientConstants.DEFAULT_RUN_TIME);

    // Evaluating
    Assert.assertEquals(tenantPublisherClient
                                .getSentMessageCount(), sendMessageCount, "Sending failed for " +
                                                          "topictenantuser1!topictenant1.com.");
    Assert.assertEquals(adminConsumerClient
                                .getReceivedMessageCount(), expectedMessageCount, "Message " +
                                              "receiving failed for admin!topictenant1.com.");
}
 
Example 17
Source File: ESBIntegrationTest.java    From product-ei with Apache License 2.0 4 votes vote down vote up
protected String login(AutomationContext context)
		throws IOException, XPathExpressionException, URISyntaxException, SAXException,
		XMLStreamException, LoginAuthenticationExceptionException, AutomationUtilException {
	LoginLogoutClient loginLogoutClient = new LoginLogoutClient(context);
	return loginLogoutClient.login();
}
 
Example 18
Source File: LifecycleUtil.java    From product-es with Apache License 2.0 4 votes vote down vote up
/**
 * @param path    path of the collection or resource to be subscribed
 * @param type    type of the element
 * @return true if subscriptions are created for all events and required
 *         notifications are captured, false otherwise
 * @throws Exception
 */
public boolean init(String path, AutomationContext automationContext, String type)
        throws Exception {

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

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

    wsRegistryServiceClient =
            registryProviderUtil.getWSRegistry(this.automationContext);
    lifeCycleAdminServiceClient =
            new LifeCycleAdminServiceClient(backEndUrl, sessionCookie);
    userManagementClient =
            new UserManagementClient(backEndUrl, sessionCookie);

    infoServiceAdminClient =
            new InfoServiceAdminClient(backEndUrl, sessionCookie);

    humanTaskAdminClient =
            new HumanTaskAdminClient(backEndUrl, sessionCookie);

    resourceAdminServiceClient =
            new ResourceAdminServiceClient(backEndUrl, sessionCookie);

    addRole();
    boolean result1 = true;
    boolean result2 = true;
    boolean result3 = true;
    boolean result4 = true;
    boolean result5;
    boolean result6 = true;
    boolean result7 = true;
    boolean result8 = true;
    if (!path.equals("/")) {
        result1 =
                consoleSubscribe(path, "LifeCycleCreated") && addLifeCycle(path) &&
                getNotification("The LifeCycle was created") &&
                managementUnsubscribe(path);
        result2 =
                consoleSubscribe(path, "CheckListItemChecked") &&
                checkItem(path) &&
                getNotification("The CheckList item 'Effective Inspection Completed' of LifeCycle State 'Tested' was Checked" +
                                " for resource at " + path + ".") &&
                managementUnsubscribe(path);
        result3 =
                consoleSubscribe(path, "CheckListItemUnchecked") &&
                unCheckItem(path) &&
                getNotification("The CheckList item 'Effective Inspection Completed' of LifeCycle State 'Tested' was Unchecked" +
                                " for resource at " + path + ".") &&
                managementUnsubscribe(path);
        result4 =
                consoleSubscribe(path, "LifeCycleStateChanged") &&
                changeState(path) &&
                getNotification("The LifeCycle State Changed from 'Tested' to 'Development'" +
                                " for resource at " + path + ".") &&
                managementUnsubscribe(path);
    }
    result5 =
            consoleSubscribe(path, type + "Updated") && update(path) &&
            getNotification("at path " + path + " was updated.") &&
            managementUnsubscribe(path);

    if (type.equals("Collection")) {
        result6 =
                consoleSubscribe(path, "ChildCreated") &&
                addChild(path) &&
                getNotification("A resource was added to the collection " + path +
                                " at Path: " + path + "/" + CHILD) &&
                managementUnsubscribe(path);
        result7 =
                consoleSubscribe(path, "ChildDeleted") &&
                deleteChild(path) &&
                getNotification("A resource was removed from the collection " + path +
                                " at Path: " + path + "/" + CHILD) &&
                managementUnsubscribe(path);
    }
    if (!path.equals("/")) {
        result8 =
                consoleSubscribe(path, type + "Deleted") && delete(path) &&
                getNotification("at path " + path + " was deleted.");
    }
    clean();
    return result1 && result2 && result3 && result4 && result5 && result6 && result7 && result8;
}
 
Example 19
Source File: ESIntegrationTest.java    From product-es with Apache License 2.0 4 votes vote down vote up
protected String getSessionCookie() throws Exception {
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(automationContext);
    return loginLogoutClient.login();
}
 
Example 20
Source File: DSSIntegrationTest.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
protected String login(AutomationContext dssContext)
        throws IOException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException,
        LoginAuthenticationExceptionException, AutomationUtilException {
    LoginLogoutClient loginLogoutClient = new LoginLogoutClient(dssContext);
    return loginLogoutClient.login();
}