Package org.hibernate.search.metadata

Examples of org.hibernate.search.metadata.IndexedTypeDescriptor


    return indexReaderAccessor;
  }

  @Override
  public IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType) {
    IndexedTypeDescriptor typeDescriptor;
    if ( indexedTypeDescriptors.containsKey( entityType ) ) {
      typeDescriptor = indexedTypeDescriptors.get( entityType );
    }
    else {
      EntityIndexBinding indexBinder = indexBindingForEntities.get( entityType );
      IndexedTypeDescriptor indexedTypeDescriptor;
      if ( indexBinder == null ) {
        indexedTypeDescriptor = new IndexedTypeDescriptorForUnindexedType(entityType);
      }
      else {
        indexedTypeDescriptor = new IndexedTypeDescriptorImpl(
View Full Code Here


    return indexReaderAccessor;
  }

  @Override
  public IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType) {
    IndexedTypeDescriptor typeDescriptor;
    if ( indexedTypeDescriptors.containsKey( entityType ) ) {
      typeDescriptor = indexedTypeDescriptors.get( entityType );
    }
    else {
      EntityIndexBinding indexBinder = indexBindingForEntities.get( entityType );
      IndexedTypeDescriptor indexedTypeDescriptor;
      if ( indexBinder == null ) {
        indexedTypeDescriptor = new IndexedTypeDescriptorForUnindexedType( entityType );
      }
      else {
        indexedTypeDescriptor = new IndexedTypeDescriptorImpl(
View Full Code Here

    return indexReaderAccessor;
  }

  @Override
  public IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType) {
    IndexedTypeDescriptor typeDescriptor;
    if ( indexedTypeDescriptors.containsKey( entityType ) ) {
      typeDescriptor = indexedTypeDescriptors.get( entityType );
    }
    else {
      EntityIndexBinding indexBinder = indexBindingForEntities.get( entityType );
      IndexedTypeDescriptor indexedTypeDescriptor;
      if ( indexBinder == null ) {
        indexedTypeDescriptor = new IndexedTypeDescriptorForUnindexedType(entityType);
      }
      else {
        indexedTypeDescriptor = new IndexedTypeDescriptorImpl(
View Full Code Here

    );
  }

  @Test
  public void testIndexInformation() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );

    Set<IndexDescriptor> indexDescriptors = typeDescriptor.getIndexDescriptors();
    assertEquals( "Wrong index name", TEST_INDEX_NAMES.get( 0 ), indexDescriptors.iterator().next().getName() );
  }
View Full Code Here

  }

  @Test
  public void testSharedIndexInformation() {
    TypeMetadata typeMetadata = metadataProvider.getTypeMetadataFor( Foo.class );
    IndexedTypeDescriptor typeDescriptor = new IndexedTypeDescriptorImpl(
        typeMetadata,
        DescriptorTestHelper.getDummyShardedIndexManager()
    );
    assertTrue( typeDescriptor.isSharded() );

    Set<IndexDescriptor> indexDescriptors = typeDescriptor.getIndexDescriptors();
    assertTrue( indexDescriptors.size() == 3 );
    for ( IndexDescriptor indexDescriptor : indexDescriptors ) {
      String shardName = indexDescriptor.getName();
      assertTrue( "Missing shard name: " + shardName, TEST_INDEX_NAMES.contains( indexDescriptor.getName() ) );
    }
View Full Code Here

    }
  }

  @Test
  public void testFieldAnnotationOnFieldAndGetterCreatesTwoFieldDescriptors() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Susfu.class );

    Set<FieldDescriptor> fieldDescriptors = typeDescriptor.getFieldsForProperty( "susfu" );
    assertEquals( "There should be two field descriptors", 2, fieldDescriptors.size() );
  }
View Full Code Here

    assertEquals( "There should be two field descriptors", 2, fieldDescriptors.size() );
  }

  @Test
  public void testRetrievingPropertyDescriptors() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Snafu.class );

    Set<PropertyDescriptor> propertyDescriptors = typeDescriptor.getIndexedProperties();
    assertEquals( "There should be 5 properties defined in Snafu", 5, propertyDescriptors.size() );
    Set<String> expectedPropertyNames = new HashSet<String>();
    expectedPropertyNames.add( "id" );
    expectedPropertyNames.add( "snafu" );
    expectedPropertyNames.add( "numericField" );
View Full Code Here

      );
    }
  }

  private PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String propertyName) {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, clazz );
    return typeDescriptor.getProperty( propertyName );
  }
View Full Code Here

    assertNotNull( fieldDescriptor.getFieldBridge() );
    assertTrue( fieldDescriptor.getFieldBridge() instanceof StringBridge );
  }

  private FieldDescriptor getFieldDescriptor(Class<?> clazz, String fieldName) {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, clazz );
    return typeDescriptor.getIndexedField( fieldName );
  }
View Full Code Here

  @Test
  public void testGetTypeDescriptorForUnindexedType() {
    SearchConfigurationForTest cfg = getManualConfiguration();

    SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
    IndexedTypeDescriptor indexedTypeDescriptor = sf.getIndexedTypeDescriptor( Foo.class);
    assertNotNull( indexedTypeDescriptor );
    assertFalse( indexedTypeDescriptor.isIndexed() );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.metadata.IndexedTypeDescriptor

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.