use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingWithContributorWithoutOrcid.
private Funding getFundingWithContributorWithoutOrcid() {
Funding funding = new Funding();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title("funding with contributor without ORCID record"));
funding.setTitle(fundingTitle);
funding.setContributors(getFundingContributorWithoutOrcid());
return funding;
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPublicName.
@Test
public void testFilterContributorPrivateDataForFundingWithPublicName() {
when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn("a public name");
Funding funding = getFundingWithOrcidContributor();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("a public name", contributor.getCreditName().getContent());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingWithOrcidContributor.
private Funding getFundingWithOrcidContributor() {
Funding funding = new Funding();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title("work with contributor who has ORCID record"));
funding.setTitle(fundingTitle);
funding.setContributors(getFundingContributorWithOrcid());
return funding;
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord.
@Test
public void testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord() {
when(profileEntityManager.orcidExists(anyString())).thenReturn(false);
Funding funding = getFundingWithOrcidContributor();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("original credit name", contributor.getCreditName().getContent());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class AccessTokenSecurityChecksTest method testTokenIssuedForOneUserFailForOtherUsers_20API.
@Test
public void testTokenIssuedForOneUserFailForOtherUsers_20API() throws JSONException, InterruptedException, URISyntaxException {
String accessToken = getNonCachedAccessTokens(getUser2OrcidId(), getUser2Password(), getScopes(), getClient1ClientId(), getClient1ClientSecret(), getClient1RedirectUri());
String orcid = getUser1OrcidId();
Long putCode = 1L;
Address address = (Address) unmarshallFromPath("/record_2.0/samples/read_samples/address-2.0.xml", Address.class);
evaluateResponse(memberV2ApiClient.createAddress(orcid, address, accessToken));
Education education = (Education) unmarshallFromPath("/record_2.0/samples/read_samples/education-2.0.xml", Education.class);
evaluateResponse(memberV2ApiClient.createEducationJson(orcid, education, accessToken));
evaluateResponse(memberV2ApiClient.createEducationXml(orcid, education, accessToken));
Employment employment = (Employment) unmarshallFromPath("/record_2.0/samples/read_samples/employment-2.0.xml", Employment.class);
evaluateResponse(memberV2ApiClient.createEmploymentJson(orcid, employment, accessToken));
evaluateResponse(memberV2ApiClient.createEmploymentXml(orcid, employment, accessToken));
PersonExternalIdentifier externalIdentifier = (PersonExternalIdentifier) unmarshallFromPath("/record_2.0/samples/read_samples/external-identifier-2.0.xml", PersonExternalIdentifier.class);
evaluateResponse(memberV2ApiClient.createExternalIdentifier(orcid, externalIdentifier, accessToken));
Funding funding = (Funding) unmarshallFromPath("/record_2.0/samples/read_samples/funding-2.0.xml", Funding.class);
evaluateResponse(memberV2ApiClient.createFundingJson(orcid, funding, accessToken));
evaluateResponse(memberV2ApiClient.createFundingXml(orcid, funding, accessToken));
Keyword keyword = (Keyword) unmarshallFromPath("/record_2.0/samples/read_samples/keyword-2.0.xml", Keyword.class);
evaluateResponse(memberV2ApiClient.createKeyword(orcid, keyword, accessToken));
OtherName otherName = (OtherName) unmarshallFromPath("/record_2.0/samples/read_samples/other-name-2.0.xml", OtherName.class);
evaluateResponse(memberV2ApiClient.createOtherName(orcid, otherName, accessToken));
PeerReview peerReview = (PeerReview) unmarshallFromPath("/record_2.0/samples/read_samples/peer-review-2.0.xml", PeerReview.class);
evaluateResponse(memberV2ApiClient.createPeerReviewJson(orcid, peerReview, accessToken));
evaluateResponse(memberV2ApiClient.createPeerReviewXml(orcid, peerReview, accessToken));
ResearcherUrl rUrl = (ResearcherUrl) unmarshallFromPath("/record_2.0/samples/read_samples/researcher-url-2.0.xml", ResearcherUrl.class);
evaluateResponse(memberV2ApiClient.createResearcherUrls(orcid, rUrl, accessToken));
Work work = (Work) unmarshallFromPath("/record_2.0/samples/read_samples/work-2.0.xml", Work.class);
evaluateResponse(memberV2ApiClient.createWorkJson(orcid, work, accessToken));
evaluateResponse(memberV2ApiClient.createWorkXml(orcid, work, accessToken));
evaluateResponse(memberV2ApiClient.deleteAddress(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteEducationXml(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteEmploymentXml(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteExternalIdentifier(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteFundingXml(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteKeyword(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteOtherName(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deletePeerReviewXml(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteResearcherUrl(orcid, putCode, accessToken));
evaluateResponse(memberV2ApiClient.deleteWorkXml(orcid, putCode, accessToken));
address.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateAddress(orcid, address, accessToken));
education.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateEducation(orcid, education, accessToken));
employment.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateEmployment(orcid, employment, accessToken));
externalIdentifier.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateExternalIdentifier(orcid, externalIdentifier, accessToken));
funding.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateFunding(orcid, funding, accessToken));
keyword.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateKeyword(orcid, keyword, accessToken));
otherName.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateOtherName(orcid, otherName, accessToken));
peerReview.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updatePeerReview(orcid, peerReview, accessToken));
rUrl.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateResearcherUrls(orcid, rUrl, accessToken));
work.setPutCode(putCode);
evaluateResponse(memberV2ApiClient.updateWork(orcid, work, accessToken));
evaluateResponse(memberV2ApiClient.getResearcherUrls(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewAddresses(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewExternalIdentifiers(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewKeywords(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewOtherNames(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewBiography(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewPersonalDetailsXML(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewActivities(orcid, accessToken));
evaluateResponse(memberV2ApiClient.viewPerson(orcid, accessToken));
}
Aggregations