use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.
the class SubmitStandingQueryRequestImplTest method testGetDate.
@Test
public void testGetDate() {
Time time = new Time((short) 15, (short) 30, 25);
DayEventTime dayEventTime = new DayEventTime();
dayEventTime.time = time;
dayEventTime.day_event = DayEvent.END_OF_MONTH;
LifeEvent lifeEvent = new LifeEvent();
lifeEvent.day_event(dayEventTime);
Date date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
assertThat(date, notNullValue());
lifeEvent = new LifeEvent();
lifeEvent.rt(time);
date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
assertThat(date, notNullValue());
org.codice.alliance.nsili.common.UCO.Date ucoDate = new org.codice.alliance.nsili.common.UCO.Date((short) 2016, (short) 5, (short) 15);
AbsTime absTime = new AbsTime();
absTime.aDate = ucoDate;
absTime.aTime = time;
lifeEvent = new LifeEvent();
lifeEvent.at(absTime);
date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
assertThat(date, notNullValue());
lifeEvent = new LifeEvent();
lifeEvent.ev("test");
date = SubmitStandingQueryRequestImpl.getDate(lifeEvent);
assertThat(date, nullValue());
}
use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.
the class SubmitStandingQueryRequestImpl method printLifeEvent.
private void printLifeEvent(LifeEvent lifeEvent) {
String discriminatorText = getLifeEventDiscriminator(lifeEvent.discriminator());
Date atDate = null;
String relTimeStr = null;
String dayEventTimeStr = null;
String dayEventStr = null;
String event = null;
if (lifeEvent.discriminator() == LifeEventType.ABSOLUTE_TIME) {
AbsTime atTime = lifeEvent.at();
atDate = convertAbsTime(atTime);
} else if (lifeEvent.discriminator() == LifeEventType.RELATIVE_TIME) {
Time relTime = lifeEvent.rt();
relTimeStr = relTime.hour + ":" + relTime.minute + ":" + relTime.second;
} else if (lifeEvent.discriminator() == LifeEventType.NAMED_EVENT) {
event = lifeEvent.ev();
} else if (lifeEvent.discriminator() == LifeEventType.DAY_EVENT_TIME) {
DayEventTime dayEventTime = lifeEvent.day_event();
dayEventStr = getDayEvent(dayEventTime.day_event);
dayEventTimeStr = dayEventTime.time.hour + ":" + dayEventTime.time.minute + ":" + dayEventTime.time.second;
}
LOGGER.trace("\t\tDiscriminator: {}", discriminatorText);
if (atDate != null) {
LOGGER.trace("\t\tAt Time: {}", atDate);
}
LOGGER.trace("\t\tRel Time: {}", relTimeStr);
LOGGER.trace("\t\tEvent: {}", event);
LOGGER.trace("\t\tDayEvent: {}, time: {}", dayEventStr, dayEventTimeStr);
}
use of org.codice.alliance.nsili.common.GIAS.DayEventTime in project alliance by codice.
the class SubmitStandingQueryRequestImplTest method convertDayEventTime.
@Test
public void convertDayEventTime() {
Time time = new Time((short) 15, (short) 30, 25);
DayEventTime dayEventTime = new DayEventTime();
dayEventTime.time = time;
dayEventTime.day_event = DayEvent.END_OF_MONTH;
Date testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.FIRST_OF_MONTH;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.MON;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.TUE;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.WED;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.THU;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.FRI;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.SAT;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
dayEventTime.day_event = DayEvent.SUN;
testDate = SubmitStandingQueryRequestImpl.convertDayEventTime(dayEventTime);
assertThat(testDate, notNullValue());
}
Aggregations