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");
}
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());
}
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");
}
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);
}
}
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());
}
Aggregations