Package org.hibernate.search.backend.impl.lucene

Examples of org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl


  private void assertExclusiveIsEnabled(IndexManagerHolder allIndexesManager, String indexName, boolean expectExclusive) {
    DirectoryBasedIndexManager indexManager = (DirectoryBasedIndexManager) allIndexesManager.getIndexManager( indexName );
    BackendQueueProcessor backendQueueProcessor = indexManager.getBackendQueueProcessor();
    assertEquals( LuceneBackendQueueProcessor.class, backendQueueProcessor.getClass() );
    LuceneBackendQueueProcessor backend = (LuceneBackendQueueProcessor) backendQueueProcessor;
    AbstractWorkspaceImpl workspace = backend.getIndexResources().getWorkspace();
    if ( expectExclusive ) {
      assertEquals( ExclusiveIndexWorkspaceImpl.class, workspace.getClass() );
    }
    else {
      assertEquals( SharedIndexWorkspaceImpl.class, workspace.getClass() );
    }
  }
View Full Code Here


      .withProperty( "hibernate.search.error_handler", CountingErrorHandler.class.getName() );

  @Test
  public void testScheduledCommits() throws Exception {
    writeData( sfAsyncExclusiveIndex, NUMBER_ENTITIES );
    AbstractWorkspaceImpl workspace = sfAsyncExclusiveIndex.extractWorkspace( Quote.class );
    CommitPolicy commitPolicy = workspace.getCommitPolicy();

    assertTrue( commitPolicy instanceof ScheduledCommitPolicy );

    ScheduledCommitPolicy scheduledCommitPolicy = (ScheduledCommitPolicy) commitPolicy;
    ScheduledThreadPoolExecutor scheduledExecutor = (ScheduledThreadPoolExecutor) scheduledCommitPolicy.getScheduledExecutorService();
View Full Code Here

    ScheduledCommitPolicy commitPolicy = (ScheduledCommitPolicy) getCommitPolicy( sfHolder );
    return commitPolicy.getDelay();
  }

  private CommitPolicy getCommitPolicy(SearchFactoryHolder sfHolder) {
    AbstractWorkspaceImpl workspace = sfHolder.extractWorkspace( A.class );
    return workspace.getCommitPolicy();
  }
View Full Code Here

    .withProperty( "hibernate.search.index2.indexwriter.max_thread_states", "7" )
    .withProperty( "hibernate.search.index2.indexwriter.infostream", "true" );

  @Test
  public void testIndexWriterTuningApplied() throws IOException {
    AbstractWorkspaceImpl dvdsWorkspace = sfHolder.extractWorkspace( Dvd.class );
    IndexWriter dvdsIndexWriter = dvdsWorkspace.getIndexWriter();
    try {
      Assert.assertEquals( 23, dvdsIndexWriter.getConfig().getMaxThreadStates() );
    }
    finally {
      dvdsIndexWriter.close( false );
View Full Code Here

  @Test
  public void testInfoStream() throws IOException {
    //Enable trace level on the magic category:
    Logger.getLogger( LoggerInfoStream.INFOSTREAM_LOGGER_CATEGORY ).setLevel( Level.TRACE );
    AbstractWorkspaceImpl dvdsWorkspace = sfHolder.extractWorkspace( Dvd.class );
    AbstractWorkspaceImpl booksWorkspace = sfHolder.extractWorkspace( Book.class );
    IndexWriter dvdsIndexWriter = dvdsWorkspace.getIndexWriter();
    IndexWriter booksIndexWriter = booksWorkspace.getIndexWriter();
    try {
      Assert.assertFalse( dvdsIndexWriter.getConfig().getInfoStream().isEnabled( "IW" ) );
      Assert.assertTrue( booksIndexWriter.getConfig().getInfoStream().isEnabled( "IW" ) );
    }
    finally {
View Full Code Here

    }
  }

  @Test
  public void testIndexWriterTuningAppliedOnDefault() throws IOException {
    AbstractWorkspaceImpl booksWorkspace = sfHolder.extractWorkspace( Book.class );
    IndexWriter booksIndexWriter = booksWorkspace.getIndexWriter();
    try {
      Assert.assertEquals( 7, booksIndexWriter.getConfig().getMaxThreadStates() );
    }
    finally {
      booksIndexWriter.close( false );
View Full Code Here

TOP

Related Classes of org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl

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.