use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class JSONInputValidatorTest method testValidateJSONInputForValidV3Work.
@Test
public void testValidateJSONInputForValidV3Work() throws JAXBException, SAXException, IOException {
Work work = org.orcid.test.helper.v3.Utils.getWork("title");
validator.validateJSONInput(work);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class JSONInputValidatorTest method testValidateJSONValidInputForInvalidV3Work.
@Test(expected = InvalidJSONException.class)
public void testValidateJSONValidInputForInvalidV3Work() throws JAXBException, SAXException, IOException {
Work work = org.orcid.test.helper.v3.Utils.getWork(null);
validator.validateJSONInput(work);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewWork.
@Test
public void testViewWork() {
Response response = serviceDelegator.viewWork(ORCID, 11L);
assertNotNull(response);
Work work = (Work) response.getEntity();
assertNotNull(work);
assertNotNull(work.getLastModifiedDate());
assertNotNull(work.getLastModifiedDate().getValue());
assertNotNull(work.getWorkTitle());
assertNotNull(work.getWorkTitle().getTitle());
assertEquals("PUBLIC", work.getWorkTitle().getTitle().getContent());
assertEquals(Long.valueOf(11), work.getPutCode());
assertEquals("/0000-0000-0000-0003/work/11", work.getPath());
assertEquals(WorkType.JOURNAL_ARTICLE, work.getWorkType());
assertEquals("APP-5555555555555555", work.getSource().retrieveSourcePath());
assertNotNull(work.getWorkContributors());
assertNotNull(work.getWorkContributors().getContributor());
assertEquals(1, work.getWorkContributors().getContributor().size());
assertNotNull(work.getWorkContributors().getContributor().get(0).getContributorOrcid());
assertEquals("0000-0000-0000-0000", work.getWorkContributors().getContributor().get(0).getContributorOrcid().getPath());
assertNull(work.getWorkContributors().getContributor().get(0).getCreditName());
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewBulkWorks.
@Test
public void testViewBulkWorks() {
Response response = serviceDelegator.viewBulkWorks(ORCID, "11,12,13");
assertNotNull(response);
WorkBulk workBulk = (WorkBulk) response.getEntity();
assertNotNull(workBulk);
assertNotNull(workBulk.getBulk());
assertEquals(3, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof Work);
assertTrue(workBulk.getBulk().get(1) instanceof OrcidError);
assertTrue(workBulk.getBulk().get(2) instanceof OrcidError);
Work work = (Work) workBulk.getBulk().get(0);
assertNotNull(work);
assertNotNull(work.getLastModifiedDate());
assertNotNull(work.getLastModifiedDate().getValue());
assertNotNull(work.getWorkTitle());
assertNotNull(work.getWorkTitle().getTitle());
assertEquals("PUBLIC", work.getWorkTitle().getTitle().getContent());
assertEquals(Long.valueOf(11), work.getPutCode());
assertEquals("/0000-0000-0000-0003/work/11", work.getPath());
assertEquals(WorkType.JOURNAL_ARTICLE, work.getWorkType());
assertEquals("APP-5555555555555555", work.getSource().retrieveSourcePath());
assertNotNull(work.getWorkContributors());
assertNotNull(work.getWorkContributors().getContributor());
assertEquals(1, work.getWorkContributors().getContributor().size());
assertNotNull(work.getWorkContributors().getContributor().get(0).getContributorOrcid());
assertEquals("0000-0000-0000-0000", work.getWorkContributors().getContributor().get(0).getContributorOrcid().getPath());
assertNull(work.getWorkContributors().getContributor().get(0).getCreditName());
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class BlackBoxBaseV3_0_dev1 method unmarshallFromPath.
public Object unmarshallFromPath(String path, Class<?> type) {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type);
Object result = null;
if (Address.class.equals(type)) {
result = (Address) obj;
} else if (Education.class.equals(type)) {
result = (Education) obj;
} else if (Employment.class.equals(type)) {
result = (Employment) obj;
} else if (Funding.class.equals(type)) {
result = (Funding) obj;
} else if (Keyword.class.equals(type)) {
result = (Keyword) obj;
} else if (Work.class.equals(type)) {
result = (Work) obj;
} else if (PeerReview.class.equals(type)) {
result = (PeerReview) obj;
} else if (ResearcherUrl.class.equals(type)) {
result = (ResearcherUrl) obj;
} else if (PersonalDetails.class.equals(type)) {
result = (PersonalDetails) obj;
} else if (OtherName.class.equals(type)) {
result = (OtherName) obj;
} else if (PersonExternalIdentifier.class.equals(type)) {
result = (PersonExternalIdentifier) obj;
} else if (Distinction.class.equals(type)) {
result = (Distinction) obj;
} else if (InvitedPosition.class.equals(type)) {
result = (InvitedPosition) obj;
} else if (Membership.class.equals(type)) {
result = (Membership) obj;
} else if (Qualification.class.equals(type)) {
result = (Qualification) obj;
} else if (Service.class.equals(type)) {
result = (Service) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
Aggregations