use of io.gravitee.rest.api.service.jackson.filter.ApiPermissionFilter in project gravitee-management-rest-api by gravitee-io.
the class ApiService_SearchTest 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_UpdateTest method setUp.
@Before
public void setUp() {
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
objectMapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
GraviteeContext.setCurrentEnvironment("DEFAULT");
final SecurityContext securityContext = mock(SecurityContext.class);
when(securityContext.getAuthentication()).thenReturn(mock(Authentication.class));
SecurityContextHolder.setContext(securityContext);
when(api.getId()).thenReturn(API_ID);
when(api.getDefinition()).thenReturn("{\"id\": \"" + API_ID + "\",\"name\": \"" + API_NAME + "\",\"proxy\": {\"context_path\": \"/old\"}}");
when(api.getEnvironmentId()).thenReturn("DEFAULT");
when(notificationTemplateService.resolveInlineTemplateWithParam(anyString(), any(Reader.class), any())).thenReturn("toDecode=decoded-value");
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 ServiceConfiguration method objectMapper.
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new GraviteeMapper();
PropertyFilter apiMembershipTypeFilter = new ApiPermissionFilter();
objectMapper.setFilterProvider(new SimpleFilterProvider(Collections.singletonMap("apiMembershipTypeFilter", apiMembershipTypeFilter)));
objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
// register API serializer
SimpleModule module = new SimpleModule();
module.addSerializer(ApiEntity.class, apiSerializer());
objectMapper.registerModule(module);
return objectMapper;
}
Aggregations