Ejemplo n.º 1
0
    def test0010_TopObject(self):
        self.assertRaises(immom.AisException,
                          immom.getobject, self.topobject)
        self.assertRaises(immom.AisException,
                          immom.createobject, self.topobject, 'TestClass', [])
        immom.ccb_initialize()
        self.assertRaises(immom.AisException,
                          immom.createobject,self.topobject,'InvalidClass', [])
        immom.createobject(self.topobject, 'TestClass', [])
        self.assertRaises(immom.AisException,
                          immom.getobject, self.topobject)
        immom.ccb_apply()
        immom.ccb_finalize()

        o = immom.getobject(self.topobject)
        o.sort()
        self.assertEqual(
            o, [
            ('SaImmAttrAdminOwnerName', 'SASTRINGT', ['TestAdmin']),
            ('SaImmAttrClassName', 'SASTRINGT', ['TestClass']),
            ('SaImmAttrImplementerName', 'SASTRINGT', []),
            ('TestClassId', 'SANAMET', ['TestClassId=1'])
            ])

        immom.adminowner_clear('SA_IMM_SUBTREE', [self.topobject])
        o = immom.getobject(self.topobject)
        o.sort()
        self.assertEqual(
            o, [
            ('SaImmAttrAdminOwnerName', 'SASTRINGT', []),
            ('SaImmAttrClassName', 'SASTRINGT', ['TestClass']),
            ('SaImmAttrImplementerName', 'SASTRINGT', []),
            ('TestClassId', 'SANAMET', ['TestClassId=1'])
            ])

        self.assertRaises(immom.AisException,
                          immom.deleteclass, 'TestClass')

        immom.ccb_initialize()
        immom.deleteobjects([self.topobject])
        immom.getobject(self.topobject)
        immom.ccb_apply()
        immom.ccb_finalize()
        self.assertRaises(immom.AisException,
                          immom.getobject, self.topobject)
Ejemplo n.º 2
0
 def do_adminowner_clear(self, args):
     """Clear the admin-owner for objects.
     Syntax: adminowner_clear [-r] [ '/' | '..' | '-' | rdn | /dn ]
     """
     arg = ''
     scope = 'SA_IMM_ONE'
     for n in args.split():
         if n == '-r':
             scope = 'SA_IMM_SUBTREE'
         else:
             arg = n
             break
     try:
         wo = self.getwo(arg)
         if not wo:
             print 'No Working Object (top)'
         else:
             immom.adminowner_clear(scope, [ wo ])
     except immom.AisException, ex:
         print 'Failed: ' + str(ex)
Ejemplo n.º 3
0
    def test0010_TopObject(self):
        self.assertRaises(immom.AisException, immom.getobject, self.topobject)
        self.assertRaises(immom.AisException, immom.createobject,
                          self.topobject, 'TestClass', [])
        immom.ccb_initialize()
        self.assertRaises(immom.AisException, immom.createobject,
                          self.topobject, 'InvalidClass', [])
        immom.createobject(self.topobject, 'TestClass', [])
        self.assertRaises(immom.AisException, immom.getobject, self.topobject)
        immom.ccb_apply()
        immom.ccb_finalize()

        o = immom.getobject(self.topobject)
        o.sort()
        self.assertEqual(
            o, [('SaImmAttrAdminOwnerName', 'SASTRINGT', ['TestAdmin']),
                ('SaImmAttrClassName', 'SASTRINGT', ['TestClass']),
                ('SaImmAttrImplementerName', 'SASTRINGT', []),
                ('TestClassId', 'SANAMET', ['TestClassId=1'])])

        immom.adminowner_clear('SA_IMM_SUBTREE', [self.topobject])
        o = immom.getobject(self.topobject)
        o.sort()
        self.assertEqual(o,
                         [('SaImmAttrAdminOwnerName', 'SASTRINGT', []),
                          ('SaImmAttrClassName', 'SASTRINGT', ['TestClass']),
                          ('SaImmAttrImplementerName', 'SASTRINGT', []),
                          ('TestClassId', 'SANAMET', ['TestClassId=1'])])

        self.assertRaises(immom.AisException, immom.deleteclass, 'TestClass')

        immom.ccb_initialize()
        immom.deleteobjects([self.topobject])
        immom.getobject(self.topobject)
        immom.ccb_apply()
        immom.ccb_finalize()
        self.assertRaises(immom.AisException, immom.getobject, self.topobject)