use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_WorksTest method testViewPrivateWork.
@Test
public void testViewPrivateWork() {
// Use the smallest scope in the pyramid to verify that you can read
// your own limited and protected data
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewWork("4444-4444-4444-4446", 7L);
assertNotNull(response);
Work work = (Work) response.getEntity();
Utils.verifyLastModified(work.getLastModifiedDate());
assertNotNull(work.getWorkTitle());
assertNotNull(work.getWorkTitle().getTitle());
assertEquals("Journal article C", work.getWorkTitle().getTitle().getContent());
assertEquals(Long.valueOf(7), work.getPutCode());
assertEquals("/4444-4444-4444-4446/work/7", work.getPath());
assertEquals(WorkType.JOURNAL_ARTICLE, work.getWorkType());
assertEquals(Visibility.PRIVATE.value(), work.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.
the class JpaJaxbWorkAdapterTest method testToWorkEntity.
@Test
public void testToWorkEntity() throws JAXBException {
Work work = getWork(true);
assertNotNull(work);
WorkEntity workEntity = jpaJaxbWorkAdapter.toWorkEntity(work);
assertNotNull(workEntity);
assertEquals(Visibility.PRIVATE, workEntity.getVisibility());
assertNotNull(workEntity);
assertEquals(123, workEntity.getId().longValue());
assertEquals("common:title", workEntity.getTitle());
assertTrue(PojoUtil.isEmpty(workEntity.getSubtitle()));
assertEquals("common:translated-title", workEntity.getTranslatedTitle());
assertEquals("en", workEntity.getTranslatedTitleLanguageCode());
assertEquals("work:short-description", workEntity.getDescription());
assertEquals(CitationType.FORMATTED_UNSPECIFIED, workEntity.getCitationType());
assertEquals(WorkType.ARTISTIC_PERFORMANCE, workEntity.getWorkType());
PublicationDateEntity publicationDateEntity = workEntity.getPublicationDate();
assertNotNull(publicationDateEntity);
assertEquals(1848, publicationDateEntity.getYear().intValue());
assertEquals(02, publicationDateEntity.getMonth().intValue());
assertEquals(02, publicationDateEntity.getDay().intValue());
assertEquals("{\"workExternalIdentifier\":[{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"AGR\",\"workExternalIdentifierId\":{\"content\":\"work:external-identifier-id\"}}]}", workEntity.getExternalIdentifiersJson());
assertEquals("http://tempuri.org", workEntity.getWorkUrl());
assertEquals("{\"contributor\":[{\"contributorOrcid\":{\"uri\":\"http://orcid.org/8888-8888-8888-8880\",\"path\":\"8888-8888-8888-8880\",\"host\":\"orcid.org\"},\"creditName\":{\"content\":\"work:credit-name\"},\"contributorEmail\":{\"value\":\"work@contributor.email\"},\"contributorAttributes\":{\"contributorSequence\":\"FIRST\",\"contributorRole\":\"AUTHOR\"}}]}", workEntity.getContributorsJson());
assertEquals("en", workEntity.getLanguageCode());
assertEquals(Iso3166Country.AF, workEntity.getIso2Country());
// Source
assertNull(workEntity.getSourceId());
assertNull(workEntity.getClientSourceId());
assertNull(workEntity.getElementSourceId());
}
use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createWork.
protected Work createWork(Visibility v, String sourceId) {
Work work = new Work();
work.setVisibility(v);
setSource(work, sourceId);
return work;
}
use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateWork_emptyContributorEmailTest.
@Test(expected = OrcidValidationException.class)
public void validateWork_emptyContributorEmailTest() {
Work work = getWork();
work.getWorkContributors().getContributor().get(0).getContributorEmail().setValue("");
activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateWork_invalidLanguageCodeTest.
@Test(expected = ActivityTypeValidationException.class)
public void validateWork_invalidLanguageCodeTest() {
Work work = getWork();
work.setLanguageCode("xx");
activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Aggregations