Search in sources :

Example 1 with InsertResultRequest

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"));
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) Test(org.junit.Test)

Example 2 with InsertResultRequest

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));
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) XmlString(org.apache.xmlbeans.XmlString) XmlObject(org.apache.xmlbeans.XmlObject) XmlString(org.apache.xmlbeans.XmlString) InsertResultType(net.opengis.sos.x20.InsertResultType) InsertResultDocument(net.opengis.sos.x20.InsertResultDocument) Test(org.junit.Test)

Example 3 with InsertResultRequest

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", ""));
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) Test(org.junit.Test)

Example 4 with InsertResultRequest

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;
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest)

Example 5 with InsertResultRequest

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);
}
Also used : InsertResultRequest(org.n52.shetland.ogc.sos.request.InsertResultRequest) Test(org.junit.Test)

Aggregations

InsertResultRequest (org.n52.shetland.ogc.sos.request.InsertResultRequest)7 Test (org.junit.Test)5 InsertResultType (net.opengis.sos.x20.InsertResultType)2 InsertResultDocument (net.opengis.sos.x20.InsertResultDocument)1 XmlObject (org.apache.xmlbeans.XmlObject)1 XmlString (org.apache.xmlbeans.XmlString)1