Search in sources :

Example 11 with Day

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

the class PojoUtilTest method affiliationsCreateDateSortString_NullStartYearNullEndYearTest.

@Test
public void affiliationsCreateDateSortString_NullStartYearNullEndYearTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    FuzzyDate end = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    end.setDay(new Day(3));
    end.setMonth(new Month(4));
    aff.setStartDate(start);
    aff.setEndDate(end);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("X-NaN-04-03-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 Day

use of org.orcid.jaxb.model.v3.dev1.common.Day 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 13 with Day

use of org.orcid.jaxb.model.v3.dev1.common.Day 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 14 with Day

use of org.orcid.jaxb.model.v3.dev1.common.Day 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 15 with Day

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

the class MemberV3ApiServiceDelegator_WorksTest method testUpdateWork.

@Test
public void testUpdateWork() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewWork("4444-4444-4444-4443", 1L);
    assertNotNull(response);
    Work work = (Work) response.getEntity();
    assertNotNull(work);
    Utils.verifyLastModified(work.getLastModifiedDate());
    assertEquals(Long.valueOf(1), work.getPutCode());
    assertNotNull(work.getWorkTitle());
    assertNotNull(work.getWorkTitle().getTitle());
    assertEquals("A day in the life", work.getWorkTitle().getTitle().getContent());
    assertEquals(WorkType.BOOK, work.getWorkType());
    assertEquals(Visibility.PUBLIC, work.getVisibility());
    work.setWorkType(WorkType.EDITED_BOOK);
    work.getWorkTitle().getTitle().setContent("Updated work title");
    response = serviceDelegator.updateWork("4444-4444-4444-4443", 1L, work);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewWork("4444-4444-4444-4443", 1L);
    assertNotNull(response);
    work = (Work) response.getEntity();
    assertNotNull(work);
    Utils.verifyLastModified(work.getLastModifiedDate());
    assertEquals(Long.valueOf(1), work.getPutCode());
    assertNotNull(work.getWorkTitle());
    assertNotNull(work.getWorkTitle().getTitle());
    assertEquals("Updated work title", work.getWorkTitle().getTitle().getContent());
    assertEquals(WorkType.EDITED_BOOK, work.getWorkType());
    // Rollback changes so we dont break other tests
    work.setWorkType(WorkType.BOOK);
    work.getWorkTitle().getTitle().setContent("A day in the life");
    response = serviceDelegator.updateWork("4444-4444-4444-4443", 1L, work);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Work(org.orcid.jaxb.model.v3.dev1.record.Work) DBUnitTest(org.orcid.test.DBUnitTest) 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)12 Work (org.orcid.jaxb.model.v3.dev1.record.Work)10 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)8 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)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)5 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)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 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)3 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)3