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);
}
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);
}
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);
}
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);
}
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());
}
Aggregations