Search in sources :

Example 66 with Addresses

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

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

use of org.orcid.jaxb.model.record_rc4.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)

Example 69 with Addresses

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

the class ConvertVrc2ToVrc3Test method upgradeAddressesToVrc3Test.

@Test
public void upgradeAddressesToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Addresses.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record_rc3.Addresses.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc2.xml");
    InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc3.xml");
    Addresses rc2Element = (Addresses) jaxbUnmarshaller.unmarshal(rc2Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record_rc3.Addresses rc3Element1 = (org.orcid.jaxb.model.record_rc3.Addresses) jaxbUnmarshaller.unmarshal(rc3Stream);
    V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Element, "v2_rc2"));
    org.orcid.jaxb.model.record_rc3.Addresses rc3Element2 = (org.orcid.jaxb.model.record_rc3.Addresses) result.getObjectToConvert();
    assertEquals(rc3Element1, rc3Element2);
}
Also used : Addresses(org.orcid.jaxb.model.record_rc2.Addresses) V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 70 with Addresses

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

the class ConvertV2ToV2_1Test method upgradeAddressesToV21Test.

@Test
public void upgradeAddressesToV21Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Addresses.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(Addresses.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0.xml");
    InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-addresses-2.1.xml");
    Addresses v20Element = (Addresses) jaxbUnmarshaller.unmarshal(v20Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    Addresses v21Element1 = (Addresses) jaxbUnmarshaller.unmarshal(v21Stream);
    V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Element, "v2.1"));
    Addresses v21Element2 = (Addresses) result.getObjectToConvert();
    assertEquals(v21Element1, v21Element2);
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

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