use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method testMarshallCreditName.
@Test
public void testMarshallCreditName() throws JAXBException, SAXException, URISyntaxException {
CreditName object = (CreditName) unmarshallFromPath("/record_2.0_rc3/samples/credit-name-2.0_rc3.xml", CreditName.class);
marshall(object, "/record_2.0_rc3/personal-details-2.0_rc3.xsd");
}
use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method testUnmarshallCreditName.
@Test
public void testUnmarshallCreditName() throws SAXException, URISyntaxException {
CreditName creditName = (CreditName) unmarshallFromPath("/record_2.1/samples/read_samples/credit-name-2.1.xml", CreditName.class, "/record_2.1/personal-details-2.1.xsd");
assertNotNull(creditName);
assertEquals("credit-name", creditName.getContent());
}
use of org.orcid.jaxb.model.record_v2.CreditName in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method unmarshallFromPath.
private Object unmarshallFromPath(String path, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type, schemaPath);
Object result = null;
if (ResearcherUrls.class.equals(type)) {
result = (ResearcherUrls) obj;
} else if (ResearcherUrl.class.equals(type)) {
result = (ResearcherUrl) obj;
} else if (PersonalDetails.class.equals(type)) {
result = (PersonalDetails) obj;
} else if (PersonExternalIdentifier.class.equals(type)) {
result = (PersonExternalIdentifier) obj;
} else if (PersonExternalIdentifiers.class.equals(type)) {
result = (PersonExternalIdentifiers) obj;
} else if (Biography.class.equals(type)) {
result = (Biography) obj;
} else if (Name.class.equals(type)) {
result = (Name) obj;
} else if (CreditName.class.equals(type)) {
result = (CreditName) obj;
} else if (OtherName.class.equals(type)) {
result = (OtherName) obj;
} else if (OtherNames.class.equals(type)) {
result = (OtherNames) obj;
} else if (Keywords.class.equals(type)) {
result = (Keywords) obj;
} else if (Keyword.class.equals(type)) {
result = (Keyword) obj;
} else if (Addresses.class.equals(type)) {
result = (Addresses) obj;
} else if (Address.class.equals(type)) {
result = (Address) obj;
} else if (Emails.class.equals(type)) {
result = (Emails) obj;
} else if (Email.class.equals(type)) {
result = (Email) obj;
} else if (Person.class.equals(type)) {
result = (Person) obj;
} else if (Deprecated.class.equals(type)) {
result = (Deprecated) obj;
} else if (Preferences.class.equals(type)) {
result = (Preferences) obj;
} else if (History.class.equals(type)) {
result = (History) obj;
} else if (Record.class.equals(type)) {
result = (Record) obj;
} else if (ActivitiesSummary.class.equals(type)) {
result = (ActivitiesSummary) obj;
} else if (Works.class.equals(type)) {
result = (Works) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
use of org.orcid.jaxb.model.record_v2.CreditName 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_v2.CreditName in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createName.
protected Name createName(Visibility v) {
Name name = new Name();
name.setVisibility(v);
name.setCreditName(new CreditName("Credit Name"));
name.setFamilyName(new FamilyName("Family Name"));
name.setGivenNames(new GivenNames("Given Names"));
return name;
}
Aggregations