use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method nestedClassChildProperties.
@Test
void nestedClassChildProperties() {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps").fromSource(ClassWithNestedProperties.NestedChildClass.class));
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.child-class-property", Integer.class).fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(20));
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.parent-class-property", Integer.class).fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(10));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method simpleTypeProperties.
@Test
void simpleTypeProperties() {
ConfigurationMetadata metadata = compile(SimpleTypeProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple.type").fromSource(SimpleTypeProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-string", String.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-byte", Byte.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-byte", Byte.class).withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-char", Character.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-char", Character.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-boolean", Boolean.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-boolean", Boolean.class).withDefaultValue(false));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-short", Short.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-short", Short.class).withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-integer", Integer.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-integer", Integer.class).withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-long", Long.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-long", Long.class).withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-double", Double.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-double", Double.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-float", Float.class));
assertThat(metadata).has(Metadata.withProperty("simple.type.my-primitive-float", Float.class));
assertThat(metadata.getItems().size()).isEqualTo(18);
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method innerClassRootConfig.
@Test
void innerClassRootConfig() {
ConfigurationMetadata metadata = compile(InnerClassRootConfig.class);
assertThat(metadata).has(Metadata.withProperty("config.name"));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method simpleProperties.
@Test
void simpleProperties() {
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class).fromSource(SimpleProperties.class).withDescription("The name of this simple properties.").withDefaultValue("boot").withDeprecation(null, null));
assertThat(metadata).has(Metadata.withProperty("simple.flag", Boolean.class).withDefaultValue(false).fromSource(SimpleProperties.class).withDescription("A simple flag.").withDeprecation(null, null));
assertThat(metadata).has(Metadata.withProperty("simple.comparator"));
assertThat(metadata).doesNotHave(Metadata.withProperty("simple.counter"));
assertThat(metadata).doesNotHave(Metadata.withProperty("simple.size"));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method parseCollectionConfig.
@Test
void parseCollectionConfig() {
ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class);
// getter and setter
assertThat(metadata).has(Metadata.withProperty("collection.integers-to-names", "java.util.Map<java.lang.Integer,java.lang.String>"));
assertThat(metadata).has(Metadata.withProperty("collection.longs", "java.util.Collection<java.lang.Long>"));
assertThat(metadata).has(Metadata.withProperty("collection.floats", "java.util.List<java.lang.Float>"));
// getter only
assertThat(metadata).has(Metadata.withProperty("collection.names-to-integers", "java.util.Map<java.lang.String,java.lang.Integer>"));
assertThat(metadata).has(Metadata.withProperty("collection.bytes", "java.util.Collection<java.lang.Byte>"));
assertThat(metadata).has(Metadata.withProperty("collection.doubles", "java.util.List<java.lang.Double>"));
assertThat(metadata).has(Metadata.withProperty("collection.names-to-holders", "java.util.Map<java.lang.String,org.springframework.boot.configurationsample.simple.SimpleCollectionProperties$Holder<java.lang.String>>"));
}
Aggregations