Search in sources :

Example 11 with Month

use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_NullEndYearTest.

@Test
public void affiliationsCreateDateSortString_NullEndYearTest() {
    Affiliation aff = new Employment();
    FuzzyDate end = new FuzzyDate();
    end.setDay(new Day(1));
    end.setMonth(new Month(2));
    aff.setEndDate(end);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("X-NaN-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 12 with Month

use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_NullStartYearTest.

@Test
public void affiliationsCreateDateSortString_NullStartYearTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    aff.setStartDate(start);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("Y-NaN-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 13 with Month

use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_StartAndEndDateExistsTest.

@Test
public void affiliationsCreateDateSortString_StartAndEndDateExistsTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    FuzzyDate end = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    start.setYear(new Year(3));
    end.setDay(new Day(4));
    end.setMonth(new Month(5));
    end.setYear(new Year(6));
    aff.setStartDate(start);
    aff.setEndDate(end);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertNotNull(dateSortString);
    assertEquals("X-6-05-04-3-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Year(org.orcid.jaxb.model.v3.dev1.common.Year) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 14 with Month

use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.

the class WorksPaginatorTest method getPublicWorkGroup.

private WorkGroup getPublicWorkGroup(int i) {
    WorkGroup workGroup = new WorkGroup();
    workGroup.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis())));
    for (int x = 0; x < 10; x++) {
        WorkSummary workSummary = new WorkSummary();
        workSummary.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(System.currentTimeMillis())));
        workSummary.setPublicationDate(new PublicationDate(new FuzzyDate(new Year(2017), new Month(x), new Day(x))));
        workSummary.setTitle(getTitle(i));
        workSummary.setVisibility(Visibility.PUBLIC);
        workSummary.setDisplayIndex(Integer.toString(x));
        workSummary.setPutCode(Long.valueOf(new StringBuilder(i).append(x).toString()));
        workSummary.setSource(getSource());
        workSummary.setType(WorkType.EDITED_BOOK);
        workGroup.getWorkSummary().add(workSummary);
    }
    return workGroup;
}
Also used : WorkGroup(org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) Month(org.orcid.jaxb.model.v3.dev1.common.Month) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) PublicationDate(org.orcid.jaxb.model.v3.dev1.common.PublicationDate) Year(org.orcid.jaxb.model.v3.dev1.common.Year) CreatedDate(org.orcid.jaxb.model.v3.dev1.common.CreatedDate) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day)

Example 15 with Month

use of org.orcid.jaxb.model.v3.dev1.common.Month in project ORCID-Source by ORCID.

the class JSONInputValidatorTest method testValidateJSONInputForValidV3PeerReview.

@Test
public void testValidateJSONInputForValidV3PeerReview() throws JAXBException, SAXException, IOException {
    PeerReview peerReview = org.orcid.test.helper.v3.Utils.getPeerReview();
    peerReview.setCompletionDate(new FuzzyDate(new Year(2017), new Month(1), new Day(1)));
    validator.validateJSONInput(peerReview);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Year(org.orcid.jaxb.model.v3.dev1.common.Year) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Aggregations

Day (org.orcid.jaxb.model.v3.dev1.common.Day)17 Month (org.orcid.jaxb.model.v3.dev1.common.Month)17 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)14 Year (org.orcid.jaxb.model.v3.dev1.common.Year)14 Test (org.junit.Test)10 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)8 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)8 Work (org.orcid.jaxb.model.v3.dev1.record.Work)8 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)6 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)5 Url (org.orcid.jaxb.model.v3.dev1.common.Url)4 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)4 ArrayList (java.util.ArrayList)3 MapperFactory (ma.glasnost.orika.MapperFactory)3 ConverterFactory (ma.glasnost.orika.converter.ConverterFactory)3 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)3 CreatedDate (org.orcid.jaxb.model.v3.dev1.common.CreatedDate)3 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)3 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)3 Date (java.util.Date)2