Add missing handle-as meta-data

Liquibase has a `changeLog` property that is definitely used as a
`Resource` but cannot be defined as such as the original String value
should be kept against an API we don't control.

Update the tests also to make it more clear that if hints are added
against a property that is detected automatically, said property still
keeps all its auto-discovered capabilities.

Closes gh-3457
This commit is contained in:
Stephane Nicoll 2015-07-13 13:45:23 +02:00
parent d64ee99b20
commit cb5eccb5c1
3 changed files with 34 additions and 8 deletions

View File

@ -165,6 +165,17 @@
"deprecated": true
}
],"hints": [
{
"name": "liquibase.change-log",
"providers": [
{
"name": "handle-as",
"parameters": {
"target": "org.springframework.core.io.Resource"
}
}
]
},
{
"name": "server.jsp-servlet.class-name",
"providers": [

View File

@ -487,17 +487,17 @@ property that defines the `SQLDialect` class name to use:
----
{"hints": [
{
"name": "spring.jooq.sql-dialect",
"name": "liquibase.change-log",
"providers": [
{
"name": "handle-as",
"parameters": {
"target": "org.jooq.SQLDialect"
{
"name": "handle-as",
"parameters": {
"target": "org.springframework.core.io.Resource"
}
}
}
]
},
]}
}
]}
----

View File

@ -366,6 +366,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint(
"boot", "Bla bla"), new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecated());
assertThat(metadata,
containsHint("simple.the-name").withValue(0, "boot", "Bla bla")
.withValue(1, "spring", null));
@ -376,6 +381,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint(
"boot", "Bla bla")));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecated());
assertThat(metadata,
containsHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
@ -388,6 +398,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.<String, Object> singletonMap("target", "org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecated());
assertThat(metadata,
containsHint("simple.the-name")
.withProvider("first", "target", "org.foo")