public void testCreateTenant() {
loginAsSysTenantAdmin();
assertNotNull( systemTenant );
assertTrue( systemTenant.isEnabled() );
ITenant tenantRoot =
tenantManager.createTenant( systemTenant, TenantUtils.TENANTID_SINGLE_TENANT, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( tenantRoot, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
assertNotNull( tenantRoot );
assertTrue( tenantRoot.isEnabled() );
ITenant subTenantRoot =
tenantManager.createTenant( tenantRoot, TENANT_ID_APPLE, tenantAdminRoleName,
tenantAuthenticatedRoleName, ANONYMOUS_ROLE_NAME );
userRoleDao.createUser( subTenantRoot, USERNAME_ADMIN, PASSWORD, "", new String[]{ tenantAdminRoleName } );
assertNotNull( subTenantRoot );
assertTrue( subTenantRoot.isEnabled() );
List<ITenant> childTenants = tenantManager.getChildTenants( tenantRoot );
assertTrue( childTenants.size() == 1 );
assertTrue( childTenants.get( 0 ).equals( subTenantRoot ) );
cleanupUserAndRoles( tenantRoot );