use of org.devgateway.ocds.persistence.mongo.Organization in project oc-explorer by devgateway.
the class OCDSPopulatorService method randomizeOrganization.
public void randomizeOrganization(Organization o) {
o.setName(getIdxName("Organization"));
String oldId = o.getId();
orgNameId.put(oldId, o.getName());
o.setId(o.getName());
o.getIdentifier().setId(o.getId());
o.getAdditionalIdentifiers().stream().filter(i -> i.getId().equals(oldId)).findFirst().get().setId(o.getId());
if (o.getAddress() != null) {
o.getAddress().setCountryName(getIdxName("Country"));
o.getAddress().setLocality(getIdxName("Locality"));
o.getAddress().setPostalCode(getIdxName("Postal Code"));
o.getAddress().setRegion(getIdxName("Region"));
o.getAddress().setStreetAddress(getIdxName("Street"));
}
if (o.getContactPoint() != null) {
o.getContactPoint().setEmail("sample@sample.abc");
o.getContactPoint().setFaxNumber("Fax");
o.getContactPoint().setName(getIdxName("Contact"));
o.getContactPoint().setTelephone("Phone");
try {
o.getContactPoint().setUrl(new URI("http://sample.abc"));
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
mongoTemplate.save(o, "tmporg");
}
use of org.devgateway.ocds.persistence.mongo.Organization in project oc-explorer by devgateway.
the class OrganizationEndpointsTest method testSupplierIdEndpoint.
@Test
public void testSupplierIdEndpoint() {
final Organization organizationId = supplierSearchController.byId(ORG_ID);
Assert.assertNull(organizationId);
}
use of org.devgateway.ocds.persistence.mongo.Organization in project oc-explorer by devgateway.
the class OrganizationEndpointsTest method testBuyerSearchText.
@Test
public void testBuyerSearchText() {
final OrganizationSearchRequest osr = new OrganizationSearchRequest();
osr.setText("Development");
final List<Organization> organizations = buyerSearchController.searchText(osr);
Assert.assertEquals(1, organizations.size(), 0);
}
use of org.devgateway.ocds.persistence.mongo.Organization in project oc-explorer by devgateway.
the class OrganizationRepositoryTest method importTestData.
@Before
public void importTestData() throws IOException, InterruptedException, URISyntaxException {
// be sure that the organization collection is empty
organizationRepository.deleteAll();
final Organization organization = new Organization();
organization.setName("Development Gateway");
organization.setId(ORG_ID);
final Address address = new Address();
address.setCountryName("Romania");
address.setLocality("Bucuresti");
address.setPostalCode("022671");
address.setRegion("Bucuresti");
address.setStreetAddress("7 Sos. Iancului");
organization.setAddress(address);
final ContactPoint contactPoint = new ContactPoint();
contactPoint.setEmail("mpostelnicu@developmentgateway.org");
contactPoint.setFaxNumber("01234567");
contactPoint.setTelephone("01234567");
contactPoint.setUrl(new URI("http://developmentgateway.org"));
organization.setContactPoint(contactPoint);
final Identifier identifier = new Identifier();
organization.getAdditionalIdentifiers().add(identifier);
organization.getRoles().add(Organization.OrganizationType.procuringEntity.toString());
organization.getRoles().add(Organization.OrganizationType.buyer.toString());
final Organization savedOrganization = organizationRepository.save(organization);
Assert.assertNotNull(savedOrganization);
Assert.assertEquals(ORG_ID, savedOrganization.getId());
}
use of org.devgateway.ocds.persistence.mongo.Organization in project ocvn by devgateway.
the class OrganizationRepositoryTest method testOrganizationSaveAndFind.
@Test
public void testOrganizationSaveAndFind() {
final Organization foundOrg = organizationRepository.findOne(ORG_ID);
Assert.assertNotNull(foundOrg);
final Organization foundOrg2 = organizationRepository.findByIdOrNameAndTypes(ORG_ID, Organization.OrganizationType.procuringEntity);
Assert.assertNotNull(foundOrg2);
final Organization foundOrg3 = organizationRepository.findByIdOrNameAndTypes(ORG_ID, Organization.OrganizationType.supplier);
Assert.assertNull(foundOrg3);
final Organization foundOrg4 = organizationRepository.findByIdOrNameAllIgnoreCase(ORG_ID, ORG_ID);
Assert.assertNotNull(foundOrg4);
}
Aggregations