X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?p=bottlenecks.git;a=blobdiff_plain;f=test-scheduler%2Fserver%2Fsrc%2Fstep%2Fstep_manager.py;fp=testing-scheduler%2Fserver%2Fsrc%2Fstep%2Fstep_manager.py;h=01e87ba7228389deb68a6a39ded327ce55306fe4;hp=8d76c67c337660fa630042d59a4832443b94dbfe;hb=e32043f58a2450b6a5986dc2a01f64f8b22c3992;hpb=a09bbea983aca3e437e254566da98196177748d9 diff --git a/testing-scheduler/server/src/step/step_manager.py b/test-scheduler/server/src/step/step_manager.py similarity index 97% rename from testing-scheduler/server/src/step/step_manager.py rename to test-scheduler/server/src/step/step_manager.py index 8d76c67c..01e87ba7 100644 --- a/testing-scheduler/server/src/step/step_manager.py +++ b/test-scheduler/server/src/step/step_manager.py @@ -1,41 +1,41 @@ -############################################################################## -# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -from src.step.test_step import TestStep -import os -import sys - - -class TestStepManager(object): - def __init__(self, context): - self._context = context - - currentDirPath = os.path.dirname(os.path.abspath(__file__)) - sys.path.append(currentDirPath) - - excludeFiles = ('__init__.py', 'step_manager.py', 'test_step.py') - for fileName in os.listdir(currentDirPath): - if os.path.isfile(os.path.join(currentDirPath, fileName)) and \ - os.path.splitext(fileName)[1] == '.py' and \ - fileName not in excludeFiles: - __import__(os.path.splitext(fileName)[0]) - - def getStepObj(self, type, id, name, service, action, args): - for subclass in TestStep.__subclasses__(): - if type == subclass.__step_type__: - return subclass(id, name, service, action, args, self._context) - - -if __name__ == "__main__": - tsMgr = TestStepManager() - args = {'command': 'greet', 'method': 'POST', 'args': {'name': 'leo'}} - stepObj = tsMgr.getStepObj('test', 1, 'test_cpu', { - 'name': 'greet', 'call': 'REST'}, 'start', args) - print stepObj - print stepObj.__class__.__mro__ +############################################################################## +# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from src.step.test_step import TestStep +import os +import sys + + +class TestStepManager(object): + def __init__(self, context): + self._context = context + + currentDirPath = os.path.dirname(os.path.abspath(__file__)) + sys.path.append(currentDirPath) + + excludeFiles = ('__init__.py', 'step_manager.py', 'test_step.py') + for fileName in os.listdir(currentDirPath): + if os.path.isfile(os.path.join(currentDirPath, fileName)) and \ + os.path.splitext(fileName)[1] == '.py' and \ + fileName not in excludeFiles: + __import__(os.path.splitext(fileName)[0]) + + def getStepObj(self, type, id, name, service, action, args): + for subclass in TestStep.__subclasses__(): + if type == subclass.__step_type__: + return subclass(id, name, service, action, args, self._context) + + +if __name__ == "__main__": + tsMgr = TestStepManager() + args = {'command': 'greet', 'method': 'POST', 'args': {'name': 'leo'}} + stepObj = tsMgr.getStepObj('test', 1, 'test_cpu', { + 'name': 'greet', 'call': 'REST'}, 'start', args) + print stepObj + print stepObj.__class__.__mro__