use of org.orcid.jaxb.model.record_rc3.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ResearcherUrlsTest method testUpdateResearcherUrl.
@Test
public void testUpdateResearcherUrl() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_UPDATE);
Response response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 5L);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
Utils.verifyLastModified(researcherUrl.getLastModifiedDate());
LastModifiedDate before = researcherUrl.getLastModifiedDate();
assertNotNull(researcherUrl.getUrl());
assertEquals("http://www.researcherurl2.com?id=5", researcherUrl.getUrl().getValue());
assertEquals("443_3", researcherUrl.getUrlName());
researcherUrl.setUrl(new Url("http://theNewResearcherUrl.com"));
researcherUrl.setUrlName("My Updated Researcher Url");
response = serviceDelegator.updateResearcherUrl("4444-4444-4444-4443", 5L, researcherUrl);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 5L);
assertNotNull(response);
researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
Utils.verifyLastModified(researcherUrl.getLastModifiedDate());
assertTrue(researcherUrl.getLastModifiedDate().after(before));
assertNotNull(researcherUrl.getUrl());
assertEquals("http://theNewResearcherUrl.com", researcherUrl.getUrl().getValue());
assertEquals("My Updated Researcher Url", researcherUrl.getUrlName());
}
use of org.orcid.jaxb.model.record_rc3.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ResearcherUrlsTest method testViewLimitedResearcherUrl.
@Test
public void testViewLimitedResearcherUrl() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 8L);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertNotNull(researcherUrl);
assertEquals("/4444-4444-4444-4443/researcher-urls/8", researcherUrl.getPath());
Utils.verifyLastModified(researcherUrl.getLastModifiedDate());
assertEquals("4444-4444-4444-4443", researcherUrl.getSource().retrieveSourcePath());
assertEquals("http://www.researcherurl2.com?id=8", researcherUrl.getUrl().getValue());
assertEquals("443_6", researcherUrl.getUrlName());
assertEquals(Visibility.LIMITED, researcherUrl.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_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.record_rc3.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ResearcherUrlsTest method testUpdateResearcherUrlLeavingVisibilityNullTest.
@Test
public void testUpdateResearcherUrlLeavingVisibilityNullTest() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_UPDATE);
Response response = serviceDelegator.viewResearcherUrl("4444-4444-4444-4443", 5L);
assertNotNull(response);
ResearcherUrl researcherUrl = (ResearcherUrl) response.getEntity();
assertEquals(Visibility.LIMITED, researcherUrl.getVisibility());
researcherUrl.setVisibility(null);
response = serviceDelegator.updateResearcherUrl("4444-4444-4444-4443", 5L, researcherUrl);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
researcherUrl = (ResearcherUrl) response.getEntity();
assertEquals(Visibility.LIMITED, researcherUrl.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_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());
}
Aggregations