Search in sources :

Example 51 with Employments

use of org.orcid.jaxb.model.record.summary_v2.Employments in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method checkIsPublicActivitiesSummaryTest.

@Test
public void checkIsPublicActivitiesSummaryTest() {
    ActivitiesSummary as = getActivitiesSummaryElement();
    publicAPISecurityManagerV2.filter(as);
    // Assert it have all activities
    assertEquals(3, as.getEducations().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEducations());
    assertEquals(3, as.getEmployments().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEmployments());
    assertEquals(3, as.getFundings().getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(as.getFundings());
    assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
    assertGroupContainsOnlyPublicElements(as.getPeerReviews());
    assertEquals(3, as.getWorks().getWorkGroup().size());
    assertGroupContainsOnlyPublicElements(as.getWorks());
    // Assert it filters educations
    as = getActivitiesSummaryElement();
    setVisibility(as.getEducations().getSummaries(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
    publicAPISecurityManagerV2.filter(as);
    assertNotNull(as.getEducations());
    assertTrue(as.getEducations().getSummaries().isEmpty());
    assertEquals(3, as.getEmployments().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEmployments());
    assertEquals(3, as.getFundings().getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(as.getFundings());
    assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
    assertGroupContainsOnlyPublicElements(as.getPeerReviews());
    assertEquals(3, as.getWorks().getWorkGroup().size());
    assertGroupContainsOnlyPublicElements(as.getWorks());
    // Assert it filters employments
    as = getActivitiesSummaryElement();
    setVisibility(as.getEmployments().getSummaries(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
    publicAPISecurityManagerV2.filter(as);
    assertEquals(3, as.getEducations().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEducations());
    assertNotNull(as.getEmployments());
    assertTrue(as.getEmployments().getSummaries().isEmpty());
    assertEquals(3, as.getFundings().getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(as.getFundings());
    assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
    assertGroupContainsOnlyPublicElements(as.getPeerReviews());
    assertEquals(3, as.getWorks().getWorkGroup().size());
    assertGroupContainsOnlyPublicElements(as.getWorks());
    // Assert it filters funding
    as = getActivitiesSummaryElement();
    setVisibility(as.getFundings(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
    publicAPISecurityManagerV2.filter(as);
    assertEquals(3, as.getEducations().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEducations());
    assertEquals(3, as.getEmployments().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEmployments());
    assertTrue(as.getFundings().getFundingGroup().isEmpty());
    assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
    assertGroupContainsOnlyPublicElements(as.getPeerReviews());
    assertEquals(3, as.getWorks().getWorkGroup().size());
    assertGroupContainsOnlyPublicElements(as.getWorks());
    // Assert it filters peer reviews
    as = getActivitiesSummaryElement();
    setVisibility(as.getPeerReviews(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
    publicAPISecurityManagerV2.filter(as);
    assertEquals(3, as.getEducations().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEducations());
    assertEquals(3, as.getEmployments().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEmployments());
    assertEquals(3, as.getFundings().getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(as.getFundings());
    assertTrue(as.getPeerReviews().getPeerReviewGroup().isEmpty());
    assertEquals(3, as.getWorks().getWorkGroup().size());
    assertGroupContainsOnlyPublicElements(as.getWorks());
    // Assert it filters works
    as = getActivitiesSummaryElement();
    setVisibility(as.getWorks(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
    publicAPISecurityManagerV2.filter(as);
    assertEquals(3, as.getEducations().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEducations());
    assertEquals(3, as.getEmployments().getSummaries().size());
    assertContainerContainsOnlyPublicElements(as.getEmployments());
    assertEquals(3, as.getFundings().getFundingGroup().size());
    assertGroupContainsOnlyPublicElements(as.getFundings());
    assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
    assertGroupContainsOnlyPublicElements(as.getPeerReviews());
    assertTrue(as.getWorks().getWorkGroup().isEmpty());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Test(org.junit.Test)

Example 52 with Employments

use of org.orcid.jaxb.model.record.summary_v2.Employments in project ORCID-Source by ORCID.

the class ConvertVrc2ToVrc3Test method upgradeEmploymentsToVrc3Test.

@Test
public void upgradeEmploymentsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Employments.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc3.Employments.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-employments-2.0_rc2.xml");
    InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-employments-2.0_rc3.xml");
    Employments rc2Employments = (Employments) jaxbUnmarshaller.unmarshal(rc2Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc3.Employments rc3Employments1 = (org.orcid.jaxb.model.record.summary_rc3.Employments) jaxbUnmarshaller.unmarshal(rc3Stream);
    V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Employments, "v2_rc2"));
    org.orcid.jaxb.model.record.summary_rc3.Employments rc3Employments2 = (org.orcid.jaxb.model.record.summary_rc3.Employments) result.getObjectToConvert();
    assertEquals(rc3Employments1, rc3Employments2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Employments(org.orcid.jaxb.model.record.summary_rc2.Employments) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 53 with Employments

use of org.orcid.jaxb.model.record.summary_v2.Employments in project ORCID-Source by ORCID.

the class ConvertVrc3ToVrc4Test method upgradeEmploymentsToVrc3Test.

@Test
public void upgradeEmploymentsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Employments.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.Employments.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-employments-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-employments-2.0_rc4.xml");
    Employments rc4Employments = (Employments) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc4.Employments rc4Employments1 = (org.orcid.jaxb.model.record.summary_rc4.Employments) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Employments, "v2_rc3"));
    org.orcid.jaxb.model.record.summary_rc4.Employments rc4Employments2 = (org.orcid.jaxb.model.record.summary_rc4.Employments) result.getObjectToConvert();
    assertEquals(rc4Employments1, rc4Employments2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Employments(org.orcid.jaxb.model.record.summary_rc3.Employments) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 54 with Employments

use of org.orcid.jaxb.model.record.summary_v2.Employments in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeEmploymentsToV21Test.

@Test
public void upgradeEmploymentsToV21Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Employments.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(Employments.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-employments-2.0.xml");
    InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-employments-2.1.xml");
    Employments v20Employments = (Employments) jaxbUnmarshaller.unmarshal(v20Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    Employments v21Employments1 = (Employments) jaxbUnmarshaller.unmarshal(v21Stream);
    V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Employments, "v2.1"));
    Employments v21Employments2 = (Employments) result.getObjectToConvert();
    assertEquals(v21Employments1, v21Employments2);
}
Also used : Employments(org.orcid.jaxb.model.record.summary_v2.Employments) 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 55 with Employments

use of org.orcid.jaxb.model.record.summary_v2.Employments in project ORCID-Source by ORCID.

the class ConvertVrc1ToVrc2Test method upgradeEmploymentsToVrc2Test.

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

Aggregations

Test (org.junit.Test)62 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)44 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)39 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)39 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)39 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)39 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)37 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)18 Address (org.orcid.jaxb.model.record_v2.Address)17 Email (org.orcid.jaxb.model.record_v2.Email)17 Keyword (org.orcid.jaxb.model.record_v2.Keyword)17 Name (org.orcid.jaxb.model.record_v2.Name)17 OtherName (org.orcid.jaxb.model.record_v2.OtherName)17 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)17 Record (org.orcid.jaxb.model.record_v2.Record)17 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)17 Addresses (org.orcid.jaxb.model.record_v2.Addresses)15 Biography (org.orcid.jaxb.model.record_v2.Biography)15 Emails (org.orcid.jaxb.model.record_v2.Emails)15 Keywords (org.orcid.jaxb.model.record_v2.Keywords)15