Search in sources :

Example 1 with PersistentEntities

use of org.springframework.data.mapping.context.PersistentEntities in project spring-data-commons by spring-projects.

the class MappingAuditableBeanWrapperFactoryUnitTests method setUp.

@Before
public void setUp() {
    SampleMappingContext context = new SampleMappingContext();
    context.getPersistentEntity(Sample.class);
    context.getPersistentEntity(SampleWithInstant.class);
    PersistentEntities entities = new PersistentEntities(Collections.singleton(context));
    factory = new MappingAuditableBeanWrapperFactory(entities);
}
Also used : PersistentEntities(org.springframework.data.mapping.context.PersistentEntities) SampleMappingContext(org.springframework.data.mapping.context.SampleMappingContext) Before(org.junit.Before)

Example 2 with PersistentEntities

use of org.springframework.data.mapping.context.PersistentEntities in project spring-data-mongodb by spring-projects.

the class AuditingEntityCallbackUnitTests method setUp.

@BeforeEach
void setUp() {
    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.getPersistentEntity(Sample.class);
    handler = spy(new IsNewAwareAuditingHandler(new PersistentEntities(Arrays.asList(mappingContext))));
    callback = new AuditingEntityCallback(() -> handler);
}
Also used : IsNewAwareAuditingHandler(org.springframework.data.auditing.IsNewAwareAuditingHandler) PersistentEntities(org.springframework.data.mapping.context.PersistentEntities) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with PersistentEntities

use of org.springframework.data.mapping.context.PersistentEntities in project spring-data-mongodb by spring-projects.

the class AuditingEventListenerUnitTests method setUp.

@BeforeEach
void setUp() {
    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.getPersistentEntity(Sample.class);
    handler = spy(new IsNewAwareAuditingHandler(new PersistentEntities(Arrays.asList(mappingContext))));
    listener = new AuditingEventListener(() -> handler);
}
Also used : IsNewAwareAuditingHandler(org.springframework.data.auditing.IsNewAwareAuditingHandler) PersistentEntities(org.springframework.data.mapping.context.PersistentEntities) MongoMappingContext(org.springframework.data.mongodb.core.mapping.MongoMappingContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PersistentEntities (org.springframework.data.mapping.context.PersistentEntities)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 IsNewAwareAuditingHandler (org.springframework.data.auditing.IsNewAwareAuditingHandler)2 MongoMappingContext (org.springframework.data.mongodb.core.mapping.MongoMappingContext)2 Before (org.junit.Before)1 SampleMappingContext (org.springframework.data.mapping.context.SampleMappingContext)1