use of com.github.fge.jsonschema.core.report.ProcessingMessage in project rest-assured by rest-assured.
the class JsonSchemaValidator method describeTo.
public void describeTo(Description description) {
if (report != null) {
description.appendText("The content to match the given JSON schema.\n");
List<ProcessingMessage> messages = Lists.newArrayList(report);
if (!messages.isEmpty()) {
for (final ProcessingMessage message : messages) description.appendText(message.toString());
}
}
}
use of com.github.fge.jsonschema.core.report.ProcessingMessage in project ocvn by devgateway.
the class ReleaseExportTest method testReleaseExportIsValid.
@Test
public void testReleaseExportIsValid() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/award-release-test.json").getFile());
final JsonImport releaseJsonImport = new ReleaseJsonImport(releaseRepository, file, false);
final Release release = (Release) releaseJsonImport.importObject();
final MvcResult result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/ocds/release/ocid/" + release.getOcid()).accept(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andReturn();
final String content = result.getResponse().getContentAsString();
final JsonNode jsonNodeResponse = JsonLoader.fromString(content);
final OcdsSchemaValidatorService.ProcessingReportWithNode processingReport = ocdsSchemaValidator.validate(jsonNodeResponse);
if (!processingReport.getReport().isSuccess()) {
for (ProcessingMessage processingMessage : processingReport.getReport()) {
logger.error(">>> processingMessage: \n" + processingMessage);
}
}
Assert.assertEquals("Is the release valid?", true, processingReport.getReport().isSuccess());
}
use of com.github.fge.jsonschema.core.report.ProcessingMessage in project ocvn by devgateway.
the class ReleaseExportTest method testWholeStandardIsImplemented.
@Test
public void testWholeStandardIsImplemented() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/full-release.json").getFile());
final JsonImport releaseJsonImport = new ReleaseJsonImport(releaseRepository, file, false);
final Release release = (Release) releaseJsonImport.importObject();
final MvcResult result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/ocds/release/ocid/" + release.getOcid()).accept(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andReturn();
final String content = result.getResponse().getContentAsString();
final JsonNode jsonNodeResponse = JsonLoader.fromString(content);
final OcdsSchemaValidatorService.ProcessingReportWithNode processingReport = ocdsSchemaAllRequiredValidator.validate(jsonNodeResponse);
if (!processingReport.getReport().isSuccess()) {
for (ProcessingMessage processingMessage : processingReport.getReport()) {
logger.error(">>> processingMessage: \n" + processingMessage);
}
}
Assert.assertEquals("Do we implement the entire standard (with all fields required)?", true, processingReport.getReport().isSuccess());
}
use of com.github.fge.jsonschema.core.report.ProcessingMessage in project ocvn by devgateway.
the class ReleaseExportTest method testWholeStandardIsImplemented.
@Test
public void testWholeStandardIsImplemented() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/full-release.json").getFile());
final JsonImport releaseJsonImport = new ReleaseJsonImport(releaseRepository, file, false);
final Release release = (Release) releaseJsonImport.importObject();
final MvcResult result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/ocds/release/ocid/" + release.getOcid()).accept(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andReturn();
final String content = result.getResponse().getContentAsString();
final JsonNode jsonNodeResponse = JsonLoader.fromString(content);
final OcdsSchemaValidatorService.ProcessingReportWithNode processingReport = ocdsSchemaAllRequiredValidator.validate(jsonNodeResponse);
if (!processingReport.getReport().isSuccess()) {
for (ProcessingMessage processingMessage : processingReport.getReport()) {
logger.error(">>> processingMessage: \n" + processingMessage);
}
}
Assert.assertEquals("Do we implement the entire standard (with all fields required)?", true, processingReport.getReport().isSuccess());
}
use of com.github.fge.jsonschema.core.report.ProcessingMessage in project oc-explorer by devgateway.
the class ReleaseExportTest method testReleaseExportIsValid.
@Test
public void testReleaseExportIsValid() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/award-release-test.json").getFile());
final JsonImport releaseJsonImport = new ReleaseJsonImport(releaseRepository, file);
final Release release = (Release) releaseJsonImport.importObject();
final MvcResult result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/ocds/release/ocid/" + release.getOcid()).accept(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andReturn();
final String content = result.getResponse().getContentAsString();
final JsonNode jsonNodeResponse = JsonLoader.fromString(content);
final OcdsSchemaValidatorService.ProcessingReportWithNode processingReport = ocdsSchemaValidator.validate(jsonNodeResponse);
if (!processingReport.getReport().isSuccess()) {
for (ProcessingMessage processingMessage : processingReport.getReport()) {
logger.error(">>> processingMessage: \n" + processingMessage);
}
}
Assert.assertEquals("Is the release valid?", true, processingReport.getReport().isSuccess());
}
Aggregations