ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject [4/8] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models
Date Wed, 08 Feb 2017 18:02:15 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/execution_plugin/test_ssh.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py
index 6b5c783..e81e623 100644
--- a/tests/orchestrator/execution_plugin/test_ssh.py
+++ b/tests/orchestrator/execution_plugin/test_ssh.py
@@ -124,10 +124,10 @@ class TestWithActualSSHServer(object):
 
     def test_run_script_download_resource_and_render(self, tmpdir):
         resource = tmpdir.join('resource')
-        resource.write('{{ctx.deployment.name}}')
+        resource.write('{{ctx.service_instance.name}}')
         self._upload(str(resource), 'test_resource')
         props = self._execute()
-        assert props['test_value'] == self._workflow_context.deployment.name
+        assert props['test_value'] == self._workflow_context.service_instance.name
 
     @pytest.mark.parametrize('value', ['string-value', [1, 2, 3], {'key': 'value'}])
     def test_run_script_inputs_as_env_variables_no_override(self, value):
@@ -217,12 +217,13 @@ class TestWithActualSSHServer(object):
         @workflow
         def mock_workflow(ctx, graph):
             op = 'test.op'
-            node_instance = ctx.model.node_instance.get_by_name(
-                mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-            node_instance.node.operations[op] = {
-                'operation': '{0}.{1}'.format(operations.__name__, operation.__name__)}
+            node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+            node.interfaces = [mock.models.get_interface(
+                op,
+                dict(implementation='{0}.{1}'.format(operations.__name__, operation.__name__))
+            )]
             graph.sequence(*[api.task.OperationTask.node_instance(
-                instance=node_instance,
+                instance=node,
                 name=op,
                 inputs={
                     'script_path': script_path,
@@ -241,7 +242,7 @@ class TestWithActualSSHServer(object):
             workflow_context=self._workflow_context,
             tasks_graph=tasks_graph)
         eng.execute()
-        return self._workflow_context.model.node_instance.get_by_name(
+        return self._workflow_context.model.node.get_by_name(
             mock.models.DEPENDENCY_NODE_INSTANCE_NAME).runtime_properties
 
     def _execute_and_get_task_exception(self, *args, **kwargs):
@@ -253,7 +254,7 @@ class TestWithActualSSHServer(object):
 
     def _upload(self, source, path):
         self._workflow_context.resource.deployment.upload(
-            entry_id=str(self._workflow_context.deployment.id),
+            entry_id=str(self._workflow_context.service_instance.id),
             source=source,
             path=path)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/test_runner.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/test_runner.py b/tests/orchestrator/test_runner.py
index 1d46e91..8927fe9 100644
--- a/tests/orchestrator/test_runner.py
+++ b/tests/orchestrator/test_runner.py
@@ -47,9 +47,9 @@ def test_runner_no_tasks():
 def test_runner_tasks():
     @workflow
     def workflow_fn(ctx, graph):
-        for node_instance in ctx.model.node_instance.iter():
+        for node in ctx.model.node:
             graph.add_tasks(
-                OperationTask.node_instance(instance=node_instance,
+                OperationTask.node_instance(instance=node,
                                             name='tosca.interfaces.node.lifecycle.Standard.create'))
 
     _test_runner(workflow_fn)
@@ -60,8 +60,7 @@ def test_runner_tasks():
 def _initialize_model_storage_fn(model_storage):
     mock.topology.create_simple_topology_single_node(
         model_storage,
-        1,
-        '%s.%s' % (__name__, mock_create_operation.__name__)
+        '{0}.{1}'.format(__name__, mock_create_operation.__name__)
     )
 
 
@@ -70,5 +69,5 @@ def _test_runner(workflow_fn):
                     workflow_fn=workflow_fn,
                     inputs={},
                     initialize_model_storage_fn=_initialize_model_storage_fn,
-                    deployment_id=1)
+                    service_instance_id=1)
     runner.run()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/__init__.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/__init__.py b/tests/orchestrator/workflows/__init__.py
index fe04b2f..7f0fd56 100644
--- a/tests/orchestrator/workflows/__init__.py
+++ b/tests/orchestrator/workflows/__init__.py
@@ -13,4 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from . import api, builtin, core
+from . import api, core

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/api/test_task.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py
index 601c437..92d0917 100644
--- a/tests/orchestrator/workflows/api/test_task.py
+++ b/tests/orchestrator/workflows/api/test_task.py
@@ -16,10 +16,9 @@
 
 import pytest
 
-from aria.storage import model
 from aria.orchestrator import context
 from aria.orchestrator.workflows import api
-
+from aria.storage.modeling import model
 from tests import mock, storage
 
 
@@ -31,7 +30,7 @@ def ctx():
     :return:
     """
     simple_context = mock.context.simple(storage.get_sqlite_api_kwargs())
-    simple_context.model.execution.put(mock.models.get_execution(simple_context.deployment))
+    simple_context.model.execution.put(mock.models.get_execution(simple_context.service_instance))
     yield simple_context
     storage.release_sqlite_storage(simple_context.model)
 
@@ -40,16 +39,17 @@ class TestOperationTask(object):
 
     def test_node_operation_task_creation(self, ctx):
         operation_name = 'aria.interfaces.lifecycle.create'
-        op_details = {'operation': True, 'plugin': 'plugin'}
-        node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME)
-        node.operations[operation_name] = op_details
+        interface = mock.models.get_interface(
+            operation_name,
+            operation_kwargs=dict(plugin='plugin', implementation='op_path'))
+
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
+        node.interfaces = [interface]
         node.plugins = [{'name': 'plugin',
                          'package_name': 'package',
                          'package_version': '0.1'}]
-        ctx.model.node.update(node)
-        node_instance = \
-            ctx.model.node_instance.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
-        inputs = {'inputs': True}
+        ctx.model.node_template.update(node)
+        inputs = {'name': True}
         max_attempts = 10
         retry_interval = 10
         ignore_failure = True
@@ -57,15 +57,15 @@ class TestOperationTask(object):
         with context.workflow.current.push(ctx):
             api_task = api.task.OperationTask.node_instance(
                 name=operation_name,
-                instance=node_instance,
+                instance=node,
                 inputs=inputs,
                 max_attempts=max_attempts,
                 retry_interval=retry_interval,
                 ignore_failure=ignore_failure)
 
-        assert api_task.name == '{0}.{1}'.format(operation_name, node_instance.id)
-        assert api_task.operation_mapping is True
-        assert api_task.actor == node_instance
+        assert api_task.name == '{0}.{1}'.format(operation_name, node.id)
+        assert api_task.implementation == 'op_path'
+        assert api_task.actor == node
         assert api_task.inputs == inputs
         assert api_task.retry_interval == retry_interval
         assert api_task.max_attempts == max_attempts
@@ -77,29 +77,34 @@ class TestOperationTask(object):
 
     def test_source_relationship_operation_task_creation(self, ctx):
         operation_name = 'aria.interfaces.relationship_lifecycle.preconfigure'
-        op_details = {'operation': True, 'plugin': 'plugin'}
+
+        interface = mock.models.get_interface(
+            operation_name,
+            operation_kwargs=dict(implementation='op_path', plugin='plugin'),
+            edge='source'
+        )
+
         relationship = ctx.model.relationship.list()[0]
-        relationship.source_operations[operation_name] = op_details
+        relationship.interfaces = [interface]
         relationship.source_node.plugins = [{'name': 'plugin',
                                              'package_name': 'package',
                                              'package_version': '0.1'}]
-        relationship_instance = ctx.model.relationship_instance.list()[0]
-        inputs = {'inputs': True}
+        inputs = {'name': True}
         max_attempts = 10
         retry_interval = 10
 
         with context.workflow.current.push(ctx):
             api_task = api.task.OperationTask.relationship_instance(
                 name=operation_name,
-                instance=relationship_instance,
-                operation_end=api.task.OperationTask.SOURCE_OPERATION,
+                instance=relationship,
+                edge='source',
                 inputs=inputs,
                 max_attempts=max_attempts,
                 retry_interval=retry_interval)
 
-        assert api_task.name == '{0}.{1}'.format(operation_name, relationship_instance.id)
-        assert api_task.operation_mapping is True
-        assert api_task.actor == relationship_instance
+        assert api_task.name == '{0}.{1}'.format(operation_name, relationship.id)
+        assert api_task.implementation == 'op_path'
+        assert api_task.actor == relationship
         assert api_task.inputs == inputs
         assert api_task.retry_interval == retry_interval
         assert api_task.max_attempts == max_attempts
@@ -110,29 +115,33 @@ class TestOperationTask(object):
 
     def test_target_relationship_operation_task_creation(self, ctx):
         operation_name = 'aria.interfaces.relationship_lifecycle.preconfigure'
-        op_details = {'operation': True, 'plugin': 'plugin'}
+        interface = mock.models.get_interface(
+            operation_name,
+            operation_kwargs=dict(implementation='op_path', plugin='plugin'),
+            edge='target'
+        )
+
         relationship = ctx.model.relationship.list()[0]
-        relationship.target_operations[operation_name] = op_details
+        relationship.interfaces = [interface]
         relationship.target_node.plugins = [{'name': 'plugin',
                                              'package_name': 'package',
                                              'package_version': '0.1'}]
-        relationship_instance = ctx.model.relationship_instance.list()[0]
-        inputs = {'inputs': True}
+        inputs = {'name': True}
         max_attempts = 10
         retry_interval = 10
 
         with context.workflow.current.push(ctx):
             api_task = api.task.OperationTask.relationship_instance(
                 name=operation_name,
-                instance=relationship_instance,
-                operation_end=api.task.OperationTask.TARGET_OPERATION,
+                instance=relationship,
+                edge='target',
                 inputs=inputs,
                 max_attempts=max_attempts,
                 retry_interval=retry_interval)
 
-        assert api_task.name == '{0}.{1}'.format(operation_name, relationship_instance.id)
-        assert api_task.operation_mapping is True
-        assert api_task.actor == relationship_instance
+        assert api_task.name == '{0}.{1}'.format(operation_name, relationship.id)
+        assert api_task.implementation == 'op_path'
+        assert api_task.actor == relationship
         assert api_task.inputs == inputs
         assert api_task.retry_interval == retry_interval
         assert api_task.max_attempts == max_attempts
@@ -142,12 +151,12 @@ class TestOperationTask(object):
         assert api_task.runs_on == model.Task.RUNS_ON_TARGET
 
     def test_operation_task_default_values(self, ctx):
-        dependency_node_instance = ctx.model.node_instance.get_by_name(
+        dependency_node_instance = ctx.model.node.get_by_name(
             mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
         with context.workflow.current.push(ctx):
             task = api.task.OperationTask(
                 name='stub',
-                operation_mapping='',
+                implementation='',
                 actor=dependency_node_instance)
 
         assert task.inputs == {}

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/builtin/test_execute_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_execute_operation.py b/tests/orchestrator/workflows/builtin/test_execute_operation.py
deleted file mode 100644
index b7e5678..0000000
--- a/tests/orchestrator/workflows/builtin/test_execute_operation.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import pytest
-
-from aria.orchestrator.workflows.api import task
-from aria.orchestrator.workflows.builtin.execute_operation import execute_operation
-
-from tests import mock
-from tests import storage
-
-
-@pytest.fixture
-def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
-    yield context
-    storage.release_sqlite_storage(context.model)
-
-
-def test_execute_operation(ctx):
-    node_instance = ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-
-    operation_name = mock.operations.NODE_OPERATIONS_INSTALL[0]
-
-    execute_tasks = list(
-        task.WorkflowTask(
-            execute_operation,
-            ctx=ctx,
-            operation=operation_name,
-            operation_kwargs={},
-            allow_kwargs_override=False,
-            run_by_dependency_order=False,
-            type_names=[],
-            node_ids=[],
-            node_instance_ids=[node_instance.id]
-        ).topological_order()
-    )
-
-    assert len(execute_tasks) == 1
-    assert execute_tasks[0].name == '{0}.{1}'.format(operation_name, node_instance.id)
-
-
-
-# TODO: add more scenarios

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/builtin/test_install.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_install.py b/tests/orchestrator/workflows/builtin/test_install.py
deleted file mode 100644
index 789a161..0000000
--- a/tests/orchestrator/workflows/builtin/test_install.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import pytest
-
-from aria.orchestrator.workflows.api import task
-from aria.orchestrator.workflows.builtin.install import install
-
-from tests import mock
-from tests import storage
-
-from . import assert_node_install_operations
-
-
-@pytest.fixture
-def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
-    yield context
-    storage.release_sqlite_storage(context.model)
-
-
-def test_install(ctx):
-
-    install_tasks = list(task.WorkflowTask(install, ctx=ctx).topological_order(True))
-
-    assert len(install_tasks) == 2
-    dependency_node_subgraph, dependent_node_subgraph = install_tasks
-    dependent_node_tasks = list(dependent_node_subgraph.topological_order(reverse=True))
-    dependency_node_tasks = list(dependency_node_subgraph.topological_order(reverse=True))
-
-    assert_node_install_operations(dependency_node_tasks)
-    assert_node_install_operations(dependent_node_tasks, with_relationships=True)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/builtin/test_uninstall.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/builtin/test_uninstall.py b/tests/orchestrator/workflows/builtin/test_uninstall.py
deleted file mode 100644
index 126c4cf..0000000
--- a/tests/orchestrator/workflows/builtin/test_uninstall.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import pytest
-
-from aria.orchestrator.workflows.api import task
-from aria.orchestrator.workflows.builtin.uninstall import uninstall
-
-from tests import mock
-from tests import storage
-
-from . import assert_node_uninstall_operations
-
-
-@pytest.fixture
-def ctx(tmpdir):
-    context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
-    yield context
-    storage.release_sqlite_storage(context.model)
-
-
-def test_uninstall(ctx):
-
-    uninstall_tasks = list(task.WorkflowTask(uninstall, ctx=ctx).topological_order(True))
-
-    assert len(uninstall_tasks) == 2
-    dependent_node_subgraph, dependency_node_subgraph = uninstall_tasks
-    dependent_node_tasks = list(dependent_node_subgraph.topological_order(reverse=True))
-    dependency_node_tasks = list(dependency_node_subgraph.topological_order(reverse=True))
-
-    assert_node_uninstall_operations(operations=dependency_node_tasks)
-    assert_node_uninstall_operations(operations=dependent_node_tasks, with_relationships=True)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/core/test_engine.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_engine.py b/tests/orchestrator/workflows/core/test_engine.py
index d9b50a9..595ed4b 100644
--- a/tests/orchestrator/workflows/core/test_engine.py
+++ b/tests/orchestrator/workflows/core/test_engine.py
@@ -23,7 +23,7 @@ from aria.orchestrator import (
     workflow,
     operation,
 )
-from aria.storage import model
+from aria.storage.modeling import model
 from aria.orchestrator.workflows import (
     api,
     exceptions,
@@ -60,13 +60,14 @@ class BaseTest(object):
             max_attempts=None,
             retry_interval=None,
             ignore_failure=None):
-        node_instance = \
-            ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-        node_instance.node.operations['aria.interfaces.lifecycle.create'] = {
-            'operation': '{name}.{func.__name__}'.format(name=__name__, func=func)
-        }
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        node.interfaces = [mock.models.get_interface(
+            'aria.interfaces.lifecycle.create',
+            operation_kwargs=dict(implementation='{name}.{func.__name__}'.format(name=__name__,
+                                                                                 func=func))
+        )]
         return api.task.OperationTask.node_instance(
-            instance=node_instance,
+            instance=node,
             name='aria.interfaces.lifecycle.create',
             inputs=inputs,
             max_attempts=max_attempts,
@@ -219,8 +220,12 @@ class TestCancel(BaseTest):
 
         @workflow
         def mock_workflow(ctx, graph):
-            return graph.sequence(*(self._op(mock_sleep_task, ctx, inputs={'seconds': 0.1})
-                                    for _ in range(number_of_tasks)))
+            operations = (
+                self._op(mock_sleep_task, ctx, inputs=dict(seconds=0.1))
+                for _ in range(number_of_tasks)
+            )
+            return graph.sequence(*operations)
+
         eng = self._engine(workflow_func=mock_workflow,
                            workflow_context=workflow_context,
                            executor=executor)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/core/test_task.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task.py b/tests/orchestrator/workflows/core/test_task.py
index 061a3f2..ca2731e 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -28,30 +28,43 @@ from aria.orchestrator.workflows import (
 
 from tests import mock, storage
 
+OP_NAME = 'tosca.interfaces.node.lifecycle.Standard.create'
+RELATIONSHIP_OP_NAME = 'tosca.interfaces.relationship.Configure.pre_configure'
+
 
 @pytest.fixture
 def ctx(tmpdir):
     context = mock.context.simple(storage.get_sqlite_api_kwargs(str(tmpdir)))
+
+    relationship = context.model.relationship.list()[0]
+    relationship.interfaces = [
+        mock.models.get_interface(RELATIONSHIP_OP_NAME, edge='source'),
+        mock.models.get_interface(RELATIONSHIP_OP_NAME, edge='target')
+    ]
+    context.model.relationship.update(relationship)
+
+    dependent_node = context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+    dependent_node.interfaces = [mock.models.get_interface(OP_NAME)]
+    context.model.node.update(dependent_node)
+
     yield context
     storage.release_sqlite_storage(context.model)
 
 
 class TestOperationTask(object):
 
-    def _create_node_operation_task(self, ctx, node_instance):
+    def _create_node_operation_task(self, ctx, node):
         with workflow_context.current.push(ctx):
             api_task = api.task.OperationTask.node_instance(
-                instance=node_instance,
+                instance=node,
                 name='tosca.interfaces.node.lifecycle.Standard.create')
             core_task = core.task.OperationTask(api_task=api_task)
         return api_task, core_task
 
-    def _create_relationship_operation_task(self, ctx, relationship_instance, operation_end):
+    def _create_relationship_operation_task(self, ctx, relationship, operation_name, edge):
         with workflow_context.current.push(ctx):
             api_task = api.task.OperationTask.relationship_instance(
-                instance=relationship_instance,
-                name='tosca.interfaces.relationship.Configure.pre_configure_source',
-                operation_end=operation_end)
+                instance=relationship, name=operation_name, edge=edge)
             core_task = core.task.OperationTask(api_task=api_task)
         return api_task, core_task
 
@@ -60,45 +73,47 @@ class TestOperationTask(object):
         storage_plugin_other = mock.models.get_plugin(package_name='p0', package_version='0.0')
         ctx.model.plugin.put(storage_plugin_other)
         ctx.model.plugin.put(storage_plugin)
-        node_instance = ctx.model.node_instance.get_by_name(
-            mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-        node = node_instance.node
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        node_template = node.node_template
         plugin_name = 'plugin1'
-        node.plugins = [{'name': plugin_name,
-                         'package_name': 'p1',
-                         'package_version': '0.1'}]
-        node.operations['tosca.interfaces.node.lifecycle.Standard.create'] = {'plugin': plugin_name}
-        api_task, core_task = self._create_node_operation_task(ctx, node_instance)
+        node_template.plugins = [{'name': 'plugin1',
+                                  'package_name': 'p1',
+                                  'package_version': '0.1'}]
+        node.interfaces = [mock.models.get_interface(
+            'tosca.interfaces.node.lifecycle.Standard.create',
+            operation_kwargs=dict(plugin='plugin1')
+        )]
+        ctx.model.node_template.update(node_template)
+        ctx.model.node.update(node)
+        api_task, core_task = self._create_node_operation_task(ctx, node)
         storage_task = ctx.model.task.get_by_name(core_task.name)
         assert storage_task.plugin_name == plugin_name
         assert storage_task.execution_name == ctx.execution.name
-        assert storage_task.runs_on.id == core_task.context.node_instance.id
+        assert storage_task.runs_on == core_task.context.node
         assert core_task.model_task == storage_task
         assert core_task.name == api_task.name
-        assert core_task.operation_mapping == api_task.operation_mapping
-        assert core_task.actor == api_task.actor == node_instance
+        assert core_task.implementation == api_task.implementation
+        assert core_task.actor == api_task.actor == node
         assert core_task.inputs == api_task.inputs == storage_task.inputs
         assert core_task.plugin == storage_plugin
 
     def test_source_relationship_operation_task_creation(self, ctx):
-        relationship_instance = ctx.model.relationship_instance.list()[0]
+        relationship = ctx.model.relationship.list()[0]
+        ctx.model.relationship.update(relationship)
         _, core_task = self._create_relationship_operation_task(
-            ctx, relationship_instance,
-            api.task.OperationTask.SOURCE_OPERATION)
-        assert core_task.model_task.runs_on.id == relationship_instance.source_node_instance.id
+            ctx, relationship, RELATIONSHIP_OP_NAME, 'source')
+        assert core_task.model_task.runs_on == relationship.source_node
 
     def test_target_relationship_operation_task_creation(self, ctx):
-        relationship_instance = ctx.model.relationship_instance.list()[0]
+        relationship = ctx.model.relationship.list()[0]
         _, core_task = self._create_relationship_operation_task(
-            ctx, relationship_instance,
-            api.task.OperationTask.TARGET_OPERATION)
-        assert core_task.model_task.runs_on.id == relationship_instance.target_node_instance.id
+            ctx, relationship, RELATIONSHIP_OP_NAME, 'target')
+        assert core_task.model_task.runs_on == relationship.target_node
 
     def test_operation_task_edit_locked_attribute(self, ctx):
-        node_instance = \
-            ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 
-        _, core_task = self._create_node_operation_task(ctx, node_instance)
+        _, core_task = self._create_node_operation_task(ctx, node)
         now = datetime.utcnow()
         with pytest.raises(exceptions.TaskException):
             core_task.status = core_task.STARTED
@@ -112,10 +127,9 @@ class TestOperationTask(object):
             core_task.due_at = now
 
     def test_operation_task_edit_attributes(self, ctx):
-        node_instance = \
-            ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 
-        _, core_task = self._create_node_operation_task(ctx, node_instance)
+        _, core_task = self._create_node_operation_task(ctx, node)
         future_time = datetime.utcnow() + timedelta(seconds=3)
 
         with core_task._update():

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
index cd37bde..acdcb1d 100644
--- a/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
+++ b/tests/orchestrator/workflows/core/test_task_graph_into_exececution_graph.py
@@ -25,20 +25,22 @@ from tests import storage
 def test_task_graph_into_execution_graph():
     operation_name = 'tosca.interfaces.node.lifecycle.Standard.create'
     task_context = mock.context.simple(storage.get_sqlite_api_kwargs())
-    node_instance = \
-        task_context.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+    node = task_context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+    node.interfaces = [mock.models.get_interface(operation_name)]
+    task_context.model.node.update(node)
+
     def sub_workflow(name, **_):
         return api.task_graph.TaskGraph(name)
 
     with context.workflow.current.push(task_context):
         test_task_graph = api.task.WorkflowTask(sub_workflow, name='test_task_graph')
-        simple_before_task = api.task.OperationTask.node_instance(instance=node_instance,
+        simple_before_task = api.task.OperationTask.node_instance(instance=node,
                                                                   name=operation_name)
-        simple_after_task = api.task.OperationTask.node_instance(instance=node_instance,
+        simple_after_task = api.task.OperationTask.node_instance(instance=node,
                                                                  name=operation_name)
 
         inner_task_graph = api.task.WorkflowTask(sub_workflow, name='test_inner_task_graph')
-        inner_task = api.task.OperationTask.node_instance(instance=node_instance,
+        inner_task = api.task.OperationTask.node_instance(instance=node,
                                                           name=operation_name)
         inner_task_graph.add_tasks(inner_task)
 
@@ -91,7 +93,7 @@ def test_task_graph_into_execution_graph():
 def _assert_execution_is_api_task(execution_task, api_task):
     assert execution_task.id == api_task.id
     assert execution_task.name == api_task.name
-    assert execution_task.operation_mapping == api_task.operation_mapping
+    assert execution_task.implementation == api_task.implementation
     assert execution_task.actor == api_task.actor
     assert execution_task.inputs == api_task.inputs
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/executor/test_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_executor.py b/tests/orchestrator/workflows/executor/test_executor.py
index 2486a1e..97e1393 100644
--- a/tests/orchestrator/workflows/executor/test_executor.py
+++ b/tests/orchestrator/workflows/executor/test_executor.py
@@ -28,7 +28,7 @@ except ImportError:
     _celery = None
     app = None
 
-from aria.storage import model
+from aria.storage.modeling import model
 from aria.orchestrator import events
 from aria.orchestrator.workflows.executor import (
     thread,
@@ -43,7 +43,7 @@ def test_execute(executor):
     expected_value = 'value'
     successful_task = MockTask(mock_successful_task)
     failing_task = MockTask(mock_failing_task)
-    task_with_inputs = MockTask(mock_task_with_input, inputs={'input': expected_value})
+    task_with_inputs = MockTask(mock_task_with_input, inputs=dict(input='value'))
 
     for task in [successful_task, failing_task, task_with_inputs]:
         executor.execute(task)
@@ -98,8 +98,9 @@ class MockTask(object):
         self.exception = None
         self.id = str(uuid.uuid4())
         name = func.__name__
-        operation = 'tests.orchestrator.workflows.executor.test_executor.{name}'.format(name=name)
-        self.operation_mapping = operation
+        implementation = 'tests.orchestrator.workflows.executor.test_executor.{name}'.format(
+            name=name)
+        self.implementation = implementation
         self.logger = logging.getLogger()
         self.name = name
         self.inputs = inputs or {}

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/executor/test_process_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor.py b/tests/orchestrator/workflows/executor/test_process_executor.py
index 687e245..ec01d60 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor.py
@@ -22,7 +22,7 @@ from contextlib import contextmanager
 import pytest
 
 from aria import application_model_storage
-from aria.storage import model as aria_model
+from aria.storage.modeling import model as aria_model
 from aria.utils.plugin import create as create_plugin
 from aria.storage.sql_mapi import SQLAlchemyModelAPI
 from aria.orchestrator import events
@@ -38,7 +38,7 @@ class TestProcessExecutor(object):
 
     def test_plugin_execution(self, executor, mock_plugin):
         task = MockTask(plugin=mock_plugin,
-                        operation='mock_plugin1.operation')
+                        implementation='mock_plugin1.operation')
 
         queue = Queue.Queue()
 
@@ -119,11 +119,11 @@ class MockTask(object):
 
     INFINITE_RETRIES = aria_model.Task.INFINITE_RETRIES
 
-    def __init__(self, plugin, operation):
+    def __init__(self, plugin, implementation):
         self.id = str(uuid.uuid4())
-        self.operation_mapping = operation
+        self.implementation = implementation
         self.logger = logging.getLogger()
-        self.name = operation
+        self.name = implementation
         self.inputs = {}
         self.context = MockContext()
         self.retry_count = 0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/executor/test_process_executor_extension.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index 4a8ef57..3c3ffb0 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -30,14 +30,17 @@ def test_decorate_extension(context, executor):
     inputs = {'input1': 1, 'input2': 2}
 
     def get_node_instance(ctx):
-        return ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        return ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 
     @workflow
     def mock_workflow(ctx, graph):
         node_instance = get_node_instance(ctx)
         op = 'test.op'
-        op_dict = {'operation': '{0}.{1}'.format(__name__, _mock_operation.__name__)}
-        node_instance.node.operations['test.op'] = op_dict
+        node_instance.interfaces = [mock.models.get_interface(
+            op,
+            operation_kwargs=dict(implementation='{0}.{1}'.format(__name__,
+                                                                  _mock_operation.__name__))
+        )]
         task = api.task.OperationTask.node_instance(instance=node_instance, name=op, inputs=inputs)
         graph.add_tasks(task)
         return graph
@@ -55,7 +58,7 @@ class MockProcessExecutorExtension(object):
     def decorate(self):
         def decorator(function):
             def wrapper(ctx, **operation_inputs):
-                ctx.node_instance.runtime_properties['out'] = {'wrapper_inputs': operation_inputs}
+                ctx.node.runtime_properties['out'] = {'wrapper_inputs': operation_inputs}
                 function(ctx=ctx, **operation_inputs)
             return wrapper
         return decorator
@@ -63,7 +66,7 @@ class MockProcessExecutorExtension(object):
 
 @operation
 def _mock_operation(ctx, **operation_inputs):
-    ctx.node_instance.runtime_properties['out']['function_inputs'] = operation_inputs
+    ctx.node.runtime_properties['out']['function_inputs'] = operation_inputs
 
 
 @pytest.fixture

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
index bd1fa96..af318c3 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
@@ -45,13 +45,13 @@ def test_track_changes_of_failed_operation(context, executor):
 
 
 def _assert_tracked_changes_are_applied(context):
-    instance = context.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+    instance = context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
     assert instance.runtime_properties == _TEST_RUNTIME_PROPERTIES
 
 
 def _update_runtime_properties(context):
-    context.node_instance.runtime_properties.clear()
-    context.node_instance.runtime_properties.update(_TEST_RUNTIME_PROPERTIES)
+    context.node.runtime_properties.clear()
+    context.node.runtime_properties.update(_TEST_RUNTIME_PROPERTIES)
 
 
 def test_refresh_state_of_tracked_attributes(context, executor):
@@ -66,7 +66,7 @@ def test_apply_tracked_changes_during_an_operation(context, executor):
         'changed_but_refreshed': {'some': 'newer', 'properties': 'right there'}
     }
 
-    expected_initial = context.model.node_instance.get_by_name(
+    expected_initial = context.model.node.get_by_name(
         mock.models.DEPENDENCY_NODE_INSTANCE_NAME).runtime_properties
 
     out = _run_workflow(context=context, executor=executor, op_func=_mock_updating_operation,
@@ -87,17 +87,18 @@ def test_apply_tracked_changes_during_an_operation(context, executor):
 def _run_workflow(context, executor, op_func, inputs=None):
     @workflow
     def mock_workflow(ctx, graph):
-        node_instance = ctx.model.node_instance.get_by_name(
-            mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-        node_instance.node.operations['test.op'] = {'operation': _operation_mapping(op_func)}
-        task = api.task.OperationTask.node_instance(instance=node_instance, name='test.op',
+        node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+        node.interfaces = [mock.models.get_interface(
+            'test.op', operation_kwargs=dict(implementation=_operation_mapping(op_func)))]
+        task = api.task.OperationTask.node_instance(instance=node,
+                                                    name='test.op',
                                                     inputs=inputs or {})
         graph.add_tasks(task)
         return graph
     graph = mock_workflow(ctx=context)  # pylint: disable=no-value-for-parameter
     eng = engine.Engine(executor=executor, workflow_context=context, tasks_graph=graph)
     eng.execute()
-    return context.model.node_instance.get_by_name(
+    return context.model.node.get_by_name(
         mock.models.DEPENDENCY_NODE_INSTANCE_NAME).runtime_properties.get('out')
 
 
@@ -114,25 +115,25 @@ def _mock_fail_operation(ctx):
 
 @operation
 def _mock_refreshing_operation(ctx):
-    out = {'initial': copy.deepcopy(ctx.node_instance.runtime_properties)}
-    ctx.node_instance.runtime_properties.update({'some': 'new', 'properties': 'right here'})
-    out['after_change'] = copy.deepcopy(ctx.node_instance.runtime_properties)
-    ctx.model.node_instance.refresh(ctx.node_instance)
-    out['after_refresh'] = copy.deepcopy(ctx.node_instance.runtime_properties)
-    ctx.node_instance.runtime_properties['out'] = out
+    out = {'initial': copy.deepcopy(ctx.node.runtime_properties)}
+    ctx.node.runtime_properties.update({'some': 'new', 'properties': 'right here'})
+    out['after_change'] = copy.deepcopy(ctx.node.runtime_properties)
+    ctx.model.node.refresh(ctx.node)
+    out['after_refresh'] = copy.deepcopy(ctx.node.runtime_properties)
+    ctx.node.runtime_properties['out'] = out
 
 
 @operation
 def _mock_updating_operation(ctx, committed, changed_but_refreshed):
-    out = {'initial': copy.deepcopy(ctx.node_instance.runtime_properties)}
-    ctx.node_instance.runtime_properties.update(committed)
-    ctx.model.node_instance.update(ctx.node_instance)
-    out['after_update'] = copy.deepcopy(ctx.node_instance.runtime_properties)
-    ctx.node_instance.runtime_properties.update(changed_but_refreshed)
-    out['after_change'] = copy.deepcopy(ctx.node_instance.runtime_properties)
-    ctx.model.node_instance.refresh(ctx.node_instance)
-    out['after_refresh'] = copy.deepcopy(ctx.node_instance.runtime_properties)
-    ctx.node_instance.runtime_properties['out'] = out
+    out = {'initial': copy.deepcopy(ctx.node.runtime_properties)}
+    ctx.node.runtime_properties.update(committed)
+    ctx.model.node.update(ctx.node)
+    out['after_update'] = copy.deepcopy(ctx.node.runtime_properties)
+    ctx.node.runtime_properties.update(changed_but_refreshed)
+    out['after_change'] = copy.deepcopy(ctx.node.runtime_properties)
+    ctx.model.node.refresh(ctx.node)
+    out['after_refresh'] = copy.deepcopy(ctx.node.runtime_properties)
+    ctx.node.runtime_properties['out'] = out
 
 
 def _operation_mapping(func):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/resources/scripts/test_ssh.sh
----------------------------------------------------------------------
diff --git a/tests/resources/scripts/test_ssh.sh b/tests/resources/scripts/test_ssh.sh
index 6f18278..90202c7 100644
--- a/tests/resources/scripts/test_ssh.sh
+++ b/tests/resources/scripts/test_ssh.sh
@@ -4,7 +4,7 @@ set -u
 set -e
 
 test_run_script_basic() {
-    ctx node-instance runtime-properties test_value $test_value
+    ctx node runtime-properties test_value $test_value
 }
 
 test_run_script_as_sudo() {
@@ -12,7 +12,7 @@ test_run_script_as_sudo() {
 }
 
 test_run_script_default_base_dir() {
-    ctx node-instance runtime-properties work_dir $PWD
+    ctx node runtime-properties work_dir $PWD
 }
 
 test_run_script_with_hide() {
@@ -20,44 +20,44 @@ test_run_script_with_hide() {
 }
 
 test_run_script_process_config() {
-    ctx node-instance runtime-properties env_value $test_value_env
-    ctx node-instance runtime-properties bash_version $BASH_VERSION
-    ctx node-instance runtime-properties arg1_value $1
-    ctx node-instance runtime-properties arg2_value $2
-    ctx node-instance runtime-properties cwd $PWD
-    ctx node-instance runtime-properties ctx_path $(which ctx)
+    ctx node runtime-properties env_value $test_value_env
+    ctx node runtime-properties bash_version $BASH_VERSION
+    ctx node runtime-properties arg1_value $1
+    ctx node runtime-properties arg2_value $2
+    ctx node runtime-properties cwd $PWD
+    ctx node runtime-properties ctx_path $(which ctx)
 }
 
 test_run_script_command_prefix() {
-    ctx node-instance runtime-properties dollar_dash $-
+    ctx node runtime-properties dollar_dash $-
 }
 
 test_run_script_reuse_existing_ctx_1() {
-    ctx node-instance runtime-properties test_value1 $test_value1
+    ctx node runtime-properties test_value1 $test_value1
 }
 
 test_run_script_reuse_existing_ctx_2() {
-    ctx node-instance runtime-properties test_value2 $test_value2
+    ctx node runtime-properties test_value2 $test_value2
 }
 
 test_run_script_download_resource_plain() {
     local destination=$(mktemp)
     ctx download-resource ${destination} test_resource
-    ctx node-instance runtime-properties test_value "$(cat ${destination})"
+    ctx node runtime-properties test_value "$(cat ${destination})"
 }
 
 test_run_script_download_resource_and_render() {
     local destination=$(mktemp)
     ctx download-resource-and-render ${destination} test_resource
-    ctx node-instance runtime-properties test_value "$(cat ${destination})"
+    ctx node runtime-properties test_value "$(cat ${destination})"
 }
 
 test_run_script_inputs_as_env_variables_no_override() {
-    ctx node-instance runtime-properties test_value "$custom_env_var"
+    ctx node runtime-properties test_value "$custom_env_var"
 }
 
 test_run_script_inputs_as_env_variables_process_env_override() {
-    ctx node-instance runtime-properties test_value "$custom_env_var"
+    ctx node runtime-properties test_value "$custom_env_var"
 }
 
 test_run_script_error_in_script() {

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/storage/__init__.py
----------------------------------------------------------------------
diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py
index 3b3715e..a50b387 100644
--- a/tests/storage/__init__.py
+++ b/tests/storage/__init__.py
@@ -14,8 +14,8 @@
 # limitations under the License.
 import os
 import platform
-from tempfile import mkdtemp
 from shutil import rmtree
+from tempfile import mkdtemp
 
 from sqlalchemy import (
     create_engine,
@@ -29,20 +29,20 @@ from sqlalchemy import (
 
 from aria.storage import (
     model,
-    structure,
     type as aria_type,
+    structure,
+    modeling
 )
 
 
-class MockModel(model.DeclarativeBase, structure.ModelMixin): #pylint: disable=abstract-method
-    __tablename__ = 'mock_models'
+class MockModel(model.DB, structure.ModelMixin): #pylint: disable=abstract-method
+    __tablename__ = 'mock_model'
     model_dict = Column(aria_type.Dict)
     model_list = Column(aria_type.List)
     value = Column(Integer)
     name = Column(Text)
 
 
-
 class TestFileSystem(object):
 
     def setup_method(self):
@@ -52,7 +52,8 @@ class TestFileSystem(object):
         rmtree(self.path, ignore_errors=True)
 
 
-def get_sqlite_api_kwargs(base_dir=None, filename='db.sqlite'):
+def get_sqlite_api_kwargs(base_dir=None,
+                          filename='db.sqlite'):
     """
     Create sql params. works in in-memory and in filesystem mode.
     If base_dir is passed, the mode will be filesystem mode. while the default mode is in-memory.
@@ -77,7 +78,7 @@ def get_sqlite_api_kwargs(base_dir=None, filename='db.sqlite'):
     session_factory = orm.sessionmaker(bind=engine)
     session = orm.scoped_session(session_factory=session_factory) if base_dir else session_factory()
 
-    model.DeclarativeBase.metadata.create_all(bind=engine)
+    modeling.declarative_base.metadata.create_all(bind=engine)
     return dict(engine=engine, session=session)
 
 
@@ -94,4 +95,4 @@ def release_sqlite_storage(storage):
             session.rollback()
             session.close()
         for engine in set(mapi._engine for mapi in mapis):
-            model.DeclarativeBase.metadata.drop_all(engine)
+            modeling.declarative_base.metadata.drop_all(engine)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/storage/test_instrumentation.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_instrumentation.py b/tests/storage/test_instrumentation.py
index 9b4da4f..f782b33 100644
--- a/tests/storage/test_instrumentation.py
+++ b/tests/storage/test_instrumentation.py
@@ -17,17 +17,16 @@ import pytest
 from sqlalchemy import Column, Text, Integer, event
 
 from aria.storage import (
-    model,
     structure,
-    type as aria_type,
     ModelStorage,
     sql_mapi,
     instrumentation,
-    exceptions
+    exceptions,
+    type as aria_type,
+    model
 )
 from ..storage import get_sqlite_api_kwargs, release_sqlite_storage
 
-
 STUB = instrumentation._STUB
 Value = instrumentation._Value
 instruments_holder = []
@@ -347,15 +346,15 @@ class _MockModel(structure.ModelMixin):
     string2 = Column(Text)
 
 
-class MockModel1(model.DeclarativeBase, _MockModel):
-    __tablename__ = 'mock_model1'
+class MockModel1(_MockModel, model.DB):
+    __tablename__ = 'mock_model_1'
 
 
-class MockModel2(model.DeclarativeBase, _MockModel):
-    __tablename__ = 'mock_model2'
+class MockModel2(_MockModel, model.DB):
+    __tablename__ = 'mock_model_2'
 
 
-class StrictMockModel(model.DeclarativeBase):
+class StrictMockModel(structure.ModelMixin, model.DB):
     __tablename__ = 'strict_mock_model'
 
     strict_dict = Column(aria_type.StrictDict(basestring, basestring))

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fb3ac003/tests/storage/test_model_storage.py
----------------------------------------------------------------------
diff --git a/tests/storage/test_model_storage.py b/tests/storage/test_model_storage.py
index d1596e3..acddab1 100644
--- a/tests/storage/test_model_storage.py
+++ b/tests/storage/test_model_storage.py
@@ -17,9 +17,9 @@ import pytest
 
 from aria.storage import (
     ModelStorage,
-    model,
     exceptions,
     sql_mapi,
+    modeling,
 )
 from aria import application_model_storage
 from ..storage import get_sqlite_api_kwargs, release_sqlite_storage
@@ -37,7 +37,7 @@ def storage():
 
 @pytest.fixture(scope='module', autouse=True)
 def module_cleanup():
-    model.DeclarativeBase.metadata.remove(MockModel.__table__)  #pylint: disable=no-member
+    modeling.model.DB.metadata.remove(MockModel.__table__)  #pylint: disable=no-member
 
 
 def test_storage_base(storage):
@@ -62,14 +62,41 @@ def test_model_storage(storage):
 def test_application_storage_factory():
     storage = application_model_storage(sql_mapi.SQLAlchemyModelAPI,
                                         api_kwargs=get_sqlite_api_kwargs())
+
+    assert storage.parameter
+    assert storage.mapping_template
+    assert storage.substitution_template
+    assert storage.service_template
+    assert storage.node_template
+    assert storage.group_template
+    assert storage.interface_template
+    assert storage.operation_template
+    assert storage.artifact_template
+    assert storage.policy_template
+    assert storage.group_policy_template
+    assert storage.group_policy_trigger_template
+    assert storage.requirement_template
+    assert storage.capability_template
+
+    assert storage.mapping
+    assert storage.substitution
+    assert storage.service_instance
     assert storage.node
-    assert storage.node_instance
-    assert storage.plugin
-    assert storage.blueprint
-    assert storage.deployment
-    assert storage.deployment_update
-    assert storage.deployment_update_step
-    assert storage.deployment_modification
+    assert storage.group
+    assert storage.interface
+    assert storage.operation
+    assert storage.capability
+    assert storage.artifact
+    assert storage.policy
+    assert storage.group_policy
+    assert storage.group_policy_trigger
+    assert storage.relationship
+
     assert storage.execution
+    assert storage.service_instance_update
+    assert storage.service_instance_update_step
+    assert storage.service_instance_modification
+    assert storage.plugin
+    assert storage.task
 
     release_sqlite_storage(storage)


Mime
View raw message