[rhmessaging-commits] rhmessaging commits: r3741 - in store/trunk/cpp: tests/new_python_tests and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Dec 14 14:39:53 EST 2009


Author: kpvdr
Date: 2009-12-14 14:39:53 -0500 (Mon, 14 Dec 2009)
New Revision: 3741

Added:
   store/trunk/cpp/tests/new_python_tests/
   store/trunk/cpp/tests/new_python_tests/__init__.py
   store/trunk/cpp/tests/new_python_tests/client_persistence_tests.py
   store/trunk/cpp/tests/old_python_tests/
   store/trunk/cpp/tests/run_new_python_tests
   store/trunk/cpp/tests/run_old_python_tests
Removed:
   store/trunk/cpp/tests/python_tests/
   store/trunk/cpp/tests/run_python_tests
Modified:
   store/trunk/cpp/tests/Makefile.am
   store/trunk/cpp/tools/jrnl.py
Log:
Added new python tests to make use of new testing framework, rearranged old tests so as not to lose them. They will eventually be updated and moved.

Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am	2009-12-14 18:31:27 UTC (rev 3740)
+++ store/trunk/cpp/tests/Makefile.am	2009-12-14 19:39:53 UTC (rev 3741)
@@ -39,7 +39,8 @@
   OrderingTest                  \
   TransactionalTest             \
   TwoPhaseCommitTest            \
-  run_python_tests              \
+  run_old_python_tests          \
+  run_new_python_tests          \
   system_test.sh                \
   clean.sh
 

Added: store/trunk/cpp/tests/new_python_tests/__init__.py
===================================================================
--- store/trunk/cpp/tests/new_python_tests/__init__.py	                        (rev 0)
+++ store/trunk/cpp/tests/new_python_tests/__init__.py	2009-12-14 19:39:53 UTC (rev 3741)
@@ -0,0 +1,24 @@
+# Do not delete - marks this directory as a python package.
+
+# Copyright (c) 2008, 2009 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+from client_persistence_tests import *

Added: store/trunk/cpp/tests/new_python_tests/client_persistence_tests.py
===================================================================
--- store/trunk/cpp/tests/new_python_tests/client_persistence_tests.py	                        (rev 0)
+++ store/trunk/cpp/tests/new_python_tests/client_persistence_tests.py	2009-12-14 19:39:53 UTC (rev 3741)
@@ -0,0 +1,94 @@
+# Copyright (c) 2008 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+from qpid.brokertest import *
+from qpid.messaging import Message
+from qmf.console import Session
+
+
+
+class AlternateExchageTests(BrokerTest):
+    """
+    Test the persistence of the Alternate Exchange property for exchanges and queues.
+    """
+    
+    def args(self):
+        assert BrokerTest.store_lib 
+        return ["--load-module", BrokerTest.store_lib]
+
+    def testExchangeAlternateExchangeProperty(self):
+        """Exchange alternate exchange property persistence test"""
+        
+        brokerName = "TestQueueAlternateExchange"
+        exchangeName = "TestExchange"
+        alternateExchangeName = "TestAlternateExchange"
+
+        broker = self.broker(self.args(), name=brokerName, expect=EXPECT_EXIT_FAIL)
+        # Use old API until new one can handle these operations
+        connection = broker.connect_old()
+        session = connection.session(str(qpid.datatypes.uuid4()))
+        session.exchange_declare(exchange=alternateExchangeName, type="direct", durable=True)
+        session.exchange_declare(exchange=exchangeName, type="direct", alternate_exchange=alternateExchangeName, durable=True)
+        connection.close()
+        broker.kill()
+
+        broker = self.broker(self.args(), name=brokerName)
+        connection = broker.connect_old()
+        session = connection.session(str(qpid.datatypes.uuid4()))
+        session.exchange_declare(exchange=alternateExchangeName, type="direct", durable=True, passive=True)
+        session.exchange_declare(exchange=exchangeName, type="direct", durable=True, passive=True)
+        # There is no AMQP support for directly querying exchanges for alternate-exchange (unlike queues)!!,
+        # so use QMF instead.
+        qmfSession = Session()
+        qmfBroker = qmfSession.addBroker("amqp://localhost:%d"%broker.port())
+        exchanges = qmfSession.getObjects(_class="exchange", _package="org.apache.qpid.broker")
+        for e in exchanges:
+            if e.name == exchangeName:
+                altExch = qmfSession.getObjects(_objectId=e.altExchange)
+                alternateExchangeNameProps = altExch[0].getProperties()
+                self.assertEqual(altExch[0].name, alternateExchangeName)
+         
+        connection.close()        
+        
+    def testQueueAlternateExchangeProperty(self):
+        """Queue alternate exchange property persistexchangeNamece test"""
+        
+        brokerName = "TestQueueAlternateExchange"
+        queueName = "TestQueue"
+        alternateExchangeName = "TestAlternateExchange"
+
+        broker = self.broker(self.args(), name=brokerName, expect=EXPECT_EXIT_FAIL)
+        # Use old API until new one can handle these operations
+        connection = broker.connect_old()
+        session = connection.session(str(qpid.datatypes.uuid4()))
+        session.exchange_declare(exchange=alternateExchangeName, type="direct", durable=True)
+        session.queue_declare(queue=queueName, alternate_exchange=alternateExchangeName, durable=True)
+        connection.close()
+        broker.kill()
+
+        broker = self.broker(self.args(), name=brokerName)
+        connection = broker.connect_old()
+        session = connection.session(str(qpid.datatypes.uuid4()))
+        session.exchange_declare(exchange=alternateExchangeName, type="direct", durable=True, passive=True)        
+        session.queue_declare(queue=queueName, alternate_exchange=alternateExchangeName, durable=True, passive=True)
+        self.assertEqual(session.queue_query(queue=queueName)["alternate_exchange"], alternateExchangeName)
+         
+        connection.close()        

Copied: store/trunk/cpp/tests/old_python_tests (from rev 3738, store/trunk/cpp/tests/python_tests)

Copied: store/trunk/cpp/tests/run_new_python_tests (from rev 3738, store/trunk/cpp/tests/run_python_tests)
===================================================================
--- store/trunk/cpp/tests/run_new_python_tests	                        (rev 0)
+++ store/trunk/cpp/tests/run_new_python_tests	2009-12-14 19:39:53 UTC (rev 3741)
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Copyright (c) 2008, 2009 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+. `dirname $0`/tests_env.sh
+
+echo "Running Python tests..."
+
+PYTHON_TESTS=${PYTHON_TESTS:-$*}
+
+OUTDIR=new_python_tests.tmp
+rm -rf $OUTDIR
+
+${PYTHON_DIR}/qpid-python-test -m new_python_tests -I ${FAILING_PYTHON_TESTS} ${PYTHON_TESTS} -DOUTDIR=$OUTDIR
+RETCODE=$?
+
+if test x${RETCODE} != x0; then 
+    exit 1;
+fi
+exit 0

Copied: store/trunk/cpp/tests/run_old_python_tests (from rev 3738, store/trunk/cpp/tests/run_python_tests)
===================================================================
--- store/trunk/cpp/tests/run_old_python_tests	                        (rev 0)
+++ store/trunk/cpp/tests/run_old_python_tests	2009-12-14 19:39:53 UTC (rev 3741)
@@ -0,0 +1,96 @@
+#!/bin/bash
+#
+# Copyright (c) 2008, 2009 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+if test x$1 == x"LONG_TEST"; then
+	echo "Running long tests..."
+	LONG_TEST=1
+fi
+
+if test -z ${QPID_DIR} ; then
+    cat <<EOF
+
+	===========  WARNING: PYTHON TESTS DISABLED ==============
+	
+	QPID_DIR not set.
+
+	===========================================================
+
+EOF
+	exit
+fi
+
+QPID_PYTHON_DIR=${QPID_DIR}/python
+export PYTHONPATH=${QPID_PYTHON_DIR}:${abs_srcdir}
+
+if python -c "import qpid" ; then
+	PYTHON_TESTS=
+	FAILING_PYTHON_TESTS=${abs_srcdir}/failing_python_tests.txt
+else
+    cat <<EOF
+
+	===========  WARNING: PYTHON TESTS DISABLED ==============
+	
+	Unable to load python qpid module - skipping python tests.
+	
+    QPID_DIR=${QPID_DIR}"
+    PYTHONPATH=${PYTHONPATH}"
+
+	===========================================================
+
+EOF
+    exit
+fi
+
+STORE_DIR=${TMP_DATA_DIR}/python
+
+#Make sure temp dir exists if this is the first to use it
+if test -d ${STORE_DIR} ; then
+    rm -rf ${STORE_DIR}
+fi
+mkdir -p ${STORE_DIR}
+
+if test -z ${QPIDD} ; then
+	export QPIDD=${QPID_BLD}/src/qpidd
+fi
+
+trap stop_broker INT TERM QUIT
+
+start_broker() {
+    ${QPIDD} --daemon --port 0 --no-module-dir --load-module=${STORE_LIB} --data-dir=${STORE_DIR} --auth=no --log-enable info+ --log-to-file ${STORE_DIR}/broker.python-test.log > qpidd.port
+    LOCAL_PORT=`cat qpidd.port`
+    echo "run_python_tests: Started qpidd on port ${LOCAL_PORT}"
+}
+
+stop_broker() {
+       echo "run_python_tests: Stopping broker on port ${LOCAL_PORT}"
+    ${QPIDD} -q --port ${LOCAL_PORT}
+}
+
+fail=0
+
+# Run all python tests
+start_broker
+$QPID_PYTHON_DIR/qpid-python-test -m old_python_tests -b localhost:$LOCAL_PORT -I ${FAILING_PYTHON_TESTS} ${PYTHON_TESTS} || { echo "FAIL python tests"; fail=1; }
+stop_broker || fail=1
+
+exit ${fail}

Deleted: store/trunk/cpp/tests/run_python_tests
===================================================================
--- store/trunk/cpp/tests/run_python_tests	2009-12-14 18:31:27 UTC (rev 3740)
+++ store/trunk/cpp/tests/run_python_tests	2009-12-14 19:39:53 UTC (rev 3741)
@@ -1,96 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2008, 2009 Red Hat, Inc.
-#
-# This file is part of the Qpid async store library msgstore.so.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
-# USA
-#
-# The GNU Lesser General Public License is available in the file COPYING.
-
-if test x$1 == x"LONG_TEST"; then
-	echo "Running long tests..."
-	LONG_TEST=1
-fi
-
-if test -z ${QPID_DIR} ; then
-    cat <<EOF
-
-	===========  WARNING: PYTHON TESTS DISABLED ==============
-	
-	QPID_DIR not set.
-
-	===========================================================
-
-EOF
-	exit
-fi
-
-QPID_PYTHON_DIR=${QPID_DIR}/python
-export PYTHONPATH=${QPID_PYTHON_DIR}:${abs_srcdir}
-
-if python -c "import qpid" ; then
-	PYTHON_TESTS=
-	FAILING_PYTHON_TESTS=${abs_srcdir}/failing_python_tests.txt
-else
-    cat <<EOF
-
-	===========  WARNING: PYTHON TESTS DISABLED ==============
-	
-	Unable to load python qpid module - skipping python tests.
-	
-    QPID_DIR=${QPID_DIR}"
-    PYTHONPATH=${PYTHONPATH}"
-
-	===========================================================
-
-EOF
-    exit
-fi
-
-STORE_DIR=${TMP_DATA_DIR}/python
-
-#Make sure temp dir exists if this is the first to use it
-if test -d ${STORE_DIR} ; then
-    rm -rf ${STORE_DIR}
-fi
-mkdir -p ${STORE_DIR}
-
-if test -z ${QPIDD} ; then
-	export QPIDD=${QPID_BLD}/src/qpidd
-fi
-
-trap stop_broker INT TERM QUIT
-
-start_broker() {
-    ${QPIDD} --daemon --port 0 --no-module-dir --load-module=${STORE_LIB} --data-dir=${STORE_DIR} --auth=no --log-enable info+ --log-to-file ${STORE_DIR}/broker.python-test.log > qpidd.port
-    LOCAL_PORT=`cat qpidd.port`
-    echo "run_python_tests: Started qpidd on port ${LOCAL_PORT}"
-}
-
-stop_broker() {
-       echo "run_python_tests: Stopping broker on port ${LOCAL_PORT}"
-    ${QPIDD} -q --port ${LOCAL_PORT}
-}
-
-fail=0
-
-# Run all python tests
-start_broker
-$QPID_PYTHON_DIR/qpid-python-test -m python_tests -b localhost:$LOCAL_PORT -I ${FAILING_PYTHON_TESTS} ${PYTHON_TESTS} || { echo "FAIL python tests"; fail=1; }
-stop_broker || fail=1
-
-exit ${fail}

Modified: store/trunk/cpp/tools/jrnl.py
===================================================================
--- store/trunk/cpp/tools/jrnl.py	2009-12-14 18:31:27 UTC (rev 3740)
+++ store/trunk/cpp/tools/jrnl.py	2009-12-14 19:39:53 UTC (rev 3741)
@@ -36,7 +36,7 @@
     __printchars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\\]^_`{\|}~ "
     
     # The @staticmethod declarations are not supported in RHEL4 (python 2.3.x)
-    # When RHEL4 support ends, replace these declarations and remove the old
+    # When RHEL4 support ends, restore these declarations and remove the older
     # staticmethod() declaration.
 
     #@staticmethod



More information about the rhmessaging-commits mailing list