use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testUpdateKeywordYouAreNotTheSourceOf.
@Test(expected = WrongSourceException.class)
public void testUpdateKeywordYouAreNotTheSourceOf() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED, ScopePathType.PERSON_UPDATE);
Response response = serviceDelegator.viewKeyword("4444-4444-4444-4443", 2L);
assertNotNull(response);
Keyword keyword = (Keyword) response.getEntity();
assertNotNull(keyword);
assertEquals("coffee making", keyword.getContent());
assertEquals(Visibility.LIMITED, keyword.getVisibility());
assertNotNull(keyword.getSource());
assertEquals("4444-4444-4444-4443", keyword.getSource().retrieveSourcePath());
keyword.setContent("Updated Keyword " + System.currentTimeMillis());
serviceDelegator.updateKeyword("4444-4444-4444-4443", 2L, keyword);
fail();
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testViewLimitedKeyword.
@Test
public void testViewLimitedKeyword() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewKeyword("4444-4444-4444-4443", 2L);
assertNotNull(response);
Keyword keyword = (Keyword) response.getEntity();
assertNotNull(keyword);
assertEquals("/4444-4444-4444-4443/keywords/2", keyword.getPath());
Utils.verifyLastModified(keyword.getLastModifiedDate());
assertEquals("coffee making", keyword.getContent());
assertEquals(Visibility.LIMITED, keyword.getVisibility());
assertEquals("4444-4444-4444-4443", keyword.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testViewPublicKeyword.
@Test
public void testViewPublicKeyword() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewKeyword("4444-4444-4444-4443", 1L);
assertNotNull(response);
Keyword keyword = (Keyword) response.getEntity();
assertNotNull(keyword);
assertEquals("/4444-4444-4444-4443/keywords/1", keyword.getPath());
Utils.verifyLastModified(keyword.getLastModifiedDate());
assertEquals("tea making", keyword.getContent());
assertEquals(Visibility.PUBLIC, keyword.getVisibility());
assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testAddKeyword.
@Test
public void testAddKeyword() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4441", ScopePathType.PERSON_READ_LIMITED, ScopePathType.PERSON_UPDATE);
Response response = serviceDelegator.createKeyword("4444-4444-4444-4441", Utils.getKeyword());
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.viewKeyword("4444-4444-4444-4441", putCode);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
Keyword newKeyword = (Keyword) response.getEntity();
assertNotNull(newKeyword);
Utils.verifyLastModified(newKeyword.getLastModifiedDate());
assertEquals("New keyword", newKeyword.getContent());
assertEquals(Visibility.PUBLIC, newKeyword.getVisibility());
assertNotNull(newKeyword.getSource());
assertEquals("APP-5555555555555555", newKeyword.getSource().retrieveSourcePath());
assertNotNull(newKeyword.getCreatedDate());
Utils.verifyLastModified(newKeyword.getLastModifiedDate());
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_KeywordsTest method testViewPrivateKeyword.
@Test
public void testViewPrivateKeyword() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewKeyword("4444-4444-4444-4443", 4L);
assertNotNull(response);
Keyword keyword = (Keyword) response.getEntity();
assertNotNull(keyword);
assertEquals("/4444-4444-4444-4443/keywords/4", keyword.getPath());
Utils.verifyLastModified(keyword.getLastModifiedDate());
assertEquals("what else can we make?", keyword.getContent());
assertEquals(Visibility.PRIVATE, keyword.getVisibility());
assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
Aggregations