Search in sources :

Example 16 with PrimaryOwnerEntity

use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.

the class ApiService_FindPrimaryOwnerTest method testHybridModeWithNonExistingPOGroupAndCurrentUserBelongsToAPoGroup.

@Test
public void testHybridModeWithNonExistingPOGroupAndCurrentUserBelongsToAPoGroup() {
    setPrimaryOwnerMode("HYBRID");
    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());
}
Also used : PrimaryOwnerEntity(io.gravitee.rest.api.model.PrimaryOwnerEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 17 with PrimaryOwnerEntity

use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.

the class ApiService_FindPrimaryOwnerTest method testHybridModeWithExistingPOUser.

// HYBRID + import with PO User
@Test
public void testHybridModeWithExistingPOUser() {
    setPrimaryOwnerMode("HYBRID");
    defineUser(PO_USER_ID);
    JsonNode definition = poUserDefinition();
    final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
    assertEquals(PO_USER_ID, primaryOwner.getId());
    assertEquals("USER", primaryOwner.getType());
}
Also used : PrimaryOwnerEntity(io.gravitee.rest.api.model.PrimaryOwnerEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 18 with PrimaryOwnerEntity

use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.

the class ApiService_FindPrimaryOwnerTest method testHybridModeWithNonExistingPOUser.

@Test
public void testHybridModeWithNonExistingPOUser() {
    setPrimaryOwnerMode("HYBRID");
    setPoUserNonExisting();
    defineUser(CURRENT_USER);
    JsonNode definition = poUserDefinition();
    final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
    assertEquals(CURRENT_USER, primaryOwner.getId());
    assertEquals("USER", primaryOwner.getType());
}
Also used : PrimaryOwnerEntity(io.gravitee.rest.api.model.PrimaryOwnerEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 19 with PrimaryOwnerEntity

use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.

the class ApiService_FindPrimaryOwnerTest method testUserModeWithPOGroup.

// USER + import with PO GROUP
@Test
public void testUserModeWithPOGroup() {
    setPrimaryOwnerMode("USER");
    defineUser(CURRENT_USER);
    JsonNode definition = poGroupDefinition();
    final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
    assertEquals(CURRENT_USER, primaryOwner.getId());
    assertEquals("USER", primaryOwner.getType());
}
Also used : PrimaryOwnerEntity(io.gravitee.rest.api.model.PrimaryOwnerEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 20 with PrimaryOwnerEntity

use of io.gravitee.rest.api.model.PrimaryOwnerEntity in project gravitee-management-rest-api by gravitee-io.

the class ApiService_FindPrimaryOwnerTest method testHybridModeWithExistingPOGroup.

// HYBRID + import with PO GROUP
@Test
public void testHybridModeWithExistingPOGroup() {
    setPrimaryOwnerMode("HYBRID");
    defineGroup(PO_GROUP_ID);
    JsonNode definition = poGroupDefinition();
    final PrimaryOwnerEntity primaryOwner = apiService.findPrimaryOwner(definition, CURRENT_USER);
    assertEquals(PO_GROUP_ID, primaryOwner.getId());
    assertEquals("GROUP", primaryOwner.getType());
}
Also used : PrimaryOwnerEntity(io.gravitee.rest.api.model.PrimaryOwnerEntity) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Aggregations

PrimaryOwnerEntity (io.gravitee.rest.api.model.PrimaryOwnerEntity)26 Test (org.junit.Test)23 JsonNode (com.fasterxml.jackson.databind.JsonNode)16 UserEntity (io.gravitee.rest.api.model.UserEntity)9 ApiEntity (io.gravitee.rest.api.model.api.ApiEntity)8 ApplicationEntity (io.gravitee.rest.api.model.ApplicationEntity)3 ApplicationListItem (io.gravitee.rest.api.model.application.ApplicationListItem)3 Assert (org.junit.Assert)3 Before (org.junit.Before)3 Mockito (org.mockito.Mockito)3 NOT_FOUND_404 (io.gravitee.common.http.HttpStatusCode.NOT_FOUND_404)2 OK_200 (io.gravitee.common.http.HttpStatusCode.OK_200)2 Proxy (io.gravitee.definition.model.Proxy)2 VirtualHost (io.gravitee.definition.model.VirtualHost)2 RatingSummaryEntity (io.gravitee.rest.api.model.RatingSummaryEntity)2 SubscriptionEntity (io.gravitee.rest.api.model.SubscriptionEntity)2 TopHitsAnalytics (io.gravitee.rest.api.model.analytics.TopHitsAnalytics)2 GroupByQuery (io.gravitee.rest.api.model.analytics.query.GroupByQuery)2 ApiEntrypointEntity (io.gravitee.rest.api.model.api.ApiEntrypointEntity)2 ApiQuery (io.gravitee.rest.api.model.api.ApiQuery)2