def testOneElementListQuoted(self): strIds = ( '' + '[' + ( '"' + 'user.language' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_1' + ')' + '"' ) + ']' ) self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 1) self.assertEquals(cfgIds[0].name, 'user.language') self.assertEquals( cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'Property_1')
def testThreeElementListQuoted(self): strIds = ('' + '[' + ('"' + 'user.language' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_1' + ')' + '"') + ' ' + ('"' + 'user.region' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_2' + ')' + '"') + ' ' + ('"' + 'file.encoding' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_3' + ')' + '"') + ']') self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 3) self.assertEquals(cfgIds[0].name, 'user.language') self.assertEquals(cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'Property_1') self.assertEquals(cfgIds[1].name, 'user.region') self.assertEquals(cfgIds[1].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[1].xmlDoc, 'server.xml') self.assertEquals(cfgIds[1].xmlId, 'Property_2') self.assertEquals(cfgIds[2].name, 'file.encoding') self.assertEquals(cfgIds[2].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[2].xmlDoc, 'server.xml') self.assertEquals(cfgIds[2].xmlId, 'Property_3')
def testThreeElementList(self): strIds = ( '' + '[' + ( 'user.language' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_1' + ')' ) + ' ' + ( 'user.region' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_2' + ')' ) + ' ' + ( 'file.encoding' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_3' + ')' ) + ']' ) self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 3) self.assertEquals(cfgIds[0].name, 'user.language') self.assertEquals( cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'Property_1') self.assertEquals(cfgIds[1].name, 'user.region') self.assertEquals( cfgIds[1].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[1].xmlDoc, 'server.xml') self.assertEquals(cfgIds[1].xmlId, 'Property_2') self.assertEquals(cfgIds[2].name, 'file.encoding') self.assertEquals( cfgIds[2].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[2].xmlDoc, 'server.xml') self.assertEquals(cfgIds[2].xmlId, 'Property_3')
def testReallyLongList(self): strIds = ('[' + ' '.join([ '(cells/wdrCell|virtualhosts.xml#MimeEntry_%s)' % i for i in range(500) ]) + ']') ids = _parseConfigIdList(strIds) self.assertEquals(len(ids), 500) for i in range(500): self.assertEquals( '(cells/wdrCell|virtualhosts.xml#MimeEntry_%s)' % i, str(ids[i]))
def testOneElementList(self): strIds = ('' + '[' + 'user.language' + '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'Property_1' + ')' + ']') self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 1) self.assertEquals(cfgIds[0].name, 'user.language') self.assertEquals(cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'Property_1')
def testReallyLongList(self): strIds = ( '[' + ' '.join( [ '(cells/wdrCell|virtualhosts.xml#MimeEntry_%s)' % i for i in range(500) ] ) + ']' ) ids = _parseConfigIdList(strIds) self.assertEquals(len(ids), 500) for i in range(500): self.assertEquals( '(cells/wdrCell|virtualhosts.xml#MimeEntry_%s)' % i, str(ids[i]) )
def testEntireListQuoted(self): # WAS 6.1 may return the entire list in quotes strIds = ( '' + '"' + '[' + ( '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'SomeObject_1' + ')' ) + ' ' + ( '(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'SomeObject_2' + ')' ) + ']' + '"' ) self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 2) self.assertEquals(cfgIds[0].name, '') self.assertEquals( cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'SomeObject_1') self.assertEquals(cfgIds[1].name, '') self.assertEquals( cfgIds[1].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' ) self.assertEquals(cfgIds[1].xmlDoc, 'server.xml') self.assertEquals(cfgIds[1].xmlId, 'SomeObject_2')
def testEntireListQuoted(self): # WAS 6.1 may return the entire list in quotes strIds = ('' + '"' + '[' + ('(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'SomeObject_1' + ')') + ' ' + ('(' + 'cells/wdrCell/nodes/wdrNode/servers/wdrServer' + '|' + 'server.xml' + '#' + 'SomeObject_2' + ')') + ']' + '"') self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 2) self.assertEquals(cfgIds[0].name, '') self.assertEquals(cfgIds[0].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[0].xmlDoc, 'server.xml') self.assertEquals(cfgIds[0].xmlId, 'SomeObject_1') self.assertEquals(cfgIds[1].name, '') self.assertEquals(cfgIds[1].xmlPath, 'cells/wdrCell/nodes/wdrNode/servers/wdrServer') self.assertEquals(cfgIds[1].xmlDoc, 'server.xml') self.assertEquals(cfgIds[1].xmlId, 'SomeObject_2')
def testMaskedList(self): strIds = '*****' self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 0)
def testEmptyElementList(self): strIds = '[]' self.assert_(_isConfigIdList(strIds)) cfgIds = _parseConfigIdList(strIds) self.assertEquals(len(cfgIds), 0)