예제 #1
0
    def execute_get(self):

        state = State('config.json')
        server = yield from Server.create(state)

        body = {
            "entity": "specimen",
            "action": "retrieve",
            "params": {
                "specimen": self.specimen_link
            }
        }

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=body)

        response = yield from server.execute_http_request(
            request, stats=True
        )

        assert response['response']['success']

        specimen = response['response']['data'][0]

        assert body[
            'params']['specimen'].split('/')[-1] == specimen['identifier']
    def execute_post(self):
        state = State('config.json')
        server = yield from Server.create(state)

        self.body = {
            "entity": "offering",
            "action": "create",
            "data": {
                "observable_property": [{
                    "type": ("http://www.opengis.net/def/observationType/"
                             "OGC-OM/2.0/OM_Measurement"),
                    "name":
                    "air-temperature",
                    "definition": ("urn:ogc:def:parameter:x-istsos:1.0:"
                                   "meteo:air:temperature"),
                    "uom":
                    "°C"
                }],
                "observation_type": [{
                    "definition":
                    ("http://www.opengis.net/def/observationType/"
                     "OGC-OM/2.0/OM_Measurement"),
                    "description":
                    ""
                }],
                "procedure":
                ("urn:ogc:def:procedure:x-istsos:1.0:{}").format(uuid.uuid4()),
                "procedure_description_format":
                ["http://www.opengis.net/sensorML/1.0.1"],
                "foi_type":
                ("http://www.opengis.net/def/samplingFeatureType/OGC-OM/"
                 "2.0/SF_SamplingPoint"),
                "foi_name":
                "https://istsos.org/istsos3/fois/ceresio",
                "systemType":
                "undefined"
            }
        }

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=self.body)

        response = yield from server.execute_http_request(request, stats=True)

        assert response['response']['success']
예제 #3
0
    def execute_post(self):
        state = State('config.json')
        server = yield from Server.create(state)

        self.body = {
            "entity": "material",
            "action": "create",
            "data": {
                "name": "{}".format(uuid.uuid4()),
                "description": "test method API"
            }
        }

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=self.body)

        response = yield from server.execute_http_request(request, stats=True)

        assert response['response']['success']
예제 #4
0
    def execute_get(self):
        # Installation of the istSOS server
        state = State('config.json')
        server = yield from Server.create(state)

        body = {"entity": "material", "action": "retrieve"}

        # Preparing the Request object
        request = HttpRequest("GET", '/rest', body=body)

        response = yield from server.execute_http_request(request, stats=True)

        mat_lists = response['response']['data']

        for mat in mat_lists:
            if mat['name'] == self.body['data']['name']:
                assert True
                return

        assert False
    def execute_get(self):
        # Installation of the istSOS server
        state = State('config.json')
        server = yield from Server.create(state)

        body = {"entity": "uoms", "action": "retrieve"}

        # Preparing the Request object
        request = HttpRequest("POST", 'rest', body=body)

        response = yield from server.execute_http_request(request, stats=True)

        uom_lists = response['response']['data']

        for key in uom_lists.keys():
            if uom_lists[key]['name'] == self.body['data']['name']:
                assert True
                return

        assert False
    def execute_get(self):
        # Installation of the istSOS server
        state = State('config.json')
        server = yield from Server.create(state)

        body = {"entity": "observedProperties", "action": "retrieve"}

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=body)

        response = yield from server.execute_http_request(request, stats=True)

        op_list = response['response']['data']

        for op in op_list:
            if op['def'] == self.body['data']['def']:
                assert True
                return

        assert False
    def execute_get(self):
        # Installation of the istSOS server
        state = State('config.json')
        server = yield from Server.create(state)

        body = {"entity": "systemType", "action": "retrieve"}

        # Preparing the Request object
        request = HttpRequest("GET", '/rest', body=body)

        response = yield from server.execute_http_request(request, stats=True)

        assert response['response']['success']

        sys_lists = response['response']['data']

        for system in sys_lists:
            if system['name'] == 'insitu-fixed-point':
                assert True
                return

        assert False
    def execute_get(self):
        # Installation of the istSOS server
        state = State('config.json')
        server = yield from Server.create(state)

        body = {
            "entity": "offering",
            "action": "retrieve",
            "params": {
                "procedures": [self.body['data']['procedure']]
            }
        }

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=body)

        response = yield from server.execute_http_request(request, stats=True)

        assert response['response']['success']

        procedure = response['response']['data'][0]['procedure']

        assert procedure == self.body['data']['procedure']
    def execute_post(self):
        state = State('config.json')
        server = yield from Server.create(state)

        self.body = {
            "entity": "observedProperties",
            "action": "create",
            "data": {
                "description": ("Air temperature at 2 meters above terrain"),
                "def": ("urn:ogc:def:parameter:x-istsos:1.0:"
                        "meteo:air:temperature:{}").format(uuid.uuid4()),
                "name":
                "air-temperature-test",
                "type": ("http://www.opengis.net/def/observationType/"
                         "OGC-OM/2.0/OM_Measurement")
            }
        }

        # Preparing the Request object
        request = HttpRequest("POST", '/rest', body=self.body)

        response = yield from server.execute_http_request(request, stats=True)

        assert response['response']['success']
예제 #10
0
    def execute_post(self):

        state = State('config.json')
        server = yield from Server.create(state)

        body = {
            "entity": "specimen",
            "action": "create",
            "data": {
                "description": (
                    "A sample for the Lugano Lake water quality monitoring"),
                "identifier": str(uuid.uuid4()),
                "name": "LUG_20170808",
                "type": {
                  "href": (
                    "http://www.opengis.net/def/samplingFeatureType/"
                    "OGC-OM/2.0/SF_Specimen")
                },
                "sampledFeature": {
                  "href": "http://www.istsos.org/demo/feature/LuganoLake"
                },
                "materialClass": {
                  "href": "http://www.istsos.org/material/water"
                  },
                "samplingTime": {
                  "timeInstant": {
                    "instant": "2017-06-30T15:27:00+01:00"
                  }
                },
                "samplingMethod": {
                    "href": "http://www.istsos.org/samplingMethod/still-water"
                },
                "samplingLocation": {
                  "type": "point",
                  "coordinates": [100.0, 0.0]
                },
                "processingDetails": [
                  {
                    "processOperator": {
                        "href": "http://www.supsi.ch/ist?person=MarioBianchi"
                    },
                    "processingDetails": {
                        "href": "http://www.istsos.org/processes/storage"
                    },
                    "time": "2017-07-01T15:27:00+01:00"
                  },
                  {
                    "processOperator": {
                        "href": "https://www.supsi.ch/ist?person=LucaRossi"
                    },
                    "processingDetails": {
                        "href": "http://www.istsos.org/processes/Reaction"
                    },
                    "time": "2017-07-06T15:27:00+01:00"
                  }
                ],
                "size": {
                  "value": 1,
                  "uom": "liter"
                },
                "currentLocation": {
                  "href": "http://www.ti.ch/umam",
                  "rel": "http://www.onu.org/offices",
                  "title": "Ufficio Monitoraggio Ambientale - Canton Ticino"
                },
                "specimenType": None
            }
        }

        request = HttpRequest("POST", '/rest', body=body)

        response = yield from server.execute_http_request(request, stats=False)

        assert response['response']['success']

        self.specimen_link = response[
            'response']['message'].split(': ')[-1].strip()