Search in sources :

Example 1 with TestJsonConverter

use of org.springframework.boot.configurationprocessor.metadata.TestJsonConverter in project spring-boot by spring-projects.

the class ConfigurationMetadataAnnotationProcessorTests method writeAdditionalHints.

private void writeAdditionalHints(ItemHint... hints) throws Exception {
    TestJsonConverter converter = new TestJsonConverter();
    File additionalMetadataFile = createAdditionalMetadataFile();
    JSONObject additionalMetadata = new JSONObject();
    additionalMetadata.put("hints", converter.toJsonArray(Arrays.asList(hints)));
    writeMetadata(additionalMetadataFile, additionalMetadata);
}
Also used : JSONObject(org.json.JSONObject) File(java.io.File) TestJsonConverter(org.springframework.boot.configurationprocessor.metadata.TestJsonConverter)

Example 2 with TestJsonConverter

use of org.springframework.boot.configurationprocessor.metadata.TestJsonConverter 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);
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) File(java.io.File) TestJsonConverter(org.springframework.boot.configurationprocessor.metadata.TestJsonConverter) ItemMetadata(org.springframework.boot.configurationprocessor.metadata.ItemMetadata)

Aggregations

File (java.io.File)2 JSONObject (org.json.JSONObject)2 TestJsonConverter (org.springframework.boot.configurationprocessor.metadata.TestJsonConverter)2 JSONArray (org.json.JSONArray)1 ItemMetadata (org.springframework.boot.configurationprocessor.metadata.ItemMetadata)1