use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project cas by apereo.
the class CasCoreConfigurationUtilsTests method verifyMappingCollections.
@Test
public void verifyMappingCollections() {
val props = new CasConfigurationProperties();
val ldap = new LdapAuthenticationProperties();
ldap.setLdapUrl("http://localhost:1234");
ldap.setBaseDn("ou=example");
ldap.setBindDn("admin-user");
ldap.setBindCredential("admin-psw");
props.getAuthn().getLdap().add(ldap);
val filters = new SimpleFilterProvider().setFailOnUnknownId(false).addFilter(CasConfigurationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept("authn")).addFilter(AuthenticationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept("ldap"));
val map = CasCoreConfigurationUtils.asMap(props.withHolder(), filters);
assertTrue(map.keySet().stream().allMatch(key -> key.startsWith("cas.authn.ldap")));
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project cas by apereo.
the class CasCoreConfigurationUtilsTests method verifyMappingByPropertyRef.
@Test
public void verifyMappingByPropertyRef() {
val props = new CasConfigurationProperties();
props.getAuthn().getSyncope().setName("SyncopeAuth");
props.getAuthn().getSyncope().setUrl("https://github.com/apereo/cas");
props.getAuthn().getSyncope().setDomain("Master");
val filters = new SimpleFilterProvider().setFailOnUnknownId(false).addFilter(CasConfigurationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept(CasCoreConfigurationUtils.getPropertyName(CasConfigurationProperties.class, CasConfigurationProperties::getAuthn))).addFilter(AuthenticationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept(CasCoreConfigurationUtils.getPropertyName(AuthenticationProperties.class, AuthenticationProperties::getSyncope)));
val map = CasCoreConfigurationUtils.asMap(props.withHolder(), filters);
assertTrue(map.keySet().stream().allMatch(key -> key.startsWith("cas.authn.syncope")));
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project uPortal by Jasig.
the class AnalyticsIncorporationComponentEventSerializationTest method testMixinNoCopy.
@Test
public void testMixinNoCopy() throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.findAndRegisterModules();
mapper.addMixInAnnotations(Object.class, PortletRenderExecutionEventFilterMixIn.class);
final FilterProvider filterProvider = new SimpleFilterProvider().addFilter(PortletRenderExecutionEventFilterMixIn.FILTER_NAME, SimpleBeanPropertyFilter.filterOutAllExcept("fname", "executionTimeNano", "parameters"));
final ObjectWriter portletEventWriter = mapper.writer(filterProvider);
final String result = portletEventWriter.writeValueAsString(createEvent());
assertEquals("{\"@c\":\".PortletRenderExecutionEvent\",\"fname\":\"fname1\",\"executionTimeNano\":123450000,\"parameters\":{}}", result);
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project uPortal by Jasig.
the class JpaStatisticalSummaryTest method testStorelessUnivariateStatistic.
public void testStorelessUnivariateStatistic(StorelessUnivariateStatistic sus, double expected) throws Exception {
assertEquals(expected, sus.getResult(), 0.1);
final ObjectMapper mapper = new ObjectMapper();
mapper.findAndRegisterModules();
// Configure Jackson to just use fields
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
mapper.setVisibility(PropertyAccessor.GETTER, Visibility.NONE);
mapper.setVisibility(PropertyAccessor.IS_GETTER, Visibility.NONE);
mapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE);
mapper.setVisibility(PropertyAccessor.CREATOR, Visibility.NONE);
mapper.addMixInAnnotations(Object.class, IgnoreTypeMixIn.class);
final FilterProvider filters = new SimpleFilterProvider().addFilter("storedDataFilter", SimpleBeanPropertyFilter.serializeAllExcept("storedData"));
final ObjectWriter ssWriter = mapper.writer(filters);
final ObjectReader ssReader = mapper.reader(sus.getClass());
final String susString = ssWriter.writeValueAsString(sus);
System.out.println(susString);
final StorelessUnivariateStatistic newSus = ssReader.readValue(susString);
assertEquals(expected, newSus.getResult(), 0.1);
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project snow-owl by b2ihealthcare.
the class FhirTest method applyFilter.
protected void applyFilter(Object filteredObject) {
SimpleFilterProvider filterProvider = new SimpleFilterProvider().setFailOnUnknownId(false);
MappingJacksonValue mappingJacksonValue = new MappingJacksonValue(filteredObject);
mappingJacksonValue.setFilters(filterProvider);
objectMapper.setFilterProvider(filterProvider);
}
Aggregations