Search in sources :

Example 1 with DoublePropertyDef

use of io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef in project zilla by aklivity.

the class ConfigurationTest method shouldGetDoubleProperty.

@Test
public void shouldGetDoubleProperty() {
    System.setProperty("scope.double.property.name", Double.toString(0.1234));
    ConfigurationDef configDef = new ConfigurationDef("scope");
    DoublePropertyDef propertyDef = configDef.property("double.property.name", 0.5678);
    Configuration config = new Configuration();
    assertEquals(0.1234, propertyDef.getAsDouble(config), 0.0);
}
Also used : DoublePropertyDef(io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef) ConfigurationDef(io.aklivity.zilla.runtime.engine.Configuration.ConfigurationDef) Test(org.junit.Test)

Example 2 with DoublePropertyDef

use of io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef in project zilla by aklivity.

the class ConfigurationTest method shouldDefaultDoubleProperty.

@Test
public void shouldDefaultDoubleProperty() {
    ConfigurationDef configDef = new ConfigurationDef("scope");
    DoublePropertyDef propertyDef = configDef.property("double.property.name", 0.1234);
    Configuration config = new Configuration();
    assertEquals(0.1234, propertyDef.getAsDouble(config), 0.0);
}
Also used : DoublePropertyDef(io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef) ConfigurationDef(io.aklivity.zilla.runtime.engine.Configuration.ConfigurationDef) Test(org.junit.Test)

Example 3 with DoublePropertyDef

use of io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef in project zilla by aklivity.

the class ConfigurationTest method shouldSupplyDefaultDoubleProperty.

@Test
public void shouldSupplyDefaultDoubleProperty() {
    ConfigurationDef configDef = new ConfigurationDef("scope");
    DoublePropertyDef propertyDef = configDef.property("double.property.name", (ToDoubleFunction<Configuration>) c -> 0.1234);
    Configuration config = new Configuration();
    assertEquals(0.1234, propertyDef.getAsDouble(config), 0.0);
}
Also used : PropertyDef(io.aklivity.zilla.runtime.engine.Configuration.PropertyDef) Properties(java.util.Properties) IntPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.IntPropertyDef) BooleanPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.BooleanPropertyDef) ConfigurationDef(io.aklivity.zilla.runtime.engine.Configuration.ConfigurationDef) Predicate(java.util.function.Predicate) FloatPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.FloatPropertyDef) ToIntFunction(java.util.function.ToIntFunction) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) LongPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.LongPropertyDef) ToCharFunction(io.aklivity.zilla.runtime.engine.Configuration.ToCharFunction) BytePropertyDef(io.aklivity.zilla.runtime.engine.Configuration.BytePropertyDef) CharPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.CharPropertyDef) ToDoubleFunction(java.util.function.ToDoubleFunction) ToShortFunction(io.aklivity.zilla.runtime.engine.Configuration.ToShortFunction) ShortPropertyDef(io.aklivity.zilla.runtime.engine.Configuration.ShortPropertyDef) ToFloatFunction(io.aklivity.zilla.runtime.engine.Configuration.ToFloatFunction) DoublePropertyDef(io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef) ToByteFunction(io.aklivity.zilla.runtime.engine.Configuration.ToByteFunction) ToLongFunction(java.util.function.ToLongFunction) Assert.assertEquals(org.junit.Assert.assertEquals) DoublePropertyDef(io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef) ConfigurationDef(io.aklivity.zilla.runtime.engine.Configuration.ConfigurationDef) Test(org.junit.Test)

Aggregations

ConfigurationDef (io.aklivity.zilla.runtime.engine.Configuration.ConfigurationDef)3 DoublePropertyDef (io.aklivity.zilla.runtime.engine.Configuration.DoublePropertyDef)3 Test (org.junit.Test)3 BooleanPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.BooleanPropertyDef)1 BytePropertyDef (io.aklivity.zilla.runtime.engine.Configuration.BytePropertyDef)1 CharPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.CharPropertyDef)1 FloatPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.FloatPropertyDef)1 IntPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.IntPropertyDef)1 LongPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.LongPropertyDef)1 PropertyDef (io.aklivity.zilla.runtime.engine.Configuration.PropertyDef)1 ShortPropertyDef (io.aklivity.zilla.runtime.engine.Configuration.ShortPropertyDef)1 ToByteFunction (io.aklivity.zilla.runtime.engine.Configuration.ToByteFunction)1 ToCharFunction (io.aklivity.zilla.runtime.engine.Configuration.ToCharFunction)1 ToFloatFunction (io.aklivity.zilla.runtime.engine.Configuration.ToFloatFunction)1 ToShortFunction (io.aklivity.zilla.runtime.engine.Configuration.ToShortFunction)1 Properties (java.util.Properties)1 Predicate (java.util.function.Predicate)1 ToDoubleFunction (java.util.function.ToDoubleFunction)1 ToIntFunction (java.util.function.ToIntFunction)1 ToLongFunction (java.util.function.ToLongFunction)1