Examples of SimpleTypeHolder


Examples of org.springframework.data.mapping.model.SimpleTypeHolder

   */
  @Test
  public void rejectsInvalidValueReturnedByFieldNamingStrategy() {

    Field field = ReflectionUtils.findField(Person.class, "lastname");
    MongoPersistentProperty property = new BasicMongoPersistentProperty(field, null, entity, new SimpleTypeHolder(),
        InvalidFieldNamingStrategy.INSTANCE);

    exception.expect(MappingException.class);
    exception.expectMessage(InvalidFieldNamingStrategy.class.getName());
    exception.expectMessage(property.toString());
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

  private MongoPersistentProperty getPropertyFor(MongoPersistentEntity<?> persistentEntity, String fieldname) {
    return getPropertyFor(persistentEntity, ReflectionUtils.findField(persistentEntity.getType(), fieldname));
  }

  private MongoPersistentProperty getPropertyFor(MongoPersistentEntity<?> persistentEntity, Field field) {
    return new BasicMongoPersistentProperty(field, null, persistentEntity, new SimpleTypeHolder(),
        PropertyNameFieldNamingStrategy.INSTANCE);
  }
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

  private SimpleSolrPersistentProperty getPersistentProperty(Class<?> clazz, String propertyName)
      throws IntrospectionException {
    PropertyDescriptor descriptor = new PropertyDescriptor(propertyName, clazz);
    java.lang.reflect.Field field = org.springframework.util.ReflectionUtils.findField(clazz, propertyName);

    return new SimpleSolrPersistentProperty(field, descriptor, persistentEntity, new SimpleTypeHolder());
  }
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

  private SimpleSolrPersistentProperty getPersistentProperty(Class<?> clazz, String propertyName)
      throws IntrospectionException {
    PropertyDescriptor descriptor = new PropertyDescriptor(propertyName, clazz);
    java.lang.reflect.Field field = org.springframework.util.ReflectionUtils.findField(clazz, propertyName);

    return new SimpleSolrPersistentProperty(field, descriptor, persistentEntity, new SimpleTypeHolder());
  }
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

  @Test
  public void testIdType() throws NoSuchFieldException, SecurityException {
    Mockito.when(persistentEntity.getTypeInformation()).thenReturn(ClassTypeInformation.from(ProductBean.class));
    SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(ProductBean.class.getDeclaredField("id"),
        null, persistentEntity, new SimpleTypeHolder());
    Mockito.when(persistentEntity.getIdProperty()).thenReturn(property);

    SolrEntityInformation<ProductBean, String> entityInformation = new MappingSolrEntityInformation<ProductBean, String>(
        persistentEntity);
    Assert.assertEquals(String.class, entityInformation.getIdType());
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

    Mockito.when(persistentEntityWithLongIdFieldType.getTypeInformation()).thenReturn(
        ClassTypeInformation.from(ProductBeanWithLongIdFieldType.class));

    SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(
        ProductBeanWithLongIdFieldType.class.getDeclaredField("id"), null, persistentEntityWithLongIdFieldType,
        new SimpleTypeHolder());
    Mockito.when(persistentEntityWithLongIdFieldType.getIdProperty()).thenReturn(property);

    SolrEntityInformation<ProductBeanWithLongIdFieldType, Long> entityInformation = new MappingSolrEntityInformation<ProductBeanWithLongIdFieldType, Long>(
        persistentEntityWithLongIdFieldType);
    Assert.assertEquals(Long.class, entityInformation.getIdType());
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

  @Test
  public void testGetIdAttribute() throws NoSuchFieldException, SecurityException {
    Mockito.when(persistentEntity.getTypeInformation()).thenReturn(ClassTypeInformation.from(ProductBean.class));
    SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(ProductBean.class.getDeclaredField("id"),
        null, persistentEntity, new SimpleTypeHolder());
    Mockito.when(persistentEntity.getIdProperty()).thenReturn(property);

    SolrEntityInformation<ProductBean, String> entityInformation = new MappingSolrEntityInformation<ProductBean, String>(
        persistentEntity);
    Assert.assertEquals("id", entityInformation.getIdAttribute());
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

    Mockito.when(persistentEntityWithAlternateFieldNameForId.getTypeInformation()).thenReturn(
        ClassTypeInformation.from(ProductBeanWithAlternateFieldNameForId.class));

    SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(
        ProductBeanWithAlternateFieldNameForId.class.getDeclaredField("productId"), null,
        persistentEntityWithAlternateFieldNameForId, new SimpleTypeHolder());
    Mockito.when(persistentEntityWithAlternateFieldNameForId.getIdProperty()).thenReturn(property);

    SolrEntityInformation<ProductBeanWithAlternateFieldNameForId, String> entityInformation = new MappingSolrEntityInformation<ProductBeanWithAlternateFieldNameForId, String>(
        persistentEntityWithAlternateFieldNameForId);
    Assert.assertEquals("product_id", entityInformation.getIdAttribute());
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

        TypeInformation typeInformation = ClassTypeInformation.from(EntityWithWrongVersionType.class);
        SimpleElasticsearchPersistentProperty persistentProperty =
                new SimpleElasticsearchPersistentProperty(EntityWithWrongVersionType.class.getDeclaredField("version"),
                        new PropertyDescriptor("version", EntityWithWrongVersionType.class),
                        new SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType>(typeInformation),
                        new SimpleTypeHolder());

        //when
        new SimpleElasticsearchPersistentEntity(typeInformation).addPersistentProperty(persistentProperty);
    }
View Full Code Here

Examples of org.springframework.data.mapping.model.SimpleTypeHolder

        TypeInformation typeInformation = ClassTypeInformation.from(EntityWithMultipleVersionField.class);
        SimpleElasticsearchPersistentProperty persistentProperty1 =
                new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version1"),
                        new PropertyDescriptor("version1", EntityWithMultipleVersionField.class),
                        new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
                        new SimpleTypeHolder());

        SimpleElasticsearchPersistentProperty persistentProperty2 =
                new SimpleElasticsearchPersistentProperty(EntityWithMultipleVersionField.class.getDeclaredField("version2"),
                        new PropertyDescriptor("version2", EntityWithMultipleVersionField.class),
                        new SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField>(typeInformation),
                        new SimpleTypeHolder());

        SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity(typeInformation);
        simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty1);
        //when
        simpleElasticsearchPersistentEntity.addPersistentProperty(persistentProperty2);
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.