Search in sources :

Example 21 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class ConvertVrc4ToV2Test method upgradeFundingsToVrc3Test.

@Test
public void upgradeFundingsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Fundings.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_v2.Fundings.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc4.xml");
    InputStream rc4Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0.xml");
    Fundings rc4Fundings = (Fundings) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_v2.Fundings rc4Fundings1 = (org.orcid.jaxb.model.record.summary_v2.Fundings) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc4ToV2_0.upgrade(new V2Convertible(rc4Fundings, "v2_rc4"));
    org.orcid.jaxb.model.record.summary_v2.Fundings rc4Fundings2 = (org.orcid.jaxb.model.record.summary_v2.Fundings) result.getObjectToConvert();
    assertEquals(rc4Fundings1, rc4Fundings2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) Fundings(org.orcid.jaxb.model.record.summary_rc4.Fundings) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 22 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method filterFundingsTest.

@Test
public void filterFundingsTest() {
    Fundings f = getFundings(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
    assertEquals(3, f.getFundingGroup().size());
    publicAPISecurityManagerV2.filter(f);
    assertEquals(3, f.getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(f);
    f = getFundings(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
    assertEquals(3, f.getFundingGroup().size());
    publicAPISecurityManagerV2.filter(f);
    assertEquals(2, f.getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(f);
    f = getFundings(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, f.getFundingGroup().size());
    publicAPISecurityManagerV2.filter(f);
    assertEquals(1, f.getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(f);
    f = getFundings(Visibility.PRIVATE, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, f.getFundingGroup().size());
    publicAPISecurityManagerV2.filter(f);
    assertTrue(f.getFundingGroup().isEmpty());
}
Also used : Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) Test(org.junit.Test)

Example 23 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method getFundings.

private Fundings getFundings(Visibility... vs) {
    Fundings fundings = new Fundings();
    for (Visibility v : vs) {
        FundingGroup g = new FundingGroup();
        FundingSummary s = new FundingSummary();
        s.setVisibility(v);
        g.getFundingSummary().add(s);
        fundings.getFundingGroup().add(g);
    }
    return fundings;
}
Also used : Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) Visibility(org.orcid.jaxb.model.common_v2.Visibility) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup)

Example 24 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class ConvertVrc1ToVrc2Test method upgradeFundingsToVrc2Test.

@Test
public void upgradeFundingsToVrc2Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Fundings.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc2.Fundings.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc1.xml");
    InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc2.xml");
    Fundings rc1Fundings = (Fundings) jaxbUnmarshaller.unmarshal(rc1Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc2.Fundings rc2Fundings1 = (org.orcid.jaxb.model.record.summary_rc2.Fundings) jaxbUnmarshaller.unmarshal(rc2Stream);
    V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Fundings, "v2_rc1"));
    org.orcid.jaxb.model.record.summary_rc2.Fundings rc2Fundings2 = (org.orcid.jaxb.model.record.summary_rc2.Fundings) result.getObjectToConvert();
    assertEquals(rc2Fundings1.getLastModifiedDate(), rc2Fundings2.getLastModifiedDate());
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) Fundings(org.orcid.jaxb.model.record.summary_rc1.Fundings) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 25 with Fundings

use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.

the class ConvertVrc3ToVrc4Test method upgradeFundingsToVrc3Test.

@Test
public void upgradeFundingsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Fundings.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.Fundings.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc4.xml");
    Fundings rc4Fundings = (Fundings) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc4.Fundings rc4Fundings1 = (org.orcid.jaxb.model.record.summary_rc4.Fundings) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Fundings, "v2_rc3"));
    org.orcid.jaxb.model.record.summary_rc4.Fundings rc4Fundings2 = (org.orcid.jaxb.model.record.summary_rc4.Fundings) result.getObjectToConvert();
    assertEquals(rc4Fundings1, rc4Fundings2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) Fundings(org.orcid.jaxb.model.record.summary_rc3.Fundings) 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)31 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)24 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)19 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)10 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)8 Educations (org.orcid.jaxb.model.record.summary_v2.Educations)8 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)8 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Works (org.orcid.jaxb.model.record.summary_v2.Works)8 BaseTest (org.orcid.core.BaseTest)7 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)5 Fundings (org.orcid.jaxb.model.record.summary_rc2.Fundings)4 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)4 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)4 Address (org.orcid.jaxb.model.record_v2.Address)4 Email (org.orcid.jaxb.model.record_v2.Email)4 Keyword (org.orcid.jaxb.model.record_v2.Keyword)4 Name (org.orcid.jaxb.model.record_v2.Name)4