use of org.n52.svalbard.encode.EncoderRepository in project arctic-sea by 52North.
the class SimpleBindingTest method mockEncoderRepository.
@SuppressWarnings({ "rawtypes", "unchecked" })
private EncoderRepository mockEncoderRepository() {
EncoderRepository encoderRepository = mock(EncoderRepository.class);
OwsOperationKey operationKey = new OwsOperationKey(response);
OperationResponseEncoderKey operationEncoderKey = new OperationResponseEncoderKey(operationKey, MediaTypes.APPLICATION_JSON);
Encoder encoder = Mockito.mock(Encoder.class);
when(encoderRepository.getEncoder(operationEncoderKey)).thenReturn(encoder);
return encoderRepository;
}
use of org.n52.svalbard.encode.EncoderRepository in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method setup.
@Before
public void setup() throws InvalidSridException, ParseException {
SensorML procedure = new SensorML();
procedure.setIdentifier(procedureIdentifier);
SamplingFeature featureOfInterest = new SamplingFeature(new CodeWithAuthority(featureIdentifier));
featureOfInterest.setIdentifier(featureIdentifier);
featureOfInterest.setName(new CodeType(featureName));
featureOfInterest.setFeatureType(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT);
featureOfInterest.setGeometry(JTSHelper.createGeometryFromWKT("POINT(30 10)", 4326));
observationTemplate = new OmObservationConstellation();
observationTemplate.addOffering(offering);
observationTemplate.setObservationType(OmConstants.OBS_TYPE_MEASUREMENT);
observationTemplate.setProcedure(procedure);
observationTemplate.setObservableProperty(new OmObservableProperty(observedProperty));
observationTemplate.setFeatureOfInterest(featureOfInterest);
SweTextEncoding textEncoding = new SweTextEncoding();
textEncoding.setBlockSeparator(blockSeparator);
textEncoding.setTokenSeparator(tokenSeparator);
SweDataRecord resultStructure = new SweDataRecord();
SweTime sweTime = new SweTime();
sweTime.setDefinition(field1Definition);
sweTime.setUom(field1Uom);
resultStructure.addField(new SweField(field1Name, sweTime));
request = new InsertResultTemplateRequest(SosConstants.SOS, Sos2Constants.SERVICEVERSION, Sos2Constants.Operations.InsertResultTemplate.name());
request.setResultEncoding(new SosResultEncoding(textEncoding));
request.setResultStructure(new SosResultStructure(resultStructure));
request.setIdentifier(templateIdentifier);
request.setObservationTemplate(observationTemplate);
Supplier<XmlOptions> xmlOptions = () -> new XmlOptions();
encoder = new InsertResultTemplateRequestEncoder();
encoder.setXmlOptions(xmlOptions);
OmEncoderv20 omEncoder = new OmEncoderv20();
omEncoder.setXmlOptions(xmlOptions);
SamplingEncoderv20 samsEncoder = new SamplingEncoderv20();
samsEncoder.setXmlOptions(xmlOptions);
GmlEncoderv321 gml32Encoder = new GmlEncoderv321();
gml32Encoder.setXmlOptions(xmlOptions);
SweCommonEncoderv20 sweEncoderv20 = new SweCommonEncoderv20();
sweEncoderv20.setXmlOptions(xmlOptions);
EncoderRepository encoderRepository = new EncoderRepository();
encoderRepository.setEncoders(Arrays.asList(encoder, omEncoder, samsEncoder, gml32Encoder, sweEncoderv20));
encoderRepository.init();
encoderRepository.getEncoders().stream().forEach(e -> ((AbstractDelegatingEncoder<?, ?>) e).setEncoderRepository(encoderRepository));
}
use of org.n52.svalbard.encode.EncoderRepository 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);
}
use of org.n52.svalbard.encode.EncoderRepository in project arctic-sea by 52North.
the class Iso19139GmdEncoderTest method setup.
@Before
public void setup() {
encoder = new Iso19139GmdEncoder();
encoder.setXmlOptions(XmlOptions::new);
Iso19139GcoEncoder iso19139GcoEncoder = new Iso19139GcoEncoder();
iso19139GcoEncoder.setXmlOptions(XmlOptions::new);
EncoderRepository encoderRepository = new EncoderRepository();
encoderRepository.setEncoders(Arrays.asList(encoder, iso19139GcoEncoder));
encoderRepository.init();
encoderRepository.getEncoders().stream().forEach(e -> ((AbstractDelegatingEncoder<?, ?>) e).setEncoderRepository(encoderRepository));
}
use of org.n52.svalbard.encode.EncoderRepository in project arctic-sea by 52North.
the class SamplingEncoderv20Test method setup.
@Before
public void setup() throws InvalidSridException, ParseException {
EncoderRepository encoderRepository = new EncoderRepository();
OmEncoderv20 omEncoderv20 = new OmEncoderv20();
omEncoderv20.setXmlOptions(XmlOptions::new);
omEncoderv20.setEncoderRepository(encoderRepository);
GmlEncoderv321 gmlEncoderv321 = new GmlEncoderv321();
gmlEncoderv321.setEncoderRepository(encoderRepository);
gmlEncoderv321.setXmlOptions(XmlOptions::new);
SensorMLEncoderv20 sensorMLEncoderv20 = new SensorMLEncoderv20();
sensorMLEncoderv20.setXmlOptions(XmlOptions::new);
sensorMLEncoderv20.setEncoderRepository(encoderRepository);
SweCommonEncoderv20 sweCommonEncoderv20 = new SweCommonEncoderv20();
sweCommonEncoderv20.setEncoderRepository(encoderRepository);
sweCommonEncoderv20.setXmlOptions(XmlOptions::new);
encoder = new SamplingEncoderv20();
encoder.setEncoderRepository(encoderRepository);
encoder.setXmlOptions(XmlOptions::new);
encoderRepository.setEncoders(Arrays.asList(omEncoderv20, gmlEncoderv321, sensorMLEncoderv20, sweCommonEncoderv20, encoder));
encoderRepository.init();
featureOfInterest = new SamplingFeature(new CodeWithAuthority("test-feature"));
featureOfInterest.setIdentifier("test-feature-identifier");
featureOfInterest.setName(new CodeType("test-feature-name"));
featureOfInterest.setFeatureType(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT);
featureOfInterest.setGeometry(JTSHelper.createGeometryFromWKT("POINT (30 10)", 4326));
}
Aggregations