Search in sources :

Example 56 with Addresses

use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testUnmarshallAddress.

@Test
public void testUnmarshallAddress() throws SAXException, URISyntaxException {
    Addresses addresses = (Addresses) unmarshallFromPath("/record_2.0/samples/read_samples/addresses-2.0.xml", Addresses.class, "/record_2.0/address-2.0.xsd");
    assertNotNull(addresses);
    assertNotNull(addresses.getAddress());
    assertEquals(2, addresses.getAddress().size());
    for (Address address : addresses.getAddress()) {
        assertNotNull(address.getPutCode());
        assertNotNull(address.getCreatedDate());
        assertNotNull(address.getLastModifiedDate());
        assertNotNull(address.getCountry());
        if (address.getPutCode().equals(new Long(1))) {
            assertEquals(Iso3166Country.US, address.getCountry().getValue());
            assertEquals(Visibility.PUBLIC, address.getVisibility());
        } else {
            assertEquals(Iso3166Country.CR, address.getCountry().getValue());
            assertEquals(Visibility.LIMITED, address.getVisibility());
        }
    }
    Address address = (Address) unmarshallFromPath("/record_2.0/samples/read_samples/address-2.0.xml", Address.class);
    assertNotNull(address);
    assertNotNull(address.getPutCode());
    assertNotNull(address.getCreatedDate());
    assertNotNull(address.getLastModifiedDate());
    assertNotNull(address.getCountry());
    assertEquals(Iso3166Country.US, address.getCountry().getValue());
    assertEquals(Visibility.PUBLIC, address.getVisibility());
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Address(org.orcid.jaxb.model.record_v2.Address) Test(org.junit.Test)

Example 57 with Addresses

use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testMarshallAddress.

@Test
public void testMarshallAddress() throws JAXBException, SAXException, URISyntaxException {
    Addresses object = (Addresses) unmarshallFromPath("/record_2.1/samples/read_samples/addresses-2.1.xml", Addresses.class);
    marshall(object, "/record_2.1/address-2.1.xsd");
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Test(org.junit.Test)

Example 58 with Addresses

use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testMarshallAddress.

@Test
public void testMarshallAddress() throws JAXBException, SAXException, URISyntaxException {
    Addresses object = (Addresses) unmarshallFromPath("/record_2.0/samples/read_samples/addresses-2.0.xml", Addresses.class);
    marshall(object, "/record_2.0/address-2.0.xsd");
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Test(org.junit.Test)

Example 59 with Addresses

use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method getAddressesElement.

private Addresses getAddressesElement(Visibility... vs) {
    Addresses elements = new Addresses();
    for (Visibility v : vs) {
        Address element = new Address();
        element.setVisibility(v);
        if (elements.getAddress() == null) {
            elements.setAddress(new ArrayList<Address>());
        }
        elements.getAddress().add(element);
    }
    return elements;
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Address(org.orcid.jaxb.model.record_v2.Address) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 60 with Addresses

use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method filterAddressesTest.

@Test
public void filterAddressesTest() {
    Addresses x = getAddressesElement(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
    assertEquals(3, x.getAddress().size());
    publicAPISecurityManagerV2.filter(x);
    assertEquals(3, x.getAddress().size());
    assertAllArePublic(x.getAddress());
    x = getAddressesElement(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
    assertEquals(3, x.getAddress().size());
    publicAPISecurityManagerV2.filter(x);
    assertEquals(2, x.getAddress().size());
    assertAllArePublic(x.getAddress());
    x = getAddressesElement(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, x.getAddress().size());
    publicAPISecurityManagerV2.filter(x);
    assertEquals(1, x.getAddress().size());
    assertAllArePublic(x.getAddress());
    x = getAddressesElement(Visibility.PRIVATE, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, x.getAddress().size());
    publicAPISecurityManagerV2.filter(x);
    assertTrue(x.getAddress().isEmpty());
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)55 Addresses (org.orcid.jaxb.model.record_v2.Addresses)55 Address (org.orcid.jaxb.model.record_v2.Address)42 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Biography (org.orcid.jaxb.model.record_v2.Biography)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Email (org.orcid.jaxb.model.record_v2.Email)31 Keyword (org.orcid.jaxb.model.record_v2.Keyword)31 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)31 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)31 Name (org.orcid.jaxb.model.record_v2.Name)28 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15