Package org.hibernate.search.metadata

Examples of org.hibernate.search.metadata.IndexedTypeDescriptor


        .property( "id", FIELD ).documentId()
    ;
    cfg.setProgrammaticMapping( mapping );

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


    metadataProvider = new AnnotationMetadataProvider( new JavaReflectionManager(), configContext );
  }

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

    Set<IndexDescriptor> indexDescriptors = typeDescriptor.getIndexDescriptors();
    assertEquals(
        "Wrong index name",
        DescriptorTestHelper.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,
View Full Code Here

    metadataProvider = new AnnotationMetadataProvider( new JavaReflectionManager(), configContext );
  }

  @Test
  public void testIsIndexed() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    assertEquals( "Wrong indexed type", Foo.class, typeDescriptor.getType() );
    assertTrue( typeDescriptor.isIndexed() );
  }
View Full Code Here

    assertTrue( typeDescriptor.isIndexed() );
  }

  @Test
  public void testDefaultStaticBoost() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    assertEquals( "The default boost should be 1.0f", 1.0f, typeDescriptor.getStaticBoost(), 0f );
  }
View Full Code Here

    assertEquals( "The default boost should be 1.0f", 1.0f, typeDescriptor.getStaticBoost(), 0f );
  }

  @Test
  public void testGetPropertyThrowsExceptionForNullParameter() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    try {
      typeDescriptor.getProperty( null );
      fail( "Passing null as parameter is not allowed" );
    }
    catch (IllegalArgumentException e) {
      assertTrue( "Wrong exception: " + e.getMessage(), e.getMessage().startsWith( "HSEARCH000181" ) );
    }
View Full Code Here

    }
  }

  @Test
  public void testGetFieldsForPropertyThrowsExceptionForNullParameter() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    try {
      typeDescriptor.getFieldsForProperty( null );
      fail( "Passing null as parameter is not allowed" );
    }
    catch (IllegalArgumentException e) {
      assertTrue( "Wrong exception: " + e.getMessage(), e.getMessage().startsWith( "HSEARCH000181" ) );
    }
View Full Code Here

    }
  }

  @Test
  public void testGetIndexedFieldThrowsExceptionForNullParameter() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    try {
      typeDescriptor.getIndexedField( null );
      fail( "Passing null as parameter is not allowed" );
    }
    catch (IllegalArgumentException e) {
      assertTrue( "Wrong exception: " + e.getMessage(), e.getMessage().startsWith( "HSEARCH000182" ) );
    }
View Full Code Here

    }
  }

  @Test
  public void testExplicitStaticBoost() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Fubar.class );
    assertEquals( "The default boost should be 42.0f", 42.0f, typeDescriptor.getStaticBoost(), 0f );
  }
View Full Code Here

    assertEquals( "The default boost should be 42.0f", 42.0f, typeDescriptor.getStaticBoost(), 0f );
  }

  @Test
  public void testDefaultDynamicBoost() {
    IndexedTypeDescriptor typeDescriptor = DescriptorTestHelper.getTypeDescriptor( metadataProvider, Foo.class );
    assertTrue( typeDescriptor.getDynamicBoost() instanceof DefaultBoostStrategy );
  }
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.