Search in sources :

Example 61 with Addresses

use of org.orcid.jaxb.model.record_v2.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 62 with Addresses

use of org.orcid.jaxb.model.record_v2.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 63 with Addresses

use of org.orcid.jaxb.model.record_v2.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 64 with Addresses

use of org.orcid.jaxb.model.record_v2.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 65 with Addresses

use of org.orcid.jaxb.model.record_v2.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)56 Addresses (org.orcid.jaxb.model.record_v2.Addresses)55 Address (org.orcid.jaxb.model.record_v2.Address)48 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)37 Biography (org.orcid.jaxb.model.record_v2.Biography)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Email (org.orcid.jaxb.model.record_v2.Email)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Name (org.orcid.jaxb.model.record_v2.Name)29 Person (org.orcid.jaxb.model.record_v2.Person)26 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