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

Examples of org.hibernate.ogm.datastore.mongodb.impl.configuration.MongoDBConfiguration


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

  @Test
  public void shouldUsePrimaryByDefault() {
    MongoDBConfiguration config = new MongoDBConfiguration( reader, globalOptions );
    assertEquals( config.buildOptions().getReadPreference(), ReadPreference.primary() );
  }
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() );
  }
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

  public void configure(Map configurationValues) {
    OptionsService optionsService = serviceRegistry.getService( OptionsService.class );
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    this.config = new MongoDBConfiguration( propertyReader, optionsService.context().getGlobalOptions() );
  }
View Full Code Here

    reader = new ConfigurationPropertyReader( cfg, new ClassLoaderServiceImpl() );
  }

  @Test
  public void shouldUseAcknowledgedByDefault() {
    MongoDBConfiguration config = new MongoDBConfiguration( reader, getGlobalOptions() );
    assertEquals( config.buildOptions().getWriteConcern(), WriteConcern.ACKNOWLEDGED );
  }
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 );
  }
View Full Code Here

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

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

  @Test
  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() );
  }
View Full Code Here

  }

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

  public void configure(Map configurationValues) {
    OptionsService optionsService = serviceRegistry.getService( OptionsService.class );
    ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService );

    this.config = new MongoDBConfiguration( propertyReader, optionsService.context().getGlobalOptions() );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.mongodb.impl.configuration.MongoDBConfiguration

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.