use of org.n52.svalbard.encode.Encoder in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method shouldThrowExceptionWhenResultStructureIsMissing.
@Test
public void shouldThrowExceptionWhenResultStructureIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultTemplateRequestEncoder.class.getSimpleName() + " can not encode 'missing resultStructure'"));
request = new InsertResultTemplateRequest("service", "version");
request.setObservationTemplate(new OmObservationConstellation());
OmObservationConstellation observationTemplate = new OmObservationConstellation();
observationTemplate.addOffering(offering);
request.setObservationTemplate(observationTemplate);
encoder.create(request);
}
use of org.n52.svalbard.encode.Encoder in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method shouldThrowExceptionWhenResultEncodingIsMissing.
@Test
public void shouldThrowExceptionWhenResultEncodingIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertResultTemplateRequestEncoder.class.getSimpleName() + " can not encode 'missing resultEncoding'"));
request = new InsertResultTemplateRequest("service", "version");
request.setObservationTemplate(new OmObservationConstellation());
request.setResultStructure(new SosResultStructure(new SweDataRecord()));
OmObservationConstellation observationTemplate = new OmObservationConstellation();
observationTemplate.addOffering(offering);
request.setObservationTemplate(observationTemplate);
encoder.create(request);
}
use of org.n52.svalbard.encode.Encoder in project arctic-sea by 52North.
the class InsertSensorRequestEncoderTest method shouldThrowExceptionWhenProcedureDescriptionIsMissing.
@Test
public void shouldThrowExceptionWhenProcedureDescriptionIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'procedure description missing'"));
InsertSensorRequest request = new InsertSensorRequest("service", "version");
request.setProcedureDescriptionFormat("test-format");
encoder.create(request);
}
use of org.n52.svalbard.encode.Encoder in project arctic-sea by 52North.
the class InsertSensorRequestEncoderTest method shouldThrowExceptionWhenMetadataIsMissing.
@Test
public void shouldThrowExceptionWhenMetadataIsMissing() throws EncodingException {
thrown.expect(UnsupportedEncoderInputException.class);
thrown.expectMessage(Is.is("Encoder " + InsertSensorRequestEncoder.class.getSimpleName() + " can not encode 'metadata field missing'"));
InsertSensorRequest request = new InsertSensorRequest("service", "version");
request.setProcedureDescriptionFormat("test-format");
request.setProcedureDescription(createProcedureDescription());
request.setObservableProperty(CollectionHelper.list("test-property"));
encoder.create(request);
}
use of org.n52.svalbard.encode.Encoder 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);
}
Aggregations