Java 类org.springframework.boot.configurationsample.simple.SimpleProperties 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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")));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:spring-boot-concourse    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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"));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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,
            containsProperty("simple.comparator", "java.util.Comparator<?>")
                    .fromSource(SimpleProperties.class)
                    .withDescription("A nice comparator."));
    assertThat(metadata.getItems().size(), is(4));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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,
            containsProperty("simple.comparator", "java.util.Comparator<?>")
                    .fromSource(SimpleProperties.class)
                    .withDeprecation("Don't use this.", "simple.complex-comparator"));
    assertThat(metadata.getItems().size(), is(4));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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);
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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,
            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")
            .withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@Test
public void mergingOfHintWithNonCanonicalName() throws Exception {
    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")).withDeprecation(null, null));
    assertThat(metadata,
            containsHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
项目:contestparser    文件:ConfigurationMetadataAnnotationProcessorTests.java   
@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, containsProperty("simple.wrong-name", String.class)
            .withDeprecation("Lame name.", "simple.the-name"));
}