use of org.n52.shetland.ogc.gml.time.Time in project arctic-sea by 52North.
the class TimeTest method inteterminate.
@Test
public void inteterminate() {
TimePosition timePosition = new TimePosition(IndeterminateValue.NOW);
assertThat("time position is not set", timePosition.isSetTime(), is(false));
assertThat("indeterminate value is set", timePosition.isSetIndeterminateValue(), is(true));
assertThat("indeterminate value is 'now'", timePosition.getIndeterminateValue(), is(IndeterminateValue.NOW));
assertThat("format is not set", timePosition.isSetTimeFormat(), is(false));
}
use of org.n52.shetland.ogc.gml.time.Time in project arctic-sea by 52North.
the class TimeTest method nullFormat.
@Test
public void nullFormat() {
TimePosition timePosition = new TimePosition(DateTime.now(), null);
assertThat("time position is set", timePosition.isSetTime(), is(true));
assertThat("time format is set", timePosition.isSetTimeFormat(), is(false));
}
use of org.n52.shetland.ogc.gml.time.Time in project arctic-sea by 52North.
the class SweHelper method getPhenomenonTimeField.
private SweField getPhenomenonTimeField(Time sosTime) {
SweAbstractUomType<?> time;
if (sosTime instanceof TimePeriod) {
time = new SweTimeRange();
} else {
time = new SweTime();
}
time.setDefinition(OmConstants.PHENOMENON_TIME);
time.setUom(OmConstants.PHEN_UOM_ISO8601);
return new SweField(OmConstants.PHENOMENON_TIME_NAME, time);
}
use of org.n52.shetland.ogc.gml.time.Time in project arctic-sea by 52North.
the class TimeJSONEncoder method encodeJSON.
@Override
public JsonNode encodeJSON(Time time) {
if (time instanceof TimeInstant) {
TimeInstant ti = (TimeInstant) time;
return nodeFactory().textNode(encodeTimePosition(ti.getTimePosition()));
}
if (time instanceof TimePeriod) {
TimePeriod tp = (TimePeriod) time;
ArrayNode a = nodeFactory().arrayNode();
a.add(encodeTimePosition(tp.getStartTimePosition()));
a.add(encodeTimePosition(tp.getEndTimePosition()));
return a;
} else {
return null;
}
}
use of org.n52.shetland.ogc.gml.time.Time in project arctic-sea by 52North.
the class FieldDecoderTest method time.
@Test
public void time() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_TYPE).put(JSONConstants.UOM, UOM);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweTime.class)));
SweTime swe = (SweTime) field.getElement();
errors.checkThat(swe.getValue(), is(nullValue()));
errors.checkThat(swe.getUom(), is(UOM));
}
Aggregations