transformer base and base unit test-2

Change-Id: Iae5874cdee6bcaf2ceb10a79523c05a62f2a9b9a
This commit is contained in:
Liat Har-Tal 2015-11-29 12:34:33 +00:00
parent 41c47b25f9
commit 87ce06e8ea
9 changed files with 78 additions and 12 deletions

View File

@ -4,3 +4,5 @@
pbr>=1.6
Babel>=1.3
oslo.log>=1.12.0 # Apache-2.0

View File

@ -8,8 +8,10 @@ coverage>=3.6
discover
python-subunit>=0.0.18
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
oslo.log>=1.12.0 # Apache-2.0
oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
testrepository>=0.0.18
testscenarios>=0.4
testtools>=1.4.0

View File

@ -12,4 +12,29 @@
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'
import abc
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class Transformer(object):
@abc.abstractmethod
def transform(self, entity_event):
"""Transforms an entity event into entity wrapper
:return: An EntityWrapper. EntityWrapper is namedTuple that contains
an entity vertex and a list of vertex and an edge pair that describe
the entity's neighbors.
"""
pass
@abc.abstractmethod
def get_key_fields(self):
pass
@abc.abstractmethod
def get_key(self, entity_event):
pass

View File

@ -0,0 +1 @@
__author__ = 'stack'

View File

@ -0,0 +1,36 @@
#OS-DCF:diskConfig=AUTO
#OS-EXT-AZ:availability_zone=nova
#OS-EXT-SRV-ATTR:host=nyakar-devstack
#OS-EXT-SRV-ATTR:hostname=vm1
#OS-EXT-SRV-ATTR:hypervisor_hostname=nyakar-devstack
#OS-EXT-SRV-ATTR:instance_name=instance-00000001
#OS-EXT-SRV-ATTR:kernel_id=7197e551-5252-4a11-8c90-bd2c7992f06a
#OS-EXT-SRV-ATTR:launch_index=0
#OS-EXT-SRV-ATTR:ramdisk_id=8c9312ac-299e-4e08-b186-6bedcf4bf5b3
#OS-EXT-SRV-ATTR:reservation_id=r-ttupwtdn
#OS-EXT-SRV-ATTR:root_device_name=/dev/vda
#OS-EXT-SRV-ATTR:user_data=-
#OS-EXT-STS:power_state=1
#OS-EXT-STS:task_state=-
#OS-EXT-STS:vm_state=active
#OS-SRV-USG:launched_at=2015-11-25T14:18:20.000000
#OS-SRV-USG:terminated_at=-
#accessIPv4=
#accessIPv6=
#config_drive=True
#| created | 2015-11-25T14:18:07Z |
#| flavor | m1.nano (42) |
#| hostId | aef68acda3cd320a1bd3488e1a4c0c783a48476d14c72ae30824aa5b |
#| id | 65481933-6db7-4b1a-839a-d1173e36c519 |
#| image | cirros-0.3.4-x86_64-uec (86fe163c-c15e-4c36-9ee9-b47a2db567e4) |
#| key_name | - |
#| metadata | {} |
#| name | vm1 |
#| os-extended-volumes:volumes_attached | [] |
#| progress | 0 |
#| public network | 172.24.4.3, 2001:db8::4 |
#| security_groups | default |
#| status | ACTIVE |
#| tenant_id | 0683517e1e354d2ba25cba6937f44e79 |
#| updated | 2015-11-25T14:18:20Z |
#| user_id | f6ab073fc15f44888e8d23497d476270

View File

@ -0,0 +1 @@
__author__ = 'stack'

View File

@ -15,6 +15,6 @@
from oslotest import base
class TestCase(base.BaseTestCase):
class BaseTest(base.BaseTestCase):
"""Test case base class for all unit tests."""

View File

@ -0,0 +1 @@
__author__ = 'stack'

View File

@ -12,17 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
test_vitrage
----------------------------------
from oslo_log import log as logging
from vitrage.tests.unit import base
Tests for `vitrage` module.
"""
from vitrage.tests import base
LOG = logging.getLogger(__name__)
class TestVitrage(base.TestCase):
class TransformNovaInstanceTest(base.BaseTest):
def test_something(self):
pass
def test_transform_instance(self):
LOG.debug('Test transform Nova instance into entity wrapper')
self.assertTrue(True)