use of com.nedap.archie.rm.datavalues.quantity.datetime.DvTime in project openEHR_SDK by ehrbase.
the class TemporalEncodingTest method testChronoFieldSupportTime.
public void testChronoFieldSupportTime() {
DvTime dvTime = new DvTime("10:10:10Z");
DvTimeAttributes timeAttributes = DvTimeAttributes.instanceFromValue(dvTime);
assertTrue(timeAttributes.isRmDvTime());
assertEquals(Long.valueOf(36610), timeAttributes.getTimeStamp());
assertFalse(timeAttributes.isTimeHH());
assertFalse(timeAttributes.isTimeHHMM());
assertTrue(timeAttributes.isTimeHHMMSS());
assertFalse(timeAttributes.isTimeHHMMSSmmm());
// String encoded = new TemporalEncoding().toDB(dvDate);
assertEquals("10:10:10Z", timeAttributes.getValueAsProvided().toString());
assertEquals(Integer.valueOf(TemporalAttributes.DV_TIME | TemporalAttributes.HOUR | TemporalAttributes.MINUTE_OF_HOUR | TemporalAttributes.SECOND_OF_MINUTE), timeAttributes.getSupportedChronoFields());
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvTime in project openEHR_SDK by ehrbase.
the class TemporalEncodingTest method testChronoFieldSupportTimeHH.
public void testChronoFieldSupportTimeHH() {
DvTime dvTime = new DvTime("10");
DvTimeAttributes timeAttributes = DvTimeAttributes.instanceFromValue(dvTime);
// Archie encode this time as 10:00, should we enforce this minimalist encoding?
assertFalse(timeAttributes.isTimeHH());
assertTrue(timeAttributes.isTimeHHMM());
assertFalse(timeAttributes.isTimeHHMMSS());
assertFalse(timeAttributes.isTimeHHMMSSmmm());
assertEquals("10:00", timeAttributes.getValueAsProvided().toString());
assertEquals(Integer.valueOf(TemporalAttributes.DV_TIME | TemporalAttributes.HOUR | TemporalAttributes.MINUTE_OF_HOUR), timeAttributes.getSupportedChronoFields());
assertEquals("YYYY-MM-DD\"T\"HH24:MI", timeAttributes.getISOdateTimeSQLFormatter(timeAttributes.getSupportedChronoFields()));
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvTime in project openEHR_SDK by ehrbase.
the class CompareCanonicalDvDateTimeTest method testComparatorDvTime.
@Test
public void testComparatorDvTime() {
DvTime dvTime = (DvTime) toRmObject(jsonDvTimeRef, DvTime.class);
assertThat(new CompareCanonicalDvTime(dvTime).isExpectedEqualToCanonicalUsing(dvTime)).isNull();
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvTime in project openEHR_SDK by ehrbase.
the class CompareCanonicalDvTime method isExpectedEqualToCanonicalUsing.
public Object isExpectedEqualToCanonicalUsing(DvTime referenceTime) {
// check each date/time part separately
Format formatter = DateTimeFormatter.ISO_LOCAL_TIME.toFormat();
DvTime actualDvTime = new DvTime(formatter.format(dvTime.getValue()));
DvTime expectedDvTime = new DvTime(formatter.format(referenceTime.getValue()));
ZoneOffset actualZoneOffset = ZoneOffset.from(dvTime.getValue());
ZoneOffset expectedZoneOffset = ZoneOffset.from(referenceTime.getValue());
// perform comparison of parts
TimePartComparator.compare(actualDvTime, expectedDvTime);
ZoneOffsetPartComparator.compare(actualZoneOffset, expectedZoneOffset);
return null;
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvTime in project openEHR_SDK by ehrbase.
the class DvTimeValidatorTest method testValidate.
@Test
void testValidate() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_time.json");
var result = validator.validate(new DvTime(LocalTime.now()), node);
assertTrue(result.isEmpty());
}
Aggregations