use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.
the class DescribeSensorRequestDecoder method decodeRequest.
@Override
protected DescribeSensorRequest decodeRequest(JsonNode node) {
DescribeSensorRequest req = new DescribeSensorRequest();
req.setProcedure(node.path(JSONConstants.PROCEDURE).textValue());
req.setProcedureDescriptionFormat(node.path(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT).textValue());
if (node.has(JSONConstants.VALID_TIME)) {
req.setValidTime(parseTime(node.path(JSONConstants.VALID_TIME)));
}
return req;
}
use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.
the class SwesDecoderv20 method parseDescribeSensor.
/**
* parses the passes XmlBeans document and creates a SOS describeSensor
* request
*
* @param xbDescSenDoc
* XmlBeans document representing the describeSensor request
* @return Returns SOS describeSensor request
*
* @throws DecodingException
* * if validation of the request failed
*/
private OwsServiceRequest parseDescribeSensor(final DescribeSensorDocument xbDescSenDoc) throws DecodingException {
final DescribeSensorRequest descSensorRequest = new DescribeSensorRequest();
final DescribeSensorType xbDescSensor = xbDescSenDoc.getDescribeSensor();
descSensorRequest.setService(xbDescSensor.getService());
descSensorRequest.setVersion(xbDescSensor.getVersion());
descSensorRequest.setProcedure(xbDescSensor.getProcedure());
descSensorRequest.setProcedureDescriptionFormat(xbDescSensor.getProcedureDescriptionFormat());
if (xbDescSensor.isSetValidTime()) {
descSensorRequest.setValidTime(getValidTime(xbDescSensor.getValidTime()));
}
// extensions
descSensorRequest.setExtensions(parseExtensibleRequest(xbDescSensor));
return descSensorRequest;
}
use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.
the class DescribeSensorV2RequestEncoderTest method shouldThrowExceptionIfServiceIsMissing.
@Test
public void shouldThrowExceptionIfServiceIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + DescribeSensorV2RequestEncoder.class.getSimpleName() + " can not encode 'missing service'"));
new DescribeSensorV2RequestEncoder().create(new DescribeSensorRequest());
}
use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.
the class SosDecoderv100 method parseDescribeSensor.
/**
* parses the XmlBean representing the describeSensor request and creates a
* DescribeSensor request
*
* @param descSensorDoc
* XmlBean created from the incoming request stream
* @return Returns SosDescribeSensorRequest representing the request
*/
private OwsServiceCommunicationObject parseDescribeSensor(DescribeSensorDocument descSensorDoc) {
DescribeSensorRequest request = new DescribeSensorRequest();
DescribeSensor descSensor = descSensorDoc.getDescribeSensor();
request.setService(descSensor.getService());
request.setVersion(descSensor.getVersion());
// parse outputFormat through MediaType to ensure it's a mime type and
// eliminate whitespace variations
request.setProcedureDescriptionFormat(MediaType.normalizeString(descSensor.getOutputFormat()));
request.setProcedure(descSensor.getProcedure());
return request;
}
use of org.n52.shetland.ogc.sos.request.DescribeSensorRequest in project arctic-sea by 52North.
the class DescribeSensorV2RequestEncoderTest method shouldThrowExceptionIfVersionIsMissing.
@Test
public void shouldThrowExceptionIfVersionIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + DescribeSensorV2RequestEncoder.class.getSimpleName() + " can not encode 'missing version'"));
new DescribeSensorV2RequestEncoder().create(new DescribeSensorRequest("service", ""));
}
Aggregations