}
@Test
public void testIsSubTenant() {
loginAsSysTenantAdmin();
ITenant mainTenant_1 =
tenantManager.createTenant( systemTenant, MAIN_TENANT_1, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( mainTenant_1, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
ITenant mainTenant_2 =
tenantManager.createTenant( systemTenant, MAIN_TENANT_2, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( mainTenant_2, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
ITenant subTenant1_1 =
tenantManager.createTenant( mainTenant_1, SUB_TENANT1_1, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( subTenant1_1, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
ITenant subTenant1_2 =
tenantManager.createTenant( mainTenant_1, SUB_TENANT1_2, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( subTenant1_2, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
ITenant subTenant2_1 =
tenantManager.createTenant( mainTenant_2, SUB_TENANT2_1, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( subTenant2_1, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
ITenant subTenant2_2 =
tenantManager.createTenant( mainTenant_2, SUB_TENANT2_2, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( subTenant2_2, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
assertTrue( tenantManager.isSubTenant( mainTenant_1, mainTenant_1 ) );
assertTrue( tenantManager.isSubTenant( mainTenant_2, mainTenant_2 ) );