本文整理汇总了Java中org.springframework.boot.configurationsample.simple.SimpleProperties类的典型用法代码示例。如果您正苦于以下问题:Java SimpleProperties类的具体用法?Java SimpleProperties怎么用?Java SimpleProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleProperties类属于org.springframework.boot.configurationsample.simple包,在下文中一共展示了SimpleProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleProperties
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void simpleProperties() throws Exception {
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)
.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"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例2: mergingOfHintWithProvider
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint>emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target",
"org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(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.withHint("simple.the-name")
.withProvider("first", "target", "org.foo").withProvider("second"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例3: mergingOfAdditionalMetadata
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfAdditionalMetadata() throws Exception {
File metaInfFolder = new File(this.compiler.getOutputLocation(), "META-INF");
metaInfFolder.mkdirs();
File additionalMetadataFile = new File(metaInfFolder,
"additional-spring-configuration-metadata.json");
additionalMetadataFile.createNewFile();
JSONObject property = new JSONObject();
property.put("name", "foo");
property.put("type", "java.lang.String");
property.put("sourceType", AdditionalMetadata.class.getName());
JSONArray properties = new JSONArray();
properties.put(property);
JSONObject additionalMetadata = new JSONObject();
additionalMetadata.put("properties", properties);
FileWriter writer = new FileWriter(additionalMetadataFile);
additionalMetadata.write(writer);
writer.flush();
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.comparator"));
assertThat(metadata).has(Metadata.withProperty("foo", String.class)
.fromSource(AdditionalMetadata.class));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例4: simpleProperties
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void simpleProperties() throws Exception {
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata, containsGroup("simple").fromSource(SimpleProperties.class));
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecation(null, null));
assertThat(metadata,
containsProperty("simple.flag", Boolean.class)
.fromSource(SimpleProperties.class)
.withDescription("A simple flag.").withDeprecation(null, null));
assertThat(metadata, containsProperty("simple.comparator"));
assertThat(metadata, not(containsProperty("simple.counter")));
assertThat(metadata, not(containsProperty("simple.size")));
}
示例5: mergingOfHintWithProvider
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint>emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<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")).withDeprecation(null, null));
assertThat(metadata, containsHint("simple.the-name")
.withProvider("first", "target", "org.foo").withProvider("second"));
}
示例6: mergingOfAdditionalProperty
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@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));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例7: mergeExistingPropertyDefaultValue
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergeExistingPropertyDefaultValue() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null,
null, null, true, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.flag", Boolean.class)
.fromSource(SimpleProperties.class).withDescription("A simple flag.")
.withDeprecation(null, null).withDefaultValue(true));
assertThat(metadata.getItems()).hasSize(4);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例8: mergeExistingPropertyDescription
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergeExistingPropertyDescription() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null,
null, null, "A nice comparator.", null, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata)
.has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>")
.fromSource(SimpleProperties.class)
.withDescription("A nice comparator."));
assertThat(metadata.getItems()).hasSize(4);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例9: mergeExistingPropertyDeprecation
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergeExistingPropertyDeprecation() throws Exception {
ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null,
null, null, null, null,
new ItemDeprecation("Don't use this.", "simple.complex-comparator"));
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata)
.has(Metadata.withProperty("simple.comparator", "java.util.Comparator<?>")
.fromSource(SimpleProperties.class)
.withDeprecation("Don't use this.", "simple.complex-comparator"));
assertThat(metadata.getItems()).hasSize(4);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例10: mergeOfInvalidAdditionalMetadata
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergeOfInvalidAdditionalMetadata() throws IOException {
File additionalMetadataFile = createAdditionalMetadataFile();
FileCopyUtils.copy("Hello World", new FileWriter(additionalMetadataFile));
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Compilation failed");
compile(SimpleProperties.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例11: mergingOfSimpleHint
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfSimpleHint() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.the-name",
new ItemHint.ValueHint("boot", "Bla bla"),
new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(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.withHint("simple.the-name")
.withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例12: mergingOfHintWithNonCanonicalName
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfHintWithNonCanonicalName() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.theName",
new ItemHint.ValueHint("boot", "Bla bla")));
ConfigurationMetadata metadata = compile(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.withHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例13: mergingOfAdditionalDeprecation
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergingOfAdditionalDeprecation() throws Exception {
writePropertyDeprecation(ItemMetadata.newProperty("simple", "wrongName",
"java.lang.String", null, null, null, null,
new ItemDeprecation("Lame name.", "simple.the-name")));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.wrong-name", String.class)
.withDeprecation("Lame name.", "simple.the-name"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例14: mergingOfAdditionalProperty
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@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, containsProperty("simple.comparator"));
assertThat(metadata, containsProperty("foo", String.class)
.fromSource(AdditionalMetadata.class));
}
示例15: mergeExistingPropertyDefaultValue
import org.springframework.boot.configurationsample.simple.SimpleProperties; //导入依赖的package包/类
@Test
public void mergeExistingPropertyDefaultValue() throws Exception {
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)));
assertThat(metadata.getItems().size(), is(4));
}