Example usage for org.springframework.data.keyvalue.core.mapping.context KeyValueMappingContext KeyValueMappingContext

List of usage examples for org.springframework.data.keyvalue.core.mapping.context KeyValueMappingContext KeyValueMappingContext

Introduction

In this page you can find the example usage for org.springframework.data.keyvalue.core.mapping.context KeyValueMappingContext KeyValueMappingContext.

Prototype

KeyValueMappingContext

Source Link

Usage

From source file:org.springframework.data.rest.webmvc.json.JacksonMetadataUnitTests.java

@Before
public void setUp() {

    this.context = new KeyValueMappingContext();

    this.mapper = new ObjectMapper();
    this.mapper.disable(MapperFeature.INFER_PROPERTY_MUTATORS);
}

From source file:org.springframework.data.rest.webmvc.json.DomainObjectReaderUnitTests.java

@Before
public void setUp() {

    KeyValueMappingContext mappingContext = new KeyValueMappingContext();
    mappingContext.getPersistentEntity(SampleUser.class);
    mappingContext.getPersistentEntity(Person.class);
    mappingContext.getPersistentEntity(TypeWithGenericMap.class);
    mappingContext.getPersistentEntity(VersionedType.class);
    mappingContext.afterPropertiesSet();

    PersistentEntities entities = new PersistentEntities(Collections.singleton(mappingContext));

    this.reader = new DomainObjectReader(entities,
            new Associations(mappings, mock(RepositoryRestConfiguration.class)));
}

From source file:org.springframework.data.rest.webmvc.json.PersistentEntityJackson2ModuleUnitTests.java

@Before
public void setUp() {

    KeyValueMappingContext mappingContext = new KeyValueMappingContext();
    mappingContext.getPersistentEntity(Sample.class);
    mappingContext.getPersistentEntity(SampleWithAdditionalGetters.class);
    mappingContext.getPersistentEntity(PersistentEntityJackson2ModuleUnitTests.PetOwner.class);

    this.persistentEntities = new PersistentEntities(Arrays.asList(mappingContext));

    ResourceProcessorInvoker invoker = new ResourceProcessorInvoker(
            Collections.<ResourceProcessor<?>>emptyList());

    NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities,
            new EmbeddedResourcesAssembler(persistentEntities, associations, mock(ExcerptProjector.class)),
            invoker);//ww w. j a v a  2  s .c om
    OrderAwarePluginRegistry<EntityLookup<?>, Class<?>> lookups = OrderAwarePluginRegistry.create();

    SimpleModule module = new SimpleModule();

    module.setSerializerModifier(new AssociationOmittingSerializerModifier(persistentEntities, associations,
            nestedEntitySerializer, new LookupObjectSerializer(lookups)));
    module.setDeserializerModifier(new AssociationUriResolvingDeserializerModifier(persistentEntities,
            associations, converter, mock(RepositoryInvokerFactory.class)));

    this.mapper = new ObjectMapper();
    this.mapper.registerModule(module);
}