use of org.n52.shetland.ogc.sos.request.InsertResultRequest in project arctic-sea by 52North.
the class InsertResultRequestEncoderTest method shouldThrowExceptionIfTemplateIdIsMissing.
@Test
public void shouldThrowExceptionIfTemplateIdIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultRequestEncoder.class.getSimpleName() + " can not encode 'missing templateIdentifier'"));
encoder.create(new InsertResultRequest("service", "version"));
}
use of org.n52.shetland.ogc.sos.request.InsertResultRequest in project arctic-sea by 52North.
the class InsertResultRequestEncoderTest method shouldEncodeInsertResultRequest.
@Test
public void shouldEncodeInsertResultRequest() throws EncodingException {
String version = Sos2Constants.SERVICEVERSION;
String service = SosConstants.SOS;
String templateIdentifier = "test-template-identifier";
String resultValues = "test-result-values";
InsertResultRequest request = new InsertResultRequest(service, version);
request.setTemplateIdentifier(templateIdentifier);
request.setResultValues(resultValues);
XmlObject encodedRequest = encoder.create(request);
Assert.assertThat(encodedRequest, Matchers.instanceOf(InsertResultDocument.class));
Assert.assertThat(((InsertResultDocument) encodedRequest).getInsertResult(), Matchers.notNullValue());
InsertResultType xbRequest = ((InsertResultDocument) encodedRequest).getInsertResult();
Assert.assertThat(xbRequest.getService(), Is.is(service));
Assert.assertThat(xbRequest.getVersion(), Is.is(version));
Assert.assertThat(xbRequest.getTemplate(), Is.is(templateIdentifier));
Assert.assertThat(xbRequest.getResultValues(), Matchers.instanceOf(XmlString.class));
Assert.assertThat(((XmlString) xbRequest.getResultValues()).getStringValue(), Is.is(resultValues));
}
use of org.n52.shetland.ogc.sos.request.InsertResultRequest in project arctic-sea by 52North.
the class InsertResultRequestEncoderTest method shouldThrowExceptionIfVersionIsMissing.
@Test
public void shouldThrowExceptionIfVersionIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultRequestEncoder.class.getSimpleName() + " can not encode 'missing version'"));
encoder.create(new InsertResultRequest("service", ""));
}
use of org.n52.shetland.ogc.sos.request.InsertResultRequest in project arctic-sea by 52North.
the class InsertResultRequestDecoder method decodeRequest.
@Override
protected InsertResultRequest decodeRequest(JsonNode node) {
InsertResultRequest irr = new InsertResultRequest();
irr.setTemplateIdentifier(node.path(JSONConstants.TEMPLATE_IDENTIFIER).textValue());
irr.setResultValues(node.path(JSONConstants.RESULT_VALUES).textValue());
return irr;
}
use of org.n52.shetland.ogc.sos.request.InsertResultRequest in project arctic-sea by 52North.
the class InsertResultRequestEncoderTest method shouldThrowExceptionIfResultValuesAreMissing.
@Test
public void shouldThrowExceptionIfResultValuesAreMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultRequestEncoder.class.getSimpleName() + " can not encode 'missing resultValues'"));
InsertResultRequest request = new InsertResultRequest("service", "version");
request.setTemplateIdentifier("templateIdentifier");
encoder.create(request);
}
Aggregations