use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestDecoderTest method multipleObservation.
@Test
public void multipleObservation() throws IOException, DecodingException {
final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertObservationRequest-multiple-observations.json");
final InsertObservationRequest req = decoder.decodeJSON(json, true);
assertThat(req, is(notNullValue()));
errors.checkThat(req.getService(), is(equalTo("SOS")));
errors.checkThat(req.getVersion(), is(equalTo("2.0.0")));
errors.checkThat(req.getOperationName(), is(equalTo("InsertObservation")));
assertThat(req.getOfferings(), is(notNullValue()));
errors.checkThat(req.getOfferings(), hasSize(2));
assertThat(req.getOfferings().get(0), is(equalTo("offering1")));
assertThat(req.getOfferings().get(1), is(equalTo("offering2")));
assertThat(req.getObservations(), is(notNullValue()));
assertThat(req.getObservations(), hasSize(2));
assertThat(req.getObservations().get(0), is(notNullValue()));
assertThat(req.getObservations().get(0).getValue().getValue(), is(instanceOf(TextValue.class)));
assertThat(req.getObservations().get(1), is(notNullValue()));
assertThat(req.getObservations().get(1).getValue().getValue(), is(instanceOf(TextValue.class)));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestDecoderTest method multipleOfferings.
@Test
public void multipleOfferings() throws IOException, DecodingException {
final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertObservationRequest-multiple-offerings.json");
final InsertObservationRequest req = decoder.decodeJSON(json, true);
assertThat(req, is(notNullValue()));
errors.checkThat(req.getService(), is(equalTo("SOS")));
errors.checkThat(req.getVersion(), is(equalTo("2.0.0")));
errors.checkThat(req.getOperationName(), is(equalTo("InsertObservation")));
assertThat(req.getOfferings(), is(notNullValue()));
errors.checkThat(req.getOfferings(), hasSize(2));
assertThat(req.getOfferings().get(0), is(equalTo("offering1")));
assertThat(req.getOfferings().get(1), is(equalTo("offering2")));
assertThat(req.getObservations(), is(notNullValue()));
assertThat(req.getObservations(), hasSize(1));
assertThat(req.getObservations().get(0), is(notNullValue()));
assertThat(req.getObservations().get(0).getValue().getValue(), is(instanceOf(TextValue.class)));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestDecoderTest method singleOffering.
@Test
public void singleOffering() throws IOException, DecodingException {
final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertObservationRequest-single-offering.json");
final InsertObservationRequest req = decoder.decodeJSON(json, true);
errors.checkThat(req.getService(), is(equalTo("SOS")));
errors.checkThat(req.getVersion(), is(equalTo("2.0.0")));
errors.checkThat(req.getOperationName(), is(equalTo("InsertObservation")));
assertThat(req.getOfferings(), is(notNullValue()));
errors.checkThat(req.getOfferings(), hasSize(1));
assertThat(req.getOfferings().get(0), is(equalTo("offering2")));
assertThat(req.getObservations(), is(notNullValue()));
assertThat(req.getObservations(), hasSize(1));
assertThat(req.getObservations().get(0), is(notNullValue()));
assertThat(req.getObservations().get(0).getValue().getValue(), is(instanceOf(TextValue.class)));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestDecoderTest method singleObservation.
@Test
public void singleObservation() throws IOException, DecodingException {
final JsonNode json = JsonLoader.fromResource("/examples/sos/InsertObservationRequest-single-observation.json");
final InsertObservationRequest req = decoder.decodeJSON(json, true);
errors.checkThat(req.getService(), is(equalTo("SOS")));
errors.checkThat(req.getVersion(), is(equalTo("2.0.0")));
errors.checkThat(req.getOperationName(), is(equalTo("InsertObservation")));
assertThat(req.getOfferings(), is(notNullValue()));
errors.checkThat(req.getOfferings(), hasSize(1));
assertThat(req.getOfferings().get(0), is(equalTo("offering2")));
assertThat(req.getObservations(), is(notNullValue()));
assertThat(req.getObservations(), hasSize(1));
assertThat(req.getObservations().get(0), is(notNullValue()));
assertThat(req.getObservations().get(0).getValue().getValue(), is(instanceOf(TextValue.class)));
}
use of org.n52.shetland.ogc.sos.request.InsertObservationRequest in project arctic-sea by 52North.
the class InsertObservationRequestDecoder method decodeRequest.
@Override
public InsertObservationRequest decodeRequest(JsonNode node) throws DecodingException {
InsertObservationRequest r = new InsertObservationRequest();
r.setObservation(decodeJsonToObjectList(node.path(JSONConstants.OBSERVATION), OmObservation.class));
r.setOfferings(parseStringOrStringList(node.path(JSONConstants.OFFERING)));
return r;
}
Aggregations