use of org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability in project arctic-sea by 52North.
the class GetDataAvailabilityXmlEncoderTest method test.
@Test
public void test() throws EncodingException {
GetDataAvailabilityResponse response = new GetDataAvailabilityResponse("SOS", "2.0.0");
response.setNamespace(GetDataAvailabilityConstants.NS_GDA);
DateTime begin = DateTime.now().withZone(DateTimeZone.UTC);
DateTime end = begin.plusHours(1).withZone(DateTimeZone.UTC);
TimePeriod timePeriod = new TimePeriod(begin, end);
ReferenceType procedure = new ReferenceType("procedure");
ReferenceType observedProperty = new ReferenceType("observedProperty");
ReferenceType featureOfInterest = new ReferenceType("featureOfInterest");
ReferenceType offering = new ReferenceType("offering");
int count = 100;
response.addDataAvailability(new DataAvailability(procedure, observedProperty, featureOfInterest, offering, timePeriod, count));
XmlObject encoded = encoder.encode(response);
System.out.println(encoded.xmlText());
errors.checkThat(encoded.xmlText(), is(String.format("<gda:GetDataAvailabilityResponse xsi:schemaLocation=\"http://www.opengis.net/sosgda/1.0 http://waterml2.org/schemas/gda/1.0/gda.xsd\" " + "xmlns:gda=\"http://www.opengis.net/sosgda/1.0\" " + "xmlns:gml=\"http://www.opengis.net/gml/3.2\" " + "xmlns:swe=\"http://www.opengis.net/swe/2.0\" " + "xmlns:xlink=\"http://www.w3.org/1999/xlink\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + " <gda:dataAvailabilityMember gml:id=\"dam_1\">\n" + " <gda:procedure xlink:href=\"procedure\" xlink:title=\"procedure\"/>\n" + " <gda:observedProperty xlink:href=\"observedProperty\" xlink:title=\"observedProperty\"/>\n" + " <gda:featureOfInterest xlink:href=\"featureOfInterest\" xlink:title=\"featureOfInterest\"/>\n" + " <gda:phenomenonTime>\n" + " <gml:TimePeriod gml:id=\"tp_1\">\n" + " <gml:beginPosition>%s</gml:beginPosition>\n" + " <gml:endPosition>%s</gml:endPosition>\n" + " </gml:TimePeriod>\n" + " </gda:phenomenonTime>\n" + " <gda:count>100</gda:count>\n" + " <gda:extension>\n" + " <swe:Text definition=\"offering\">\n" + " <swe:value>offering</swe:value>\n" + " </swe:Text>\n" + " </gda:extension>\n" + " </gda:dataAvailabilityMember>\n" + "</gda:GetDataAvailabilityResponse>", begin.toString(ISODateTimeFormat.dateTime()), end.toString(ISODateTimeFormat.dateTime()))));
}
Aggregations