Commit cb5eccb5 authored by Stephane Nicoll's avatar Stephane Nicoll

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
parent d64ee99b
...@@ -165,6 +165,17 @@ ...@@ -165,6 +165,17 @@
"deprecated": true "deprecated": true
} }
],"hints": [ ],"hints": [
{
"name": "liquibase.change-log",
"providers": [
{
"name": "handle-as",
"parameters": {
"target": "org.springframework.core.io.Resource"
}
}
]
},
{ {
"name": "server.jsp-servlet.class-name", "name": "server.jsp-servlet.class-name",
"providers": [ "providers": [
......
...@@ -487,17 +487,17 @@ property that defines the `SQLDialect` class name to use: ...@@ -487,17 +487,17 @@ property that defines the `SQLDialect` class name to use:
---- ----
{"hints": [ {"hints": [
{ {
"name": "spring.jooq.sql-dialect", "name": "liquibase.change-log",
"providers": [ "providers": [
{ {
"name": "handle-as", "name": "handle-as",
"parameters": { "parameters": {
"target": "org.jooq.SQLDialect" "target": "org.springframework.core.io.Resource"
}
} }
}
] ]
}, }
]} ]}
---- ----
......
...@@ -366,6 +366,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -366,6 +366,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint( writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint(
"boot", "Bla bla"), new ItemHint.ValueHint("spring", null))); "boot", "Bla bla"), new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(SimpleProperties.class); 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, assertThat(metadata,
containsHint("simple.the-name").withValue(0, "boot", "Bla bla") containsHint("simple.the-name").withValue(0, "boot", "Bla bla")
.withValue(1, "spring", null)); .withValue(1, "spring", null));
...@@ -376,6 +381,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -376,6 +381,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint( writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint(
"boot", "Bla bla"))); "boot", "Bla bla")));
ConfigurationMetadata metadata = compile(SimpleProperties.class); 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, assertThat(metadata,
containsHint("simple.the-name").withValue(0, "boot", "Bla bla")); containsHint("simple.the-name").withValue(0, "boot", "Bla bla"));
} }
...@@ -388,6 +398,11 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -388,6 +398,11 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.<String, Object> singletonMap("target", "org.foo")), .<String, Object> singletonMap("target", "org.foo")),
new ItemHint.ValueProvider("second", null)))); new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class); 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, assertThat(metadata,
containsHint("simple.the-name") containsHint("simple.the-name")
.withProvider("first", "target", "org.foo") .withProvider("first", "target", "org.foo")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment