use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class ReleasePackageJsonImport method importObjects.
@Override
public Collection<Release> importObjects() throws IOException {
final ReleasePackage releasePackage = (ReleasePackage) releasePackageJsonToObject.toObject();
final Collection<Release> savedReleases = new LinkedHashSet<>();
if (!releasePackage.getReleases().isEmpty()) {
Set<Release> releases = releasePackage.getReleases();
for (Release release : releases) {
Release savedRelease = releaseRepository.save(release);
savedReleases.add(savedRelease);
}
}
return savedReleases;
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class AwardReleaseRowImporter method newReleaseFromAwardFactory.
public Release newReleaseFromAwardFactory(String planningBidNo) {
Release release = new Release();
release.getTag().add(Tag.award);
release.setOcid(MongoConstants.OCDS_PREFIX + "bidno-" + planningBidNo);
VNPlanning planning = new VNPlanning();
release.setPlanning(planning);
planning.setBidNo(planningBidNo);
return 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());
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class OcdsControllerTest method createReleasePackage.
@Test
public void createReleasePackage() throws Exception {
final ReleasePackage releasePackage = ocdsController.createReleasePackage(ocdsController.ocdsByOcid("ocds-endpoint-001"));
Assert.assertNotNull(releasePackage);
final Optional<Release> release = releasePackage.getReleases().stream().findFirst();
Assert.assertEquals(true, release.isPresent());
Assert.assertEquals("ocds-endpoint-001", release.get().getOcid());
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn 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());
}
Aggregations