Examples of property()


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

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

    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( "foo", "bar" );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    String value = reader.property( "foo", String.class ).getValue();
    assertThat( value ).isEqualTo( "bar" );
  }

  @Test
  public void shouldRetrieveIntProperty() {
View Full Code Here

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

    properties.put( "foo", "123" );
    properties.put( "bar", 456 );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    int value = reader.property( "foo", int.class ).getValue();
    assertThat( value ).isEqualTo( 123 );

    value = reader.property( "bar", int.class ).getValue();
    assertThat( value ).isEqualTo( 456 );
  }
View Full Code Here

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

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    int value = reader.property( "foo", int.class ).getValue();
    assertThat( value ).isEqualTo( 123 );

    value = reader.property( "bar", int.class ).getValue();
    assertThat( value ).isEqualTo( 456 );
  }

  @Test
  public void shouldRetrieveBooleanProperty() {
View Full Code Here

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

    properties.put( "foo", "true" );
    properties.put( "bar", true );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    boolean value = reader.property( "foo", boolean.class ).getValue();
    assertThat( value ).isEqualTo( true );

    value = reader.property( "bar", boolean.class ).getValue();
    assertThat( value ).isEqualTo( true );
  }
View Full Code Here

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

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    boolean value = reader.property( "foo", boolean.class ).getValue();
    assertThat( value ).isEqualTo( true );

    value = reader.property( "bar", boolean.class ).getValue();
    assertThat( value ).isEqualTo( true );
  }

  @Test
  public void shouldRetrieveEnumProperty() {
View Full Code Here

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

    properties.put( "foo", "ANNOTATION_TYPE" );
    properties.put( "bar", ElementType.FIELD );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    ElementType value = reader.property( "foo", ElementType.class ).getValue();
    assertThat( value ).isEqualTo( ElementType.ANNOTATION_TYPE );

    value = reader.property( "bar", ElementType.class ).getValue();
    assertThat( value ).isEqualTo( ElementType.FIELD );
  }
View Full Code Here

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

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    ElementType value = reader.property( "foo", ElementType.class ).getValue();
    assertThat( value ).isEqualTo( ElementType.ANNOTATION_TYPE );

    value = reader.property( "bar", ElementType.class ).getValue();
    assertThat( value ).isEqualTo( ElementType.FIELD );
  }

  @Test
  public void shouldRetrieveEnumPropertyWithDefaultValue() {
View Full Code Here

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

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

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    ElementType value = reader.property( "foo", ElementType.class )
        .withDefault( ElementType.ANNOTATION_TYPE )
        .getValue();
    assertThat( value ).isEqualTo( ElementType.ANNOTATION_TYPE );
  }
View Full Code Here

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

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "configuration_resource", "configuration-test.properties" );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    URL value = reader.property( "configuration_resource", URL.class ).getValue();
    assertThat( value ).isNotNull();

    Properties loadedProperties = loadPropertiesFromUrl( value );
    assertThat( loadedProperties.get( "hibernate.ogm.configuration.testproperty" ) ).isEqualTo( "foobar" );
  }
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.