|
|
|
|
@@ -348,8 +348,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void mergingOfAdditionalProperty() throws Exception {
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty(null, "foo",
|
|
|
|
|
"java.lang.String", AdditionalMetadata.class.getName(), null, null, null,null);
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String",
|
|
|
|
|
AdditionalMetadata.class.getName(), null, null, null, null);
|
|
|
|
|
writeAdditionalMetadata(property);
|
|
|
|
|
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
|
|
|
|
assertThat(metadata, containsProperty("simple.comparator"));
|
|
|
|
|
@@ -360,16 +360,15 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void mergeExistingPropertyDefaultValue() throws Exception {
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null,
|
|
|
|
|
null, null, null, true, null);
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null,
|
|
|
|
|
null, null, true, null);
|
|
|
|
|
writeAdditionalMetadata(property);
|
|
|
|
|
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
|
|
|
|
assertThat(
|
|
|
|
|
metadata,
|
|
|
|
|
containsProperty("simple.flag", Boolean.class)
|
|
|
|
|
.fromSource(SimpleProperties.class)
|
|
|
|
|
.withDescription("A simple flag.")
|
|
|
|
|
.withDefaultValue(is(true)));
|
|
|
|
|
.withDescription("A simple flag.").withDefaultValue(is(true)));
|
|
|
|
|
assertThat(metadata.getItems().size(), is(4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -382,8 +381,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|
|
|
|
assertThat(
|
|
|
|
|
metadata,
|
|
|
|
|
containsProperty("simple.comparator", "java.util.Comparator<?>")
|
|
|
|
|
.fromSource(SimpleProperties.class)
|
|
|
|
|
.withDescription("A nice comparator."));
|
|
|
|
|
.fromSource(SimpleProperties.class).withDescription(
|
|
|
|
|
"A nice comparator."));
|
|
|
|
|
assertThat(metadata.getItems().size(), is(4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -397,23 +396,23 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|
|
|
|
assertThat(
|
|
|
|
|
metadata,
|
|
|
|
|
containsProperty("simple.comparator", "java.util.Comparator<?>")
|
|
|
|
|
.fromSource(SimpleProperties.class)
|
|
|
|
|
.withDeprecation("Don't use this.", "simple.complex-comparator"));
|
|
|
|
|
.fromSource(SimpleProperties.class).withDeprecation(
|
|
|
|
|
"Don't use this.", "simple.complex-comparator"));
|
|
|
|
|
assertThat(metadata.getItems().size(), is(4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void mergeExistingPropertyDeprecationOverride() throws Exception {
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", null,
|
|
|
|
|
null, null, null, null, new ItemDeprecation("Don't use this.",
|
|
|
|
|
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name",
|
|
|
|
|
null, null, null, null, null, new ItemDeprecation("Don't use this.",
|
|
|
|
|
"single.name"));
|
|
|
|
|
writeAdditionalMetadata(property);
|
|
|
|
|
ConfigurationMetadata metadata = compile(DeprecatedSingleProperty.class);
|
|
|
|
|
assertThat(
|
|
|
|
|
metadata,
|
|
|
|
|
containsProperty("singledeprecated.name", String.class.getName())
|
|
|
|
|
.fromSource(DeprecatedSingleProperty.class)
|
|
|
|
|
.withDeprecation("Don't use this.", "single.name"));
|
|
|
|
|
.fromSource(DeprecatedSingleProperty.class).withDeprecation(
|
|
|
|
|
"Don't use this.", "single.name"));
|
|
|
|
|
assertThat(metadata.getItems().size(), is(3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -461,9 +460,9 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|
|
|
|
@Test
|
|
|
|
|
public void mergingOfHintWithProvider() throws Exception {
|
|
|
|
|
writeAdditionalHints(new ItemHint("simple.theName",
|
|
|
|
|
Collections.<ItemHint.ValueHint> emptyList(), Arrays.asList(
|
|
|
|
|
Collections.<ItemHint.ValueHint>emptyList(), Arrays.asList(
|
|
|
|
|
new ItemHint.ValueProvider("first", Collections
|
|
|
|
|
.<String, Object> singletonMap("target", "org.foo")),
|
|
|
|
|
.<String, Object>singletonMap("target", "org.foo")),
|
|
|
|
|
new ItemHint.ValueProvider("second", null))));
|
|
|
|
|
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
|
|
|
|
assertThat(
|
|
|
|
|
|