def lsNode(i,n,long,maxlevel): if i >= 0: print "%s%s" % (' '*i, long and n or immom.split_dn(n)[0]) if i >= maxlevel: return for e in immom.getchildobjects(n): lsNode(i+1,e,long,maxlevel)
def test0020_ObjectTree(self): immom.ccb_initialize() immom.createobject(self.topobject, 'TestClass', []) for n in xrange(1,5): dn = "TestClassId=%d,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) immom.ccb_apply() immom.ccb_finalize() c = immom.getchildobjects(self.topobject) self.assertEqual( c, [ 'TestClassId=1,TestClassId=1', 'TestClassId=2,TestClassId=1', 'TestClassId=3,TestClassId=1', 'TestClassId=4,TestClassId=1' ]) immom.ccb_initialize() for n in xrange(30,35): dn = "TestClassId=%d,TestClassId=3,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) for n in xrange(20,23): dn = "TestClassId=%d,TestClassId=2,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) immom.ccb_apply() immom.ccb_finalize() c = immom.getsubtree(self.topobject) self.assertEqual( c, [ 'TestClassId=1,TestClassId=1', 'TestClassId=2,TestClassId=1', 'TestClassId=3,TestClassId=1', 'TestClassId=4,TestClassId=1', 'TestClassId=20,TestClassId=2,TestClassId=1', 'TestClassId=21,TestClassId=2,TestClassId=1', 'TestClassId=22,TestClassId=2,TestClassId=1', 'TestClassId=30,TestClassId=3,TestClassId=1', 'TestClassId=31,TestClassId=3,TestClassId=1', 'TestClassId=32,TestClassId=3,TestClassId=1', 'TestClassId=33,TestClassId=3,TestClassId=1', 'TestClassId=34,TestClassId=3,TestClassId=1' ]) immom.ccb_initialize() immom.deletesubtree(self.topobject) immom.getobject(self.topobject) immom.ccb_apply() immom.ccb_finalize() self.assertRaises(immom.AisException, immom.getobject, self.topobject)
def test0020_ObjectTree(self): immom.ccb_initialize() immom.createobject(self.topobject, 'TestClass', []) for n in xrange(1, 5): dn = "TestClassId=%d,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) immom.ccb_apply() immom.ccb_finalize() c = immom.getchildobjects(self.topobject) self.assertEqual(c, [ 'TestClassId=1,TestClassId=1', 'TestClassId=2,TestClassId=1', 'TestClassId=3,TestClassId=1', 'TestClassId=4,TestClassId=1' ]) immom.ccb_initialize() for n in xrange(30, 35): dn = "TestClassId=%d,TestClassId=3,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) for n in xrange(20, 23): dn = "TestClassId=%d,TestClassId=2,%s" % (n, self.topobject) immom.createobject(dn, 'TestClass', []) immom.ccb_apply() immom.ccb_finalize() c = immom.getsubtree(self.topobject) self.assertEqual(c, [ 'TestClassId=1,TestClassId=1', 'TestClassId=2,TestClassId=1', 'TestClassId=3,TestClassId=1', 'TestClassId=4,TestClassId=1', 'TestClassId=20,TestClassId=2,TestClassId=1', 'TestClassId=21,TestClassId=2,TestClassId=1', 'TestClassId=22,TestClassId=2,TestClassId=1', 'TestClassId=30,TestClassId=3,TestClassId=1', 'TestClassId=31,TestClassId=3,TestClassId=1', 'TestClassId=32,TestClassId=3,TestClassId=1', 'TestClassId=33,TestClassId=3,TestClassId=1', 'TestClassId=34,TestClassId=3,TestClassId=1' ]) immom.ccb_initialize() immom.deletesubtree(self.topobject) immom.getobject(self.topobject) immom.ccb_apply() immom.ccb_finalize() self.assertRaises(immom.AisException, immom.getobject, self.topobject)