use of org.orcid.jaxb.model.record_v2.ResearcherUrl in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_ResearcherUrlsTest method testUpdateResearcherUrlChangingVisibilityTest.
@Test(expected = VisibilityMismatchException.class)
public void testUpdateResearcherUrlChangingVisibilityTest() {
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(Visibility.PRIVATE);
response = serviceDelegator.updateResearcherUrl("4444-4444-4444-4443", 5L, researcherUrl);
fail();
}
use of org.orcid.jaxb.model.record_v2.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_v2.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_v2.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_v2.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());
}
Aggregations