Search in sources :

Example 6 with InsertSensorRequest

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

the class InsertSensorRequestEncoderTest method prepare.

@Before
public void prepare() {
    request = new InsertSensorRequest("service", "version");
    request.setProcedureDescriptionFormat(SensorML20Constants.SENSORML_20_OUTPUT_FORMAT_URL);
    request.setProcedureDescription(createProcedureDescription());
    SosInsertionMetadata metadata = new SosInsertionMetadata();
    metadata.setFeatureOfInterestTypes(CollectionHelper.list("test-foi-type-1", "test-foi-type-2"));
    metadata.setObservationTypes(CollectionHelper.list("test-observation-type-1", "test-observation-type-2"));
    request.setMetadata(metadata);
    request.setObservableProperty(CollectionHelper.list("test-property-1", "test-property-2"));
    encoder = new InsertSensorRequestEncoder();
    encoder.setXmlOptions(() -> new XmlOptions());
    SensorMLEncoderv20 sensorMLEncoderv20 = new SensorMLEncoderv20();
    sensorMLEncoderv20.setXmlOptions(() -> new XmlOptions());
    GmlEncoderv321 gmlEncoder = new GmlEncoderv321();
    gmlEncoder.setXmlOptions(() -> new XmlOptions());
    SosInsertionMetadataTypeEncoder metadataEncoder = new SosInsertionMetadataTypeEncoder();
    metadataEncoder.setXmlOptions(() -> new XmlOptions());
    EncoderRepository encoderRepository = new EncoderRepository();
    encoderRepository.setEncoders(Arrays.asList(encoder, sensorMLEncoderv20, gmlEncoder, metadataEncoder));
    encoderRepository.init();
    encoder.setEncoderRepository(encoderRepository);
    sensorMLEncoderv20.setEncoderRepository(encoderRepository);
    gmlEncoder.setEncoderRepository(encoderRepository);
    metadataEncoder.setEncoderRepository(encoderRepository);
}
Also used : XmlOptions(org.apache.xmlbeans.XmlOptions) SosInsertionMetadata(org.n52.shetland.ogc.sos.SosInsertionMetadata) InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest) Before(org.junit.Before)

Example 7 with InsertSensorRequest

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

the class InsertSensorRequestEncoderTest method shouldThrowExceptionIfVersionIsMissing.

@Test
public void shouldThrowExceptionIfVersionIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'missing version'"));
    encoder.create(new InsertSensorRequest("service", ""));
}
Also used : InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest) Test(org.junit.Test)

Example 8 with InsertSensorRequest

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

the class InsertSensorRequestEncoderTest method shouldThrowExceptionWhenProcedureDescriptionFormatIsMissing.

@Test
public void shouldThrowExceptionWhenProcedureDescriptionFormatIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'procedure description format missing'"));
    encoder.create(new InsertSensorRequest("service", "version"));
}
Also used : InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest) Test(org.junit.Test)

Example 9 with InsertSensorRequest

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

the class InsertSensorRequestEncoderTest method shouldThrowExceptionIfServiceIsMissing.

@Test
public void shouldThrowExceptionIfServiceIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'missing service'"));
    encoder.create(new InsertSensorRequest());
}
Also used : InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest) Test(org.junit.Test)

Example 10 with InsertSensorRequest

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

the class InsertSensorRequestEncoderTest method shouldThrowExceptionWhenObservablePropertyIsMissing.

@Test
public void shouldThrowExceptionWhenObservablePropertyIsMissing() throws EncodingException {
    thrown.expect(UnsupportedEncoderInputException.class);
    thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'observed property missing'"));
    InsertSensorRequest request = new InsertSensorRequest("service", "version");
    request.setProcedureDescriptionFormat("test-format");
    request.setProcedureDescription(createProcedureDescription());
    encoder.create(request);
}
Also used : InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest) Test(org.junit.Test)

Aggregations

InsertSensorRequest (org.n52.shetland.ogc.sos.request.InsertSensorRequest)9 Test (org.junit.Test)6 XmlObject (org.apache.xmlbeans.XmlObject)2 SosInsertionMetadata (org.n52.shetland.ogc.sos.SosInsertionMetadata)2 DecodingException (org.n52.svalbard.decode.exception.DecodingException)2 InsertSensorType (net.opengis.swes.x20.InsertSensorType)1 XmlException (org.apache.xmlbeans.XmlException)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 Before (org.junit.Before)1 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)1 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)1 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)1 SosProcedureDescriptionUnknownType (org.n52.shetland.ogc.sos.SosProcedureDescriptionUnknownType)1 EncodingException (org.n52.svalbard.encode.exception.EncodingException)1