def test_create_platfrom(self): """ creates platform, procedure object and tests adding a procedure to a sensor attached to the platform """ # procedure object proc1 = Procedure("procedure 1", "proc1") proc2 = Procedure("procedure 2", "proc2") # list of procedures proList = [proc1, proc2] # observable property object obs1 = ObservableProperty("obs-property1", "obs-property") obs2 = ObservableProperty("obs-property2", "obs-property2") obs3 = ObservableProperty("obs-property3", "obs-property3") # list of observable properties obsList = [obs1, obs2] obsList2 =[obs1,obs2] # sensor object s1 = Sensor("Sensor 1", "first sensor", obsList, proList) s2 = Sensor("Sensor 2", "second sensor", obsList2, proList) s3 = Sensor("Sensor 3", "second sensor", obsList2, proList) act1 = Actuator("Actuator 1", "first actuator",[],[]) act2 = Actuator("Actuator 2", "second actuator",[],[]) act3 = Actuator("Actuator 3", "third actuator",[],[]) #list of actuators actList =[act1,act2,act3] #list of sensors senList = [s1,s2] # platform object p1 = Platform("platform 1", "p1", senList, actList,[]) p1.add_sensor(s3) this_graph = cfg.get_graph() #print(this_graph.serialize(format='turtle')) print(this_graph.serialize(format="ttl").decode('utf-8'))
def test_add_observable_property(self): """ Test adding observable property to sensor """ proc1 = Procedure("procedure 1", "proc1") proc2 = Procedure("procedure 2", "proc2") # list of procedures proList = [proc1, proc2] # observable property object obs1 = ObservableProperty("obs-property1", "obs-property") obs2 = ObservableProperty("obs-property2", "obs-property2") obs3 = ObservableProperty("obs-property3", "obs-property3") # list of observable properties obsList = [obs1, obs2] s4 = Sensor("Sensor 4", "fourth sensor", obsList, proList) obs4 = ObservableProperty("temperature", "property 1") s4.add_obs_property(obs4)
def test_set_procedure_id(self): """ creates a procedure object and test setting that procedure's id """ procedure_id = "UND2020" proc1 = Procedure("procedure 1", "proc1", "Sensor calibration proc", "procedureInput", "procedureOutput") proc2 = Procedure("procedure 2", "proc2", "Sensor calibration proc", "procedureInput", "procedureOutput") # list of procedures proList = [proc1, proc2] # observable property object obs1 = ObservableProperty("obs-property1", "obs-property") obs2 = ObservableProperty("obs-property2", "obs-property2") obs3 = ObservableProperty("obs-property3", "obs-property3") # list of observable properties obsList = [obs1, obs2] s4 = Sensor("Sensor 4", "fourth sensor", obsList, proList) obs4 = ObservableProperty("temperature", "property 1") s4.add_obs_property(obs4)
def test_add_procedure(self): """ Test adding procedure to sensor """ proc1 = Procedure("procedure 1", "proc1") proc2 = Procedure("procedure 2", "proc2") # list of procedures proList = [proc1, proc2] # observable property object obs1 = ObservableProperty("obs-property1", "obs-property") obs2 = ObservableProperty("obs-property2", "obs-property2") obs3 = ObservableProperty("obs-property3", "obs-property3") # list of observable properties obsList = [obs1, obs2] # sensor object s5 = Sensor("Sensor 5", "fifth sensor", obsList, proList) proc3 = Procedure("Procedure 1", "setting height of temperature sensor") #add procedure s5.add_procedure(proc3)
def test_add_sensor(self): """Test add a single sensor to platform method""" #empty platform p2 = Platform("platform 2", "p2", [], [], []) # procedure object proc1 = Procedure("procedure 1", "proc1") proc2 = Procedure("procedure 2", "proc2") # list of procedures proList = [proc1, proc2] # observable property object obs1 = ObservableProperty("obs-property1", "obs-property") obs2 = ObservableProperty("obs-property2", "obs-property2") obs3 = ObservableProperty("obs-property3", "obs-property3") # list of observable properties obsList = [obs1, obs2] # sensor object s1 = Sensor("Sensor 1", "first sensor", obsList, proList) p2.add_sensor(s1)