Exemplo n.º 1
0
    def test_get_json(self):
        rest = _RestProxyForTest()
        adam_objects = AdamObjects(rest, 'MyType')

        rest.expect_get("/adam_object/single/MyType/uuid1", 200,
                        {'anyKey': 'anyVal'})
        json = adam_objects._get_json('uuid1')
        self.assertEqual({'anyKey': 'anyVal'}, json)

        rest.expect_get("/adam_object/single/MyType/uuid1", 404, {})
        json = adam_objects._get_json('uuid1')
        self.assertEqual(json, None)

        rest.expect_get("/adam_object/single/MyType/uuid1", 403, {})
        with self.assertRaises(RuntimeError):
            adam_objects._get_json('uuid1')
Exemplo n.º 2
0
    def update_with_results(self, batch_propagation):
        uuid = batch_propagation.get_uuid()
        response = AdamObjects._get_json(self, uuid)
        if response is None:
            raise RuntimeError("Could not retrieve results for " + uuid)

        batch_propagation.set_summary(response.get('summary'))
    def update_with_results(self, targeted_propagation):
        uuid = targeted_propagation.get_uuid()
        response = AdamObjects._get_json(self, uuid)
        if response is None:
            raise RuntimeError("Could not retrieve results for " + uuid)

        ephemeris = response.get('ephemeris')
        maneuver = None
        if 'maneuverX' in response:
            maneuver = [response['maneuverX'],
                        response['maneuverY'], response['maneuverZ']]
        targeted_propagation.set_ephemeris(ephemeris)
        targeted_propagation.set_maneuver(maneuver)
Exemplo n.º 4
0
    def get(self, uuid):
        response = AdamObjects._get_json(self, uuid)
        if response is None:
            return None

        # Values in [] are guaranteed to be present. Values in .get() may be missing.
        opmParams = OpmParams.fromJsonResponse(
            response['templatePropagationParameters']['opm'])
        propParams = PropagationParams.fromJsonResponse(
            response['templatePropagationParameters'], response.get('description'))
        batch_propagation = BatchPropagation(propParams, opmParams)

        batch_propagation.set_uuid(response['uuid'])
        batch_propagation.set_summary(response.get('summary'))
        return batch_propagation
    def get(self, uuid):
        response = AdamObjects._get_json(self, uuid)
        if response is None:
            return None
        opmParams = OpmParams.fromJsonResponse(
            response['initialPropagationParameters']['opm'])
        propParams = PropagationParams.fromJsonResponse(
            response['initialPropagationParameters'], response.get('description'))
        targetingParams = TargetingParams.fromJsonResponse(
            response['targetingParameters'])
        targeted_propagation = TargetedPropagation(
            propParams, opmParams, targetingParams)

        uuid = response['uuid']
        ephemeris = response.get('ephemeris')
        maneuver = None
        if 'maneuverX' in response:
            maneuver = [response['maneuverX'],
                        response['maneuverY'], response['maneuverZ']]
        targeted_propagation.set_uuid(uuid)
        targeted_propagation.set_ephemeris(ephemeris)
        targeted_propagation.set_maneuver(maneuver)

        return targeted_propagation