use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceIT method testGetTenant.
@Test
public void testGetTenant() throws Exception {
Tenant tenant = tenantService.getTenant(DEFAULT_TENANT_NAME);
assertNotNull(tenant);
assertNotNull(tenant.getId());
assertEquals(DEFAULT_TENANT_NAME, tenant.getName());
assertEquals(false, tenant.isVerifyNewProfiles());
assertEquals(DEFAULT_ROLES, tenant.getAvailableRoles());
assertEqualAttributeDefinitions(getAttributeDefinitions(), tenant.getAttributeDefinitions());
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceIT method testVerifyNewProfiles.
@Test
public void testVerifyNewProfiles() throws Exception {
tenantService.createTenant(getCorporateTenant());
try {
Tenant tenant = tenantService.verifyNewProfiles(CORPORATE_TENANT_NAME, false);
assertNotNull(tenant);
assertEquals(false, tenant.isVerifyNewProfiles());
} finally {
tenantService.deleteTenant(CORPORATE_TENANT_NAME);
}
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceIT method testAddRoles.
@Test
public void testAddRoles() throws Exception {
tenantService.createTenant(getCorporateTenant());
try {
Tenant tenant = tenantService.addRoles(CORPORATE_TENANT_NAME, Arrays.asList(USER_ROLE));
Set<String> expectedRoles = new HashSet<>(CORPORATE_ROLES);
expectedRoles.add(USER_ROLE);
assertNotNull(tenant);
assertEquals(expectedRoles, tenant.getAvailableRoles());
} finally {
tenantService.deleteTenant(CORPORATE_TENANT_NAME);
}
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceIT method testAddAttributeDefinitions.
@Test
public void testAddAttributeDefinitions() throws Exception {
tenantService.createTenant(getCorporateTenant());
try {
List<AttributeDefinition> definitions = Arrays.asList(getGenderAttributeDefinition());
Tenant tenant = tenantService.addAttributeDefinitions(CORPORATE_TENANT_NAME, definitions);
List<AttributeDefinition> expected = getAttributeDefinitions();
expected.addAll(definitions);
assertNotNull(tenant);
assertNotNull(tenant.getAttributeDefinitions());
assertEquals(4, tenant.getAttributeDefinitions().size());
assertEquals(expected, tenant.getAttributeDefinitions());
} finally {
tenantService.deleteTenant(CORPORATE_TENANT_NAME);
}
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantControllerTest method testUpdateTenant.
@Test
public void testUpdateTenant() throws Exception {
setCurrentUser(getProfile(TENANT_NAME2, TENANT_ADMIN_ROLE));
Tenant tenant = getTenant(TENANT_ID2, TENANT_NAME2, TENANT_ADMIN_ROLE, PROFILE_ADMIN_ROLE);
Map<String, String> model = controller.updateTenant(tenant);
assertNotNull(model);
assertEquals(1, model.size());
assertEquals(String.format(MSG_TENANT_UPDATED_FORMAT, TENANT_NAME2), model.get(MODEL_MESSAGE));
verify(tenantService).updateTenant(tenant);
}
Aggregations