Search in sources :

Example 1 with InsertResultTemplateResponse

use of org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse in project arctic-sea by 52North.

the class InsertResultTemplateResponseDecoder method decode.

@Override
public InsertResultTemplateResponse decode(XmlObject xmlObject) throws DecodingException {
    LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
    if (!(xmlObject instanceof InsertResultTemplateResponseDocument)) {
        throw new UnsupportedDecoderInputException(this, xmlObject);
    }
    InsertResultTemplateResponseDocument isrd = (InsertResultTemplateResponseDocument) xmlObject;
    InsertResultTemplateResponseType isr = isrd.getInsertResultTemplateResponse();
    if (isr == null) {
        throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
    }
    InsertResultTemplateResponse decodedResponse = new InsertResultTemplateResponse(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
    decodedResponse.setAcceptedTemplate(isr.getAcceptedTemplate());
    return decodedResponse;
}
Also used : InsertResultTemplateResponse(org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse) InsertResultTemplateResponseDocument(net.opengis.sos.x20.InsertResultTemplateResponseDocument) DecodingException(org.n52.svalbard.decode.exception.DecodingException) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) InsertResultTemplateResponseType(net.opengis.sos.x20.InsertResultTemplateResponseType)

Example 2 with InsertResultTemplateResponse

use of org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse in project arctic-sea by 52North.

the class InsertResultTemplateResponseDecoderTest method shouldCreateInsertSensorResponse.

@Test
public void shouldCreateInsertSensorResponse() throws DecodingException {
    String templateId = "test-template-id";
    InsertResultTemplateResponseDocument isrd = InsertResultTemplateResponseDocument.Factory.newInstance();
    isrd.addNewInsertResultTemplateResponse().setAcceptedTemplate(templateId);
    InsertResultTemplateResponse decodedResponse = new InsertResultTemplateResponseDecoder().decode(isrd);
    assertThat(decodedResponse.getAcceptedTemplate(), is(templateId));
}
Also used : InsertResultTemplateResponse(org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse) InsertResultTemplateResponseDocument(net.opengis.sos.x20.InsertResultTemplateResponseDocument) Test(org.junit.Test)

Aggregations

InsertResultTemplateResponseDocument (net.opengis.sos.x20.InsertResultTemplateResponseDocument)2 InsertResultTemplateResponse (org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse)2 InsertResultTemplateResponseType (net.opengis.sos.x20.InsertResultTemplateResponseType)1 Test (org.junit.Test)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1