Java Code Examples for org.wso2.carbon.automation.engine.context.TestUserMode#TENANT_USER

The following examples show how to use org.wso2.carbon.automation.engine.context.TestUserMode#TENANT_USER . 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: InMemoryDSSampleTestCase.java    From product-ei with Apache License 2.0 7 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init(userMode);
    String resourceFileLocation;
    resourceFileLocation = getResourceLocation();
    //DataSource already exist by default for super user.
    if (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER) {
        addDataSources();
    }
    deployService(serviceName,
                  new DataHandler(new URL("file:///" + resourceFileLocation +
                                          File.separator + "samples" + File.separator +
                                          "dbs" + File.separator + "inmemory" + File.separator +
                                          "InMemoryDSSample.dbs")));
    log.info(serviceName + " uploaded");
    serviceUrl = getServiceUrlHttp(serviceName);
}
 
Example 2
Source File: DSSIntegrationTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private void validateServiceUrl(String serviceUrl, Tenant tenant) {
    //if user mode is null can not validate the service url
    if (userMode != null) {
        if ((userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER)) {
            Assert.assertTrue(serviceUrl.contains("/t/" + tenant.getDomain() + "/"),
                    "invalid service url for tenant. " + serviceUrl);
        } else {
            Assert.assertFalse(serviceUrl.contains("/t/"), "Invalid service url for user. " + serviceUrl);
        }
    }
}
 
Example 3
Source File: InMemoryDSSampleTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void initialize() throws Exception {
    super.init();
    String resourceFileLocation;
    resourceFileLocation = getResourceLocation();
    //DataSource already exist by default for super user.
    if (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER) {
        addDataSources();
    }
    deployService(serviceName, new DataHandler(
            new URL("file:///" + resourceFileLocation + File.separator + "samples" + File.separator + "dbs"
                    + File.separator + "inmemory" + File.separator + "InMemoryDSSample.dbs")));
    log.info(serviceName + " uploaded");
    serviceUrl = getServiceUrlHttp(serviceName);
}
 
Example 4
Source File: DSSIntegrationTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void validateServiceUrl(String serviceUrl, Tenant tenant) {
    //if user mode is null can not validate the service url
    if (userMode != null) {
        if ((userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER)) {
            Assert.assertTrue(serviceUrl.contains("/t/" + tenant.getDomain() + "/"), "invalid service url for tenant. " + serviceUrl);
        } else {
            Assert.assertFalse(serviceUrl.contains("/t/"), "Invalid service url for user. " + serviceUrl);
        }
    }
}
 
Example 5
Source File: RequestBoxTenantUserTestCase.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(TestUserMode.TENANT_USER);
    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("RequestBoxTestTables.sql"));
    deployService(serviceName,
                  createArtifact(getResourceLocation() + File.separator + "dbs" + File.separator
                                 + "rdbms" + File.separator + "h2" + File.separator
                                 + "RequestBoxTenantTest.dbs", sqlFileLis));
    serviceEndPoint = getServiceUrlHttp(serviceName);
}
 
Example 6
Source File: ODataTenantUserTestCase.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(TestUserMode.TENANT_USER);
	List<File> sqlFileLis = new ArrayList<>();
	sqlFileLis.add(selectSqlFile("CreateODataTables.sql"));
	sqlFileLis.add(selectSqlFile("Customers.sql"));
	deployService(serviceName,
	              createArtifact(getResourceLocation() + File.separator + "dbs" + File.separator + "odata" +
	                             File.separator + "ODataSampleTenantService.dbs", sqlFileLis));
	webAppUrl = dssContext.getContextUrls().getWebAppURL();
	int i = webAppUrl.indexOf("/t/");
	webAppUrl = webAppUrl.substring(0,i);
}
 
Example 7
Source File: ESIntegrationTest.java    From product-es with Apache License 2.0 5 votes vote down vote up
private void validateServiceUrl(String serviceUrl, Tenant tenant) {
    //if user mode is null can not validate the service url
    if (userMode != null) {
        if (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER) {
            Assert.assertTrue(serviceUrl.contains("/t/" + tenant.getDomain() + "/"), "invalid service url for tenant. " + serviceUrl);
        } else {
            Assert.assertFalse(serviceUrl.contains("/t/"), "Invalid service url for user. " + serviceUrl);
        }
    }
}
 
Example 8
Source File: DSSIntegrationTest.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
protected boolean isTenant() throws Exception {
    if (userMode == null) {
        throw new Exception("UserMode Not Initialized. Can not identify user type");
    }
    return (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER);
}
 
Example 9
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 10
Source File: DSSIntegrationTest.java    From product-ei with Apache License 2.0 4 votes vote down vote up
protected boolean isTenant() throws Exception {
    if(userMode == null){
        throw new Exception("UserMode Not Initialized. Can not identify user type");
    }
    return (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER);
}
 
Example 11
Source File: ESPublisherTenantSubscriptionTestCase.java    From product-es with Apache License 2.0 4 votes vote down vote up
@DataProvider(name = "userMode")
private static Object[][] userModeProvider() {
    return new Object[][]{{TestUserMode.TENANT_ADMIN, "Notification asset - TenantAdmin"},
            {TestUserMode.TENANT_USER, "Notification asset - TenantUser"}};
}
 
Example 12
Source File: ESPublisherTenantNotificationTestCase.java    From product-es with Apache License 2.0 4 votes vote down vote up
@DataProvider(name = "userMode")
private static Object[][] userModeProvider() {
    return new Object[][]{{TestUserMode.TENANT_ADMIN, "Notification asset - TenantAdmin"},
            {TestUserMode.TENANT_USER, "Notification asset - TenantUser"}};
}
 
Example 13
Source File: ESPublisherTenantAddEditAssetTestCase.java    From product-es with Apache License 2.0 4 votes vote down vote up
@DataProvider(name = "userMode")
private static Object[][] userModeProvider() {
    return new Object[][]{{TestUserMode.TENANT_ADMIN, "Add Edit asset - TenantAdmin"},
            {TestUserMode.TENANT_USER, "Add Edit asset - TenantUser"}};
}
 
Example 14
Source File: ESIntegrationTest.java    From product-es with Apache License 2.0 4 votes vote down vote up
protected boolean isTenant() throws Exception {
    if(userMode == null){
        throw new Exception("UserMode Not Initialized. Can not identify user type");
    }
    return (userMode == TestUserMode.TENANT_ADMIN || userMode == TestUserMode.TENANT_USER);
}