1 ##############################################################################
2 # Copyright (c) 2016 Juan Qiu and others
3 # juan_ qiu@tongji.edu.cn
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 class ActionPlayer(object):
13 Abstract the action functions of attacker,
14 monitor, operation, resultchecker and mybe others in future
21 class AttackerPlayer(ActionPlayer):
23 def __init__(self, attacker):
24 self.underlyingAttacker = attacker
27 self.underlyingAttacker.inject_fault()
30 class OperationPlayer(ActionPlayer):
32 def __init__(self, operation):
33 self.underlyingOperation = operation
36 self.underlyingOperation.run()
39 class MonitorPlayer(ActionPlayer):
41 def __init__(self, monitor):
42 self.underlyingmonitor = monitor
45 self.underlyingmonitor.start_monitor()
48 class ResultCheckerPlayer(ActionPlayer):
50 def __init__(self, resultChecker):
51 self.underlyingresultChecker = resultChecker
54 self.underlyingresultChecker.verify()