Package org.hibernate.search.engine.spi

Examples of org.hibernate.search.engine.spi.SearchFactoryImplementor


  @BMRule(targetClass = "org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer",
      targetMethod = "loadList",
      action = "throw new NullPointerException(\"Byteman created NPE\")",
      name = "testMassIndexerErrorsReported")
  public void testMassIndexerErrorsReported() throws InterruptedException {
    SearchFactoryImplementor searchFactory = getSearchFactoryImpl();
    MockErrorHandler mockErrorHandler = getErrorHandler( searchFactory );

    FullTextSession fullTextSession = prepareSomeData( this );

    fullTextSession.createIndexer( Book.class ).startAndWait();
View Full Code Here


    SearchConfiguration conf = new HibernateManualConfiguration()
        .addClass( Theater.class )
        .addClass( Chain.class );
    boolean throwException = false;
    try {
      SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( conf ).buildSearchFactory();
      sf.close();
    }
    catch (SearchException e) {
      assertThat( e.getMessage() ).contains( "TheaterBridgeProvider1" );
      throwException = true;
    }
View Full Code Here

      .addAnnotatedClass( BlogEntry.class )
      .addAnnotatedClass( Foo.class )
      .addAnnotatedClass( org.hibernate.search.test.query.Book.class )
      .addAnnotatedClass( org.hibernate.search.test.query.Author.class )
      .openFullTextSession();
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) ftSession.getSearchFactory();
    ftSession.close();
    IndexManagerHolder allIndexesManager = searchFactory.getIndexManagerHolder();

    //checks for the default implementation
    checkIndexManagerType( allIndexesManager, "org.hibernate.search.test.configuration.BlogEntry",
        org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.class );
View Full Code Here

    out.println( "INDEX CHECK..." );
    out.println( "" );

    Session s = ctx.sf.openSession();
    FullTextSession fts = Search.getFullTextSession( s );
    SearchFactoryImplementor sfi = (SearchFactoryImplementor) fts.getSearchFactory();
    Collection<IndexManager> indexManagers = sfi.getIndexManagerHolder().getIndexManagers();

    for ( IndexManager indexManager : indexManagers ) {
      DirectoryBasedIndexManager directoryBasedIndexManager = (DirectoryBasedIndexManager) indexManager;
      DirectoryProvider<?> directoryProvider = directoryBasedIndexManager.getDirectoryProvider();
      Directory directory = directoryProvider.getDirectory();
View Full Code Here

      fullTextSession.close();
    }
  }

  private void verifyIndexIsLocked(boolean isLocked, Class type) throws IOException {
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) builder.getSearchFactory();
    DirectoryBasedIndexManager indexManager = (DirectoryBasedIndexManager) searchFactory.getIndexBinding( type ).getIndexManagers()[0];
    Directory directory = indexManager.getDirectoryProvider().getDirectory();
    LockFactory lockFactory = directory.getLockFactory();
    Lock writeLock = lockFactory.makeLock( "write.lock" );
    Assert.assertEquals( isLocked, writeLock.isLocked() );
  }
View Full Code Here

      .addAnnotatedClass( BlogEntry.class )
      .addAnnotatedClass( Foo.class )
      .addAnnotatedClass( org.hibernate.search.test.query.Book.class )
      .addAnnotatedClass( org.hibernate.search.test.query.Author.class )
      .openFullTextSession();
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) ftSession.getSearchFactory();
    ftSession.close();
    IndexManagerHolder allIndexesManager = searchFactory.getIndexManagerHolder();
    //explicitly enabled:
    assertExclusiveIsEnabled( allIndexesManager, "org.hibernate.search.test.configuration.BlogEntry", true );
    //explicitly disabled (this entity defined a short index name):
    assertExclusiveIsEnabled( allIndexesManager, "Book", false );
    //using default:
View Full Code Here

  public SearchFactoryHolder sfHolder = new SearchFactoryHolder( Book.class )
    .withProperty( "hibernate.search.default.indexmanager", "near-real-time" );

  @Test
  public void testPropertiesIndexing() throws InterruptedException {
    SearchFactoryImplementor searchFactory = sfHolder.getSearchFactory();
    ThreadPoolExecutor threadPool = Executors.newFixedThreadPool( THREAD_NUMBER, "ReadWriteParallelismTest" );
    for ( int i = 0; i < THREAD_NUMBER; i++ ) {
      threadPool.execute( new Task( searchFactory, i ) );
    }
    threadPool.shutdown();
View Full Code Here

  @Test
  @RequiresDialect(comment = "H2 does not accept negative fetch sizes",
    strictMatching = true, value = org.hibernate.dialect.H2Dialect.class)
  public void testSetFetchSizeOnH2Fails() throws InterruptedException {
    SearchFactoryImplementor searchFactory = getSearchFactoryImpl();
    MockErrorHandler mockErrorHandler = MassIndexerErrorReportingTest.getErrorHandler( searchFactory );

    FullTextSession fullTextSession = MassIndexerErrorReportingTest.prepareSomeData( this );

    fullTextSession.createIndexer( Book.class ).idFetchSize( -1 ).startAndWait();
View Full Code Here

  @Test
  @RequiresDialect(comment = "MySQL definitely should accept Integer.MIN_VALUE",
    strictMatching = false, value = org.hibernate.dialect.MySQLDialect.class)
  public void testSetFetchSizeOnMySQL() throws InterruptedException {
    SearchFactoryImplementor searchFactory = getSearchFactoryImpl();
    MockErrorHandler mockErrorHandler = MassIndexerErrorReportingTest.getErrorHandler( searchFactory );

    FullTextSession fullTextSession = MassIndexerErrorReportingTest.prepareSomeData( this );

    fullTextSession.createIndexer( Book.class ).idFetchSize( Integer.MIN_VALUE ).startAndWait();
View Full Code Here

    s.close();

    TermQuery query = new TermQuery( new Term( "Abstract", "hibernate" ) );

    FullTextSession fullTextSession = Search.getFullTextSession( s );
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) fullTextSession.getSearchFactory();

    //this is *not* the standard way to create a Query:
    HSQuery hsQuery = searchFactory.createHSQuery()
        .luceneQuery( query )
        .targetedEntities( new ArrayList<Class<?>>() );
    int size = extractResultSize( hsQuery );

    assertEquals( "Should have found a match", 1, size );
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.spi.SearchFactoryImplementor

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.