use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ObjectMapperResolver method registerFilterProvider.
private void registerFilterProvider() {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
mapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
}
use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ObjectMapperResolver method registerFilterProvider.
private void registerFilterProvider() {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
mapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
}
use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ApiService_Update_DefaultLoggingMaxDurationTest method setUp.
@Before
public void setUp() throws TechnicalException {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
objectMapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
when(apiRepository.findById(API_ID)).thenReturn(Optional.of(api));
when(apiRepository.update(any())).thenReturn(api);
when(api.getId()).thenReturn(API_ID);
when(api.getName()).thenReturn(API_NAME);
when(api.getApiLifecycleState()).thenReturn(ApiLifecycleState.CREATED);
existingApi = new UpdateApiEntity();
existingApi.setName(API_NAME);
existingApi.setVersion("v1");
existingApi.setDescription("Ma description");
existingApi.setLifecycleState(io.gravitee.rest.api.model.api.ApiLifecycleState.CREATED);
final Proxy proxy = new Proxy();
EndpointGroup endpointGroup = new EndpointGroup();
endpointGroup.setName("endpointGroupName");
Endpoint endpoint = new HttpEndpoint("endpointName", null);
endpointGroup.setEndpoints(singleton(endpoint));
proxy.setGroups(singleton(endpointGroup));
existingApi.setProxy(proxy);
proxy.setVirtualHosts(Collections.singletonList(new VirtualHost("/context")));
RoleEntity poRoleEntity = new RoleEntity();
poRoleEntity.setName(SystemRole.PRIMARY_OWNER.name());
poRoleEntity.setScope(RoleScope.API);
when(roleService.findPrimaryOwnerRoleByOrganization("DEFAULT", RoleScope.API)).thenReturn(poRoleEntity);
MemberEntity po = new MemberEntity();
po.setId(USER_NAME);
po.setReferenceId(API_ID);
po.setReferenceType(io.gravitee.rest.api.model.MembershipReferenceType.API);
po.setRoles(Collections.singletonList(poRoleEntity));
when(membershipService.getMembersByReferencesAndRole(any(), any(), any())).thenReturn(singleton(po));
mockStatic(System.class);
when(System.currentTimeMillis()).thenReturn(0L);
final SecurityContext securityContext = mock(SecurityContext.class);
when(securityContext.getAuthentication()).thenReturn(mock(Authentication.class));
SecurityContextHolder.setContext(securityContext);
when(notificationTemplateService.resolveInlineTemplateWithParam(anyString(), any(Reader.class), any())).thenReturn("toDecode=decoded-value");
when(parameterService.find(Key.API_PRIMARY_OWNER_MODE, ParameterReferenceType.ENVIRONMENT)).thenReturn("USER");
MembershipEntity primaryOwner = new MembershipEntity();
primaryOwner.setMemberType(MembershipMemberType.USER);
when(membershipService.getPrimaryOwner(eq(MembershipReferenceType.API), any())).thenReturn(primaryOwner);
reset(searchEngineService);
}
use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ApiService_DeleteTest method setUp.
@Before
public void setUp() {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
objectMapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
}
use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ApiService_FindByUserTest method setUp.
@Before
public void setUp() {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
objectMapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
}
Aggregations