Upgrade to version Device5_Impl to fix problem #35

parent 3f25c19b
*sh
*~
.metadata
target/*
......
......@@ -56,12 +56,12 @@ try:
except ImportError:
graypy = None
class MetaExperiment (tango.Device_4Impl):
class MetaExperiment (tango.Device_5Impl):
"""Metadata for high level experiment"""
def __init__(self, cl, name):
tango.Device_4Impl.__init__(self,cl,name)
tango.Device_5Impl.__init__(self,cl,name)
self.debug_stream("In __init__()")
MetaExperiment.init_device(self)
......@@ -211,7 +211,7 @@ class MetaExperiment (tango.Device_4Impl):
self.Connect()
#----- PROTECTED REGION END -----# // MetaExperiment.State
if argout != tango.DevState.ALARM:
tango.Device_4Impl.dev_state(self)
tango.Device_5Impl.dev_state(self)
return self.get_state()
def dev_status(self):
......@@ -223,7 +223,7 @@ class MetaExperiment (tango.Device_4Impl):
#----- PROTECTED REGION ID(MetadataManager.Status) ENABLED START -----#
self.Connect()
#----- PROTECTED REGION END -----# // MetadataManager.Status
self.__status = tango.Device_4Impl.dev_status(self)
self.__status = tango.Device_5Impl.dev_status(self)
return self.__status
#----- PROTECTED REGION ID(MetaExperiment.programmer_methods) ENABLED START -----#
......
......@@ -87,7 +87,7 @@ from metadata_manager import tangoworker
## RUNNING : Dataset currently recorded
class MetadataManager (tango.Device_4Impl):
class MetadataManager (tango.Device_5Impl):
""""""
def info(self, message):
self.info_stream(message)
......@@ -99,7 +99,7 @@ class MetadataManager (tango.Device_4Impl):
self.error_stream(message)
def __init__(self, cl, name):
tango.Device_4Impl.__init__(self,cl,name)
tango.Device_5Impl.__init__(self,cl,name)
self.metadataWorker = MetadataWorker(self.get_name())
MetadataManager.init_device(self)
......@@ -486,7 +486,7 @@ class MetadataManager (tango.Device_4Impl):
self.Connect()
#----- PROTECTED REGION END -----# // MetadataManager.State
if argout != tango.DevState.ALARM:
tango.Device_4Impl.dev_state(self)
tango.Device_5Impl.dev_state(self)
return self.get_state()
def dev_status(self):
......@@ -498,7 +498,7 @@ class MetadataManager (tango.Device_4Impl):
#----- PROTECTED REGION ID(MetadataManager.Status) ENABLED START -----#
self.Connect()
#----- PROTECTED REGION END -----# // MetadataManager.Status
self.__status = tango.Device_4Impl.dev_status(self)
self.__status = tango.Device_5Impl.dev_status(self)
return self.__status
def IngestTomodbXML(self, argin):
......
......@@ -8,17 +8,20 @@ import time
class TestMetaDataManager(unittest.TestCase):
data_root = "/tmp/data"
proposal = "ID000001"
proposal = "ID000000"
sample = "testSample"
dataset_name = "datasetName"
DEFAULT_SAMPLE_NAME = "please enter"
DEFAULT_DATA_ROOT = "/data/visitor/"
exp_device = "id00/meta_exp/id00"
mgr_device = "id00/meta_ing/id00"
def test_set_dataset_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_data = PyTango.client.Device("id00/metadata/mgr")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_data = PyTango.client.Device(self.mgr_device)
meta_experiment.proposal = self.proposal
meta_experiment.dataRoot = self.data_root
meta_experiment.sample = self.sample
......@@ -30,7 +33,15 @@ class TestMetaDataManager(unittest.TestCase):
self.assertEqual(meta_experiment.proposal, meta_data.proposal)
self.assertEqual(meta_experiment.sample, self.sample)
self.assertEqual(meta_data.datasetName, self.dataset_name)
self.proposal = "ID0000XX"
meta_experiment.proposal = self.proposal
self.assertEqual(meta_experiment.proposal, self.proposal)
self.assertEqual(meta_experiment.proposal, meta_data.proposal)
self.sample = "newSample"
meta_experiment.sample = self.sample
self.assertEqual(meta_experiment.sample, meta_data.sampleName)
except Exception:
......
......@@ -14,9 +14,11 @@ class TestMetaExperiment(unittest.TestCase):
DEFAULT_SAMPLE_NAME = "please enter"
DEFAULT_DATA_ROOT = "/data/visitor/"
exp_device = "id00/meta_exp/id00"
def test_init_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
pprint(meta_experiment.State())
assert meta_experiment.state() is not None
except Exception:
......@@ -25,7 +27,7 @@ class TestMetaExperiment(unittest.TestCase):
def test_set_data_root_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_experiment.dataRoot = self.data_root
self.assertEqual(meta_experiment.dataRoot, self.data_root)
except Exception:
......@@ -34,7 +36,7 @@ class TestMetaExperiment(unittest.TestCase):
def test_set_proposal_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_experiment.proposal = self.proposal
self.assertEqual(meta_experiment.proposal, self.proposal)
except Exception:
......@@ -43,7 +45,7 @@ class TestMetaExperiment(unittest.TestCase):
def test_set_sample_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_experiment.sample = self.sample
self.assertEqual(meta_experiment.sample, self.sample)
except Exception:
......@@ -52,7 +54,7 @@ class TestMetaExperiment(unittest.TestCase):
def test_full_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_experiment.proposal = self.proposal
meta_experiment.dataRoot = self.data_root
meta_experiment.sample = self.sample
......@@ -65,7 +67,7 @@ class TestMetaExperiment(unittest.TestCase):
def test_change_proposal_metadata_experiment(self):
try:
meta_experiment = PyTango.client.Device("id00/metadata/exp")
meta_experiment = PyTango.client.Device(self.exp_device)
meta_experiment.proposal = self.proposal
meta_experiment.dataRoot = self.data_root
meta_experiment.sample = self.sample
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment