diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuthAppsWithSameClientIdTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuthAppsWithSameClientIdTestCase.java
index 59324c1307f..26a3dfe7720 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuthAppsWithSameClientIdTestCase.java
+++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuthAppsWithSameClientIdTestCase.java
@@ -159,9 +159,7 @@ private void testInit() throws Exception {
@AfterClass(alwaysRun = true)
public void testClear() throws IOException, AutomationUtilException {
- if (!configurationsRestored) {
- serverConfigurationManager.restoreToLastConfiguration(true);
- }
+ restoreISConfigurations();
tenantMgtRestClient.closeHttpClient();
oAuth2RestClientTenant1.closeHttpClient();
oAuth2RestClientTenant2.closeHttpClient();
@@ -188,7 +186,7 @@ public void afterMethod() throws IOException {
accessToken = null;
}
- @Test(description = "Create two OAuth apps in the same tenant with same client id.", priority = 0)
+ @Test(description = "Create two OAuth apps in the same tenant with same client id.")
public void testCreateAppsWithSameClientIdInSameTenant() throws Exception {
// Create first app.
@@ -200,7 +198,8 @@ public void testCreateAppsWithSameClientIdInSameTenant() throws Exception {
Assert.assertEquals(statusLine.getStatusCode(), HttpStatus.SC_CONFLICT, "Expected status code not received.");
}
- @Test(description = "Create two OAuth apps in two tenants with the same client id.", priority = 1)
+ @Test(description = "Create two OAuth apps in two tenants with the same client id.",
+ dependsOnMethods = "testCreateAppsWithSameClientIdInSameTenant")
public void testCreateAppsWithSameClientIdInMultipleTenants() throws Exception {
// Create oauth apps in both tenants.
@@ -222,7 +221,7 @@ public void testCreateAppsWithSameClientIdInMultipleTenants() throws Exception {
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and retrieve " +
- "tenant app by client id.", priority = 2)
+ "tenant app by client id.", dependsOnMethods = "testCreateAppsWithSameClientIdInMultipleTenants")
public void testRetrieveTenantAppByClientId() throws JSONException, IOException {
// Create oauth apps in both tenants.
@@ -241,7 +240,7 @@ public void testRetrieveTenantAppByClientId() throws JSONException, IOException
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and update " +
- "inbound configurations of one app.", priority = 3)
+ "inbound configurations of one app.", dependsOnMethods = "testRetrieveTenantAppByClientId")
public void testCreateAppsAndUpdateInboundConfigurationsOfOne() throws Exception {
// Create oauth apps in both tenants.
@@ -292,7 +291,7 @@ public void testCreateAppsAndUpdateInboundConfigurationsOfOne() throws Exception
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and delete an app " +
- "in one tenant.", priority = 4)
+ "in one tenant.", dependsOnMethods = "testCreateAppsAndUpdateInboundConfigurationsOfOne")
public void testCreateAppsAndDeleteOne() throws Exception {
// Create oauth apps in both tenants.
@@ -312,7 +311,7 @@ public void testCreateAppsAndDeleteOne() throws Exception {
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and delete " +
- "inbound configurations of one app.", priority = 5)
+ "inbound configurations of one app.", dependsOnMethods = "testCreateAppsAndDeleteOne")
public void testCreateAppsAndDeleteInboundConfigurationsOfOne() throws Exception {
// Create oauth apps in both tenants.
@@ -343,7 +342,7 @@ public void testCreateAppsAndDeleteInboundConfigurationsOfOne() throws Exception
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and try to login " +
- "with the user for the tenant.", priority = 6)
+ "with the user for the tenant.", dependsOnMethods = "testCreateAppsAndDeleteInboundConfigurationsOfOne")
public void testOAuthApplicationLoginSuccess() throws Exception {
// Create oauth apps in both tenants.
@@ -365,7 +364,8 @@ public void testOAuthApplicationLoginSuccess() throws Exception {
}
@Test(description = "Create two OAuth apps in two tenants with the same client id and try to login " +
- "with the user from the other tenant.", priority = 7, expectedExceptions = AssertionError.class)
+ "with the user from the other tenant.", dependsOnMethods = "testOAuthApplicationLoginSuccess",
+ expectedExceptions = AssertionError.class)
public void testOAuthApplicationLoginIncorrectTenant() throws Exception {
// Create oauth apps in both tenants.
@@ -385,12 +385,11 @@ public void testOAuthApplicationLoginIncorrectTenant() throws Exception {
}
@Test(description = "Create an OAuth app in tenant 1 and try to login when tenant qualified urls are disabled.",
- priority = 8)
+ dependsOnMethods = "testOAuthApplicationLoginIncorrectTenant")
public void testOAuthApplicationLoginWhenTenantQualifiedUrlsDisabled() throws Exception {
// Restore the server back to the initial state (tenant qualified urls disabled).
- serverConfigurationManager.restoreToLastConfiguration(true);
- configurationsRestored = true;
+ restoreISConfigurations();
// Create oauth app and add user.
ApplicationResponseModel tenant1App = createApplication(TENANT_1_DOMAIN);
@@ -416,6 +415,20 @@ private void changeISConfigurations() throws AutomationUtilException, IOExceptio
serverConfigurationManager.applyConfiguration(modifiedConfigFile, defaultTomlFile, true, true);
}
+ private void restoreISConfigurations() throws AutomationUtilException, IOException {
+
+ if (configurationsRestored) {
+ return;
+ }
+ String carbonHome = Utils.getResidentCarbonHome();
+ File defaultTomlFile = getDeploymentTomlFile(carbonHome);
+ File modifiedConfigFile = new File(getISResourceLocation()
+ + File.separator + "tenant.qualified" + File.separator
+ + "tenant_qualified_url_tenanted_sessions_default.toml");
+ serverConfigurationManager.applyConfiguration(modifiedConfigFile, defaultTomlFile, true, true);
+ configurationsRestored = true;
+ }
+
private void addTenant(String tenantDomain, String adminUsername, String adminPassword,
String adminTenantAwareUsername) throws Exception {
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/tenant.qualified/tenant_qualified_url_tenanted_sessions_default.toml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/tenant.qualified/tenant_qualified_url_tenanted_sessions_default.toml
new file mode 100644
index 00000000000..2a6ee115a7e
--- /dev/null
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/tenant.qualified/tenant_qualified_url_tenanted_sessions_default.toml
@@ -0,0 +1,39 @@
+[server]
+hostname = "localhost"
+node_ip = "127.0.0.1"
+base_path = "https://$ref{server.hostname}:${carbon.management.port}"
+
+[super_admin]
+username = "admin"
+password = "admin"
+create_admin_account = true
+
+[user_store]
+type = "database_unique_id"
+
+[database.identity_db]
+driver = "$env{IDENTITY_DATABASE_DRIVER}"
+url = "$env{IDENTITY_DATABASE_URL}"
+username = "$env{IDENTITY_DATABASE_USERNAME}"
+password = "$env{IDENTITY_DATABASE_PASSWORD}"
+
+[database.shared_db]
+driver = "$env{SHARED_DATABASE_DRIVER}"
+url = "$env{SHARED_DATABASE_URL}"
+username = "$env{SHARED_DATABASE_USERNAME}"
+password = "$env{SHARED_DATABASE_PASSWORD}"
+
+[keystore.primary]
+file_name = "wso2carbon.jks"
+password = "wso2carbon"
+
+[truststore]
+file_name = "client-truststore.jks"
+password = "wso2carbon"
+type = "JKS"
+
+[account_recovery.endpoint.auth]
+hash = "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262"
+
+[identity.auth_framework.endpoint]
+app_password = "dashboard"
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
index e165c051740..88cd04b199e 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
@@ -69,7 +69,6 @@
-
@@ -347,6 +346,7 @@
+