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;
}
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));
}
Aggregations