use of org.orcid.jaxb.model.record_rc4.ExternalIDs in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_FundingTest method testUpdateFundingYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateFundingYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewFunding("4444-4444-4444-4446", 5L);
assertNotNull(response);
Funding funding = (Funding) response.getEntity();
assertNotNull(funding);
funding.getTitle().getTitle().setContent("Updated funding title");
ExternalID fExtId = new ExternalID();
fExtId.setRelationship(Relationship.PART_OF);
fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
fExtId.setUrl(new Url("http://fundingExtId.com"));
fExtId.setValue("new-funding-ext-id");
ExternalIDs fExtIds = new ExternalIDs();
fExtIds.getExternalIdentifier().add(fExtId);
funding.setExternalIdentifiers(fExtIds);
serviceDelegator.updateFunding("4444-4444-4444-4446", 5L, funding);
fail();
}
use of org.orcid.jaxb.model.record_rc4.ExternalIDs in project ORCID-Source by ORCID.
the class ValidateV2_1IdentifiersTest method testActivities.
@Test
public void testActivities() {
ActivitiesSummary as = unmarshallFromPath("/record_2.1/samples/read_samples/activities-2.1.xml", ActivitiesSummary.class);
ExternalIDs fundingIDs = as.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getExternalIdentifiers();
ExternalIDs fundingIDs2 = as.getFundings().getFundingGroup().get(0).getIdentifiers();
assertEquals("grant_number", fundingIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", fundingIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://tempuri.org"), fundingIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, fundingIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getType(), fundingIDs2.getExternalIdentifier().get(0).getType());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getValue(), fundingIDs2.getExternalIdentifier().get(0).getValue());
ExternalIDs peerIDs = as.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getExternalIdentifiers();
ExternalIDs peerIDs2 = as.getPeerReviews().getPeerReviewGroup().get(0).getIdentifiers();
assertEquals("something", peerIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", peerIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://orcid.org"), peerIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, peerIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(peerIDs.getExternalIdentifier().get(0).getType(), peerIDs2.getExternalIdentifier().get(0).getType());
assertEquals(peerIDs.getExternalIdentifier().get(0).getValue(), peerIDs2.getExternalIdentifier().get(0).getValue());
ExternalIDs workIDs = as.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getExternalIdentifiers();
ExternalIDs workIDs2 = as.getWorks().getWorkGroup().get(0).getIdentifiers();
assertEquals("agr", workIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", workIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://orcid.org"), workIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, workIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(workIDs.getExternalIdentifier().get(0).getType(), workIDs2.getExternalIdentifier().get(0).getType());
assertEquals(workIDs.getExternalIdentifier().get(0).getValue(), workIDs2.getExternalIdentifier().get(0).getValue());
}
use of org.orcid.jaxb.model.record_rc4.ExternalIDs in project ORCID-Source by ORCID.
the class ValidateV2_1IdentifiersTest method testRecord.
@Test
public void testRecord() {
Record record = unmarshallFromPath("/record_2.1/samples/read_samples/record-2.1.xml", Record.class);
ActivitiesSummary as = record.getActivitiesSummary();
ExternalIDs fundingIDs = as.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getExternalIdentifiers();
ExternalIDs fundingIDs2 = as.getFundings().getFundingGroup().get(0).getIdentifiers();
assertEquals("grant_number", fundingIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", fundingIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://tempuri.org"), fundingIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, fundingIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getType(), fundingIDs2.getExternalIdentifier().get(0).getType());
assertEquals(fundingIDs.getExternalIdentifier().get(0).getValue(), fundingIDs2.getExternalIdentifier().get(0).getValue());
ExternalIDs workIDs = as.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getExternalIdentifiers();
ExternalIDs workIDs2 = as.getWorks().getWorkGroup().get(0).getIdentifiers();
assertEquals("agr", workIDs.getExternalIdentifier().get(0).getType());
assertEquals("external-id-value", workIDs.getExternalIdentifier().get(0).getValue());
assertEquals(new Url("http://tempuri.org"), workIDs.getExternalIdentifier().get(0).getUrl());
assertEquals(Relationship.SELF, workIDs.getExternalIdentifier().get(0).getRelationship());
assertEquals(workIDs.getExternalIdentifier().get(0).getType(), workIDs2.getExternalIdentifier().get(0).getType());
assertEquals(workIDs.getExternalIdentifier().get(0).getValue(), workIDs2.getExternalIdentifier().get(0).getValue());
}
use of org.orcid.jaxb.model.record_rc4.ExternalIDs in project ORCID-Source by ORCID.
the class ActivitiesGroupGenerator_GroupingWorksTest method generateWorks.
/**
* work-1 -> ARG(A), ARG(B), ARG(C)
* work-2 -> ARG(C), ARG(D), ARG(E)
* work-3 -> ARG(X), ARG(Y), ARG(Z)
* work-4 -> ARG(Y), ARG(B), ARG(1)
* work-5 -> ARG(M), ARG(N), ARG(O)
* work-6 -> ARXIV(A), ARXIV(B), ARXIV(C)
* work-7 -> DOI(1), DOI(2), ARIXV(B)
* work-8 -> No external identifiers
* work-9 -> No external identifiers
* work-10 -> ISSN(1), ISSN(2), ISSN(3)
* work-11 -> ISSN(3), ISSN(4), ISSN(5)
* work-12 -> DOI(1), ISSN(1)
* work-13 -> DOI(1), ISSN(4)
* */
private Map<String, WorkSummary> generateWorks() {
Map<String, WorkSummary> result = new HashMap<String, WorkSummary>();
for (int i = 1; i < 14; i++) {
String title = "work-" + i;
WorkSummary work = new WorkSummary();
//Set title
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title(title));
work.setTitle(workTitle);
ExternalIDs wei = new ExternalIDs();
switch(i) {
case 1:
ExternalID e1 = new ExternalID();
e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e1.setValue("A");
ExternalID e2 = new ExternalID();
e2.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e2.setValue("B");
ExternalID e3 = new ExternalID();
e3.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e3.setValue("C");
wei.getExternalIdentifier().add(e1);
wei.getExternalIdentifier().add(e2);
wei.getExternalIdentifier().add(e3);
break;
case 2:
ExternalID e4 = new ExternalID();
e4.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e4.setValue("C");
ExternalID e5 = new ExternalID();
e5.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e5.setValue("D");
ExternalID e6 = new ExternalID();
e6.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e6.setValue("E");
wei.getExternalIdentifier().add(e4);
wei.getExternalIdentifier().add(e5);
wei.getExternalIdentifier().add(e6);
break;
case 3:
ExternalID e7 = new ExternalID();
e7.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e7.setValue("X");
ExternalID e8 = new ExternalID();
e8.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e8.setValue("Y");
ExternalID e9 = new ExternalID();
e9.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e9.setValue("Z");
wei.getExternalIdentifier().add(e7);
wei.getExternalIdentifier().add(e8);
wei.getExternalIdentifier().add(e9);
break;
case 4:
ExternalID e10 = new ExternalID();
e10.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e10.setValue("Y");
ExternalID e11 = new ExternalID();
e11.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e11.setValue("B");
ExternalID e12 = new ExternalID();
e12.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e12.setValue("1");
wei.getExternalIdentifier().add(e10);
wei.getExternalIdentifier().add(e11);
wei.getExternalIdentifier().add(e12);
break;
case 5:
ExternalID e13 = new ExternalID();
e13.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e13.setValue("M");
ExternalID e14 = new ExternalID();
e14.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e14.setValue("N");
ExternalID e15 = new ExternalID();
e15.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e15.setValue("O");
wei.getExternalIdentifier().add(e13);
wei.getExternalIdentifier().add(e14);
wei.getExternalIdentifier().add(e15);
break;
case 6:
ExternalID e16 = new ExternalID();
e16.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e16.setValue("A");
ExternalID e17 = new ExternalID();
e17.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e17.setValue("B");
ExternalID e18 = new ExternalID();
e18.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e18.setValue("C");
wei.getExternalIdentifier().add(e16);
wei.getExternalIdentifier().add(e17);
wei.getExternalIdentifier().add(e18);
break;
case 7:
ExternalID e19 = new ExternalID();
e19.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e19.setValue("1");
ExternalID e20 = new ExternalID();
e20.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e20.setValue("2");
ExternalID e21 = new ExternalID();
e21.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ARXIV.value());
e21.setValue("B");
wei.getExternalIdentifier().add(e19);
wei.getExternalIdentifier().add(e20);
wei.getExternalIdentifier().add(e21);
break;
case 10:
ExternalID e22 = new ExternalID();
e22.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e22.setValue("1");
ExternalID e23 = new ExternalID();
e23.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e23.setValue("2");
ExternalID e24 = new ExternalID();
e24.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e24.setValue("3");
wei.getExternalIdentifier().add(e22);
wei.getExternalIdentifier().add(e23);
wei.getExternalIdentifier().add(e24);
break;
case 11:
ExternalID e25 = new ExternalID();
e25.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e25.setValue("3");
ExternalID e26 = new ExternalID();
e26.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e26.setValue("3");
ExternalID e27 = new ExternalID();
e27.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e27.setValue("3");
wei.getExternalIdentifier().add(e25);
wei.getExternalIdentifier().add(e26);
wei.getExternalIdentifier().add(e27);
break;
case 12:
ExternalID e28 = new ExternalID();
e28.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e28.setValue("1");
ExternalID e29 = new ExternalID();
e29.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e29.setValue("1");
wei.getExternalIdentifier().add(e28);
wei.getExternalIdentifier().add(e29);
break;
case 13:
ExternalID e30 = new ExternalID();
e30.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e30.setValue("1");
ExternalID e31 = new ExternalID();
e31.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.value());
e31.setValue("4");
wei.getExternalIdentifier().add(e30);
wei.getExternalIdentifier().add(e31);
break;
}
work.setExternalIdentifiers(wei);
result.put(title, work);
}
return result;
}
use of org.orcid.jaxb.model.record_rc4.ExternalIDs in project ORCID-Source by ORCID.
the class PublicProfileVisibilityTest method peerReviewPrivacyTest.
@Test
public void peerReviewPrivacyTest() throws InterruptedException, JSONException, URISyntaxException {
// Create peer review group
String accessToken = getAccessToken(getScopes(ScopePathType.PERSON_READ_LIMITED, ScopePathType.PERSON_UPDATE, ScopePathType.ACTIVITIES_READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE));
List<GroupIdRecord> groups = createGroupIds();
assertNotNull(groups);
assertTrue(groups.size() > 0);
GroupIdRecord g1 = groups.get(0);
// Create peer review
long time = System.currentTimeMillis();
PeerReview peerReview = new PeerReview();
peerReview.setGroupId(g1.getGroupId());
ExternalIDs extIds = new ExternalIDs();
peerReview.setExternalIdentifiers(extIds);
peerReview.getExternalIdentifiers().getExternalIdentifier().clear();
ExternalID wExtId = new ExternalID();
wExtId.setValue("Work Id " + time);
wExtId.setType(WorkExternalIdentifierType.AGR.value());
wExtId.setRelationship(Relationship.SELF);
peerReview.getExternalIdentifiers().getExternalIdentifier().add(wExtId);
Organization organization = new Organization();
organization.setName("My org name " + System.currentTimeMillis());
OrganizationAddress address = new OrganizationAddress();
address.setCity("Imagination city");
address.setCountry(Iso3166Country.US);
organization.setAddress(address);
peerReview.setOrganization(organization);
peerReview.setRole(Role.CHAIR);
peerReview.setType(PeerReviewType.EVALUATION);
peerReview.setCompletionDate(new FuzzyDate(new Year(2016), new Month(1), new Day(1)));
ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(this.getUser1OrcidId(), peerReview, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
ClientResponse getResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
assertEquals(Response.Status.OK.getStatusCode(), getResponse.getStatus());
peerReview = getResponse.getEntity(PeerReview.class);
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.PRIVATE);
try {
//Verify it doesn't appear in the public page
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
fail();
} catch (Exception e) {
}
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.LIMITED);
try {
//Verify it doesn't appear in the public page
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
fail();
} catch (Exception e) {
}
showMyOrcidPage();
changePeerReviewVisibility(g1.getName(), Visibility.PUBLIC);
showPublicProfilePage(getUser1OrcidId());
peerReviewAppearsInPublicPage(g1.getName());
// Rollback
ClientResponse deleteResponse = memberV2ApiClient.deletePeerReviewXml(this.getUser1OrcidId(), peerReview.getPutCode(), accessToken);
assertNotNull(deleteResponse);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
Aggregations