You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/06/22 19:58:04 UTC
[6/7] remove tools/testClient as they are moved to
tools/marvin/marvin already
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py b/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
deleted file mode 100644
index e2027fc..0000000
--- a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/dbapi20.py
+++ /dev/null
@@ -1,856 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-''' Python DB API 2.0 driver compliance unit test suite.
-
- This software is Public Domain and may be used without restrictions.
-
- "Now we have booze and barflies entering the discussion, plus rumours of
- DBAs on drugs... and I won't tell you what flashes through my mind each
- time I read the subject line with 'Anal Compliance' in it. All around
- this is turning out to be a thoroughly unwholesome unit test."
-
- -- Ian Bicking
-'''
-
-__rcs_id__ = '$Id$'
-__version__ = '$Revision$'[11:-2]
-__author__ = 'Stuart Bishop <ze...@shangri-la.dropbear.id.au>'
-
-import unittest
-import time
-
-# $Log$
-# Revision 1.1.2.1 2006/02/25 03:44:32 adustman
-# Generic DB-API unit test module
-# Revision 1.10 2003/10/09 03:14:14 zenzen
-# Add test for DB API 2.0 optional extension, where database exceptions
-# are exposed as attributes on the Connection object.
-# Revision 1.9 2003/08/13 01:16:36 zenzen
-# Minor tweak from Stefan Fleiter
-# Revision 1.8 2003/04/10 00:13:25 zenzen
-# Changes, as per suggestions by M.-A. Lemburg
-# Revision 1.7 2003/02/26 23:33:37 zenzen
-# Break out DDL into helper functions, as per request by David Rushby
-# Revision 1.6 2003/02/21 03:04:33 zenzen
-# Stuff from Henrik Ekelund:
-# added test_None
-# added test_nextset & hooks
-# Revision 1.5 2003/02/17 22:08:43 zenzen
-# defaults to 1 & generic cursor.callproc test added
-# Revision 1.4 2003/02/15 00:16:33 zenzen
-# Changes, as per suggestions and bug reports by M.-A. Lemburg,
-# Matthew T. Kromer, Federico Di Gregorio and Daniel Dittmar
-# - Class renamed
-# - Now a subclass of TestCase, to avoid requiring the driver stub
-# to use multiple inheritance
-# - Reversed the polarity of buggy test in test_description
-# - Test exception heirarchy correctly
-# - self.populate is now self._populate(), so if a driver stub
-# overrides self.ddl1 this change propogates
-# - VARCHAR columns now have a width, which will hopefully make the
-# DDL even more portible (this will be reversed if it causes more problems)
-# - cursor.rowcount being checked after various execute and fetchXXX methods
-# - Check for fetchall and fetchmany returning empty lists after results
-# are exhausted (already checking for empty lists if select retrieved
-# nothing
-# - Fix bugs in test_setoutputsize_basic and test_setinputsizes
-#
-
-class DatabaseAPI20Test(unittest.TestCase):
- ''' Test a database self.driver for DB API 2.0 compatibility.
- This implementation tests Gadfly, but the TestCase
- is structured so that other self.drivers can subclass this
- test case to ensure compiliance with the DB-API. It is
- expected that this TestCase may be expanded in the future
- if ambiguities or edge conditions are discovered.
-
- The 'Optional Extensions' are not yet being tested.
-
- self.drivers should subclass this test, overriding setUp, tearDown,
- self.driver, connect_args and connect_kw_args. Class specification
- should be as follows:
-
- import dbapi20
- class mytest(dbapi20.DatabaseAPI20Test):
- [...]
-
- Don't 'import DatabaseAPI20Test from dbapi20', or you will
- confuse the unit tester - just 'import dbapi20'.
- '''
-
- # The self.driver module. This should be the module where the 'connect'
- # method is to be found
- driver = None
- connect_args = () # List of arguments to pass to connect
- connect_kw_args = {} # Keyword arguments for connect
- table_prefix = 'dbapi20test_' # If you need to specify a prefix for tables
-
- ddl1 = 'create table %sbooze (name varchar(20))' % table_prefix
- ddl2 = 'create table %sbarflys (name varchar(20))' % table_prefix
- xddl1 = 'drop table %sbooze' % table_prefix
- xddl2 = 'drop table %sbarflys' % table_prefix
-
- lowerfunc = 'lower' # Name of stored procedure to convert string->lowercase
-
- # Some drivers may need to override these helpers, for example adding
- # a 'commit' after the execute.
- def executeDDL1(self,cursor):
- cursor.execute(self.ddl1)
-
- def executeDDL2(self,cursor):
- cursor.execute(self.ddl2)
-
- def setUp(self):
- ''' self.drivers should override this method to perform required setup
- if any is necessary, such as creating the database.
- '''
- pass
-
- def tearDown(self):
- ''' self.drivers should override this method to perform required cleanup
- if any is necessary, such as deleting the test database.
- The default drops the tables that may be created.
- '''
- con = self._connect()
- try:
- cur = con.cursor()
- for ddl in (self.xddl1,self.xddl2):
- try:
- cur.execute(ddl)
- con.commit()
- except self.driver.Error:
- # Assume table didn't exist. Other tests will check if
- # execute is busted.
- pass
- finally:
- con.close()
-
- def _connect(self):
- try:
- return self.driver.connect(
- *self.connect_args,**self.connect_kw_args
- )
- except AttributeError:
- self.fail("No connect method found in self.driver module")
-
- def test_connect(self):
- con = self._connect()
- con.close()
-
- def test_apilevel(self):
- try:
- # Must exist
- apilevel = self.driver.apilevel
- # Must equal 2.0
- self.assertEqual(apilevel,'2.0')
- except AttributeError:
- self.fail("Driver doesn't define apilevel")
-
- def test_threadsafety(self):
- try:
- # Must exist
- threadsafety = self.driver.threadsafety
- # Must be a valid value
- self.assertTrue(threadsafety in (0,1,2,3))
- except AttributeError:
- self.fail("Driver doesn't define threadsafety")
-
- def test_paramstyle(self):
- try:
- # Must exist
- paramstyle = self.driver.paramstyle
- # Must be a valid value
- self.assertTrue(paramstyle in (
- 'qmark','numeric','named','format','pyformat'
- ))
- except AttributeError:
- self.fail("Driver doesn't define paramstyle")
-
- def test_Exceptions(self):
- # Make sure required exceptions exist, and are in the
- # defined heirarchy.
- self.assertTrue(issubclass(self.driver.Warning,StandardError))
- self.assertTrue(issubclass(self.driver.Error,StandardError))
- self.assertTrue(
- issubclass(self.driver.InterfaceError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.DatabaseError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.OperationalError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.IntegrityError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.InternalError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.ProgrammingError,self.driver.Error)
- )
- self.assertTrue(
- issubclass(self.driver.NotSupportedError,self.driver.Error)
- )
-
- def test_ExceptionsAsConnectionAttributes(self):
- # OPTIONAL EXTENSION
- # Test for the optional DB API 2.0 extension, where the exceptions
- # are exposed as attributes on the Connection object
- # I figure this optional extension will be implemented by any
- # driver author who is using this test suite, so it is enabled
- # by default.
- con = self._connect()
- drv = self.driver
- self.assertTrue(con.Warning is drv.Warning)
- self.assertTrue(con.Error is drv.Error)
- self.assertTrue(con.InterfaceError is drv.InterfaceError)
- self.assertTrue(con.DatabaseError is drv.DatabaseError)
- self.assertTrue(con.OperationalError is drv.OperationalError)
- self.assertTrue(con.IntegrityError is drv.IntegrityError)
- self.assertTrue(con.InternalError is drv.InternalError)
- self.assertTrue(con.ProgrammingError is drv.ProgrammingError)
- self.assertTrue(con.NotSupportedError is drv.NotSupportedError)
-
-
- def test_commit(self):
- con = self._connect()
- try:
- # Commit must work, even if it doesn't do anything
- con.commit()
- finally:
- con.close()
-
- def test_rollback(self):
- con = self._connect()
- # If rollback is defined, it should either work or throw
- # the documented exception
- if hasattr(con,'rollback'):
- try:
- con.rollback()
- except self.driver.NotSupportedError:
- pass
-
- def test_cursor(self):
- con = self._connect()
- try:
- cur = con.cursor()
- finally:
- con.close()
-
- def test_cursor_isolation(self):
- con = self._connect()
- try:
- # Make sure cursors created from the same connection have
- # the documented transaction isolation level
- cur1 = con.cursor()
- cur2 = con.cursor()
- self.executeDDL1(cur1)
- cur1.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
- cur2.execute("select name from %sbooze" % self.table_prefix)
- booze = cur2.fetchall()
- self.assertEqual(len(booze),1)
- self.assertEqual(len(booze[0]),1)
- self.assertEqual(booze[0][0],'Victoria Bitter')
- finally:
- con.close()
-
- def test_description(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
- self.assertEqual(cur.description,None,
- 'cursor.description should be none after executing a '
- 'statement that can return no rows (such as DDL)'
- )
- cur.execute('select name from %sbooze' % self.table_prefix)
- self.assertEqual(len(cur.description),1,
- 'cursor.description describes too many columns'
- )
- self.assertEqual(len(cur.description[0]),7,
- 'cursor.description[x] tuples must have 7 elements'
- )
- self.assertEqual(cur.description[0][0].lower(),'name',
- 'cursor.description[x][0] must return column name'
- )
- self.assertEqual(cur.description[0][1],self.driver.STRING,
- 'cursor.description[x][1] must return column type. Got %r'
- % cur.description[0][1]
- )
-
- # Make sure self.description gets reset
- self.executeDDL2(cur)
- self.assertEqual(cur.description,None,
- 'cursor.description not being set to None when executing '
- 'no-result statements (eg. DDL)'
- )
- finally:
- con.close()
-
- def test_rowcount(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
- self.assertEqual(cur.rowcount,-1,
- 'cursor.rowcount should be -1 after executing no-result '
- 'statements'
- )
- cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
- self.assertTrue(cur.rowcount in (-1,1),
- 'cursor.rowcount should == number or rows inserted, or '
- 'set to -1 after executing an insert statement'
- )
- cur.execute("select name from %sbooze" % self.table_prefix)
- self.assertTrue(cur.rowcount in (-1,1),
- 'cursor.rowcount should == number of rows returned, or '
- 'set to -1 after executing a select statement'
- )
- self.executeDDL2(cur)
- self.assertEqual(cur.rowcount,-1,
- 'cursor.rowcount not being reset to -1 after executing '
- 'no-result statements'
- )
- finally:
- con.close()
-
- lower_func = 'lower'
- def test_callproc(self):
- con = self._connect()
- try:
- cur = con.cursor()
- if self.lower_func and hasattr(cur,'callproc'):
- r = cur.callproc(self.lower_func,('FOO',))
- self.assertEqual(len(r),1)
- self.assertEqual(r[0],'FOO')
- r = cur.fetchall()
- self.assertEqual(len(r),1,'callproc produced no result set')
- self.assertEqual(len(r[0]),1,
- 'callproc produced invalid result set'
- )
- self.assertEqual(r[0][0],'foo',
- 'callproc produced invalid results'
- )
- finally:
- con.close()
-
- def test_close(self):
- con = self._connect()
- try:
- cur = con.cursor()
- finally:
- con.close()
-
- # cursor.execute should raise an Error if called after connection
- # closed
- self.assertRaises(self.driver.Error,self.executeDDL1,cur)
-
- # connection.commit should raise an Error if called after connection'
- # closed.'
- self.assertRaises(self.driver.Error,con.commit)
-
- # connection.close should raise an Error if called more than once
- self.assertRaises(self.driver.Error,con.close)
-
- def test_execute(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self._paraminsert(cur)
- finally:
- con.close()
-
- def _paraminsert(self,cur):
- self.executeDDL1(cur)
- cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
- self.assertTrue(cur.rowcount in (-1,1))
-
- if self.driver.paramstyle == 'qmark':
- cur.execute(
- 'insert into %sbooze values (?)' % self.table_prefix,
- ("Cooper's",)
- )
- elif self.driver.paramstyle == 'numeric':
- cur.execute(
- 'insert into %sbooze values (:1)' % self.table_prefix,
- ("Cooper's",)
- )
- elif self.driver.paramstyle == 'named':
- cur.execute(
- 'insert into %sbooze values (:beer)' % self.table_prefix,
- {'beer':"Cooper's"}
- )
- elif self.driver.paramstyle == 'format':
- cur.execute(
- 'insert into %sbooze values (%%s)' % self.table_prefix,
- ("Cooper's",)
- )
- elif self.driver.paramstyle == 'pyformat':
- cur.execute(
- 'insert into %sbooze values (%%(beer)s)' % self.table_prefix,
- {'beer':"Cooper's"}
- )
- else:
- self.fail('Invalid paramstyle')
- self.assertTrue(cur.rowcount in (-1,1))
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- res = cur.fetchall()
- self.assertEqual(len(res),2,'cursor.fetchall returned too few rows')
- beers = [res[0][0],res[1][0]]
- beers.sort()
- self.assertEqual(beers[0],"Cooper's",
- 'cursor.fetchall retrieved incorrect data, or data inserted '
- 'incorrectly'
- )
- self.assertEqual(beers[1],"Victoria Bitter",
- 'cursor.fetchall retrieved incorrect data, or data inserted '
- 'incorrectly'
- )
-
- def test_executemany(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
- largs = [ ("Cooper's",) , ("Boag's",) ]
- margs = [ {'beer': "Cooper's"}, {'beer': "Boag's"} ]
- if self.driver.paramstyle == 'qmark':
- cur.executemany(
- 'insert into %sbooze values (?)' % self.table_prefix,
- largs
- )
- elif self.driver.paramstyle == 'numeric':
- cur.executemany(
- 'insert into %sbooze values (:1)' % self.table_prefix,
- largs
- )
- elif self.driver.paramstyle == 'named':
- cur.executemany(
- 'insert into %sbooze values (:beer)' % self.table_prefix,
- margs
- )
- elif self.driver.paramstyle == 'format':
- cur.executemany(
- 'insert into %sbooze values (%%s)' % self.table_prefix,
- largs
- )
- elif self.driver.paramstyle == 'pyformat':
- cur.executemany(
- 'insert into %sbooze values (%%(beer)s)' % (
- self.table_prefix
- ),
- margs
- )
- else:
- self.fail('Unknown paramstyle')
- self.assertTrue(cur.rowcount in (-1,2),
- 'insert using cursor.executemany set cursor.rowcount to '
- 'incorrect value %r' % cur.rowcount
- )
- cur.execute('select name from %sbooze' % self.table_prefix)
- res = cur.fetchall()
- self.assertEqual(len(res),2,
- 'cursor.fetchall retrieved incorrect number of rows'
- )
- beers = [res[0][0],res[1][0]]
- beers.sort()
- self.assertEqual(beers[0],"Boag's",'incorrect data retrieved')
- self.assertEqual(beers[1],"Cooper's",'incorrect data retrieved')
- finally:
- con.close()
-
- def test_fetchone(self):
- con = self._connect()
- try:
- cur = con.cursor()
-
- # cursor.fetchone should raise an Error if called before
- # executing a select-type query
- self.assertRaises(self.driver.Error,cur.fetchone)
-
- # cursor.fetchone should raise an Error if called after
- # executing a query that cannnot return rows
- self.executeDDL1(cur)
- self.assertRaises(self.driver.Error,cur.fetchone)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- self.assertEqual(cur.fetchone(),None,
- 'cursor.fetchone should return None if a query retrieves '
- 'no rows'
- )
- self.assertTrue(cur.rowcount in (-1,0))
-
- # cursor.fetchone should raise an Error if called after
- # executing a query that cannnot return rows
- cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
- self.assertRaises(self.driver.Error,cur.fetchone)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- r = cur.fetchone()
- self.assertEqual(len(r),1,
- 'cursor.fetchone should have retrieved a single row'
- )
- self.assertEqual(r[0],'Victoria Bitter',
- 'cursor.fetchone retrieved incorrect data'
- )
- self.assertEqual(cur.fetchone(),None,
- 'cursor.fetchone should return None if no more rows available'
- )
- self.assertTrue(cur.rowcount in (-1,1))
- finally:
- con.close()
-
- samples = [
- 'Carlton Cold',
- 'Carlton Draft',
- 'Mountain Goat',
- 'Redback',
- 'Victoria Bitter',
- 'XXXX'
- ]
-
- def _populate(self):
- ''' Return a list of sql commands to setup the DB for the fetch
- tests.
- '''
- populate = [
- "insert into %sbooze values ('%s')" % (self.table_prefix,s)
- for s in self.samples
- ]
- return populate
-
- def test_fetchmany(self):
- con = self._connect()
- try:
- cur = con.cursor()
-
- # cursor.fetchmany should raise an Error if called without
- #issuing a query
- self.assertRaises(self.driver.Error,cur.fetchmany,4)
-
- self.executeDDL1(cur)
- for sql in self._populate():
- cur.execute(sql)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- r = cur.fetchmany()
- self.assertEqual(len(r),1,
- 'cursor.fetchmany retrieved incorrect number of rows, '
- 'default of arraysize is one.'
- )
- cur.arraysize=10
- r = cur.fetchmany(3) # Should get 3 rows
- self.assertEqual(len(r),3,
- 'cursor.fetchmany retrieved incorrect number of rows'
- )
- r = cur.fetchmany(4) # Should get 2 more
- self.assertEqual(len(r),2,
- 'cursor.fetchmany retrieved incorrect number of rows'
- )
- r = cur.fetchmany(4) # Should be an empty sequence
- self.assertEqual(len(r),0,
- 'cursor.fetchmany should return an empty sequence after '
- 'results are exhausted'
- )
- self.assertTrue(cur.rowcount in (-1,6))
-
- # Same as above, using cursor.arraysize
- cur.arraysize=4
- cur.execute('select name from %sbooze' % self.table_prefix)
- r = cur.fetchmany() # Should get 4 rows
- self.assertEqual(len(r),4,
- 'cursor.arraysize not being honoured by fetchmany'
- )
- r = cur.fetchmany() # Should get 2 more
- self.assertEqual(len(r),2)
- r = cur.fetchmany() # Should be an empty sequence
- self.assertEqual(len(r),0)
- self.assertTrue(cur.rowcount in (-1,6))
-
- cur.arraysize=6
- cur.execute('select name from %sbooze' % self.table_prefix)
- rows = cur.fetchmany() # Should get all rows
- self.assertTrue(cur.rowcount in (-1,6))
- self.assertEqual(len(rows),6)
- self.assertEqual(len(rows),6)
- rows = [r[0] for r in rows]
- rows.sort()
-
- # Make sure we get the right data back out
- for i in range(0,6):
- self.assertEqual(rows[i],self.samples[i],
- 'incorrect data retrieved by cursor.fetchmany'
- )
-
- rows = cur.fetchmany() # Should return an empty list
- self.assertEqual(len(rows),0,
- 'cursor.fetchmany should return an empty sequence if '
- 'called after the whole result set has been fetched'
- )
- self.assertTrue(cur.rowcount in (-1,6))
-
- self.executeDDL2(cur)
- cur.execute('select name from %sbarflys' % self.table_prefix)
- r = cur.fetchmany() # Should get empty sequence
- self.assertEqual(len(r),0,
- 'cursor.fetchmany should return an empty sequence if '
- 'query retrieved no rows'
- )
- self.assertTrue(cur.rowcount in (-1,0))
-
- finally:
- con.close()
-
- def test_fetchall(self):
- con = self._connect()
- try:
- cur = con.cursor()
- # cursor.fetchall should raise an Error if called
- # without executing a query that may return rows (such
- # as a select)
- self.assertRaises(self.driver.Error, cur.fetchall)
-
- self.executeDDL1(cur)
- for sql in self._populate():
- cur.execute(sql)
-
- # cursor.fetchall should raise an Error if called
- # after executing a a statement that cannot return rows
- self.assertRaises(self.driver.Error,cur.fetchall)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- rows = cur.fetchall()
- self.assertTrue(cur.rowcount in (-1,len(self.samples)))
- self.assertEqual(len(rows),len(self.samples),
- 'cursor.fetchall did not retrieve all rows'
- )
- rows = [r[0] for r in rows]
- rows.sort()
- for i in range(0,len(self.samples)):
- self.assertEqual(rows[i],self.samples[i],
- 'cursor.fetchall retrieved incorrect rows'
- )
- rows = cur.fetchall()
- self.assertEqual(
- len(rows),0,
- 'cursor.fetchall should return an empty list if called '
- 'after the whole result set has been fetched'
- )
- self.assertTrue(cur.rowcount in (-1,len(self.samples)))
-
- self.executeDDL2(cur)
- cur.execute('select name from %sbarflys' % self.table_prefix)
- rows = cur.fetchall()
- self.assertTrue(cur.rowcount in (-1,0))
- self.assertEqual(len(rows),0,
- 'cursor.fetchall should return an empty list if '
- 'a select query returns no rows'
- )
-
- finally:
- con.close()
-
- def test_mixedfetch(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
- for sql in self._populate():
- cur.execute(sql)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- rows1 = cur.fetchone()
- rows23 = cur.fetchmany(2)
- rows4 = cur.fetchone()
- rows56 = cur.fetchall()
- self.assertTrue(cur.rowcount in (-1,6))
- self.assertEqual(len(rows23),2,
- 'fetchmany returned incorrect number of rows'
- )
- self.assertEqual(len(rows56),2,
- 'fetchall returned incorrect number of rows'
- )
-
- rows = [rows1[0]]
- rows.extend([rows23[0][0],rows23[1][0]])
- rows.append(rows4[0])
- rows.extend([rows56[0][0],rows56[1][0]])
- rows.sort()
- for i in range(0,len(self.samples)):
- self.assertEqual(rows[i],self.samples[i],
- 'incorrect data retrieved or inserted'
- )
- finally:
- con.close()
-
- def help_nextset_setUp(self,cur):
- ''' Should create a procedure called deleteme
- that returns two result sets, first the
- number of rows in booze then "name from booze"
- '''
- raise NotImplementedError,'Helper not implemented'
- #sql="""
- # create procedure deleteme as
- # begin
- # select count(*) from booze
- # select name from booze
- # end
- #"""
- #cur.execute(sql)
-
- def help_nextset_tearDown(self,cur):
- 'If cleaning up is needed after nextSetTest'
- raise NotImplementedError,'Helper not implemented'
- #cur.execute("drop procedure deleteme")
-
- def test_nextset(self):
- con = self._connect()
- try:
- cur = con.cursor()
- if not hasattr(cur,'nextset'):
- return
-
- try:
- self.executeDDL1(cur)
- sql=self._populate()
- for sql in self._populate():
- cur.execute(sql)
-
- self.help_nextset_setUp(cur)
-
- cur.callproc('deleteme')
- numberofrows=cur.fetchone()
- assert numberofrows[0]== len(self.samples)
- assert cur.nextset()
- names=cur.fetchall()
- assert len(names) == len(self.samples)
- s=cur.nextset()
- assert s == None,'No more return sets, should return None'
- finally:
- self.help_nextset_tearDown(cur)
-
- finally:
- con.close()
-
- def test_nextset(self):
- raise NotImplementedError,'Drivers need to override this test'
-
- def test_arraysize(self):
- # Not much here - rest of the tests for this are in test_fetchmany
- con = self._connect()
- try:
- cur = con.cursor()
- self.assertTrue(hasattr(cur,'arraysize'),
- 'cursor.arraysize must be defined'
- )
- finally:
- con.close()
-
- def test_setinputsizes(self):
- con = self._connect()
- try:
- cur = con.cursor()
- cur.setinputsizes( (25,) )
- self._paraminsert(cur) # Make sure cursor still works
- finally:
- con.close()
-
- def test_setoutputsize_basic(self):
- # Basic test is to make sure setoutputsize doesn't blow up
- con = self._connect()
- try:
- cur = con.cursor()
- cur.setoutputsize(1000)
- cur.setoutputsize(2000,0)
- self._paraminsert(cur) # Make sure the cursor still works
- finally:
- con.close()
-
- def test_setoutputsize(self):
- # Real test for setoutputsize is driver dependant
- raise NotImplementedError,'Driver need to override this test'
-
- def test_None(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
- cur.execute('insert into %sbooze values (NULL)' % self.table_prefix)
- cur.execute('select name from %sbooze' % self.table_prefix)
- r = cur.fetchall()
- self.assertEqual(len(r),1)
- self.assertEqual(len(r[0]),1)
- self.assertEqual(r[0][0],None,'NULL value not returned as None')
- finally:
- con.close()
-
- def test_Date(self):
- d1 = self.driver.Date(2002,12,25)
- d2 = self.driver.DateFromTicks(time.mktime((2002,12,25,0,0,0,0,0,0)))
- # Can we assume this? API doesn't specify, but it seems implied
- # self.assertEqual(str(d1),str(d2))
-
- def test_Time(self):
- t1 = self.driver.Time(13,45,30)
- t2 = self.driver.TimeFromTicks(time.mktime((2001,1,1,13,45,30,0,0,0)))
- # Can we assume this? API doesn't specify, but it seems implied
- # self.assertEqual(str(t1),str(t2))
-
- def test_Timestamp(self):
- t1 = self.driver.Timestamp(2002,12,25,13,45,30)
- t2 = self.driver.TimestampFromTicks(
- time.mktime((2002,12,25,13,45,30,0,0,0))
- )
- # Can we assume this? API doesn't specify, but it seems implied
- # self.assertEqual(str(t1),str(t2))
-
- def test_Binary(self):
- b = self.driver.Binary('Something')
- b = self.driver.Binary('')
-
- def test_STRING(self):
- self.assertTrue(hasattr(self.driver,'STRING'),
- 'module.STRING must be defined'
- )
-
- def test_BINARY(self):
- self.assertTrue(hasattr(self.driver,'BINARY'),
- 'module.BINARY must be defined.'
- )
-
- def test_NUMBER(self):
- self.assertTrue(hasattr(self.driver,'NUMBER'),
- 'module.NUMBER must be defined.'
- )
-
- def test_DATETIME(self):
- self.assertTrue(hasattr(self.driver,'DATETIME'),
- 'module.DATETIME must be defined.'
- )
-
- def test_ROWID(self):
- self.assertTrue(hasattr(self.driver,'ROWID'),
- 'module.ROWID must be defined.'
- )
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py b/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
deleted file mode 100644
index c1423c5..0000000
--- a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-import capabilities
-import unittest
-import pymysql
-from pymysql.tests import base
-import warnings
-
-warnings.filterwarnings('error')
-
-class test_MySQLdb(capabilities.DatabaseTest):
-
- db_module = pymysql
- connect_args = ()
- connect_kwargs = base.PyMySQLTestCase.databases[0].copy()
- connect_kwargs.update(dict(read_default_file='~/.my.cnf',
- use_unicode=True,
- charset='utf8', sql_mode="ANSI,STRICT_TRANS_TABLES,TRADITIONAL"))
-
- create_table_extra = "ENGINE=INNODB CHARACTER SET UTF8"
- leak_test = False
-
- def quote_identifier(self, ident):
- return "`%s`" % ident
-
- def test_TIME(self):
- from datetime import timedelta
- def generator(row,col):
- return timedelta(0, row*8000)
- self.check_data_integrity(
- ('col1 TIME',),
- generator)
-
- def test_TINYINT(self):
- # Number data
- def generator(row,col):
- v = (row*row) % 256
- if v > 127:
- v = v-256
- return v
- self.check_data_integrity(
- ('col1 TINYINT',),
- generator)
-
- def test_stored_procedures(self):
- db = self.connection
- c = self.cursor
- try:
- self.create_table(('pos INT', 'tree CHAR(20)'))
- c.executemany("INSERT INTO %s (pos,tree) VALUES (%%s,%%s)" % self.table,
- list(enumerate('ash birch cedar larch pine'.split())))
- db.commit()
-
- c.execute("""
- CREATE PROCEDURE test_sp(IN t VARCHAR(255))
- BEGIN
- SELECT pos FROM %s WHERE tree = t;
- END
- """ % self.table)
- db.commit()
-
- c.callproc('test_sp', ('larch',))
- rows = c.fetchall()
- self.assertEquals(len(rows), 1)
- self.assertEquals(rows[0][0], 3)
- c.nextset()
- finally:
- c.execute("DROP PROCEDURE IF EXISTS test_sp")
- c.execute('drop table %s' % (self.table))
-
- def test_small_CHAR(self):
- # Character data
- def generator(row,col):
- i = ((row+1)*(col+1)+62)%256
- if i == 62: return ''
- if i == 63: return None
- return chr(i)
- self.check_data_integrity(
- ('col1 char(1)','col2 char(1)'),
- generator)
-
- def test_bug_2671682(self):
- from pymysql.constants import ER
- try:
- self.cursor.execute("describe some_non_existent_table");
- except self.connection.ProgrammingError, msg:
- self.assertTrue(msg.args[0] == ER.NO_SUCH_TABLE)
-
- def test_insert_values(self):
- from pymysql.cursors import insert_values
- query = """INSERT FOO (a, b, c) VALUES (a, b, c)"""
- matched = insert_values.search(query)
- self.assertTrue(matched)
- values = matched.group(1)
- self.assertTrue(values == "(a, b, c)")
-
- def test_ping(self):
- self.connection.ping()
-
- def test_literal_int(self):
- self.assertTrue("2" == self.connection.literal(2))
-
- def test_literal_float(self):
- self.assertTrue("3.1415" == self.connection.literal(3.1415))
-
- def test_literal_string(self):
- self.assertTrue("'foo'" == self.connection.literal("foo"))
-
-
-if __name__ == '__main__':
- if test_MySQLdb.leak_test:
- import gc
- gc.enable()
- gc.set_debug(gc.DEBUG_LEAK)
- unittest.main()
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py b/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
deleted file mode 100644
index 7077c7a..0000000
--- a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-import dbapi20
-import unittest
-import pymysql
-from pymysql.tests import base
-
-class test_MySQLdb(dbapi20.DatabaseAPI20Test):
- driver = pymysql
- connect_args = ()
- connect_kw_args = base.PyMySQLTestCase.databases[0].copy()
- connect_kw_args.update(dict(read_default_file='~/.my.cnf',
- charset='utf8',
- sql_mode="ANSI,STRICT_TRANS_TABLES,TRADITIONAL"))
-
- def test_setoutputsize(self): pass
- def test_setoutputsize_basic(self): pass
- def test_nextset(self): pass
-
- """The tests on fetchone and fetchall and rowcount bogusly
- test for an exception if the statement cannot return a
- result set. MySQL always returns a result set; it's just that
- some things return empty result sets."""
-
- def test_fetchall(self):
- con = self._connect()
- try:
- cur = con.cursor()
- # cursor.fetchall should raise an Error if called
- # without executing a query that may return rows (such
- # as a select)
- self.assertRaises(self.driver.Error, cur.fetchall)
-
- self.executeDDL1(cur)
- for sql in self._populate():
- cur.execute(sql)
-
- # cursor.fetchall should raise an Error if called
- # after executing a a statement that cannot return rows
-## self.assertRaises(self.driver.Error,cur.fetchall)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- rows = cur.fetchall()
- self.assertTrue(cur.rowcount in (-1,len(self.samples)))
- self.assertEqual(len(rows),len(self.samples),
- 'cursor.fetchall did not retrieve all rows'
- )
- rows = [r[0] for r in rows]
- rows.sort()
- for i in range(0,len(self.samples)):
- self.assertEqual(rows[i],self.samples[i],
- 'cursor.fetchall retrieved incorrect rows'
- )
- rows = cur.fetchall()
- self.assertEqual(
- len(rows),0,
- 'cursor.fetchall should return an empty list if called '
- 'after the whole result set has been fetched'
- )
- self.assertTrue(cur.rowcount in (-1,len(self.samples)))
-
- self.executeDDL2(cur)
- cur.execute('select name from %sbarflys' % self.table_prefix)
- rows = cur.fetchall()
- self.assertTrue(cur.rowcount in (-1,0))
- self.assertEqual(len(rows),0,
- 'cursor.fetchall should return an empty list if '
- 'a select query returns no rows'
- )
-
- finally:
- con.close()
-
- def test_fetchone(self):
- con = self._connect()
- try:
- cur = con.cursor()
-
- # cursor.fetchone should raise an Error if called before
- # executing a select-type query
- self.assertRaises(self.driver.Error,cur.fetchone)
-
- # cursor.fetchone should raise an Error if called after
- # executing a query that cannnot return rows
- self.executeDDL1(cur)
-## self.assertRaises(self.driver.Error,cur.fetchone)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- self.assertEqual(cur.fetchone(),None,
- 'cursor.fetchone should return None if a query retrieves '
- 'no rows'
- )
- self.assertTrue(cur.rowcount in (-1,0))
-
- # cursor.fetchone should raise an Error if called after
- # executing a query that cannnot return rows
- cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
-## self.assertRaises(self.driver.Error,cur.fetchone)
-
- cur.execute('select name from %sbooze' % self.table_prefix)
- r = cur.fetchone()
- self.assertEqual(len(r),1,
- 'cursor.fetchone should have retrieved a single row'
- )
- self.assertEqual(r[0],'Victoria Bitter',
- 'cursor.fetchone retrieved incorrect data'
- )
-## self.assertEqual(cur.fetchone(),None,
-## 'cursor.fetchone should return None if no more rows available'
-## )
- self.assertTrue(cur.rowcount in (-1,1))
- finally:
- con.close()
-
- # Same complaint as for fetchall and fetchone
- def test_rowcount(self):
- con = self._connect()
- try:
- cur = con.cursor()
- self.executeDDL1(cur)
-## self.assertEqual(cur.rowcount,-1,
-## 'cursor.rowcount should be -1 after executing no-result '
-## 'statements'
-## )
- cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
- self.table_prefix
- ))
-## self.assertTrue(cur.rowcount in (-1,1),
-## 'cursor.rowcount should == number or rows inserted, or '
-## 'set to -1 after executing an insert statement'
-## )
- cur.execute("select name from %sbooze" % self.table_prefix)
- self.assertTrue(cur.rowcount in (-1,1),
- 'cursor.rowcount should == number of rows returned, or '
- 'set to -1 after executing a select statement'
- )
- self.executeDDL2(cur)
-## self.assertEqual(cur.rowcount,-1,
-## 'cursor.rowcount not being reset to -1 after executing '
-## 'no-result statements'
-## )
- finally:
- con.close()
-
- def test_callproc(self):
- pass # performed in test_MySQL_capabilities
-
- def help_nextset_setUp(self,cur):
- ''' Should create a procedure called deleteme
- that returns two result sets, first the
- number of rows in booze then "name from booze"
- '''
- sql="""
- create procedure deleteme()
- begin
- select count(*) from %(tp)sbooze;
- select name from %(tp)sbooze;
- end
- """ % dict(tp=self.table_prefix)
- cur.execute(sql)
-
- def help_nextset_tearDown(self,cur):
- 'If cleaning up is needed after nextSetTest'
- cur.execute("drop procedure deleteme")
-
- def test_nextset(self):
- from warnings import warn
- con = self._connect()
- try:
- cur = con.cursor()
- if not hasattr(cur,'nextset'):
- return
-
- try:
- self.executeDDL1(cur)
- sql=self._populate()
- for sql in self._populate():
- cur.execute(sql)
-
- self.help_nextset_setUp(cur)
-
- cur.callproc('deleteme')
- numberofrows=cur.fetchone()
- assert numberofrows[0]== len(self.samples)
- assert cur.nextset()
- names=cur.fetchall()
- assert len(names) == len(self.samples)
- s=cur.nextset()
- if s:
- empty = cur.fetchall()
- self.assertEquals(len(empty), 0,
- "non-empty result set after other result sets")
- #warn("Incompatibility: MySQL returns an empty result set for the CALL itself",
- # Warning)
- #assert s == None,'No more return sets, should return None'
- finally:
- self.help_nextset_tearDown(cur)
-
- finally:
- con.close()
-
-
-if __name__ == '__main__':
- unittest.main()
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py b/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
deleted file mode 100644
index c5599e9..0000000
--- a/tools/testClient/pymysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-import unittest
-
-import pymysql
-_mysql = pymysql
-from pymysql.constants import FIELD_TYPE
-from pymysql.tests import base
-
-
-class TestDBAPISet(unittest.TestCase):
- def test_set_equality(self):
- self.assertTrue(pymysql.STRING == pymysql.STRING)
-
- def test_set_inequality(self):
- self.assertTrue(pymysql.STRING != pymysql.NUMBER)
-
- def test_set_equality_membership(self):
- self.assertTrue(FIELD_TYPE.VAR_STRING == pymysql.STRING)
-
- def test_set_inequality_membership(self):
- self.assertTrue(FIELD_TYPE.DATE != pymysql.STRING)
-
-
-class CoreModule(unittest.TestCase):
- """Core _mysql module features."""
-
- def test_NULL(self):
- """Should have a NULL constant."""
- self.assertEqual(_mysql.NULL, 'NULL')
-
- def test_version(self):
- """Version information sanity."""
- self.assertTrue(isinstance(_mysql.__version__, str))
-
- self.assertTrue(isinstance(_mysql.version_info, tuple))
- self.assertEqual(len(_mysql.version_info), 5)
-
- def test_client_info(self):
- self.assertTrue(isinstance(_mysql.get_client_info(), str))
-
- def test_thread_safe(self):
- self.assertTrue(isinstance(_mysql.thread_safe(), int))
-
-
-class CoreAPI(unittest.TestCase):
- """Test _mysql interaction internals."""
-
- def setUp(self):
- kwargs = base.PyMySQLTestCase.databases[0].copy()
- kwargs["read_default_file"] = "~/.my.cnf"
- self.conn = _mysql.connect(**kwargs)
-
- def tearDown(self):
- self.conn.close()
-
- def test_thread_id(self):
- tid = self.conn.thread_id()
- self.assertTrue(isinstance(tid, int),
- "thread_id didn't return an int.")
-
- self.assertRaises(TypeError, self.conn.thread_id, ('evil',),
- "thread_id shouldn't accept arguments.")
-
- def test_affected_rows(self):
- self.assertEquals(self.conn.affected_rows(), 0,
- "Should return 0 before we do anything.")
-
-
- #def test_debug(self):
- ## FIXME Only actually tests if you lack SUPER
- #self.assertRaises(pymysql.OperationalError,
- #self.conn.dump_debug_info)
-
- def test_charset_name(self):
- self.assertTrue(isinstance(self.conn.character_set_name(), str),
- "Should return a string.")
-
- def test_host_info(self):
- self.assertTrue(isinstance(self.conn.get_host_info(), str),
- "Should return a string.")
-
- def test_proto_info(self):
- self.assertTrue(isinstance(self.conn.get_proto_info(), int),
- "Should return an int.")
-
- def test_server_info(self):
- self.assertTrue(isinstance(self.conn.get_server_info(), basestring),
- "Should return an str.")
-
-if __name__ == "__main__":
- unittest.main()
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/times.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/times.py b/tools/testClient/pymysql/times.py
deleted file mode 100644
index f0aba81..0000000
--- a/tools/testClient/pymysql/times.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-from time import localtime
-from datetime import date, datetime, time, timedelta
-
-Date = date
-Time = time
-TimeDelta = timedelta
-Timestamp = datetime
-
-def DateFromTicks(ticks):
- return date(*localtime(ticks)[:3])
-
-def TimeFromTicks(ticks):
- return time(*localtime(ticks)[3:6])
-
-def TimestampFromTicks(ticks):
- return datetime(*localtime(ticks)[:6])
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/pymysql/util.py
----------------------------------------------------------------------
diff --git a/tools/testClient/pymysql/util.py b/tools/testClient/pymysql/util.py
deleted file mode 100644
index 2c2392b..0000000
--- a/tools/testClient/pymysql/util.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-import struct
-
-def byte2int(b):
- if isinstance(b, int):
- return b
- else:
- return struct.unpack("!B", b)[0]
-
-def int2byte(i):
- return struct.pack("!B", i)
-
-def join_bytes(bs):
- if len(bs) == 0:
- return ""
- else:
- rv = bs[0]
- for b in bs[1:]:
- rv += b
- return rv
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/testClient/remoteSSHClient.py b/tools/testClient/remoteSSHClient.py
deleted file mode 100644
index 99d298b..0000000
--- a/tools/testClient/remoteSSHClient.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-import paramiko
-import cloudstackException
-class remoteSSHClient(object):
- def __init__(self, host, port, user, passwd):
- self.host = host
- self.port = port
- self.user = user
- self.passwd = passwd
- self.ssh = paramiko.SSHClient()
- self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- self.ssh.connect(str(host),int(port), user, passwd)
- except paramiko.SSHException, sshex:
- raise cloudstackException.InvalidParameterException(repr(sshex))
-
- def execute(self, command):
- stdin, stdout, stderr = self.ssh.exec_command(command)
- output = stdout.readlines()
- errors = stderr.readlines()
- results = []
- if output is not None and len(output) == 0:
- if errors is not None and len(errors) > 0:
- for error in errors:
- results.append(error.rstrip())
-
- else:
- for strOut in output:
- results.append(strOut.rstrip())
-
- return results
-
-
-if __name__ == "__main__":
- ssh = remoteSSHClient("192.168.137.2", 22, "root", "password")
- print ssh.execute("ls -l")
- print ssh.execute("rm x")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/resourceMgrTest/__init__.py
----------------------------------------------------------------------
diff --git a/tools/testClient/resourceMgrTest/__init__.py b/tools/testClient/resourceMgrTest/__init__.py
deleted file mode 100755
index 37f96ce..0000000
--- a/tools/testClient/resourceMgrTest/__init__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/resourceMgrTest/setup.py
----------------------------------------------------------------------
diff --git a/tools/testClient/resourceMgrTest/setup.py b/tools/testClient/resourceMgrTest/setup.py
deleted file mode 100755
index 87bd72c..0000000
--- a/tools/testClient/resourceMgrTest/setup.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on Oct 18, 2011
-
-@author: frank
-'''
-from optparse import OptionParser
-from configGenerator import *
-
-if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option('-o', '--output', action='store', default='./setup.conf', dest='output', help='the path where the json config file generated')
- parser.add_option('-m', '--mshost', dest='mshost', help='hostname/ip of management server', action='store')
-
- (opts, args) = parser.parse_args()
- mandatories = ['mshost']
- for m in mandatories:
- if not opts.__dict__[m]:
- parser.error("mandatory option - " + m +" missing")
-
- zs = cloudstackConfiguration()
-
- #Define Zone
- z = zone()
- z.dns1 = "8.8.8.8"
- z.dns2 = "4.4.4.4"
- z.internaldns1 = "192.168.110.254"
- z.internaldns2 = "192.168.110.253"
- z.name = "testZone"
- z.networktype = 'Basic'
-
- #Define SecondaryStorage
- ss = secondaryStorage()
- ss.url ="nfs://172.16.15.32/export/share/secondary"
- z.secondaryStorages.append(ss)
-
- p = pod()
- p.name = "POD-1"
- p.gateway = "10.223.64.1"
- p.netmask = "255.255.254.0"
- p.startip = "10.223.64.50"
- p.endip = "10.223.64.60"
-
- ip = iprange()
- ip.vlan="untagged"
- ip.gateway = p.gateway
- ip.netmask = p.netmask
- ip.startip = "10.223.64.70"
- ip.endip = "10.223.64.220"
- p.guestIpRanges.append(ip)
-
- c = cluster()
- c.clustername = "CLUSTER-1"
- c.clustertype = "CloudManaged"
- c.hypervisor = "Simulator"
- p.clusters.append(c)
-
- z.pods.append(p)
- zs.zones.append(z)
-
- '''Add one mgt server'''
- mgt = managementServer()
- mgt.mgtSvrIp = opts.mshost
- zs.mgtSvr.append(mgt)
-
- '''Add a database'''
- db = dbServer()
- db.dbSvr = opts.mshost
- db.user = "root"
- db.passwd = ""
- zs.dbSvr = db
-
- generate_setup_config(zs,opts.output)
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/resourceMgrTest/testDeploy100Host.py
----------------------------------------------------------------------
diff --git a/tools/testClient/resourceMgrTest/testDeploy100Host.py b/tools/testClient/resourceMgrTest/testDeploy100Host.py
deleted file mode 100755
index 927fb9a..0000000
--- a/tools/testClient/resourceMgrTest/testDeploy100Host.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-Created on Oct 18, 2011
-
-@author: frank
-'''
-from cloudstackTestCase import *
-from cloudstackAPI import *
-import uuid
-import threading
-import random
-import time
-
-class Task(threading.Thread):
- def __init__(self, func, param=None):
- super(Task, self).__init__()
- self.func = func
- self.param = param
-
- def run(self):
- self.func(self.param)
-
- def doTask(self):
- self.start()
-
-class TestDeploy100Hosts(cloudstackTestCase):
- hosts = []
- def deployHost(self, url):
- apiClient = self.testClient.getApiClient()
- addHostCmd = addHost.addHostCmd()
- addHostCmd.hypervisor = "simulator"
- addHostCmd.clusterid = 1
- addHostCmd.zoneid = 1
- addHostCmd.podid = 1
- addHostCmd.url = "http://sim/%s"%url
- addHostCmd.username = "placeholder"
- addHostCmd.password = "placeholder"
- addHostResponce = apiClient.addHost(addHostCmd)
- return addHostResponce[0].id
-
- def randomCancelMaintenance(self):
- def run(param):
- while(1):
- try:
- interval = random.randint(1, 2)
- time.sleep(interval)
- if len(self.hosts) == 0:
- continue
-
- index = random.randint(0, len(self.hosts)-1)
- hostId = self.hosts[index]
- apiClient = self.testClient.getApiClient()
- cMaintainCmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
- cMaintainCmd.id = hostId
- response = apiClient.cancelHostMaintenance(cMaintainCmd)
- id = response.id
- print "Host %s cancelled maintenance mode" % id
- except Exception, e:
- print e
-
- t = Task(run)
- t.doTask()
-
- def randomEnterMaintenance(self):
- def run(param):
- while(1):
- try:
- interval = random.randint(1, 2)
- time.sleep(interval)
- if len(self.hosts) == 0:
- continue
- index = random.randint(0, len(self.hosts)-1)
- hostId = self.hosts[index]
- apiClient = self.testClient.getApiClient()
- maintainCmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
- maintainCmd.id = hostId
- response = apiClient.prepareHostForMaintenance(maintainCmd)
- id = response.id
- print "Host %s entered maintenance mode" % id
- except Exception, e:
- print e
-
- t = Task(run)
- t.doTask()
-
-
- def test_deploy100Hosts(self):
- #for i in range(200):
- #self.hosts.append(self.deployHost(i))
- for i in range(200):
- self.hosts.append(i)
- self.randomEnterMaintenance()
- self.randomCancelMaintenance()
- while(1): time.sleep(10000)
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/advanced/advanced_env.py
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/advanced/advanced_env.py b/tools/testClient/sandbox/advanced/advanced_env.py
deleted file mode 100644
index ffb4de4..0000000
--- a/tools/testClient/sandbox/advanced/advanced_env.py
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-
-'''
-# Experimental state of scripts
-# * Need to be reviewed
-# * Only a sandbox
-'''
-
-from ConfigParser import SafeConfigParser
-from optparse import OptionParser
-from configGenerator import *
-import random
-
-
-def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
- cfg = configuration()
- cfg.name = k
- cfg.value = v
- yield cfg
-
-
-def describeResources(config):
- zs = cloudstackConfiguration()
-
- z = zone()
- z.dns1 = config.get('environment', 'dns')
- z.internaldns1 = config.get('environment', 'dns')
- z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor'))
- z.networktype = 'Advanced'
- z.guestcidraddress = '10.1.1.0/24'
-
- prov = provider()
- prov.vlan = config.get('cloudstack','guest.vlan')
- z.providers.append(prov)
-
- p = pod()
- p.name = 'POD0'
- p.gateway = config.get('cloudstack', 'private.gateway')
- p.startip = config.get('cloudstack', 'private.pod.startip')
- p.endip = config.get('cloudstack', 'private.pod.endip')
- p.netmask = '255.255.255.0'
-
- v = iprange()
- v.gateway = config.get('cloudstack', 'public.gateway')
- v.startip = config.get('cloudstack', 'public.vlan.startip')
- v.endip = config.get('cloudstack', 'public.vlan.endip')
- v.netmask = '255.255.255.0'
- v.vlan = config.get('cloudstack', 'public.vlan')
- z.ipranges.append(v)
-
- c = cluster()
- c.clustername = 'C0'
- c.hypervisor = config.get('environment', 'hypervisor')
- c.clustertype = 'CloudManaged'
-
- h = host()
- h.username = 'root'
- h.password = 'password'
- h.url = 'http://%s'%(config.get('cloudstack', 'host'))
- c.hosts.append(h)
-
- ps = primaryStorage()
- ps.name = 'PS0'
- ps.url = config.get('cloudstack', 'pool')
- c.primaryStorages.append(ps)
-
- p.clusters.append(c)
- z.pods.append(p)
-
- secondary = secondaryStorage()
- secondary.url = config.get('cloudstack', 'secondary')
- z.secondaryStorages.append(secondary)
-
- '''Add zone'''
- zs.zones.append(z)
-
- '''Add mgt server'''
- mgt = managementServer()
- mgt.mgtSvrIp = config.get('environment', 'mshost')
- zs.mgtSvr.append(mgt)
-
- '''Add a database'''
- db = dbServer()
- db.dbSvr = config.get('environment', 'database')
- zs.dbSvr = db
-
- '''Add some configuration'''
- [zs.globalConfig.append(cfg) for cfg in getGlobalSettings(config)]
-
- ''''add loggers'''
- testClientLogger = logger()
- testClientLogger.name = 'TestClient'
- testClientLogger.file = '/var/log/testclient.log'
-
- testCaseLogger = logger()
- testCaseLogger.name = 'TestCase'
- testCaseLogger.file = '/var/log/testcase.log'
-
- zs.logger.append(testClientLogger)
- zs.logger.append(testCaseLogger)
- return zs
-
-
-if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option('-i', '--input', action='store', default='setup.properties', \
- dest='input', help='file containing environment setup information')
- parser.add_option('-o', '--output', action='store', default='./sandbox.cfg', \
- dest='output', help='path where environment json will be generated')
-
-
- (opts, args) = parser.parse_args()
-
- cfg_parser = SafeConfigParser()
- cfg_parser.read(opts.input)
-
- cfg = describeResources(cfg_parser)
- generate_setup_config(cfg, opts.output)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/advanced/kvm.properties
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/advanced/kvm.properties b/tools/testClient/sandbox/advanced/kvm.properties
deleted file mode 100644
index a34da93..0000000
--- a/tools/testClient/sandbox/advanced/kvm.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-[globals]
-expunge.delay=60
-expunge.interval=60
-storage.cleanup.interval=300
-account.cleanup.interval=600
-expunge.workers=3
-workers=10
-use.user.concentrated.pod.allocation=false
-vm.allocation.algorithm=random
-vm.op.wait.interval=5
-guest.domain.suffix=sandbox.kvm
-instance.name=QA
-direct.agent.load.size=1000
-default.page.size=10000
-check.pod.cidrs=true
-secstorage.allowed.internal.sites=10.147.28.0/24
-[environment]
-dns=10.147.28.6
-mshost=10.147.29.111
-database=10.147.29.111
-hypervisor=kvm
-[cloudstack]
-zone.vlan=675-679
-#pod configuration
-private.gateway=10.147.29.1
-private.pod.startip=10.147.29.150
-private.pod.endip=10.147.29.159
-#public vlan range
-public.gateway=10.147.31.1
-public.vlan=31
-public.vlan.startip=10.147.31.150
-public.vlan.endip=10.147.31.159
-#hosts
-host=10.147.29.58
-#pools
-pool=nfs://10.147.28.6:/export/home/prasanna/kamakura
-secondary=nfs://10.147.28.6:/export/home/prasanna/sstor
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/advanced/setup.properties
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/advanced/setup.properties b/tools/testClient/sandbox/advanced/setup.properties
deleted file mode 100644
index a90630c..0000000
--- a/tools/testClient/sandbox/advanced/setup.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-[globals]
-expunge.delay=60
-expunge.interval=60
-storage.cleanup.interval=300
-account.cleanup.interval=600
-expunge.workers=3
-workers=10
-use.user.concentrated.pod.allocation=false
-vm.allocation.algorithm=random
-vm.op.wait.interval=5
-guest.domain.suffix=sandbox.kvm
-instance.name=QA
-direct.agent.load.size=1000
-default.page.size=10000
-check.pod.cidrs=true
-secstorage.allowed.internal.sites=10.147.28.0/24
-[environment]
-dns=10.147.28.6
-mshost=10.147.29.111
-database=10.147.29.111
-[cloudstack]
-zone.vlan=675-679
-#pod configuration
-private.gateway=10.147.29.1
-private.pod.startip=10.147.29.150
-private.pod.endip=10.147.29.159
-#public vlan range
-public.gateway=10.147.31.1
-public.vlan=31
-public.vlan.startip=10.147.31.150
-public.vlan.endip=10.147.31.159
-#hosts
-host=10.147.29.58
-#pools
-pool=nfs://10.147.28.6:/export/home/prasanna/kamakura
-secondary=nfs://10.147.28.6:/export/home/prasanna/sstor
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/advanced/tests/test_scenarios.py
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/advanced/tests/test_scenarios.py b/tools/testClient/sandbox/advanced/tests/test_scenarios.py
deleted file mode 100644
index a332a09..0000000
--- a/tools/testClient/sandbox/advanced/tests/test_scenarios.py
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
-
-import random
-import hashlib
-from cloudstackTestCase import *
-import remoteSSHClient
-
-class SampleScenarios(cloudstackTestCase):
- '''
- '''
- def setUp(self):
- pass
-
-
- def tearDown(self):
- pass
-
-
- def test_1_createAccounts(self, numberOfAccounts=2):
- '''
- Create a bunch of user accounts
- '''
- mdf = hashlib.md5()
- mdf.update('password')
- mdf_pass = mdf.hexdigest()
- api = self.testClient.getApiClient()
- for i in range(1, numberOfAccounts + 1):
- acct = createAccount.createAccountCmd()
- acct.accounttype = 0
- acct.firstname = 'user' + str(i)
- acct.lastname = 'user' + str(i)
- acct.password = mdf_pass
- acct.username = 'user' + str(i)
- acct.email = 'user@example.com'
- acct.account = 'user' + str(i)
- acct.domainid = 1
- acctResponse = api.createAccount(acct)
- self.debug("successfully created account: %s, user: %s, id: %s"%(acctResponse.account, acctResponse.username, acctResponse.id))
-
-
- def test_2_createServiceOffering(self):
- apiClient = self.testClient.getApiClient()
- createSOcmd=createServiceOffering.createServiceOfferingCmd()
- createSOcmd.name='Sample SO'
- createSOcmd.displaytext='Sample SO'
- createSOcmd.storagetype='shared'
- createSOcmd.cpunumber=1
- createSOcmd.cpuspeed=100
- createSOcmd.memory=128
- createSOcmd.offerha='false'
- createSOresponse = apiClient.createServiceOffering(createSOcmd)
- return createSOresponse.id
-
- def deployCmd(self, account, service):
- deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
- deployVmCmd.zoneid = 1
- deployVmCmd.account=account
- deployVmCmd.domainid=1
- deployVmCmd.templateid=2
- deployVmCmd.serviceofferingid=service
- return deployVmCmd
-
- def listVmsInAccountCmd(self, acct):
- api = self.testClient.getApiClient()
- listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
- listVmCmd.account = acct
- listVmCmd.zoneid = 1
- listVmCmd.domainid = 1
- listVmResponse = api.listVirtualMachines(listVmCmd)
- return listVmResponse
-
-
- def destroyVmCmd(self, key):
- api = self.testClient.getApiClient()
- destroyVmCmd = destroyVirtualMachine.destroyVirtualMachineCmd()
- destroyVmCmd.id = key
- api.destroyVirtualMachine(destroyVmCmd)
-
-
- def test_3_stressDeploy(self):
- '''
- Deploy 5 Vms in each account
- '''
- service_id = self.test_2_createServiceOffering()
- api = self.testClient.getApiClient()
- for acct in range(1, 5):
- [api.deployVirtualMachine(self.deployCmd('user'+str(acct), service_id)) for x in range(0,5)]
-
- @unittest.skip("skipping destroys")
- def test_4_stressDestroy(self):
- '''
- Cleanup all Vms in every account
- '''
- api = self.testClient.getApiClient()
- for acct in range(1, 6):
- for vm in self.listVmsInAccountCmd('user'+str(acct)):
- if vm is not None:
- self.destroyVmCmd(vm.id)
-
- @unittest.skip("skipping destroys")
- def test_5_combineStress(self):
- for i in range(0, 5):
- self.test_3_stressDeploy()
- self.test_4_stressDestroy()
-
- def deployN(self,nargs=300,batchsize=0):
- '''
- Deploy Nargs number of VMs concurrently in batches of size {batchsize}.
- When batchsize is 0 all Vms are deployed in one batch
- VMs will be deployed in 5:2:6 ratio
- '''
- cmds = []
-
- if batchsize == 0:
- self.testClient.submitCmdsAndWait(cmds)
- else:
- while len(z) > 0:
- try:
- newbatch = [cmds.pop() for b in range(batchsize)] #pop batchsize items
- self.testClient.submitCmdsAndWait(newbatch)
- except IndexError:
- break
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/advanced/xen.properties
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/advanced/xen.properties b/tools/testClient/sandbox/advanced/xen.properties
deleted file mode 100644
index 90c2f71..0000000
--- a/tools/testClient/sandbox/advanced/xen.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-[globals]
-expunge.delay=60
-expunge.interval=60
-storage.cleanup.interval=300
-account.cleanup.interval=600
-expunge.workers=3
-workers=10
-vm.allocation.algorithm=userdispersing
-vm.op.wait.interval=5
-guest.domain.suffix=sandbox.xen
-instance.name=QA
-direct.agent.load.size=1000
-default.page.size=10000
-check.pod.cidrs=true
-secstorage.allowed.internal.sites=10.147.28.0/24
-[environment]
-dns=10.147.28.6
-mshost=10.147.29.110
-database=localhost
-hypervisor=XenServer
-[cloudstack]
-guest.vlan=670-674
-#pod configuration
-private.gateway=10.147.29.1
-private.pod.startip=10.147.29.140
-private.pod.endip=10.147.29.149
-#public vlan range
-public.gateway=10.147.31.1
-public.vlan=31
-public.vlan.startip=10.147.31.140
-public.vlan.endip=10.147.31.149
-#hosts
-host=10.147.29.56
-#pools
-pool=nfs://10.147.28.6:/export/home/prasanna/taxila
-secondary=nfs://10.147.28.6:/export/home/prasanna/secondary
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/basic/basic_env.py
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/basic/basic_env.py b/tools/testClient/sandbox/basic/basic_env.py
deleted file mode 100644
index 6e5ef80..0000000
--- a/tools/testClient/sandbox/basic/basic_env.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012 Citrix Systems, Inc. Licensed under the
-# Apache License, Version 2.0 (the "License"); you may not use this
-# file except in compliance with the License. Citrix Systems, Inc.
-# reserves all rights not expressly granted by the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Automatically generated by addcopyright.py at 04/03/2012
-'''
-# Experimental state of scripts
-# * Need to be reviewed
-# * Only a sandbox
-'''
-
-from ConfigParser import SafeConfigParser
-from optparse import OptionParser
-from configGenerator import *
-import random
-
-
-def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
- cfg = configuration()
- cfg.name = k
- cfg.value = v
- yield cfg
-
-
-def describeResources(config):
- zs = cloudstackConfiguration()
-
- z = zone()
- z.dns1 = config.get('environment', 'dns')
- z.internaldns1 = config.get('environment', 'dns')
- z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor'))
- z.networktype = 'Basic'
- z.domain = 'cloud.basic'
-
- sgprov = provider() #SecurityGroup Provider
- sgprov.name = 'SecurityGroupProvider'
- z.providers.append(sgprov)
-
- p = pod()
- p.name = 'POD0'
- p.gateway = config.get('cloudstack', 'private.gateway')
- p.startip = config.get('cloudstack', 'private.pod.startip')
- p.endip = config.get('cloudstack', 'private.pod.endip')
- p.netmask = '255.255.255.0'
-
- v = iprange()
- v.gateway = config.get('cloudstack', 'guest.gateway')
- v.startip = config.get('cloudstack', 'guest.startip')
- v.endip = config.get('cloudstack', 'guest.endip')
- v.netmask = '255.255.255.0'
- p.guestIpRanges.append(v)
-
- c = cluster()
- c.clustername = 'C0'
- c.hypervisor = config.get('environment', 'hypervisor')
- c.clustertype = 'CloudManaged'
-
- h = host()
- h.username = 'root'
- h.password = 'password'
- h.url = 'http://%s'%(config.get('cloudstack', 'host'))
- c.hosts.append(h)
-
- ps = primaryStorage()
- ps.name = 'PS0'
- ps.url = config.get('cloudstack', 'pool')
- c.primaryStorages.append(ps)
-
- p.clusters.append(c)
- z.pods.append(p)
-
- secondary = secondaryStorage()
- secondary.url = config.get('cloudstack', 'secondary')
- z.secondaryStorages.append(secondary)
-
- '''Add zone'''
- zs.zones.append(z)
-
- '''Add mgt server'''
- mgt = managementServer()
- mgt.mgtSvrIp = config.get('environment', 'mshost')
- zs.mgtSvr.append(mgt)
-
- '''Add a database'''
- db = dbServer()
- db.dbSvr = config.get('environment', 'database')
- zs.dbSvr = db
-
- '''Add some configuration'''
- [zs.globalConfig.append(cfg) for cfg in getGlobalSettings(config)]
-
- ''''add loggers'''
- testClientLogger = logger()
- testClientLogger.name = 'TestClient'
- testClientLogger.file = '/var/log/testclient.log'
-
- testCaseLogger = logger()
- testCaseLogger.name = 'TestCase'
- testCaseLogger.file = '/var/log/testcase.log'
-
- zs.logger.append(testClientLogger)
- zs.logger.append(testCaseLogger)
- return zs
-
-
-if __name__ == '__main__':
- parser = OptionParser()
- parser.add_option('-i', '--input', action='store', default='setup.properties', \
- dest='input', help='file containing environment setup information')
- parser.add_option('-o', '--output', action='store', default='./sandbox.cfg', \
- dest='output', help='path where environment json will be generated')
-
-
- (opts, args) = parser.parse_args()
-
- cfg_parser = SafeConfigParser()
- cfg_parser.read(opts.input)
-
- cfg = describeResources(cfg_parser)
- generate_setup_config(cfg, opts.output)
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e38db694/tools/testClient/sandbox/basic/setup.properties
----------------------------------------------------------------------
diff --git a/tools/testClient/sandbox/basic/setup.properties b/tools/testClient/sandbox/basic/setup.properties
deleted file mode 100644
index 11d20de..0000000
--- a/tools/testClient/sandbox/basic/setup.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-[globals]
-expunge.delay=60
-expunge.interval=60
-storage.cleanup.interval=300
-account.cleanup.interval=600
-expunge.workers=3
-workers=10
-vm.allocation.algorithm=userdispersing
-vm.op.wait.interval=5
-guest.domain.suffix=sandbox.xen
-instance.name=QA
-direct.agent.load.size=1000
-default.page.size=10000
-check.pod.cidrs=true
-secstorage.allowed.internal.sites=10.147.28.0/24
-[environment]
-dns=10.147.28.6
-mshost=10.147.29.110
-database=10.147.29.110
-hypervisor=XenServer
-[cloudstack]
-#pod configuration
-private.gateway=10.147.29.1
-private.pod.startip=10.147.29.150
-private.pod.endip=10.147.29.153
-#public/guest ip range
-guest.gateway=10.147.29.1
-guest.startip=10.147.29.154
-guest.endip=10.147.29.159
-#hosts
-host=10.147.29.56
-#pools
-pool=nfs://10.147.28.6:/export/home/prasanna/taxila
-secondary=nfs://10.147.28.6:/export/home/prasanna/secondary