Search in sources :

Example 1 with InsertSensorResponse

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

the class InsertSensorResponseDecoder method decode.

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

Example 2 with InsertSensorResponse

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

the class InsertSensorResponseDecoderTest method shouldCreateInsertSensorResponse.

@Test
public void shouldCreateInsertSensorResponse() throws DecodingException {
    String offering = "test-offering";
    String procedure = "test-procedure";
    InsertSensorResponseDocument isrd = InsertSensorResponseDocument.Factory.newInstance();
    InsertSensorResponseType response = isrd.addNewInsertSensorResponse();
    response.setAssignedOffering(offering);
    response.setAssignedProcedure(procedure);
    InsertSensorResponse decodedResponse = new InsertSensorResponseDecoder().decode(isrd);
    assertThat(decodedResponse.getAssignedOffering(), is(offering));
    assertThat(decodedResponse.getAssignedProcedure(), is(procedure));
}
Also used : InsertSensorResponseType(net.opengis.swes.x20.InsertSensorResponseType) InsertSensorResponseDocument(net.opengis.swes.x20.InsertSensorResponseDocument) InsertSensorResponse(org.n52.shetland.ogc.sos.response.InsertSensorResponse) Test(org.junit.Test)

Aggregations

InsertSensorResponseDocument (net.opengis.swes.x20.InsertSensorResponseDocument)2 InsertSensorResponseType (net.opengis.swes.x20.InsertSensorResponseType)2 InsertSensorResponse (org.n52.shetland.ogc.sos.response.InsertSensorResponse)2 Test (org.junit.Test)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)1