Examples of MongoMappingContext


Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

   */
  @Test
  public void lifecycleCallbacksAreInvokedInAppropriateOrder() {

    AbstractApplicationContext context = new AnnotationConfigApplicationContext(SampleMongoConfiguration.class);
    MongoMappingContext mappingContext = context.getBean(MongoMappingContext.class);
    BasicMongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(Entity.class);
    StandardEvaluationContext spElContext = (StandardEvaluationContext) ReflectionTestUtils.getField(entity, "context");

    assertThat(spElContext.getBeanResolver(), is(notNullValue()));
    context.close();
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void setUp() {

    when(metadataMock.getDomainType()).thenReturn((Class) Person.class);
    when(metadataMock.getReturnedDomainClass(Matchers.any(Method.class))).thenReturn((Class) Person.class);
    mappingContext = new MongoMappingContext();
    DbRefResolver dbRefResolver = new DefaultDbRefResolver(mock(MongoDbFactory.class));
    MongoConverter converter = new MappingMongoConverter(dbRefResolver, mappingContext);

    when(mongoOperationsMock.getConverter()).thenReturn(converter);
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

  MongoMappingContext context;

  @Before
  public void setUp() {
    context = new MongoMappingContext();
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

    when(collection.find(Mockito.any(DBObject.class))).thenReturn(cursor);
    when(cursor.limit(anyInt())).thenReturn(cursor);
    when(cursor.sort(Mockito.any(DBObject.class))).thenReturn(cursor);
    when(cursor.hint(anyString())).thenReturn(cursor);

    this.mappingContext = new MongoMappingContext();
    this.converter = new MappingMongoConverter(new DefaultDbRefResolver(factory), mappingContext);
    this.template = new MongoTemplate(factory, converter);
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

  @Test
  public void registersDefaultEntityIndexCreatorIfApplicationContextHasOneForDifferentMappingContext() {

    GenericApplicationContext applicationContext = new GenericApplicationContext();
    applicationContext.getBeanFactory().registerSingleton("foo",
        new MongoPersistentEntityIndexCreator(new MongoMappingContext(), factory));
    applicationContext.refresh();

    GenericApplicationContext spy = spy(applicationContext);

    MongoTemplate mongoTemplate = new MongoTemplate(factory, converter);
View Full Code Here

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext

    this.mongo = new MongoClient();

    SimpleMongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(this.mongo, DATABASE_NAME);

    MongoMappingContext context = new MongoMappingContext();
    context.setInitialEntitySet(Collections.singleton(Person.class));
    context.afterPropertiesSet();

    this.converter = new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory), context);
    this.operations = new MongoTemplate(new SimpleMongoDbFactory(this.mongo, DATABASE_NAME), converter);

    MongoRepositoryFactoryBean<PersonRepository, Person, ObjectId> factory = new MongoRepositoryFactoryBean<PersonRepository, Person, ObjectId>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.