Package org.hibernate.ogm.options.container.impl

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer


  @Test
  public void testWriteConcernGivenByTypeOnGlobalLevel() throws Exception {
    mongoOptions
      .writeConcern( WriteConcernType.ERRORS_IGNORED );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( WriteConcern.ERRORS_IGNORED );
  }
View Full Code Here


  public void testWriteConcernGivenByInstanceOnGlobalLevel() throws Exception {
    ReplicaConfigurableWriteConcern writeConcern = new ReplicaConfigurableWriteConcern( 5 );

    mongoOptions.writeConcern( writeConcern );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( writeConcern );
  }
View Full Code Here

      .entity( ExampleForMongoDBMapping.class )
        .writeConcern( WriteConcernType.MAJORITY )
        .property( "content", ElementType.FIELD )
          .writeConcern( WriteConcernType.FSYNCED );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( WriteConcern.ERRORS_IGNORED );

    options = getSource().getEntityOptions( ExampleForMongoDBMapping.class );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( WriteConcern.MAJORITY );

    options = getSource().getPropertyOptions( ExampleForMongoDBMapping.class, "content" );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( WriteConcern.FSYNCED );
  }
View Full Code Here

      .entity( ExampleForMongoDBMapping.class )
        .writeConcern( new ReplicaConfigurableWriteConcern( 3 ) )
        .property( "content", ElementType.FIELD )
          .writeConcern( new ReplicaConfigurableWriteConcern( 4 ) );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 2 ) );

    options = getSource().getEntityOptions( ExampleForMongoDBMapping.class );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 3 ) );

    options = getSource().getPropertyOptions( ExampleForMongoDBMapping.class, "content" );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 4 ) );
  }
View Full Code Here

        .writeConcern( new ReplicaConfigurableWriteConcern( 3 ) )
        .property( "content", ElementType.FIELD )
          .writeConcern( WriteConcernType.ACKNOWLEDGED )
          .writeConcern( new ReplicaConfigurableWriteConcern( 4 ) );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 2 ) );

    options = getSource().getEntityOptions( ExampleForMongoDBMapping.class );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 3 ) );

    options = getSource().getPropertyOptions( ExampleForMongoDBMapping.class, "content" );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new ReplicaConfigurableWriteConcern( 4 ) );
  }
View Full Code Here

    source = new AnnotationOptionValueSource();
  }

  @Test
  public void testWriteConcernForEntity() throws Exception {
    OptionsContainer options = source.getEntityOptions( EntityWriteConcernExample.class );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( com.mongodb.WriteConcern.ERRORS_IGNORED );
  }
View Full Code Here

    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( com.mongodb.WriteConcern.ERRORS_IGNORED );
  }

  @Test
  public void testWriteConcernByTypeForEntity() throws Exception {
    OptionsContainer options = source.getEntityOptions( EntityWriteConcernUsingTypeExample.class );
    assertThat( options.getUnique( WriteConcernOption.class ) ).isEqualTo( new MultipleDataCenters() );
  }
View Full Code Here

    source = new AnnotationOptionValueSource();
  }

  @Test
  public void shouldObtainReadPreferenceOptionFromAnnotation() throws Exception {
    OptionsContainer options = source.getEntityOptions( MyEntity.class );
    assertThat( options.getUnique( ReadPreferenceOption.class ) ).isEqualTo( com.mongodb.ReadPreference.secondaryPreferred() );
  }
View Full Code Here

  @Test
  public void testReadPreferenceGivenOnGlobalLevel() throws Exception {
    mongoOptions.readPreference( ReadPreferenceType.SECONDARY );

    OptionsContainer options = getSource().getGlobalOptions();
    assertThat( options.getUnique( ReadPreferenceOption.class ) ).isEqualTo( ReadPreference.secondary() );
  }
View Full Code Here

  public void testReadPreferenceGivenOnEntityLevel() throws Exception {
    mongoOptions
      .entity( MyEntity.class )
        .readPreference( ReadPreferenceType.SECONDARY_PREFERRED );

    OptionsContainer options = getSource().getEntityOptions( MyEntity.class );
    assertThat( options.getUnique( ReadPreferenceOption.class ) ).isEqualTo( ReadPreference.secondaryPreferred() );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.options.container.impl.OptionsContainer

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.