Examples of property()


Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  @BeforeClass
  public static void createDatabaseAndSetUpAuthentication() throws Exception {
    OgmConfiguration configuration = getConfiguration();

    ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configuration );
    host = propertyReader.property( OgmProperties.HOST, String.class ).withDefault( "localhost" ).getValue();
    port = propertyReader.property( OgmProperties.PORT, int.class ).withDefault( 5984 ).getValue();
    serverUri = "http://" + host + ":" + port;

    client = getClientWithServerAdminCredentials();
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  public void shouldRetrievePropertyWithInstanceValue() {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", new MyServiceImpl() );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyServiceImpl.class );
  }
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  public void shouldRetrievePropertyWithClassValue() {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", MyServiceImpl.class );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyServiceImpl.class );
  }
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  public void shouldRetrievePropertyWithStringValue() {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", MyServiceImpl.class.getName() );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyServiceImpl.class );
  }
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  @Test
  public void shouldRetrievePropertyWithDefaultImplementation() {
    Map<String, Object> properties = new HashMap<String, Object>();

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .withDefaultImplementation( MyOtherServiceImpl.class )
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyOtherServiceImpl.class );
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  public void shouldRetrievePropertyWithShortName() {
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", "other" );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .withShortNameResolver( new MyShortNameResolver() )
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyOtherServiceImpl.class );
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  @Test
  public void shouldRetrievePropertyWithDefaultImplementationName() {
    Map<String, Object> properties = new HashMap<String, Object>();

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = reader.property( "service", MyService.class )
        .instantiate()
        .withDefaultImplementation( MyServiceImpl.class.getName() )
        .getValue();

    assertThat( value.getClass() ).isEqualTo( MyServiceImpl.class );
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

  @Test
  public void shouldRetrievePropertyUsingCustomInstantiator() {
    Map<String, Object> properties = new HashMap<String, Object>();

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );
    MyService value = ( (DefaultClassPropertyReaderContext<MyService>) reader.property( "service", MyService.class )
        .instantiate() )
        .withDefaultImplementation( MyYetAnotherServiceImpl.class )
        .withInstantiator( new MyInstantiator() )
        .getValue();
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", 42 );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );

    reader.property( "service", MyService.class )
        .instantiate()
        .getValue();
  }

  @Test
View Full Code Here

Examples of org.hibernate.ogm.util.configurationreader.spi.ConfigurationPropertyReader.property()

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "service", Integer.class );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties, new ClassLoaderServiceImpl() );

    reader.property( "service", MyService.class )
        .instantiate()
        .getValue();
  }

  @Test
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.