本文整理汇总了Java中com.redhat.lightblue.util.JsonUtils.loadSchema方法的典型用法代码示例。如果您正苦于以下问题:Java JsonUtils.loadSchema方法的具体用法?Java JsonUtils.loadSchema怎么用?Java JsonUtils.loadSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.redhat.lightblue.util.JsonUtils
的用法示例。
在下文中一共展示了JsonUtils.loadSchema方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyMetadataJson
import com.redhat.lightblue.util.JsonUtils; //导入方法依赖的package包/类
/**
* Verify the audit metadata conforms to metadata schema.
*
* @throws Exception
*/
@Test
public void verifyMetadataJson() throws Exception {
String jsonSchemaString = FileUtil.readFile(AUDIT_METADATA_FILENAME);
JsonNode node = json(jsonSchemaString);
JsonSchema schema = JsonUtils.loadSchema("json-schema/metadata/metadata.json");
// verify metadata is valid
String report = JsonUtils.jsonSchemaValidation(schema, node);
// if report isn't null it's a failure and the value of report is the detail of why
Assert.assertTrue("Expected validation to succeed!\nResource: " + AUDIT_METADATA_FILENAME + "\nMessages:\n" + report, report == null);
}
示例2: jsonSchema
import com.redhat.lightblue.util.JsonUtils; //导入方法依赖的package包/类
/**
* Verify country.json against metadata json schema.
*
* @throws Exception
*/
@Test
public void jsonSchema() throws Exception {
String jsonSchemaString = FileUtil.readFile(COUNTRY_METADATA_FILENAME);
JsonNode node = json(jsonSchemaString);
JsonSchema schema = JsonUtils.loadSchema("json-schema/metadata/metadata.json");
// verify metadata is valid
String report = JsonUtils.jsonSchemaValidation(schema, node);
// if report isn't null it's a failure and the value of report is the detail of why
Assert.assertTrue("Expected validation to succeed!\nResource: " + COUNTRY_METADATA_FILENAME + "\nMessages:\n" + report, report == null);
}