use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ResearcherUrlsTest method testViewResearcherUrlReadPublic.
@Test
public void testViewResearcherUrlReadPublic() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewResearcherUrl(ORCID, 13L);
ResearcherUrl element = (ResearcherUrl) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/researcher-urls/13", element.getPath());
Utils.assertIsPublicOrSource(element, SecurityContextTestUtils.DEFAULT_CLIENT_ID);
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ResearcherUrlsTest method testViewPrivateResearcherUrl.
@Test
public void testViewPrivateResearcherUrl() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 7L);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
assertEquals("/4444-4444-4444-4443/researcher-urls/7", researcherUrl.getPath());
Utils.verifyLastModified(researcherUrl.getLastModifiedDate());
assertEquals("APP-5555555555555555", researcherUrl.getSource().retrieveSourcePath());
assertEquals("http://www.researcherurl2.com?id=7", researcherUrl.getUrl().getValue());
assertEquals("443_5", researcherUrl.getUrlName());
assertEquals(Visibility.PRIVATE, researcherUrl.getVisibility());
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ResearcherUrlsTest method testViewResearcherUrls.
@Test
public void testViewResearcherUrls() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewResearcherUrls("4444-4444-4444-4443");
assertNotNull(response);
ResearcherUrls researcherUrls = (ResearcherUrls) response.getEntity();
assertNotNull(researcherUrls);
Utils.verifyLastModified(researcherUrls.getLastModifiedDate());
assertEquals("/4444-4444-4444-4443/researcher-urls", researcherUrls.getPath());
assertNotNull(researcherUrls.getResearcherUrls());
assertEquals(5, researcherUrls.getResearcherUrls().size());
for (ResearcherUrl rUrl : researcherUrls.getResearcherUrls()) {
assertThat(rUrl.getPutCode(), anyOf(equalTo(Long.valueOf(2)), equalTo(Long.valueOf(3)), equalTo(Long.valueOf(5)), equalTo(Long.valueOf(7)), equalTo(Long.valueOf(8))));
Utils.verifyLastModified(researcherUrls.getLastModifiedDate());
assertNotNull(rUrl.getSource());
assertFalse(PojoUtil.isEmpty(rUrl.getSource().retrieveSourcePath()));
assertNotNull(rUrl.getUrl());
assertNotNull(rUrl.getUrlName());
assertNotNull(rUrl.getVisibility());
if (rUrl.getPutCode().equals(Long.valueOf(5)) || rUrl.getPutCode().equals(Long.valueOf(7))) {
assertEquals("APP-5555555555555555", rUrl.getSource().retrieveSourcePath());
}
}
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ResearcherUrlsTest method testAddResearcherUrl.
@Test
public void testAddResearcherUrl() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4441", ScopePathType.PERSON_READ_LIMITED, ScopePathType.PERSON_UPDATE);
Response response = serviceDelegator.createResearcherUrl("4444-4444-4444-4441", Utils.getResearcherUrl());
assertNotNull(response);
assertEquals(Response.Status.CREATED.getStatusCode(), 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)));
response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4441", putCode);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
Utils.verifyLastModified(researcherUrl.getLastModifiedDate());
assertEquals("APP-5555555555555555", researcherUrl.getSource().retrieveSourcePath());
assertEquals("http://www.myRUrl.com", researcherUrl.getUrl().getValue());
assertEquals("My researcher Url", researcherUrl.getUrlName());
assertEquals(Visibility.PUBLIC, researcherUrl.getVisibility());
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ResearcherUrlsTest method testUpdateResearcherUrlYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateResearcherUrlYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_UPDATE, ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 8L);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
assertNotNull(researcherUrl.getUrl());
assertEquals("http://www.researcherurl2.com?id=8", researcherUrl.getUrl().getValue());
assertEquals("443_6", researcherUrl.getUrlName());
researcherUrl.setUrlName("Updated Name");
serviceDelegator.updateResearcherUrl("4444-4444-4444-4443", 8L, researcherUrl);
}
Aggregations