Package org.hibernate.ogm.datastore.mongodb.impl.configuration

Examples of org.hibernate.ogm.datastore.mongodb.impl.configuration.MongoDBConfiguration.buildOptions()


  }

  @Test
  public void shouldUsePrimaryByDefault() {
    MongoDBConfiguration config = new MongoDBConfiguration( reader, globalOptions );
    assertEquals( config.buildOptions().getReadPreference(), ReadPreference.primary() );
  }

  @Test
  public void shouldApplyValueGivenViaProperties() {
    cfg.put( MongoDBProperties.READ_PREFERENCE, "SECONDARY" );
View Full Code Here


  @Test
  public void shouldApplyValueGivenViaProperties() {
    cfg.put( MongoDBProperties.READ_PREFERENCE, "SECONDARY" );

    MongoDBConfiguration config = new MongoDBConfiguration( reader, globalOptions );
    assertEquals( config.buildOptions().getReadPreference(), ReadPreference.secondary() );
  }

  @Test
  public void shouldApplyValueGivenViaGlobalOptions() {
    cfg.put( OgmProperties.OPTION_CONFIGURATOR, new OptionConfigurator() {
View Full Code Here

    } );

    globalOptions = OptionsContextImpl.forGlobal( OptionValueSources.getDefaultSources( reader ) );

    MongoDBConfiguration config = new MongoDBConfiguration( reader, globalOptions );
    assertEquals( config.buildOptions().getReadPreference(), ReadPreference.secondaryPreferred() );
  }
}
View Full Code Here

  }

  @Test
  public void shouldUseAcknowledgedByDefault() {
    MongoDBConfiguration config = new MongoDBConfiguration( reader, getGlobalOptions() );
    assertEquals( config.buildOptions().getWriteConcern(), WriteConcern.ACKNOWLEDGED );
  }

  @Test
  public void shouldApplyValueGivenViaProperties() {
    cfg.put( MongoDBProperties.WRITE_CONCERN, "JOURNALED" );
View Full Code Here

  @Test
  public void shouldApplyValueGivenViaProperties() {
    cfg.put( MongoDBProperties.WRITE_CONCERN, "JOURNALED" );

    MongoDBConfiguration config = new MongoDBConfiguration( reader, getGlobalOptions() );
    assertEquals( config.buildOptions().getWriteConcern(), WriteConcern.JOURNALED );
  }

  @Test
  public void shouldApplyValueGivenViaGlobalOptions() {
    configuration.writeConcern( WriteConcernType.FSYNCED );
View Full Code Here

  @Test
  public void shouldApplyValueGivenViaGlobalOptions() {
    configuration.writeConcern( WriteConcernType.FSYNCED );

    MongoDBConfiguration config = new MongoDBConfiguration( reader, getGlobalOptions() );
    assertEquals( config.buildOptions().getWriteConcern(), WriteConcern.FSYNCED );
  }

  @Test
  public void shouldApplyCustomWriteConcernType() {
    cfg.put( MongoDBProperties.WRITE_CONCERN, WriteConcernType.CUSTOM );
View Full Code Here

  public void shouldApplyCustomWriteConcernType() {
    cfg.put( MongoDBProperties.WRITE_CONCERN, WriteConcernType.CUSTOM );
    cfg.put( MongoDBProperties.WRITE_CONCERN_TYPE, MultipleDataCenters.class );

    MongoDBConfiguration config = new MongoDBConfiguration( reader, getGlobalOptions() );
    assertEquals( config.buildOptions().getWriteConcern(), new MultipleDataCenters() );
  }

  @Test(expected = HibernateException.class )
  public void shouldRaiseErrorIfStrategyIsCUSTOMButNoTypeIsGiven() {
    cfg.put( MongoDBProperties.WRITE_CONCERN, WriteConcernType.CUSTOM );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.