19 sys.path.insert(1,
"../")
24 from GlobalFactory
import *
37 self.
factory.addFactory(
"test",Test,OpenRTM_aist.Delete)
41 self.
factory.removeFactory(
"test")
45 self.assertEqual(self.
factory,GlobalFactory.instance())
49 self.assertEqual(self.
factory.hasFactory(
"test"),
True)
51 self.assertEqual(self.
factory.hasFactory(
"testtest"),
False)
53 self.assertEqual(self.
factory.hasFactory(
""),
False)
58 self.assertEqual(self.
factory.getIdentifiers(),[
"test"])
59 GlobalFactory.instance().addFactory(
"test2",Test,OpenRTM_aist.Delete)
60 self.assertEqual(self.
factory.getIdentifiers(),[
"test",
"test2"])
62 self.
factory.removeFactory(
"test")
63 self.
factory.removeFactory(
"test2")
64 self.assertEqual(self.
factory.getIdentifiers(),[])
69 self.assertEqual(GlobalFactory.instance().addFactory(
"test",
None,OpenRTM_aist.Delete),
70 GlobalFactory.INVALID_ARG)
73 self.assertEqual(GlobalFactory.instance().addFactory(
"test",Test,OpenRTM_aist.Delete),
74 GlobalFactory.ALREADY_EXISTS)
77 self.assertEqual(GlobalFactory.instance().addFactory(
"test1",Test,OpenRTM_aist.Delete),
78 GlobalFactory.FACTORY_OK)
79 self.
factory.removeFactory(
"test1")
86 self.assertEqual(self.
factory.removeFactory(
"testtest"),
87 GlobalFactory.NOT_FOUND)
90 self.assertEqual(self.
factory.removeFactory(
"test"),
91 GlobalFactory.FACTORY_OK)
94 self.assertEqual(self.
factory.getIdentifiers(),[])
99 self.assertEqual(self.
factory.createObject(
"testtest"),
102 self.assertEqual(self.
factory.createObject(
"test").
test(),
True)
107 self.
factory.deleteObject(self.
factory.createObject(
"test"),
"testtest")
113 if __name__ ==
'__main__':
def test_addFactory(self)
def test_isinstance(self)
def test_deleteObject(self)
def test_createObject(self)
def test_getIdentifiers(self)
def test_hasFactory(self)
def test_removeFactory(self)