use of org.springframework.boot.configurationprocessor.metadata.ItemMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method writeAdditionalMetadata.
private void writeAdditionalMetadata(ItemMetadata... metadata) throws Exception {
TestJsonConverter converter = new TestJsonConverter();
File additionalMetadataFile = createAdditionalMetadataFile();
JSONObject additionalMetadata = new JSONObject();
JSONArray properties = new JSONArray();
for (ItemMetadata itemMetadata : metadata) {
properties.put(converter.toJsonObject(itemMetadata));
}
additionalMetadata.put("properties", properties);
writeMetadata(additionalMetadataFile, additionalMetadata);
}
use of org.springframework.boot.configurationprocessor.metadata.ItemMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method mergingOfAdditionalProperty.
@Test
public void mergingOfAdditionalProperty() throws Exception {
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).has(Metadata.withProperty("simple.comparator"));
assertThat(metadata).has(Metadata.withProperty("foo", String.class).fromSource(AdditionalMetadata.class));
}
use of org.springframework.boot.configurationprocessor.metadata.ItemMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method mergeExistingPropertyDeprecationOverride.
@Test
public void mergeExistingPropertyDeprecationOverride() throws Exception {
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).has(Metadata.withProperty("singledeprecated.name", String.class.getName()).fromSource(DeprecatedSingleProperty.class).withDeprecation("Don't use this.", "single.name"));
assertThat(metadata.getItems()).hasSize(3);
}
Aggregations