Search in sources :

Example 51 with Release

use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.

the class OcdsControllerTest method ocdsByOcid.

@Test
public void ocdsByOcid() throws Exception {
    final Release release = ocdsController.ocdsByOcid("ocds-endpoint-001");
    Assert.assertNotNull(release);
    Assert.assertEquals("ocds-endpoint-001-tender", release.getTender().getId());
}
Also used : Release(org.devgateway.ocds.persistence.mongo.Release) Test(org.junit.Test)

Example 52 with Release

use of org.devgateway.ocds.persistence.mongo.Release 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());
}
Also used : ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonImport(org.devgateway.ocds.persistence.mongo.spring.json.JsonImport) ProcessingMessage(com.github.fge.jsonschema.core.report.ProcessingMessage) ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonNode(com.fasterxml.jackson.databind.JsonNode) MvcResult(org.springframework.test.web.servlet.MvcResult) OcdsSchemaValidatorService(org.devgateway.ocds.persistence.mongo.spring.OcdsSchemaValidatorService) File(java.io.File) Release(org.devgateway.ocds.persistence.mongo.Release) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 53 with Release

use of org.devgateway.ocds.persistence.mongo.Release 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());
}
Also used : ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonImport(org.devgateway.ocds.persistence.mongo.spring.json.JsonImport) ProcessingMessage(com.github.fge.jsonschema.core.report.ProcessingMessage) ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonNode(com.fasterxml.jackson.databind.JsonNode) MvcResult(org.springframework.test.web.servlet.MvcResult) OcdsSchemaValidatorService(org.devgateway.ocds.persistence.mongo.spring.OcdsSchemaValidatorService) File(java.io.File) Release(org.devgateway.ocds.persistence.mongo.Release) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 54 with Release

use of org.devgateway.ocds.persistence.mongo.Release 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());
}
Also used : ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonImport(org.devgateway.ocds.persistence.mongo.spring.json.JsonImport) ProcessingMessage(com.github.fge.jsonschema.core.report.ProcessingMessage) ReleaseJsonImport(org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport) JsonNode(com.fasterxml.jackson.databind.JsonNode) MvcResult(org.springframework.test.web.servlet.MvcResult) OcdsSchemaValidatorService(org.devgateway.ocds.persistence.mongo.spring.OcdsSchemaValidatorService) File(java.io.File) Release(org.devgateway.ocds.persistence.mongo.Release) Test(org.junit.Test) AbstractWebTest(org.devgateway.toolkit.web.AbstractWebTest)

Example 55 with Release

use of org.devgateway.ocds.persistence.mongo.Release in project oc-explorer by devgateway.

the class OcdsControllerTest method packagedReleaseByProjectId.

@Test
public void packagedReleaseByProjectId() throws Exception {
    final ReleasePackage releasePackage = ocdsController.packagedReleaseByProjectId("SP001");
    Assert.assertNotNull(releasePackage);
    final Optional<Release> release = releasePackage.getReleases().stream().findFirst();
    Assert.assertEquals(true, release.isPresent());
    Assert.assertEquals("ocds-endpoint-001-tender", release.get().getTender().getId());
}
Also used : ReleasePackage(org.devgateway.ocds.persistence.mongo.ReleasePackage) Release(org.devgateway.ocds.persistence.mongo.Release) Test(org.junit.Test)

Aggregations

Release (org.devgateway.ocds.persistence.mongo.Release)68 Test (org.junit.Test)44 File (java.io.File)22 AbstractMongoTest (org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)20 ReleasePackage (org.devgateway.ocds.persistence.mongo.ReleasePackage)12 Amount (org.devgateway.ocds.persistence.mongo.Amount)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 ProcessingMessage (com.github.fge.jsonschema.core.report.ProcessingMessage)6 BigDecimal (java.math.BigDecimal)6 Award (org.devgateway.ocds.persistence.mongo.Award)6 OcdsSchemaValidatorService (org.devgateway.ocds.persistence.mongo.spring.OcdsSchemaValidatorService)6 JsonImport (org.devgateway.ocds.persistence.mongo.spring.json.JsonImport)6 ReleaseJsonImport (org.devgateway.ocds.persistence.mongo.spring.json.ReleaseJsonImport)6 AbstractWebTest (org.devgateway.toolkit.web.AbstractWebTest)6 MvcResult (org.springframework.test.web.servlet.MvcResult)6 Budget (org.devgateway.ocds.persistence.mongo.Budget)5 Contract (org.devgateway.ocds.persistence.mongo.Contract)4 Planning (org.devgateway.ocds.persistence.mongo.Planning)4 VNPlanning (org.devgateway.ocvn.persistence.mongo.dao.VNPlanning)4 VNTender (org.devgateway.ocvn.persistence.mongo.dao.VNTender)4