X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=test%2Fresources%2Fomf%2Fset_hook.py;h=f515f1e79d152c2b086975006a5e1bc35f9f048f;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=08abb005c2c4a552cc8c0eea2a26a40fe40bc95a;hpb=0a796df7191ef93f55f42d378315d97721aa5cb2;p=nepi.git diff --git a/test/resources/omf/set_hook.py b/test/resources/omf/set_hook.py index 08abb005..f515f1e7 100755 --- a/test/resources/omf/set_hook.py +++ b/test/resources/omf/set_hook.py @@ -4,9 +4,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,8 +17,10 @@ # # Author: Julien Tribino +from __future__ import print_function -from nepi.execution.resource import ResourceFactory, clsinit_copy, ResourceManager, ResourceAction, ResourceState +from nepi.execution.resource import (ResourceFactory, clsinit_copy, + ResourceManager, ResourceAction, ResourceState) from nepi.execution.ec import ExperimentController from nepi.execution.attribute import Attribute, Flags @@ -35,8 +36,8 @@ class DummyEC(ExperimentController): pass @clsinit_copy -class DummyOMFApplication(OMFApplication): - _rtype = "DummyOMFApplication" +class OMFDummyApplication(OMFApplication): + _rtype = "omf::DummyApplication" @classmethod def _register_attributes(cls): @@ -46,7 +47,7 @@ class DummyOMFApplication(OMFApplication): @classmethod def test_hook(cls, old_value, new_value): new_value *= 10 - print "Change the value of test from "+ str(old_value) +" to : " + str(new_value) + print("Change the value of test from "+ str(old_value) +" to : " + str(new_value)) return new_value @@ -55,16 +56,16 @@ class OMFTestSet(unittest.TestCase): def test_set_hook(self): self.ec = DummyEC(exp_id = "30") - ResourceFactory.register_type(DummyOMFApplication) + ResourceFactory.register_type(OMFDummyApplication) - self.node1 = self.ec.register_resource("OMFNode") + self.node1 = self.ec.register_resource("omf::Node") self.ec.set(self.node1, 'hostname', 'omf.plexus.wlab17') self.ec.set(self.node1, 'xmppSlice', "nepi") self.ec.set(self.node1, 'xmppHost', "xmpp-plexus.onelab.eu") self.ec.set(self.node1, 'xmppPort', "5222") self.ec.set(self.node1, 'xmppPassword', "1234") - self.app1 = self.ec.register_resource("DummyOMFApplication") + self.app1 = self.ec.register_resource("omf::DummyApplication") self.ec.set(self.app1, 'appid', 'Test#1') self.ec.set(self.app1, 'path', "/usr/bin/ping") self.ec.set(self.app1, 'args', "") @@ -81,13 +82,13 @@ class OMFTestSet(unittest.TestCase): self.ec.deploy() time.sleep(3) - print "First try to change the STDIN" + print("First try to change the STDIN") self.ec.set(self.app1, 'test', 3) self.assertEquals(self.ec.get(self.app1, 'test'), 30) time.sleep(3) - print "Second try to change the STDIN" + print("Second try to change the STDIN") self.ec.set(self.app1, 'test', 101) self.assertEquals(self.ec.get(self.app1, 'test'), 1010)