use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewKeywords.
@Test
public void testViewKeywords() {
Response response = serviceDelegator.viewKeywords(ORCID);
assertNotNull(response);
Keywords keywords = (Keywords) response.getEntity();
assertNotNull(keywords);
assertNotNull(keywords.getLastModifiedDate());
assertNotNull(keywords.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/keywords", keywords.getPath());
assertEquals(1, keywords.getKeywords().size());
Keyword keyword = keywords.getKeywords().get(0);
assertNotNull(keyword);
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), keyword.getPutCode());
assertEquals("PUBLIC", keyword.getContent());
assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
assertEquals("/0000-0000-0000-0003/keywords/9", keyword.getPath());
assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class Utils method getKeyword.
public static Keyword getKeyword() {
Keyword keyword = new Keyword();
keyword.setContent("New keyword");
keyword.setVisibility(Visibility.LIMITED);
return keyword;
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Keywords keywords) {
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
LastModifiedDate latest = null;
for (Keyword keyword : keywords.getKeywords()) {
if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
latest = keyword.getLastModifiedDate();
}
}
keywords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class JpaJaxbKeywordAdapterTest method getKeyword.
private Keyword getKeyword() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Keyword.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_2.0/samples/read_samples/keyword-2.0.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Keyword) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.record_rc2.Keyword in project ORCID-Source by ORCID.
the class JpaJaxbKeywordAdapterTest method fromProfileKeywordEntityToKeywordTest.
@Test
public void fromProfileKeywordEntityToKeywordTest() {
ProfileKeywordEntity entity = getProfileKeywordEntity();
Keyword keyword = adapter.toKeyword(entity);
assertNotNull(keyword);
assertEquals("keyword-1", keyword.getContent());
assertNotNull(keyword.getCreatedDate());
assertNotNull(keyword.getCreatedDate().getValue());
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(1), keyword.getPutCode());
assertNotNull(keyword.getSource());
assertEquals("APP-000000000000", keyword.getSource().retrieveSourcePath());
assertEquals(Visibility.LIMITED, keyword.getVisibility());
}
Aggregations