Package org.hibernate.search.testsupport.setup

Examples of org.hibernate.search.testsupport.setup.SearchConfigurationForTest


    assertEquals( "Wrong number of indexed entities", 2, indexedClasses.size() );
  }

  @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


    assertFalse( indexedTypeDescriptor.isIndexed() );
  }

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

    SearchMapping mapping = new SearchMapping();
    mapping
        .entity( Foo.class ).indexed()
        .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

    assertNotNull( indexedTypeDescriptor );
    assertTrue( indexedTypeDescriptor.isIndexed() );
  }

  private SearchConfigurationForTest getManualConfiguration() {
    return new SearchConfigurationForTest()
      .addClass( Foo.class )
      .addClass( Bar.class );
  }
View Full Code Here

public class IndexDescriptorTest {
  private AnnotationMetadataProvider metadataProvider;

  @Before
  public void setUp() {
    SearchConfiguration searchConfiguration = new SearchConfigurationForTest();
    ConfigContext configContext = new ConfigContext(
        searchConfiguration,
        new BuildContextForTest( searchConfiguration )
    );
    metadataProvider = new AnnotationMetadataProvider( new JavaReflectionManager(), configContext );
View Full Code Here

  private AnnotationMetadataProvider metadataProvider;

  @Before
  public void setUp() {
    SearchConfiguration searchConfiguration = new SearchConfigurationForTest();
    ConfigContext configContext = new ConfigContext(
        searchConfiguration,
        new BuildContextForTest( searchConfiguration )
    );
    metadataProvider = new AnnotationMetadataProvider( new JavaReflectionManager(), configContext );
View Full Code Here

*/
public class MutableFactoryTest {

  @Test
  public void testCreateEmptyFactory() throws Exception {
    SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( new SearchConfigurationForTest() ).buildSearchFactory();
    sf.close();
  }
View Full Code Here

    sf.close();
  }

  @Test
  public void testAddingClassFullModel() throws Exception {
    SearchFactoryIntegrator sf = new SearchFactoryBuilder().configuration( new SearchConfigurationForTest() ).buildSearchFactory();
    final SearchFactoryBuilder builder = new SearchFactoryBuilder();
    sf = builder.currentFactory( sf )
        .addClass( A.class )
        .buildSearchFactory();
View Full Code Here

    sf.close();
  }

  @Test
  public void testAddingClassSimpleAPI() throws Exception {
    SearchFactoryIntegrator sf = new SearchFactoryBuilder().configuration( new SearchConfigurationForTest() ).buildSearchFactory();

    sf.addClasses( A.class );

    TransactionContextForTest tc = new TransactionContextForTest();
View Full Code Here

    QueryParser parser = new QueryParser(
        TestConstants.getTargetLuceneVersion(),
        "name",
        TestConstants.standardAnalyzer
    );
    final SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( new SearchConfigurationForTest() ).buildSearchFactory();
    try {
      List<DoAddClasses> runnables = new ArrayList<DoAddClasses>( 10 );
      final int nbrOfThread = 10;
      final int nbrOfClassesPerThread = 10;
      for ( int i = 0; i < nbrOfThread; i++ ) {
View Full Code Here

    return sf;
  }

  @Override
  protected void before() throws Throwable {
    SearchConfigurationForTest cfg = new SearchConfigurationForTest();
    cfg.setProgrammaticMapping( buildMappingDefinition );
    for ( Entry<Class<? extends Service>, Service> entry : providedServices.entrySet() ) {
      cfg.addProvidedService( entry.getKey(), entry.getValue() );
    }
    for ( String key : configuration.stringPropertyNames() ) {
      cfg.addProperty( key, configuration.getProperty( key ) );
    }
    for ( Class<?> c : entities ) {
      cfg.addClass( c );
    }
    sf = new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.testsupport.setup.SearchConfigurationForTest

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.