use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_FindPrimaryOwnerTest method testGroupModeWithNonExistingPOGroupAndCurrentUserBelongsToAPoGroup.
@Test
public void testGroupModeWithNonExistingPOGroupAndCurrentUserBelongsToAPoGroup() {
setPrimaryOwnerMode("GROUP");
setPoGroupNonExisting();
addUserInPOGroup(CURRENT_USER, CURRENT_USER_PO_GROUP);
JsonNode definition = poGroupDefinition();
final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
assertEquals(CURRENT_USER_PO_GROUP, primaryOwner.getId());
assertEquals("GROUP", primaryOwner.getType());
}
use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_FindPrimaryOwnerTest method testHybridModeWithNonExistingPOGroupAndCurrentUserDoesNotBelongToAPoGroup.
@Test
public void testHybridModeWithNonExistingPOGroupAndCurrentUserDoesNotBelongToAPoGroup() {
setPrimaryOwnerMode("HYBRID");
setPoGroupNonExisting();
setCurrentUserInNoPOGroup();
defineUser(CURRENT_USER);
JsonNode definition = poGroupDefinition();
final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
assertEquals(CURRENT_USER, primaryOwner.getId());
assertEquals("USER", primaryOwner.getType());
}
use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_FindPrimaryOwnerTest method testGroupModeWithExistingPOUserAndPoUserDoesNotBelongToAPoGroupAndCurrentUserBelongsToAPoGroup.
@Test
public void testGroupModeWithExistingPOUserAndPoUserDoesNotBelongToAPoGroupAndCurrentUserBelongsToAPoGroup() {
setPrimaryOwnerMode("GROUP");
defineUser(PO_USER_ID);
setPoUserInNoPOGroup();
addUserInPOGroup(CURRENT_USER, CURRENT_USER_PO_GROUP);
JsonNode definition = poUserDefinition();
final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
assertEquals(CURRENT_USER_PO_GROUP, primaryOwner.getId());
assertEquals("GROUP", primaryOwner.getType());
}
use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_FindPrimaryOwnerTest method testGroupModeWithExistingPOUserAndPoUserBelongsToAPoGroup.
// GROUP + import with PO User
@Test
public void testGroupModeWithExistingPOUserAndPoUserBelongsToAPoGroup() {
setPrimaryOwnerMode("GROUP");
defineUser(PO_USER_ID);
addUserInPOGroup(PO_USER_ID, PO_GROUP_ID);
JsonNode definition = poUserDefinition();
final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
assertEquals(PO_GROUP_ID, primaryOwner.getId());
assertEquals("GROUP", primaryOwner.getType());
}
use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.
the class MetadataServiceTest method checkMetadataFormat_badEmailFormat_EL.
@Test(expected = TechnicalManagementException.class)
public void checkMetadataFormat_badEmailFormat_EL() throws TemplateException {
when(this.notificationTemplateService.resolveInlineTemplateWithParam(anyString(), any(Reader.class), any())).thenReturn("test");
UserEntity userEntity = new UserEntity();
userEntity.setEmail("test");
PrimaryOwnerEntity primaryOwnerEntity = new PrimaryOwnerEntity(userEntity);
ApiEntity apiEntity = new ApiEntity();
apiEntity.setPrimaryOwner(primaryOwnerEntity);
metadataService.checkMetadataFormat(MetadataFormat.MAIL, "${api.primaryOwner.email}", API, apiEntity);
}
Aggregations