Package org.hibernate.ogm.util.configurationreader.spi

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


    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

    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

    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

    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

  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

    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

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "configuration_resource", root.toExternalForm() + "/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

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "configuration_resource", root + File.separator + "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

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "configuration_resource", new URL( "file://foobar/" ) );

    ConfigurationPropertyReader reader = new ConfigurationPropertyReader( properties );

    URL value = reader.property( "configuration_resource", URL.class ).getValue();
    assertThat( value ).isEqualTo( new URL( "file://foobar/" ) );
  }

  @Test
  public void shouldRaiseExceptionDueToMissingRequiredProperty() {
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.