Search in sources :

Example 21 with Qualification

use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.

the class ValidateV3_dev1SamplesTest method testMarshallQualification.

@Test
public void testMarshallQualification() throws JAXBException, SAXException, URISyntaxException {
    Qualification object = (Qualification) unmarshallFromPath("/record_3.0_dev1/samples/read_samples/qualification-3.0_dev1.xml", Qualification.class);
    marshall(object, "/record_3.0_dev1/qualification-3.0_dev1.xsd");
    object = (Qualification) unmarshallFromPath("/record_3.0_dev1/samples/write_samples/qualification-3.0_dev1.xml", Qualification.class);
    marshall(object, "/record_3.0_dev1/qualification-3.0_dev1.xsd");
}
Also used : Qualification(org.orcid.jaxb.model.v3.dev1.record.Qualification) Test(org.junit.Test)

Example 22 with Qualification

use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.

the class ActivityUtilsTest method setPathToActivitiesSummaryTest.

@Test
public void setPathToActivitiesSummaryTest() {
    ActivitiesSummary x = new ActivitiesSummary();
    x.setDistinctions(getDistinctions());
    x.setEducations(getEducations());
    x.setEmployments(getEmployments());
    x.setInvitedPositions(getInvitedPositions());
    x.setFundings(getFundings());
    x.setMemberships(getMemberships());
    x.setQualifications(getQualifications());
    x.setServices(getServices());
    x.setWorks(getWorks());
    x.setPeerReviews(getPeerReviews());
    ActivityUtils.setPathToActivity(x, ORCID);
    assertEquals("/" + ORCID + "/activities", x.getPath());
    assertEquals("/" + ORCID + "/distinction/123", x.getDistinctions().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/education/123", x.getEducations().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/employment/123", x.getEmployments().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/invited-position/123", x.getInvitedPositions().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/funding/123", x.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPath());
    assertEquals("/" + ORCID + "/membership/123", x.getMemberships().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/qualification/123", x.getQualifications().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/service/123", x.getServices().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/work/123", x.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getPath());
    assertEquals("/" + ORCID + "/peer-review/123", x.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPath());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test)

Example 23 with Qualification

use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_QualificationsTest method testViewQualificationSummaryReadPublic.

@Test
public void testViewQualificationSummaryReadPublic() {
    SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
    Response r = serviceDelegator.viewQualificationSummary(ORCID, 42L);
    QualificationSummary element = (QualificationSummary) r.getEntity();
    assertNotNull(element);
    assertEquals("/0000-0000-0000-0003/qualification/42", element.getPath());
    Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
Also used : Response(javax.ws.rs.core.Response) QualificationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 24 with Qualification

use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_QualificationsTest method testAddQualificationsDuplicateExternalIDs.

@Test(expected = OrcidDuplicatedActivityException.class)
public void testAddQualificationsDuplicateExternalIDs() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    ExternalID e1 = new ExternalID();
    e1.setRelationship(Relationship.SELF);
    e1.setType("erm");
    e1.setUrl(new Url("https://orcid.org"));
    e1.setValue("err");
    ExternalID e2 = new ExternalID();
    e2.setRelationship(Relationship.SELF);
    e2.setType("err");
    e2.setUrl(new Url("http://bbc.co.uk"));
    e2.setValue("erm");
    ExternalIDs externalIDs = new ExternalIDs();
    externalIDs.getExternalIdentifier().add(e1);
    externalIDs.getExternalIdentifier().add(e2);
    Qualification qualification = (Qualification) Utils.getAffiliation(AffiliationType.QUALIFICATION);
    qualification.setExternalIDs(externalIDs);
    Response response = serviceDelegator.createQualification(ORCID, qualification);
    assertNotNull(response);
    assertEquals(HttpStatus.SC_CREATED, response.getStatus());
    Map<?, ?> map = response.getMetadata();
    assertNotNull(map);
    assertTrue(map.containsKey("Location"));
    List<?> resultWithPutCode = (List<?>) map.get("Location");
    Long putCode = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
    try {
        Qualification duplicate = (Qualification) Utils.getAffiliation(AffiliationType.QUALIFICATION);
        duplicate.setExternalIDs(externalIDs);
        serviceDelegator.createQualification(ORCID, duplicate);
    } finally {
        serviceDelegator.deleteAffiliation(ORCID, putCode);
    }
}
Also used : Response(javax.ws.rs.core.Response) Qualification(org.orcid.jaxb.model.v3.dev1.record.Qualification) ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) List(java.util.List) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 25 with Qualification

use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_QualificationsTest method testUpdateQualificationLeavingVisibilityNullTest.

@Test
public void testUpdateQualificationLeavingVisibilityNullTest() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewQualification(ORCID, 42L);
    assertNotNull(response);
    Qualification qualification = (Qualification) response.getEntity();
    assertNotNull(qualification);
    assertEquals(Visibility.PUBLIC, qualification.getVisibility());
    qualification.setVisibility(null);
    response = serviceDelegator.updateQualification(ORCID, 42L, qualification);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    qualification = (Qualification) response.getEntity();
    assertNotNull(qualification);
    assertEquals(Visibility.PUBLIC, qualification.getVisibility());
}
Also used : Response(javax.ws.rs.core.Response) Qualification(org.orcid.jaxb.model.v3.dev1.record.Qualification) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Qualification (org.orcid.jaxb.model.v3.dev1.record.Qualification)40 Test (org.junit.Test)31 DBUnitTest (org.orcid.test.DBUnitTest)18 Response (javax.ws.rs.core.Response)17 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)11 Education (org.orcid.jaxb.model.v3.dev1.record.Education)11 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)11 Service (org.orcid.jaxb.model.v3.dev1.record.Service)11 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)10 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)10 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)8 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)7 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)6 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)5 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)4 Work (org.orcid.jaxb.model.v3.dev1.record.Work)4 Qualifications (org.orcid.jaxb.model.v3.dev1.record.summary.Qualifications)4