use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class OcdsController method ocdsPackages.
@ApiOperation(value = "Returns all available packages, filtered by the given criteria." + "This will contain the OCDS package information (metadata about publisher) plus the release itself.")
@RequestMapping(value = "/api/ocds/package/all", method = { RequestMethod.POST, RequestMethod.GET }, produces = "application/json")
@JsonView(Views.Public.class)
public List<ReleasePackage> ocdsPackages(@ModelAttribute @Valid final YearFilterPagingRequest releaseRequest) {
List<Release> ocdsReleases = ocdsReleases(releaseRequest);
List<ReleasePackage> releasePackages = new ArrayList<>(ocdsReleases.size());
for (Release release : ocdsReleases) {
releasePackages.add(createReleasePackage(release));
}
return releasePackages;
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class ReleaseRepositoryTest method testReleaseSaveAndFind.
@Test
public void testReleaseSaveAndFind() {
final Release release = new Release();
release.setOcid(ocid);
releaseRepository.insert(release);
final Release byOcid = releaseRepository.findByOcid(ocid);
Assert.assertEquals(ocid, byOcid.getOcid());
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class XMLFileImportDefault method process.
@Test
@Ignore
public void process() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("xml/release.xml").getFile());
xmlFile.process(file);
final List<Release> releases = releaseRepository.findAll();
Assert.assertNotNull(releases);
final Release release = releaseRepository.findById("xmlimport-123");
Assert.assertNotNull(release);
Assert.assertEquals("check field", release.getLanguage(), "en");
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class ReleasePackageJsonImportTest method importObjectsTenderAmendment.
@Test
public void importObjectsTenderAmendment() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/fictional-example/ocds-213czf-000-00001-03-tenderAmendment.json").getFile());
final ReleasePackageJsonImport releasePackageJsonImport = new ReleasePackageJsonImport(releaseRepository, file, false);
final Collection<Release> releases = releasePackageJsonImport.importObjects();
final Release importedRelease = releaseRepository.findById("ocds-213czf-000-00001-03-tenderAmendment");
Assert.assertEquals(1, releases.size());
Assert.assertNotNull(importedRelease);
Assert.assertArrayEquals(new Tender.SubmissionMethod[] { Tender.SubmissionMethod.electronicSubmission }, importedRelease.getTender().getSubmissionMethod().toArray());
}
use of org.devgateway.ocds.persistence.mongo.Release in project ocvn by devgateway.
the class ReleasePackageJsonImportTest method importObjectsTender.
@Test
public void importObjectsTender() throws Exception {
final ClassLoader classLoader = getClass().getClassLoader();
final File file = new File(classLoader.getResource("json/fictional-example/ocds-213czf-000-00001-02-tender.json").getFile());
final ReleasePackageJsonImport releasePackageJsonImport = new ReleasePackageJsonImport(releaseRepository, file, false);
final Collection<Release> releases = releasePackageJsonImport.importObjects();
final Release importedRelease = releaseRepository.findById("ocds-213czf-000-00001-02-tender");
Assert.assertEquals(1, releases.size());
Assert.assertNotNull(importedRelease);
Assert.assertEquals(Tender.ProcurementMethod.open, importedRelease.getTender().getProcurementMethod());
}
Aggregations