use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class ResearcherUrlsTest method testTryingToAddInvalidResearcherUrls.
@Test
public void testTryingToAddInvalidResearcherUrls() throws InterruptedException, JSONException, URISyntaxException {
String accessToken = getAccessToken();
assertNotNull(accessToken);
org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl rUrlToCreate = new org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl();
rUrlToCreate.setUrl(new org.orcid.jaxb.model.v3.dev1.common.Url(""));
rUrlToCreate.setUrlName("");
// Create
ClientResponse postResponse = memberV3Dev1ApiClient.createResearcherUrls(getUser1OrcidId(), rUrlToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), postResponse.getStatus());
String _2001Chars = new String();
for (int i = 0; i < 2001; i++) {
_2001Chars += "a";
}
rUrlToCreate.setUrl(new org.orcid.jaxb.model.v3.dev1.common.Url(_2001Chars));
postResponse = memberV3Dev1ApiClient.createResearcherUrls(getUser1OrcidId(), rUrlToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), postResponse.getStatus());
rUrlToCreate.setUrl(new org.orcid.jaxb.model.v3.dev1.common.Url("http://myurl.com"));
rUrlToCreate.setUrlName(_2001Chars);
postResponse = memberV3Dev1ApiClient.createResearcherUrls(getUser1OrcidId(), rUrlToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), postResponse.getStatus());
rUrlToCreate.setUrlName("The name");
postResponse = memberV3Dev1ApiClient.createResearcherUrls(getUser1OrcidId(), rUrlToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
// Read it to delete it
ClientResponse getResponse = memberV3Dev1ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
assertEquals(Response.Status.OK.getStatusCode(), getResponse.getStatus());
org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl gotResearcherUrl = getResponse.getEntity(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl.class);
ClientResponse deleteResponse = memberV3Dev1ApiClient.deleteResearcherUrl(getUser1OrcidId(), gotResearcherUrl.getPutCode(), accessToken);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class JSONExternalIdentifiersConverterV3Test method getEducation.
private Education getEducation() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Education.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_3.0_dev1/samples/read_samples/education-full-3.0_dev1.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Education) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class JSONWorkExternalIdentifiersConverterV3Test method getWork.
private Work getWork() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Work.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_2.0/samples/read_samples/work-full-2.0.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Work) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class WorkFormTest method getWork.
private Work getWork() {
Work work = new Work();
work.setCountry(new Country(Iso3166Country.US));
work.setJournalTitle(new Title("Journal title"));
work.setLanguageCode("en");
work.setPutCode(Long.valueOf("1"));
work.setShortDescription("Short description");
work.setSource(new org.orcid.jaxb.model.v3.dev1.common.Source("0000-0000-0000-0000"));
work.setUrl(new Url("http://myurl.com"));
work.setVisibility(org.orcid.jaxb.model.v3.dev1.common.Visibility.PUBLIC);
org.orcid.jaxb.model.v3.dev1.record.Citation citation = new org.orcid.jaxb.model.v3.dev1.record.Citation();
citation.setCitation("Citation");
citation.setWorkCitationType(CitationType.FORMATTED_UNSPECIFIED);
work.setWorkCitation(citation);
WorkTitle title = new WorkTitle();
title.setTitle(new Title("Title"));
title.setTranslatedTitle(new org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle("Translated Title", "es"));
title.setSubtitle(new Subtitle("Subtitle"));
work.setWorkTitle(title);
work.setWorkType(WorkType.ARTISTIC_PERFORMANCE);
Date date = new Date();
date.setDay("1");
date.setMonth("1");
date.setYear("2015");
GregorianCalendar calendar = date.toCalendar();
work.setCreatedDate(new CreatedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
date = new Date();
date.setDay("2");
date.setMonth("2");
date.setYear("2015");
calendar = date.toCalendar();
work.setLastModifiedDate(new LastModifiedDate(datatypeFactory.newXMLGregorianCalendar(calendar)));
work.setPublicationDate(new PublicationDate(new Year(2015), new Month(3), new Day(3)));
org.orcid.jaxb.model.v3.dev1.record.WorkContributors contributors = new org.orcid.jaxb.model.v3.dev1.record.WorkContributors();
org.orcid.jaxb.model.v3.dev1.common.Contributor contributor = new org.orcid.jaxb.model.v3.dev1.common.Contributor();
org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes attributes = new org.orcid.jaxb.model.v3.dev1.common.ContributorAttributes();
attributes.setContributorRole(org.orcid.jaxb.model.v3.dev1.common.ContributorRole.CO_INVENTOR);
attributes.setContributorSequence(org.orcid.jaxb.model.v3.dev1.record.SequenceType.FIRST);
contributor.setContributorAttributes(attributes);
contributor.setContributorEmail(null);
ContributorOrcid contributorOrcid = new ContributorOrcid("Contributor orcid");
contributorOrcid.setUri("Contributor uri");
contributor.setContributorOrcid(contributorOrcid);
CreditName creditName = new CreditName("Contributor credit name");
contributor.setCreditName(creditName);
contributors.getContributor().add(contributor);
work.setWorkContributors(contributors);
ExternalIDs externalIdentifiers = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setValue("External Identifier ID");
extId.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ASIN.value());
extId.setRelationship(Relationship.SELF);
externalIdentifiers.getExternalIdentifier().add(extId);
work.setWorkExternalIdentifiers(externalIdentifiers);
return work;
}
use of org.orcid.jaxb.model.v3.dev1.record.Name in project ORCID-Source by ORCID.
the class WorkFormTest method getWorkForm.
private WorkForm getWorkForm() {
WorkForm form = new WorkForm();
form.setCitation(new Citation("Citation", "formatted-unspecified"));
List<Contributor> çontributors = new ArrayList<Contributor>();
Contributor contributor = new Contributor();
contributor.setContributorRole(Text.valueOf("co_inventor"));
contributor.setContributorSequence(Text.valueOf("first"));
contributor.setCreditName(Text.valueOf("Contributor credit name"));
contributor.setEmail(null);
contributor.setOrcid(Text.valueOf("Contributor orcid"));
contributor.setUri(Text.valueOf("Contributor uri"));
çontributors.add(contributor);
form.setContributors(çontributors);
form.setCountryCode(Text.valueOf("US"));
Date createdDate = new Date();
createdDate.setDay("1");
createdDate.setMonth("1");
createdDate.setYear("2015");
form.setCreatedDate(createdDate);
form.setJournalTitle(Text.valueOf("Journal title"));
form.setLanguageCode(Text.valueOf("en"));
Date lastModifiedDate = new Date();
lastModifiedDate.setDay("2");
lastModifiedDate.setMonth("2");
lastModifiedDate.setYear("2015");
form.setLastModified(lastModifiedDate);
Date publicationDate = new Date();
publicationDate.setDay("03");
publicationDate.setMonth("03");
publicationDate.setYear("2015");
form.setPublicationDate(publicationDate);
form.setDateSortString(PojoUtil.createDateSortString(null, FuzzyDate.valueOf(2015, 3, 3)));
form.setPutCode(Text.valueOf("1"));
form.setShortDescription(Text.valueOf("Short description"));
form.setSource("0000-0000-0000-0000");
form.setSubtitle(Text.valueOf("Subtitle"));
form.setTitle(Text.valueOf("Title"));
form.setTranslatedTitle(new TranslatedTitleForm("Translated Title", "es"));
form.setUrl(Text.valueOf("http://myurl.com"));
form.setVisibility(Visibility.valueOf(org.orcid.jaxb.model.v3.dev1.common.Visibility.PUBLIC));
List<WorkExternalIdentifier> extIds = new ArrayList<WorkExternalIdentifier>();
WorkExternalIdentifier extId = new WorkExternalIdentifier();
extId.setWorkExternalIdentifierId(Text.valueOf("External Identifier ID"));
extId.setWorkExternalIdentifierType(Text.valueOf("asin"));
extId.setRelationship(Text.valueOf(Relationship.SELF.value()));
extIds.add(extId);
form.setWorkExternalIdentifiers(extIds);
form.setWorkType(Text.valueOf("artistic-performance"));
WorkCategory category = WorkCategory.fromWorkType(WorkType.fromValue(form.getWorkType().getValue()));
form.setWorkCategory(Text.valueOf(category.value()));
return form;
}
Aggregations