Search in sources :

Example 1 with Address

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

the class OrganizationRepositoryTests method saveOrganization.

@Test
public void saveOrganization() {
    Organization o = new Organization();
    Address a = new Address();
    a.setCountryName("United States");
    a.setLocality("Washington");
    a.setRegion("DC");
    a.setPostalCode("20005");
    a.setStreetAddress("1110 Vermont Ave. NW, Suite 500");
    o.setAddress(a);
    ContactPoint cp = new ContactPoint();
    cp.setEmail("info@developmentgateway.org");
    cp.setName("John Doe");
    cp.setTelephone("555-1234567");
    cp.setUrl("http://developmentgateway.org");
    cp.setFaxNumber("555-7654321");
    o.setContactPoint(cp);
    Identifier i = new Identifier();
    i.setId("DG");
    i.setLegalName("Development Gateway");
    o.setIdentifier(i);
    o.getRoles().add(OrganizationType.procuringEntity);
    o.getAdditionalIdentifiers().add(i);
    Organization save = vnOrganizationRepository.save(o);
    assertThat(save.getId(), is(not(nullValue())));
    LOGGER.info(save.getId());
}
Also used : ContactPoint(org.devgateway.ocds.persistence.mongo.ContactPoint) Organization(org.devgateway.ocds.persistence.mongo.Organization) Identifier(org.devgateway.ocds.persistence.mongo.Identifier) Address(org.devgateway.ocds.persistence.mongo.Address) Test(org.junit.Test) AbstractMongoTest(org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)

Example 2 with Address

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

the class OrganizationEndpointsTest method importTestData.

@Before
public void importTestData() throws IOException, InterruptedException {
    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("http://developmentgateway.org");
    organization.setContactPoint(contactPoint);
    final Identifier identifier = new Identifier();
    identifier.setId(ORG_ID);
    organization.getAdditionalIdentifiers().add(identifier);
    organization.getRoles().add(Organization.OrganizationType.procuringEntity);
    organization.getRoles().add(Organization.OrganizationType.buyer);
    final Organization savedOrganization = organizationRepository.save(organization);
    Assert.assertNotNull(savedOrganization);
    Assert.assertEquals(ORG_ID, savedOrganization.getId());
}
Also used : ContactPoint(org.devgateway.ocds.persistence.mongo.ContactPoint) Organization(org.devgateway.ocds.persistence.mongo.Organization) Identifier(org.devgateway.ocds.persistence.mongo.Identifier) Address(org.devgateway.ocds.persistence.mongo.Address) Before(org.junit.Before)

Example 3 with Address

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

the class OrganizationRepositoryTest method importTestData.

@Before
public void importTestData() throws IOException, InterruptedException {
    // 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("http://developmentgateway.org");
    organization.setContactPoint(contactPoint);
    final Identifier identifier = new Identifier();
    organization.getAdditionalIdentifiers().add(identifier);
    organization.getRoles().add(Organization.OrganizationType.procuringEntity);
    organization.getRoles().add(Organization.OrganizationType.buyer);
    final Organization savedOrganization = organizationRepository.save(organization);
    Assert.assertNotNull(savedOrganization);
    Assert.assertEquals(ORG_ID, savedOrganization.getId());
}
Also used : ContactPoint(org.devgateway.ocds.persistence.mongo.ContactPoint) Organization(org.devgateway.ocds.persistence.mongo.Organization) Identifier(org.devgateway.ocds.persistence.mongo.Identifier) Address(org.devgateway.ocds.persistence.mongo.Address) Before(org.junit.Before)

Example 4 with Address

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

the class OrganizationRowImporter method newAddress.

protected void newAddress(Organization organization, String addressCell) {
    Address address = new Address();
    address.setStreetAddress(addressCell);
    organization.setAddress(address);
}
Also used : Address(org.devgateway.ocds.persistence.mongo.Address)

Aggregations

Address (org.devgateway.ocds.persistence.mongo.Address)4 ContactPoint (org.devgateway.ocds.persistence.mongo.ContactPoint)3 Identifier (org.devgateway.ocds.persistence.mongo.Identifier)3 Organization (org.devgateway.ocds.persistence.mongo.Organization)3 Before (org.junit.Before)2 AbstractMongoTest (org.devgateway.toolkit.persistence.mongo.AbstractMongoTest)1 Test (org.junit.Test)1