Package org.hibernate.search.test.util

Examples of org.hibernate.search.test.util.FullTextSessionBuilder


    }
  }

  @Test
  public void testNonLeafPathInvalid() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( InvalidNonLeafUseCase.class );
    try {
      cfg.build();
      fail( "Exception should have been thrown for D having invalid path: b.c" );
    }
    catch (SearchException se) {
      assertTrue( "Expected search exception to contain information about invalid path b.c",
          se.getMessage().contains( "b.c" ) );
View Full Code Here


    }
  }

  @Test
  public void testEmbeddedPathValidation() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( InvalidEmbeddedWithoutPathsCase.class );
    cfg.addAnnotatedClass( InvalidEmbeddedPathCase.class );
    try {
      cfg.build();
      fail( "Exception should have been thrown for InvalidEmbeddedPathsCase having invalid path: emb.e4" );
    }
    catch (SearchException se) {
      assertTrue(
          "Expected search exception to contain information about invalid path emb.e4, instead got error: "
View Full Code Here

    }
  }

  @Test
  public void testNonLeafEmbeddedPath() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( InvalidEmbeddedWithoutPathsCase.class );
    cfg.addAnnotatedClass( InvalidEmbeddedNonLeafCase.class );
    try {
      cfg.build();
      fail( "Exception should have been thrown for InvalidEmbeddedNonLeafCase having invalid path: emb.e3" );
    }
    catch (SearchException se) {
      assertTrue(
          "Expected search exception to contain information about invalid leaf path emb.e3, instead got error: "
View Full Code Here

    }
  }

  @Test
  public void testNonIndexedPath() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( ReferencesC.class );
    cfg.addAnnotatedClass( PathNotIndexedCase.class );
    try {
      cfg.build();
      fail( "Exception should have been thrown for PathNotIndexedCase having invalid path: c.indexed" );
    }
    catch (SearchException se) {
      assertTrue(
          "Expected search exception to contain information about invalid leaf path c.indexed, instead got error: "
View Full Code Here

    }
  }

  @Test
  public void testRenamedFieldInPath() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( FieldRenamedContainerEntity.class );
    cfg.addAnnotatedClass( FieldRenamedEmbeddedEntity.class );
    try {
      cfg.build();
      fail( "Exception should have been thrown for FieldRenamedContainerEntity having invalid path (attribute instead of field name): embedded.field" );
    }
    catch (SearchException se) {
      assertTrue(
          "Expected search exception to contain information about invalid leaf path embedded.field, instead got error: "
View Full Code Here

    directory = dp.getDirectory();
    assertTrue( directory instanceof FSDirectory );
  }

  private FullTextSessionBuilder createMasterNode() {
    return new FullTextSessionBuilder()
      .addAnnotatedClass( SnowStorm.class )
      .setProperty( "hibernate.search.default.sourceBase", root.getAbsolutePath() + masterCopy )
      .setProperty( "hibernate.search.default.indexBase", root.getAbsolutePath() + masterMain )
      .setProperty( "hibernate.search.default.directory_provider", "filesystem-master" )
      .build();
View Full Code Here

      .setProperty( "hibernate.search.default.directory_provider", "filesystem-master" )
      .build();
  }

  private FullTextSessionBuilder createSlaveNode(boolean enableRetryInitializePeriod) {
    FullTextSessionBuilder builder = new FullTextSessionBuilder()
      .addAnnotatedClass( SnowStorm.class )
      .setProperty( "hibernate.search.default.sourceBase", root.getAbsolutePath() + masterCopy )
      .setProperty( "hibernate.search.default.indexBase", root.getAbsolutePath() + "/slave" )
      .setProperty( "hibernate.search.default.directory_provider", FSSlaveDirectoryProviderTestingExtension.class.getName() );
    if ( enableRetryInitializePeriod ) {
      builder.setProperty( "hibernate.search.default.retry_initialize_period", "12" );
    }
    return builder.build();
  }
View Full Code Here

   * Ensures that path still marked as encountered if depth is the cause of the path being
   * traversed, and they are the same depth
   */
  @Test
  public void testDepthMatchesPathMarkedAsEncountered() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( ReferencesIndexedEmbeddedA.class );
    cfg.addAnnotatedClass( DepthMatchesPathDepthCase.class );
    cfg.build();
  }
View Full Code Here

   * Ensures that path still marked as encountered if depth is the cause of the path being
   * traversed, and depth exceeds path depth
   */
  @Test
  public void testDepthExceedsPathMarkedAsEncountered() {
    FullTextSessionBuilder cfg = new FullTextSessionBuilder();
    cfg.addAnnotatedClass( A.class );
    cfg.addAnnotatedClass( B.class );
    cfg.addAnnotatedClass( C.class );
    cfg.addAnnotatedClass( ReferencesIndexedEmbeddedA.class );
    cfg.addAnnotatedClass( DepthExceedsPathTestCase.class );
    cfg.build();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.test.util.FullTextSessionBuilder

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.