use of org.n52.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class InsertResultTemplateRequestDecoderTest method resultEncoding.
@Test
public void resultEncoding() throws IOException, DecodingException {
InsertResultTemplateRequest req = load();
assertThat(req.getResultEncoding(), is(notNullValue()));
assertThat(req.getResultEncoding().isDecoded(), is(true));
assertThat(req.getResultEncoding().isEncoded(), is(false));
assertThat(req.getResultEncoding().get().get(), is(instanceOf(SweTextEncoding.class)));
SweTextEncoding encoding = (SweTextEncoding) req.getResultEncoding().get().get();
errors.checkThat(encoding.getTokenSeparator(), is(","));
errors.checkThat(encoding.getBlockSeparator(), is("#"));
}
Aggregations