Search in sources :

Example 6 with DataAvailability

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()))));
}
Also used : TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) DataAvailability(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability) GetDataAvailabilityResponse(org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse) XmlObject(org.apache.xmlbeans.XmlObject) DateTime(org.joda.time.DateTime) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) Test(org.junit.Test)

Aggregations

DataAvailability (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.DataAvailability)6 ReferenceType (org.n52.shetland.ogc.gml.ReferenceType)3 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)3 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 DataAvailabilityMemberType (net.opengis.sosgda.x10.DataAvailabilityMemberType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 DateTime (org.joda.time.DateTime)1 Test (org.junit.Test)1 GetDataAvailabilityResponse (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse)1 FormatDescriptor (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.FormatDescriptor)1 ObservationFormatDescriptor (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.ObservationFormatDescriptor)1 ProcedureDescriptionFormatDescriptor (org.n52.shetland.ogc.sos.gda.GetDataAvailabilityResponse.ProcedureDescriptionFormatDescriptor)1