use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class MellonAutoLoginProcessorTest method getTenant.
private Tenant getTenant() {
AttributeDefinition firstNameDef = new AttributeDefinition(FIRST_NAME_ATTRIB_NAME);
AttributeDefinition lastNameDef = new AttributeDefinition(LAST_NAME_ATTRIB_NAME);
Tenant tenant = new Tenant();
tenant.setName(TENANT_NAME);
tenant.setSsoEnabled(true);
tenant.getAttributeDefinitions().add(firstNameDef);
tenant.getAttributeDefinitions().add(lastNameDef);
return tenant;
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceImplTest method testGetTenant.
@Test
public void testGetTenant() throws Exception {
Tenant actual = tenantService.getTenant(TENANT1_NAME);
Tenant expected = getTenant1();
assertEqualTenants(expected, actual);
verify(tenantRepository).findByName(TENANT1_NAME);
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class ProfileServiceImpl method getProfileByQuery.
@Override
public Profile getProfileByQuery(String tenantName, String query, String... attributesToReturn) throws ProfileException {
checkIfManageProfilesIsAllowed(tenantName);
Tenant tenant = getTenant(tenantName);
try {
Profile profile = profileRepository.findOneByQuery(getFinalQuery(tenant, query), attributesToReturn);
filterNonReadableAttributes(tenant, profile);
return profile;
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_GET_PROFILE_BY_QUERY_ERROR, e, query);
}
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceImplTest method testCreateTenant.
@Test
public void testCreateTenant() throws Exception {
Tenant actual = tenantService.createTenant(getTenant1());
Tenant expected = getTenant1();
assertEqualTenants(expected, actual);
verify(tenantRepository).insert(actual);
}
use of org.craftercms.profile.api.Tenant in project profile by craftercms.
the class TenantServiceImplTest method testVerifyNewProfiles.
@Test
public void testVerifyNewProfiles() throws Exception {
Tenant expected = getTenant1();
expected.setVerifyNewProfiles(false);
Map<String, Object> expectedSetParams = new HashMap<>();
expectedSetParams.put("verifyNewProfiles", expected.isVerifyNewProfiles());
Tenant actual = tenantService.verifyNewProfiles(TENANT1_NAME, false);
assertEqualTenants(expected, actual);
verify(tenantRepository).findByName(TENANT1_NAME);
verify(tenantRepository).update(TENANT1_ID.toString(), "{$set: #}", false, false, expectedSetParams);
}
Aggregations