use of org.orcid.jaxb.model.v3.dev1.common.Title in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_WorksTest method testCleanEmptyFieldsOnWorks.
@Test
public void testCleanEmptyFieldsOnWorks() {
LastModifiedDate lmd = new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis()));
Work work = new Work();
work.setLastModifiedDate(lmd);
work.setWorkCitation(new Citation("", CitationType.FORMATTED_UNSPECIFIED));
WorkTitle title = new WorkTitle();
title.setTitle(new Title("My Work"));
title.setSubtitle(new Subtitle("My subtitle"));
title.setTranslatedTitle(new TranslatedTitle("", ""));
work.setWorkTitle(title);
ActivityUtils.cleanEmptyFields(work);
assertNotNull(work);
Utils.verifyLastModified(work.getLastModifiedDate());
assertNotNull(work.getWorkTitle());
assertNotNull(work.getWorkTitle().getTitle());
assertNotNull(work.getWorkTitle().getSubtitle());
assertEquals("My Work", work.getWorkTitle().getTitle().getContent());
assertEquals("My subtitle", work.getWorkTitle().getSubtitle().getContent());
assertNull(work.getWorkCitation());
assertNull(work.getWorkTitle().getTranslatedTitle());
}
use of org.orcid.jaxb.model.v3.dev1.common.Title in project ORCID-Source by ORCID.
the class JpaJaxbServiceAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
Service e = getService();
assertNotNull(e);
OrgAffiliationRelationEntity oar = adapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
// General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("department-name", oar.getDepartment());
assertEquals("role-title", oar.getTitle());
// Dates
assertEquals(Integer.valueOf(2), oar.getStartDate().getDay());
assertEquals(Integer.valueOf(2), oar.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getStartDate().getYear());
assertEquals(Integer.valueOf(2), oar.getEndDate().getDay());
assertEquals(Integer.valueOf(2), oar.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getEndDate().getYear());
// Source
assertNull(oar.getSourceId());
assertNull(oar.getClientSourceId());
assertNull(oar.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.common.Title 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(org.orcid.jaxb.model.common_v2.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(org.orcid.jaxb.model.record_v2.CitationType.FORMATTED_UNSPECIFIED, workEntity.getCitationType());
assertEquals(org.orcid.jaxb.model.record_v2.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(org.orcid.jaxb.model.common_v2.Iso3166Country.AF, workEntity.getIso2Country());
// Source
assertNull(workEntity.getSourceId());
assertNull(workEntity.getClientSourceId());
assertNull(workEntity.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.common.Title in project ORCID-Source by ORCID.
the class JpaJaxbFundingAdapterTest method toFundingEntityTest.
@Test
public void toFundingEntityTest() throws JAXBException {
Funding f = getFunding(true);
assertNotNull(f);
ProfileFundingEntity pfe = jpaJaxbFundingAdapter.toProfileFundingEntity(f);
assertNotNull(pfe);
// Enums
assertEquals(Visibility.PRIVATE.value(), pfe.getVisibility().value());
assertEquals(FundingType.GRANT.value(), pfe.getType().value());
// General info
assertEquals(Long.valueOf(0), pfe.getId());
assertEquals("common:title", pfe.getTitle());
assertEquals("common:translated-title", pfe.getTranslatedTitle());
assertEquals("en", pfe.getTranslatedTitleLanguageCode());
assertEquals("funding:organization-defined-type", pfe.getOrganizationDefinedType());
assertEquals("funding:short-description", pfe.getDescription());
assertEquals("1234", pfe.getNumericAmount().toString());
assertEquals("ADP", pfe.getCurrencyCode());
assertEquals("http://tempuri.org", pfe.getUrl());
// Dates
assertEquals(Integer.valueOf(2), pfe.getStartDate().getDay());
assertEquals(Integer.valueOf(2), pfe.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), pfe.getStartDate().getYear());
assertEquals(Integer.valueOf(2), pfe.getEndDate().getDay());
assertEquals(Integer.valueOf(2), pfe.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), pfe.getEndDate().getYear());
// Contributors
assertEquals("{\"contributor\":[{\"contributorOrcid\":{\"uri\":\"http://orcid.org/8888-8888-8888-8880\",\"path\":\"8888-8888-8888-8880\",\"host\":\"orcid.org\"},\"creditName\":{\"content\":\"funding:credit-name\"},\"contributorEmail\":{\"value\":\"funding@contributor.email\"},\"contributorAttributes\":{\"contributorRole\":\"LEAD\"}}]}", pfe.getContributorsJson());
// External identifiers
assertEquals("{\"fundingExternalIdentifier\":[{\"type\":\"GRANT_NUMBER\",\"value\":\"funding:external-identifier-value\",\"url\":{\"value\":\"http://tempuri.org\"},\"relationship\":\"SELF\"},{\"type\":\"GRANT_NUMBER\",\"value\":\"funding:external-identifier-value2\",\"url\":{\"value\":\"http://tempuri.org/2\"},\"relationship\":\"SELF\"}]}", pfe.getExternalIdentifiersJson());
// Check org is null
assertNull(pfe.getOrg());
// Source
assertNull(pfe.getSourceId());
assertNull(pfe.getClientSourceId());
assertNull(pfe.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.common.Title in project ORCID-Source by ORCID.
the class JpaJaxbInvitedPositionAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
InvitedPosition e = getInvitedPosition();
assertNotNull(e);
OrgAffiliationRelationEntity oar = adapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
// General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("department-name", oar.getDepartment());
assertEquals("role-title", oar.getTitle());
// Dates
assertEquals(Integer.valueOf(2), oar.getStartDate().getDay());
assertEquals(Integer.valueOf(2), oar.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getStartDate().getYear());
assertEquals(Integer.valueOf(2), oar.getEndDate().getDay());
assertEquals(Integer.valueOf(2), oar.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getEndDate().getYear());
// Source
assertNull(oar.getSourceId());
assertNull(oar.getClientSourceId());
assertNull(oar.getElementSourceId());
}
Aggregations