Ejemplo n.º 1
0
def create_stack_trace(context, include_native_frames=True):
    stacktrace = yaql_integration.call_func(
        context,
        'new',
        'io.murano.StackTrace',
        includeNativeFrames=include_native_frames)
    executor = helpers.get_executor(context)
    return dsl.MuranoObjectInterface(stacktrace, executor)
Ejemplo n.º 2
0
 def _load(self, data):
     if not isinstance(data, dict):
         raise TypeError()
     self._attribute_store.load(data.get(constants.DM_ATTRIBUTES) or [])
     result = self._object_store.load(data.get(constants.DM_OBJECTS), None)
     if result is None:
         return None
     return dsl.MuranoObjectInterface(result, executor=self)
Ejemplo n.º 3
0
 def setUp(self):
     super(TestAttributeStore, self).setUp()
     self.attribute_store = attribute_store.AttributeStore()
     self.fake_object = mock.MagicMock(object_id=mock.sentinel.oid)
     self.tagged_obj = dsl.MuranoObjectInterface(self.fake_object)
     self.owner_type = dsl_types.MuranoTypeReference(self.fake_object)
     self.owner_type.type.name = mock.sentinel.typename
     self.name = 'foobar'
Ejemplo n.º 4
0
 def call():
     if isinstance(method.body, specs.FunctionDefinition):
         if isinstance(this, dsl_types.MuranoType):
             native_this = this.get_reference()
         else:
             native_this = dsl.MuranoObjectInterface(
                 this.cast(method.declaring_type), self)
         return method.body(yaql_engine, context,
                            native_this)(*args, **kwargs)
     else:
         context[constants.CTX_NAMES_SCOPE] = \
             method.declaring_type
         return (None if method.body is None else
                 method.body.execute(context))
Ejemplo n.º 5
0
 def test_set_object_if(self, mock_get_attr_key):
     val = dsl.MuranoObjectInterface(self.fake_object)
     self.attribute_store._attributes = mock.MagicMock()
     self.attribute_store.set(self.tagged_obj, self.owner_type, self.name,
                              val)
Ejemplo n.º 6
0
 def test_forget_object_if(self):
     obj = dsl.MuranoObjectInterface(mock.MagicMock(object_id='bar'))
     self.attribute_store._attributes = {'foo': 42, 'bar': 43}
     self.attribute_store.forget_object(obj)
     self.assertEqual({'foo': 42}, self.attribute_store._attributes)