Package org.springframework.data.mongodb.core.convert

Examples of org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider


  }

  @SuppressWarnings("deprecation")
  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullMongoDbFactory() {
    new MappingMongoConverter((MongoDbFactory) null, context);
  }
View Full Code Here


    new MappingMongoConverter((MongoDbFactory) null, context);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullDbRefResolver() {
    new MappingMongoConverter((DbRefResolver) null, context);
  }
View Full Code Here

    new MappingMongoConverter((DbRefResolver) null, context);
  }

  @Test(expected = IllegalArgumentException.class)
  public void rejectsNullContext() {
    new MappingMongoConverter(resolver, null);
  }
View Full Code Here

  @Before
  public void setUp() {

    MongoMappingContext context = new MongoMappingContext();

    this.converter = new MappingMongoConverter(dbFactory, context);
    this.serializer = new SpringDataMongodbSerializer(converter);
  }
View Full Code Here

    when(persitentEntityMock.getCollection()).thenReturn("persons");
    when(mappingContextMock.getPersistentEntity(Matchers.any(Class.class))).thenReturn(persitentEntityMock);
    when(persitentEntityMock.getType()).thenReturn(Person.class);

    DbRefResolver dbRefResolver = new DefaultDbRefResolver(mock(MongoDbFactory.class));
    MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mappingContextMock);
    converter.afterPropertiesSet();

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

        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();

    this.mappingTemplate = new MongoTemplate(factory, mappingConverter);
  }
View Full Code Here

   */
  @Test
  public void hasCustomTypeMapper() {

    loadValidConfiguration();
    MappingMongoConverter converter = factory.getBean("converter", MappingMongoConverter.class);
    MongoTypeMapper customMongoTypeMapper = factory.getBean(CustomMongoTypeMapper.class);

    assertThat(converter.getTypeMapper(), is(customMongoTypeMapper));
  }
View Full Code Here

  @Before
  public void setUp() {

    this.context = new MongoMappingContext();
    this.converter = new MappingMongoConverter(dbRefResolver, context);
    this.mapper = new QueryMapper(converter);
  }
View Full Code Here

  }

  @Test
  public void shouldConvertCompoundExpressionToPropertyPath() {

    MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, new MongoMappingContext());
    TypeBasedAggregationOperationContext ctxt = new TypeBasedAggregationOperationContext(Data.class,
        new MongoMappingContext(), new QueryMapper(converter));
    assertThat(transformer.transform("item.primitiveIntValue", ctxt, new Object[0]).toString(),
        is("$item.primitiveIntValue"));
  }
View Full Code Here

  public void shouldThrowExceptionIfNestedPropertyCannotBeFound() {

    exception.expect(MappingException.class);
    exception.expectMessage("value2");

    MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, new MongoMappingContext());
    TypeBasedAggregationOperationContext ctxt = new TypeBasedAggregationOperationContext(Data.class,
        new MongoMappingContext(), new QueryMapper(converter));
    assertThat(transformer.transform("item.value2", ctxt, new Object[0]).toString(), is("$item.value2"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider

Copyright © 2018 www.massapicom. 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.