Package org.springframework.data.mongodb.core.mapping

Examples of org.springframework.data.mongodb.core.mapping.MongoMappingContext.initialize()


   */
  @Test
  public void isIndexCreatorForMappingContextHandedIntoConstructor() {

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.initialize();

    MongoPersistentEntityIndexCreator creator = new MongoPersistentEntityIndexCreator(mappingContext, factory);
    assertThat(creator.isIndexCreatorFor(mappingContext), is(true));
    assertThat(creator.isIndexCreatorFor(new MongoMappingContext()), is(false));
  }
View Full Code Here


  private static MongoMappingContext prepareMappingContext(Class<?> type) {

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.setInitialEntitySet(Collections.singleton(type));
    mappingContext.initialize();

    return mappingContext;
  }

  @Document
View Full Code Here

        PersonWith_idPropertyOfTypeString.class, PersonWithIdPropertyOfTypeObjectId.class,
        PersonWithIdPropertyOfTypeString.class, PersonWithIdPropertyOfTypeInteger.class,
        PersonWithIdPropertyOfTypeBigInteger.class, PersonWithIdPropertyOfPrimitiveInt.class,
        PersonWithIdPropertyOfTypeLong.class, PersonWithIdPropertyOfPrimitiveLong.class)));
    mappingContext.setSimpleTypeHolder(conversions.getSimpleTypeHolder());
    mappingContext.initialize();

    DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory);
    MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, mappingContext);
    mappingConverter.setCustomConversions(conversions);
    mappingConverter.afterPropertiesSet();
View Full Code Here

  @SuppressWarnings("unchecked")
  public void setMongo(Mongo mongo) throws Exception {

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.setInitialEntitySet(new HashSet<Class<?>>(Arrays.asList(XObject.class)));
    mappingContext.initialize();

    DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory);
    MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, mappingContext);
    mappingConverter.afterPropertiesSet();
View Full Code Here

  @SuppressWarnings("unchecked")
  public void setMongo(Mongo mongo) throws Exception {

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.setInitialEntitySet(new HashSet<Class<?>>(Arrays.asList(ValueObject.class)));
    mappingContext.initialize();

    DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory);
    MappingMongoConverter mappingConverter = new MappingMongoConverter(dbRefResolver, mappingContext);
    mappingConverter.afterPropertiesSet();
    this.mongoTemplate = new MongoTemplate(factory, mappingConverter);
View Full Code Here

  private static MongoMappingContext prepareMappingContext(Class<?> type) {

    MongoMappingContext mappingContext = new MongoMappingContext();
    mappingContext.setInitialEntitySet(Collections.singleton(type));
    mappingContext.initialize();

    return mappingContext;
  }

  private static void assertIndexPathAndCollection(String expectedPath, String expectedCollection,
View Full Code Here

    SampleMongoConfiguration configuration = new SampleMongoConfiguration();
    MongoMappingContext context = configuration.mongoMappingContext();

    assertThat(context.getPersistentEntities(), is(emptyIterable()));
    context.initialize();
    assertThat(context.getPersistentEntities(), is(not(emptyIterable())));
  }

  /**
   * @see DATAMONGO-717
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.