rhmessaging commits: r3745 - mgmt/trunk/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-12-16 11:19:00 -0500 (Wed, 16 Dec 2009)
New Revision: 3745
Modified:
mgmt/trunk/wooly/python/wooly/__init__.py
mgmt/trunk/wooly/python/wooly/server.py
mgmt/trunk/wooly/python/wooly/util.py
Log:
Use a custom unique id function, since uuid4 is not available in python 2.4
Modified: mgmt/trunk/wooly/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/__init__.py 2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/__init__.py 2009-12-16 16:19:00 UTC (rev 3745)
@@ -8,7 +8,6 @@
from copy import copy
from urlparse import urlsplit
from time import gmtime
-from uuid import uuid4
from wooly.profile import *
from resources import ResourceFinder, StringCatalog
@@ -694,7 +693,7 @@
class ClientSession(object):
def __init__(self):
- self.id = str(uuid4())
+ self.id = unique_id()
self.created = datetime.now()
self.visited = None
Modified: mgmt/trunk/wooly/python/wooly/server.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/server.py 2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/server.py 2009-12-16 16:19:00 UTC (rev 3745)
@@ -2,8 +2,6 @@
from datetime import datetime, timedelta
from threading import Thread
from time import strptime
-from uuid import uuid4
-from base64 import decodestring
from parsley.threadingex import Lifecycle
from wooly import *
Modified: mgmt/trunk/wooly/python/wooly/util.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/util.py 2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/util.py 2009-12-16 16:19:00 UTC (rev 3745)
@@ -1,4 +1,13 @@
import logging
+import random
from datetime import datetime
from time import clock
+
+def unique_id():
+ bits0 = random.getrandbits(32)
+ bits1 = random.getrandbits(32)
+ bits2 = random.getrandbits(32)
+ bits3 = random.getrandbits(32)
+
+ return "%08x-%08x-%08x-%08x" % (bits0, bits1, bits2, bits3)
15 years
rhmessaging commits: r3744 - in mgmt/trunk/cumin/python/cumin: grid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2009-12-15 13:35:00 -0500 (Tue, 15 Dec 2009)
New Revision: 3744
Modified:
mgmt/trunk/cumin/python/cumin/grid/job.py
mgmt/trunk/cumin/python/cumin/grid/negotiator.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/parameters.py
Log:
Added QmfCall and QmfCallSet classes for synchronous qmf calls.
Modified: mgmt/trunk/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/job.py 2009-12-14 20:36:08 UTC (rev 3743)
+++ mgmt/trunk/cumin/python/cumin/grid/job.py 2009-12-15 18:35:00 UTC (rev 3744)
@@ -11,7 +11,7 @@
from cumin.stat import *
from cumin.formats import *
from cumin.util import *
-
+from cumin.model import FetchJobAd, FetchJobOutput
import main
strings = StringCatalog(__file__)
@@ -429,12 +429,9 @@
scheduler = sched
break
- action = self.app.model.job.GetAd
- return action.qmfcall(job)
-
if scheduler:
- action = self.app.model.scheduler.GetAd
- return action.qmfcall(scheduler, job.id)
+ action = FetchJobAd(self.app)
+ return action.execute(scheduler, job.id).data['JobAd']
else:
return () # XXX
@@ -689,9 +686,9 @@
job = self.frame.get_object(session)
file, start, end = self.get_file_args(session)
if file:
- action = self.app.model.scheduler.Fetch
- data = action.qmfcall(scheduler, job, file, start, end)
- return escape_entity(data)
+ action = FetchJobOutput(self.app)
+ result = action.execute(scheduler, job.id, file, start, end)
+ return escape_entity(result.data['Data'])
return self.err_msg
def get_file_args(self, session):
Modified: mgmt/trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-12-14 20:36:08 UTC (rev 3743)
+++ mgmt/trunk/cumin/python/cumin/grid/negotiator.py 2009-12-15 18:35:00 UTC (rev 3744)
@@ -11,6 +11,7 @@
from cumin.util import *
from submitter import SubmitterSet
+from cumin.model import FetchRawConfig, FetchRawConfigSet
import main
strings = StringCatalog(__file__)
@@ -314,8 +315,9 @@
groups = self.groups.get(session)
if len(groups) == 0:
negotiator = self.negotiator.get(session)
- action = self.app.model.negotiator.GetRawConfig
- groups = action.do_invoke(negotiator, "GROUP_NAMES", 10)
+ action = FetchRawConfig(self.app)
+ results = action.execute(negotiator, "GROUP_NAMES", timeout=10)
+ groups = results.data
try:
groups = self.split_group_names(groups['Value'])
except Exception, e:
@@ -342,11 +344,14 @@
if groups is None:
groups = self.get_group_names(session)
negotiator = self.negotiator.get(session)
- action = self.app.model.negotiator.GetConfigSet
+ action = FetchRawConfigSet(self.app)
+ raw_configs = action.execute(negotiator, groups, config, timeout=15)
- raw_configs = action.do_invoke(negotiator, groups, config, "GetRawConfig", timeout=15)
- for [group, data, status] in raw_configs:
- configs.append([group, data['Value'], status])
+ for group in sorted(raw_configs):
+ res = raw_configs[group]
+ configs.append([group, res.data['Value'],
+ (res.status, res.error, res.got_data)])
+
param.set(session, configs)
return configs
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-12-14 20:36:08 UTC (rev 3743)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-12-15 18:35:00 UTC (rev 3744)
@@ -2068,9 +2068,6 @@
prop = CuminProperty(self, "HoldReason")
prop.title = "Hold Reason"
- action = self.GetAd(self, "GetAd")
- action.navigable = False
-
def init(self):
super(CuminJob, self).init()
@@ -2079,7 +2076,6 @@
def get_title(self, session):
return "Job"
- def get_object_name(self, job):
if isinstance(job, basestring):
return job
else:
@@ -2092,16 +2088,6 @@
def render_status(self, session, status):
return JobStatusInfo.get_status_string(status)
- class GetAd(CuminAction):
- def qmfcall(self, job):
-
- default = {'JobAd': {"":{"VALUE":"", "TYPE":0}}}
- qmf = QMFCaller(default)
- job.GetAd(self.mint.model, qmf.get_completion(), None)
- wait(qmf.done, timeout=10)
-
- return qmf.data['JobAd']
-
class GetStartedAction(CuminAction):
def get_xml_response(self, session, object, *args):
updateTime = object.statsCurr and object.statsCurr.qmfUpdateTime \
@@ -2112,13 +2098,13 @@
return "%s%s" % (conf, rect)
-# XXX no, not this way
-class QMFCaller(object):
- def __init__(self, default):
+class QmfCall(object):
+ def __init__(self, app, default=None):
self.data = default
self.got_data = False
self.error = False
self.status = None
+ self.model = app.model.mint.model
def get_completion(self):
def completion(status, data):
@@ -2131,9 +2117,70 @@
return completion
+ def do_wait(self, timeout=5):
+ wait(self.done, timeout=timeout)
+ return self
+
def done(self):
return self.got_data or self.error
+class QmfCallSet(object):
+ def __init__(self, app):
+ self.app = app
+ self.calls = dict()
+
+ def add_call(self, key, default=None):
+ call = QmfCall(self.app, default)
+ self.calls[key] = call
+ return call
+
+ def do_wait(self, timeout=5):
+ def predicate(calls):
+ done = 0
+ for call in calls:
+ if calls[call].done():
+ done += 1
+ return done == len(calls)
+
+ wait(predicate, timeout=timeout, args=self.calls)
+ return self.calls
+
+class FetchRawConfig(QmfCall):
+ def __init_(self, app):
+ super(FetchRawConfig, self).__init__(app)
+ self.data = {'Value': None}
+
+ def execute(self, negotiator, config_name, timeout=5):
+ negotiator.GetRawConfig(self.model, self.get_completion(), config_name, None)
+ return self.do_wait(timeout)
+
+class FetchRawConfigSet(QmfCallSet):
+ def execute(self, negotiator, groups, prepend="", timeout=5):
+ default = {'Value': 0}
+ for group in groups:
+ call = self.add_call(group, default)
+ negotiator.GetRawConfig(call.model, call.get_completion(), prepend+group, None)
+
+ return self.do_wait(timeout)
+
+class FetchJobAd(QmfCall):
+ def __init__(self, app):
+ super(FetchJobAd, self).__init__(app)
+ self.data = {'JobAd': {"":{"VALUE":"", "TYPE":0}}}
+
+ def execute(self, scheduler, jobId, timeout=10):
+ scheduler.GetAd(self.model, self.get_completion(), jobId, None)
+ return self.do_wait(timeout)
+
+class FetchJobOutput(QmfCall):
+ def __init__(self, app):
+ super(FetchJobOutput, self).__init__(app)
+ self.data = {'Data': ""}
+
+ def execute(self, scheduler, jobId, file, start, end, timeout=10):
+ scheduler.Fetch(self.model, self.get_completion(), jobId, file, start, end, None)
+ return self.do_wait(timeout)
+
class CuminScheduler(RemoteClass):
def __init__(self, model):
super(CuminScheduler, self).__init__(model, "scheduler",
@@ -2182,12 +2229,6 @@
action = GetStartedAction(self, "GetStarted")
action.navigable = False
- action = self.GetAd(self, "GetAd")
- action.navigable = False
-
- action = self.Fetch(self, "Fetch")
- action.navigable = False
-
def init(self):
super(CuminScheduler, self).init()
@@ -2199,25 +2240,6 @@
def get_object_name(self, sched):
return sched.Name
- class Fetch(CuminAction):
- def qmfcall(self, scheduler, job, file, start, end):
- default = {'Data': ""}
- qmf = QMFCaller(default)
- scheduler.Fetch(self.mint.model, qmf.get_completion(), job.id, file, start, end, None)
- wait(qmf.done, timeout=10)
-
- return qmf.data['Data']
-
- class GetAd(CuminAction):
- def qmfcall(self, scheduler, job):
-
- default = {'JobAd': {"":{"VALUE":"", "TYPE":0}}}
- qmf = QMFCaller(default)
- scheduler.GetAd(self.mint.model, qmf.get_completion(), job, None)
- wait(qmf.done, timeout=10)
-
- return qmf.data['JobAd']
-
class CuminSubmission(RemoteClass):
def __init__(self, model):
super(CuminSubmission, self).__init__(model, "submission",
@@ -2367,12 +2389,6 @@
action = GetStartedAction(self, "GetStarted")
action.navigable = False
- action = self.GetConfigSet(self, "GetConfigSet")
- action.navigable = False
-
- action = self.GetRawConfig(self, "GetRawConfig")
- action.navigable = False
-
def init(self):
super(CuminNegotiator, self).init()
@@ -2384,40 +2400,6 @@
def get_object_name(self, neg):
return neg.Name
- class GetRawConfig(CuminAction):
- def do_invoke(self, negotiator, config_name, timeout=5):
- default = {'Value': None}
- qmf = QMFCaller(default)
- negotiator.GetRawConfig(self.mint.model, qmf.get_completion(), config_name, None)
- wait(qmf.done, timeout=timeout)
- return qmf.data
-
- class GetConfigSet(CuminAction):
- """ send a set of qmf requests at the same time and wait for
- them all to complete or timeout """
- def do_invoke(self, negotiator, groups, prepend="", method="GetStats", timeout=5):
- def predicate(calls):
- done = 0
- for call in calls:
- if call.done():
- done = done + 1
- return done == len(calls)
-
- calls = list()
- default = {'Value': 0}
- for group in groups:
- call = QMFCaller(default)
- calls.append(call)
- if method == "GetStats":
- negotiator.GetStats(self.mint.model, call.get_completion(), group, None)
- elif method == "GetRawConfig":
- negotiator.GetRawConfig(self.mint.model, call.get_completion(), prepend+group, None)
-
- wait(predicate, timeout=timeout, args=calls)
-
- return [(group, call.data, (call.status, call.error, call.got_data))
- for call, group in zip(calls, groups)]
-
class CuminSubject(CuminClass):
def __init__(self, model):
super(CuminSubject, self).__init__(model, "subject", Subject)
Modified: mgmt/trunk/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py 2009-12-14 20:36:08 UTC (rev 3743)
+++ mgmt/trunk/cumin/python/cumin/parameters.py 2009-12-15 18:35:00 UTC (rev 3744)
@@ -94,16 +94,10 @@
class JobParameter(Parameter):
def do_unmarshal(self, id):
- try:
- return Job.select("custom_id='%s'" % id)[0]
- except:
- return Job.get(id)
+ return Job.get(int(id))
def do_marshal(self, job):
- try:
- return str(job.id)
- except:
- return job.CustomId
+ return str(job.id)
class JobGroupParameter(Parameter):
def do_unmarshal(self, string):
15 years
rhmessaging commits: r3743 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-12-14 15:36:08 -0500 (Mon, 14 Dec 2009)
New Revision: 3743
Modified:
store/trunk/cpp/tests/run_new_python_tests
Log:
Fix to previous checkin - omitted check for correct python environment
Modified: store/trunk/cpp/tests/run_new_python_tests
===================================================================
--- store/trunk/cpp/tests/run_new_python_tests 2009-12-14 19:41:14 UTC (rev 3742)
+++ store/trunk/cpp/tests/run_new_python_tests 2009-12-14 20:36:08 UTC (rev 3743)
@@ -21,6 +21,19 @@
#
# The GNU Lesser General Public License is available in the file COPYING.
+if test -z ${QPID_DIR} ; then
+ cat <<EOF
+
+ =========== WARNING: PYTHON TESTS DISABLED ==============
+
+ QPID_DIR not set.
+
+ ===========================================================
+
+EOF
+ exit
+fi
+
. `dirname $0`/tests_env.sh
echo "Running Python tests..."
15 years
rhmessaging commits: r3742 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-12-14 14:41:14 -0500 (Mon, 14 Dec 2009)
New Revision: 3742
Added:
store/trunk/cpp/tests/tests_env.sh
Log:
Additional file omitted on previouis checkin
Added: store/trunk/cpp/tests/tests_env.sh
===================================================================
--- store/trunk/cpp/tests/tests_env.sh (rev 0)
+++ store/trunk/cpp/tests/tests_env.sh 2009-12-14 19:41:14 UTC (rev 3742)
@@ -0,0 +1,251 @@
+# 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.
+
+
+# --- Function definitions ---
+
+
+func_check_required_env ()
+#-------------------------
+# Check that EITHER:
+# QPID_DIR is set (for running against svn QPID)
+# OR
+# QPID_PREFIX is set (for running against installed QPID
+# Will exit with error code 1 if neither of these is defined.
+# Params: None
+# Returns: 0 if env vars ok, 1 otherwise
+{
+ if test -z "${QPID_DIR}" -a -z "${QPID_PREFIX}"; then
+ # Try to find qpidd in the normal installed location
+ if test -x /usr/sbin/qpidd; then
+ QPID_PREFIX=/usr
+ else
+ echo "ERROR: Could not find installed Qpid"
+ echo "Either of the following must be set in the environment for this script to run:"
+ echo " QPID_DIR for running against a Qpid svn build"
+ echo " QPID_PREFIX for running against an installed Qpid"
+ return 1
+ fi
+ fi
+ return 0
+}
+
+
+func_check_qpid_python ()
+#------------------------
+# Check that Qpid python environment is ok
+# Params: None
+# Returns: 0 if Python environment is ok; 1 otherwise
+{
+ if ! python -c "import qpid" ; then
+ cat <<EOF
+
+ =========== WARNING: PYTHON TESTS DISABLED ==============
+
+ Unable to load python qpid module - skipping python tests.
+
+ PYTHONPATH=${PYTHONPATH}
+
+ ===========================================================
+
+EOF
+ return 1
+ fi
+ return 0
+}
+
+
+func_set_env ()
+#--------------
+# Set up the environment based on value of ${QPID_DIR}: if ${QPID_DIR} exists, assume a svn checkout,
+# otherwise set up for an installed or prefix test.
+# Params: None
+# Returns: Nothing
+{
+ if test "${QPID_DIR}" -a -d "${QPID_DIR}" ; then
+ # QPID_DIR is defined for source tree builds by the --with-qpid-checkout configure option.
+ # QPID_BLD is defined as the build directory, either $QPID_DIR/cpp or separately specified with
+ # the --with-qpid-build option for VPATH builds.
+
+ # Check QPID_BLD is also set
+ if test -z ${QPID_BLD}; then
+ QPID_BLD="${QPID_DIR}/cpp"
+ fi
+
+ # Paths and dirs
+ PYTHON_DIR="${QPID_DIR}/python"
+ export PYTHONPATH="${PYTHON_DIR}":"${QPID_DIR}/cpp/src/tests":"${abs_srcdir}"
+
+ # Libraries
+
+ # Executables
+ export QPIDD_EXEC="${QPID_BLD}/src/qpidd"
+
+ # Test data
+
+ else
+ # Set up the environment based on value of ${QPID_PREFIX} for testing against an installed qpid
+ # Alternatively, make sure ${QPID_BIN_DIR}, ${QPID_SBIN_DIR}, ${QPID_LIB_DIR} and ${QPID_LIBEXEC_DIR} are set for
+ # the installed location.
+ if test "${QPID_PREFIX}" -a -d "${QPID_PREFIX}" ; then
+ QPID_BIN_DIR=${QPID_PREFIX}/bin
+ QPID_SBIN_DIR=${QPID_PREFIX}/sbin
+ QPID_LIB_DIR=${QPID_PREFIX}/lib
+ QPID_LIBEXEC_DIR=${QPID_PREFIX}/libexec
+ fi
+
+ # These four env vars must be set prior to calling this script
+ func_checkpaths QPID_BIN_DIR QPID_SBIN_DIR QPID_LIB_DIR QPID_LIBEXEC_DIR
+
+ # Paths and dirs
+ export PYTHON_DIR="${QPID_BIN_DIR}"
+ export PYTHONPATH="${PYTHONPATH}":"${QPID_LIB_DIR}/python":"${QPID_LIBEXEC_DIR}/qpid/tests":"${QPID_LIB_DIR}/python2.4"
+
+
+ # Libraries
+
+ # Executables
+ export QPIDD_EXEC="${QPID_SBIN_DIR}/qpidd"
+
+ # Test Data
+
+ fi
+
+}
+
+
+func_mk_data_dir ()
+#------------------
+# Create a data dir at ${TMP_DATA_DIR} if not present, clear it otherwise.
+# Set TMP_DATA_DIR if it is not set.
+# Params: None
+# Returns: Nothing
+{
+ if test -z "${TMP_DATA_DIR}"; then
+ TMP_DATA_DIR=/tmp/python_tests
+ echo "TMP_DATA_DIR not set; using ${TMP_DATA_DIR}"
+ fi
+
+ # Delete old test dirs if they exist
+ if test -d "${TMP_DATA_DIR}" ; then
+ rm -rf "${TMP_DATA_DIR}/*"
+ fi
+ mkdir -p "${TMP_DATA_DIR}"
+ export TMP_DATA_DIR
+}
+
+
+func_checkvar ()
+#---------------
+# Check that an environment var is set (ie non-zero length)
+# Params: $1 - env var to be checked
+# Returns: 0 = env var is set (ie non-zero length)
+# 1 = env var is not set
+{
+ local loc_VAR=$1
+ if test -z ${!loc_VAR}; then
+ echo "WARNING: environment variable ${loc_VAR} not set."
+ return 1
+ fi
+ return 0
+}
+
+
+func_checkpaths ()
+#-----------------
+# Check a list of paths (each can contain ':'-separated sub-list) is set and valid (ie each path exists as a dir)
+# Params: $@ - List of path env vars to be checked
+# Returns: Nothing
+{
+ local loc_PATHS=$@
+ for path in ${loc_PATHS}; do
+ func_checkvar ${path}
+ if test $? == 0; then
+ local temp_IFS=${IFS}
+ IFS=":"
+ local pl=${!path}
+ for p in ${pl[@]}; do
+ if test ! -d ${p}; then
+ echo "WARNING: Directory ${p} in var ${path} not found."
+ fi
+ done
+ IFS=${temp_IFS}
+ fi
+ done
+}
+
+
+func_checklibs ()
+#----------------
+# Check that a list of libs is set and valid (ie each lib exists as an executable file)
+# Params: $@ - List of lib values to be checked
+# Returns: Nothing
+{
+ local loc_LIBS=$@
+ for lib in ${loc_LIBS[@]}; do
+ func_checkvar ${lib}
+ if test $? == 0; then
+ if test ! -x ${!lib}; then
+ echo "WARNING: Library ${lib}=${!lib} not found."
+ fi
+ fi
+ done
+}
+
+
+func_checkexecs ()
+#-----------------
+# Check that a list of executable is set and valid (ie each exec exists as an executable file)
+# Params: $@ - List of exec values to be checked
+# Returns: Nothing
+{
+ local loc_EXECS=$@
+ for exec in ${loc_EXECS[@]}; do
+ func_checkvar ${exec}
+ if test $? == 0; then
+ if test ! -x ${!exec}; then
+ echo "WARNING: Executable ${exec}=${!exec} not found or is not executable."
+ fi
+ fi
+ done
+}
+
+
+#--- Start of script ---
+
+func_check_required_env || exit 1 # Cannot run, exit with error
+func_check_qpid_python || exit 0 # A warning, not a failure.
+
+srcdir=`dirname $0`
+if test -z ${abs_srcdir}; then
+ abs_srcdir=${srcdir}
+fi
+
+func_set_env
+func_mk_data_dir
+
+# Check expected environment vars are set
+func_checkpaths PYTHON_DIR PYTHONPATH TMP_DATA_DIR
+func_checklibs STORE_LIB
+func_checkexecs QPIDD_EXEC
+
+FAILING_PYTHON_TESTS="${abs_srcdir}/failing_python_tests.txt"
+
15 years
rhmessaging commits: r3741 - in store/trunk/cpp: tests/new_python_tests and 1 other directories.
by rhmessaging-commits@lists.jboss.org
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
15 years
rhmessaging commits: r3740 - in mgmt/trunk: wooly/python/wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-12-14 13:31:27 -0500 (Mon, 14 Dec 2009)
New Revision: 3740
Modified:
mgmt/trunk/cumin/python/cumin/grid/submission.py
mgmt/trunk/wooly/python/wooly/forms.py
mgmt/trunk/wooly/python/wooly/forms.strings
Log:
Add help text to the submission add form; enhance field form to show required and help text
Modified: mgmt/trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-12-14 16:19:49 UTC (rev 3739)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-12-14 18:31:27 UTC (rev 3740)
@@ -130,36 +130,46 @@
self.scheduler = SchedulerSelectField(app, "scheduler", self.pool)
self.scheduler.required = True
+ self.scheduler.help = "Create submission at this scheduler"
self.main.add_field(self.scheduler)
self.description = self.DescriptionField(app, "description")
self.description.input.size = 50
self.description.required = True
+ self.description.help = "This text will identify the submission"
self.main.add_field(self.description)
self.command = self.CommandField(app, "command")
self.command.input.columns = 50
self.command.required = True
+ self.command.help = "The path to the executable and any arguments"
self.main.add_field(self.command)
self.requirements = self.RequirementsField(app, "requirements")
self.requirements.input.columns = 50
+ self.requirements.help = "Attributes controlling where and when " + \
+ "this submission will run"
+
self.main.add_field(self.requirements)
self.directory = self.WorkingDirectoryField(app, "directory")
self.directory.input.size = 50
+ self.directory.help = "Run the process in this directory"
self.extra.add_field(self.directory)
self.stdin = self.StdinField(app, "stdin")
self.stdin.input.size = 50
+ self.stdin.help = "Get process input from this file"
self.extra.add_field(self.stdin)
self.stdout = self.StdoutField(app, "stdout")
self.stdout.input.size = 50
+ self.stdout.help = "Send process output to this file"
self.extra.add_field(self.stdout)
self.stderr = self.StderrField(app, "stderr")
self.stderr.input.size = 50
+ self.stderr.help = "Send error output to this file"
self.extra.add_field(self.stderr)
#self.options = self.OptionsField(app, "options")
Modified: mgmt/trunk/wooly/python/wooly/forms.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.py 2009-12-14 16:19:49 UTC (rev 3739)
+++ mgmt/trunk/wooly/python/wooly/forms.py 2009-12-14 18:31:27 UTC (rev 3740)
@@ -276,6 +276,7 @@
self.form = None
self.required = False
+ self.help = None
def init(self):
super(FormField, self).init()
@@ -289,8 +290,12 @@
def check(self, session):
pass
+ def render_required(self, session, *args):
+ if self.required:
+ return "<span style=\"color: #c33\">*</span>"
+
def render_help(self, session, *args):
- pass
+ return self.help
def render_form_field_class(self, session, *args):
return self.css_class
Modified: mgmt/trunk/wooly/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.strings 2009-12-14 16:19:49 UTC (rev 3739)
+++ mgmt/trunk/wooly/python/wooly/forms.strings 2009-12-14 18:31:27 UTC (rev 3740)
@@ -113,7 +113,7 @@
[FormField.html]
<tr>
<th>
- <div class="title">{title}</div>
+ <div class="title">{title}{required}</div>
<div class="help">{help}</div>
</th>
<td>{inputs}</td>
@@ -128,29 +128,29 @@
table.FormFieldSet > tbody > tr {
padding: 2em;
border-top: 1px dotted #ccc;
+ vertical-align: top;
}
table.FormFieldSet > tbody > tr > th,
table.FormFieldSet > tbody > tr > td {
- padding: 0.5em 0;
+ padding: 0.5em 0.5em 0.5em 0;
border-top: 1px dotted #ccc;
margin: 0.25em 0;
}
table.FormFieldSet > tbody > tr:first-child > th {
border-top: hidden;
- width: 25%;
+ width: 33%;
}
table.FormFieldSet > tbody > tr:first-child > td {
border-top: hidden;
- width: 75%;
+ width: 67%;
}
table.FormFieldSet > tbody > tr > th {
- width: 25%;
+ width: 33%;
text-align: left;
- vertical-align: top;
}
table.FormFieldSet > tbody > tr > th > div.title {
@@ -158,8 +158,13 @@
font-size: 0.9em;
}
+table.FormFieldSet > tbody > tr > th > div.help {
+ font-weight: normal;
+ font-size: 0.7em;
+}
+
table.FormFieldSet > tbody > tr > td {
- width: 75%;
+ width: 67%;
}
[FormFieldSet.html]
15 years
rhmessaging commits: r3739 - mgmt/trunk/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-12-14 11:19:49 -0500 (Mon, 14 Dec 2009)
New Revision: 3739
Modified:
mgmt/trunk/wooly/python/wooly/forms.strings
Log:
Make the show fields link a button
Modified: mgmt/trunk/wooly/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.strings 2009-12-11 18:51:55 UTC (rev 3738)
+++ mgmt/trunk/wooly/python/wooly/forms.strings 2009-12-14 16:19:49 UTC (rev 3739)
@@ -176,11 +176,18 @@
display: none;
}
+div.heading {
+ margin: 1em 0;
+}
+
[ShowableFieldSet.javascript]
(function() {
wooly.toggleFieldDisplay = function(id) {
elem = $(id);
- a = elem.getFirst("a");
+
+ div = elem.getFirst("div");
+ a = div.getFirst("a");
+
table = elem.getFirst("table");
if (table.getStyle("display") === "table") {
@@ -195,7 +202,9 @@
[ShowableFieldSet.html]
<div id="{id}" class="ShowableFieldSet">
- <a onclick="wooly.toggleFieldDisplay('{id}');">Show extra fields</a>
+ <div class="heading">
+ <a onclick="wooly.toggleFieldDisplay('{id}');" class="action">Show extra fields</a>
+ </div>
<table class="FormFieldSet">
<tbody>{fields}</tbody>
15 years
rhmessaging commits: r3738 - store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2009-12-11 13:51:55 -0500 (Fri, 11 Dec 2009)
New Revision: 3738
Modified:
store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp
store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.cpp
Log:
Regenerated management code
Modified: store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp 2009-12-07 19:35:29 UTC (rev 3737)
+++ store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp 2009-12-11 18:51:55 UTC (rev 3738)
@@ -127,7 +127,6 @@
buf.putShortString (packageName); // Package Name
buf.putShortString (className); // Class Name
buf.putBin128 (md5Sum); // Schema Hash
- buf.putOctet (0); // No Superclass
buf.putShort (13); // Config Element Count
buf.putShort (29); // Inst Element Count
buf.putShort (1); // Method Count
Modified: store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.cpp 2009-12-07 19:35:29 UTC (rev 3737)
+++ store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.cpp 2009-12-11 18:51:55 UTC (rev 3738)
@@ -111,7 +111,6 @@
buf.putShortString (packageName); // Package Name
buf.putShortString (className); // Class Name
buf.putBin128 (md5Sum); // Schema Hash
- buf.putOctet (0); // No Superclass
buf.putShort (11); // Config Element Count
buf.putShort (9); // Inst Element Count
buf.putShort (0); // Method Count
15 years
rhmessaging commits: r3737 - store/trunk/cpp/tools.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-12-07 14:35:29 -0500 (Mon, 07 Dec 2009)
New Revision: 3737
Modified:
store/trunk/cpp/tools/jrnl.py
Log:
Minor updates to jrnl.py
Modified: store/trunk/cpp/tools/jrnl.py
===================================================================
--- store/trunk/cpp/tools/jrnl.py 2009-12-07 18:44:06 UTC (rev 3736)
+++ store/trunk/cpp/tools/jrnl.py 2009-12-07 19:35:29 UTC (rev 3737)
@@ -53,7 +53,7 @@
formatData = staticmethod(formatData)
#@staticmethod
- def formatXid(xid, xidsize = None, uuidFormat = False):
+ def formatXid(xid, xidsize = None):
if xid == None and xidsize != None:
if xidsize > 0: raise Exception("Inconsistent XID size: xidsize=%d, xid=None" % xidsize)
return ""
@@ -475,9 +475,9 @@
def __str__(self):
return self.report(True, True)
- def add(self, fid, hdr):
+ def add(self, fid, hdr, lock = False):
if hdr.rid in self.__map.keys(): raise Exception("ERROR: Duplicate rid to EnqMap: rid=0x%x" % hdr.rid)
- self.__map[hdr.rid] = (fid, hdr, False)
+ self.__map[hdr.rid] = (fid, hdr, lock)
def contains(self, rid):
return rid in self.__map.keys()
15 years
rhmessaging commits: r3736 - in store/trunk/cpp: tests and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-12-07 13:44:06 -0500 (Mon, 07 Dec 2009)
New Revision: 3736
Modified:
store/trunk/cpp/lib/DataTokenImpl.cpp
store/trunk/cpp/lib/DataTokenImpl.h
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/jrnl/run-journal-tests
Log:
Fix for BZ 544426 - "Attempting to dequeue a transactionally locked record leaks memory". Also some code tidy-up and a fix to the long test run-jrnl-tests, which allows it to run stand-alone.
Modified: store/trunk/cpp/lib/DataTokenImpl.cpp
===================================================================
--- store/trunk/cpp/lib/DataTokenImpl.cpp 2009-12-03 21:01:30 UTC (rev 3735)
+++ store/trunk/cpp/lib/DataTokenImpl.cpp 2009-12-07 18:44:06 UTC (rev 3736)
@@ -25,8 +25,6 @@
using namespace mrg::msgstore;
-DataTokenImpl::DataTokenImpl():data_tok()
-{}
+DataTokenImpl::DataTokenImpl():data_tok() {}
-DataTokenImpl::~DataTokenImpl()
-{}
+DataTokenImpl::~DataTokenImpl() {}
Modified: store/trunk/cpp/lib/DataTokenImpl.h
===================================================================
--- store/trunk/cpp/lib/DataTokenImpl.h 2009-12-03 21:01:30 UTC (rev 3735)
+++ store/trunk/cpp/lib/DataTokenImpl.h 2009-12-07 18:44:06 UTC (rev 3736)
@@ -39,10 +39,8 @@
DataTokenImpl();
virtual ~DataTokenImpl();
- inline boost::intrusive_ptr<qpid::broker::PersistableMessage>& getSourceMessage()
- { return sourceMsg; }
- inline void setSourceMessage(const boost::intrusive_ptr<qpid::broker::PersistableMessage>& msg)
- { sourceMsg = msg; }
+ inline boost::intrusive_ptr<qpid::broker::PersistableMessage>& getSourceMessage() { return sourceMsg; }
+ inline void setSourceMessage(const boost::intrusive_ptr<qpid::broker::PersistableMessage>& msg) { sourceMsg = msg; }
};
} // namespace msgstore
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-12-03 21:01:30 UTC (rev 3735)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-12-07 18:44:06 UTC (rev 3736)
@@ -1522,7 +1522,6 @@
const PersistableQueue& queue)
{
boost::intrusive_ptr<DataTokenImpl> ddtokp(new DataTokenImpl);
- ddtokp->addRef();
ddtokp->setSourceMessage(msg);
ddtokp->set_external_rid(true);
ddtokp->set_rid(messageIdSequence.next());
@@ -1533,6 +1532,8 @@
TxnCtxt* txn = check(ctxt);
tid = txn->getXid();
}
+ // Manually increase the ref count, as raw pointers are used beyond this point
+ ddtokp->addRef();
try {
JournalImpl* jc = static_cast<JournalImpl*>(queue.getExternalQueueStore());
if (tid.empty()) {
@@ -1541,6 +1542,7 @@
jc->dequeue_txn_data_record(ddtokp.get(), tid);
}
} catch (const journal::jexception& e) {
+ ddtokp->release();
THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() + ": async_dequeue() failed: " + e.what());
}
}
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2009-12-03 21:01:30 UTC (rev 3735)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2009-12-07 18:44:06 UTC (rev 3736)
@@ -26,6 +26,7 @@
#include "MessageStoreImpl.h"
#include <iostream>
#include "MessageUtils.h"
+#include "StoreException.h"
#include "qpid/broker/Queue.h"
#include "qpid/broker/RecoveryManagerImpl.h"
#include "qpid/framing/AMQHeaderBody.h"
@@ -238,6 +239,42 @@
checkMsg(queueB, 0);
}
+boost::intrusive_ptr<Message> nonTxEnq(Queue::shared_ptr q)
+{
+ boost::intrusive_ptr<Message> msg = createMessage("Message", "exchange", "routingKey");
+ q->deliver(msg);
+ return msg;
+}
+
+QueuedMessage getMsg(Queue::shared_ptr q)
+{
+ boost::intrusive_ptr<Message> msg = q->get().payload;
+ BOOST_REQUIRE(msg);
+ QueuedMessage qm;
+ qm.payload = msg;
+ return qm;
+}
+
+void txDeq(Queue::shared_ptr q, QueuedMessage& qm, TransactionContext* tp)
+{
+ q->dequeue(tp, qm);
+}
+
+void testLock(Queue::shared_ptr q, QueuedMessage qm)
+{
+ try {
+ q->dequeue(0, qm);
+ BOOST_ERROR("Did not throw JERR_MAP_LOCKED exception as expected.");
+ }
+ catch (const mrg::msgstore::StoreException& e) {
+ if (std::strstr(e.what(), "JERR_MAP_LOCKED") == 0)
+ BOOST_ERROR("Unexpected StoreException: " << e.what());
+ }
+ catch (const std::exception& e) {
+ BOOST_ERROR("Unexpected exception: " << e.what());
+ }
+}
+
// === Test suite ===
QPID_AUTO_TEST_CASE(Commit)
@@ -312,4 +349,20 @@
cout << "ok" << endl;
}
+QPID_AUTO_TEST_CASE(LockedRecordTest)
+{
+ cout << test_filename << ".LockedRecordTest: " << flush;
+
+ setup<MessageStoreImpl>();
+ nonTxEnq(queueA);
+ std::auto_ptr<TransactionContext> txn = store->begin();
+ QueuedMessage qm = getMsg(queueA);
+ txDeq(queueA, qm, txn.get());
+ testLock(queueA, qm);
+ store->commit(*txn);
+ checkMsg(queueA, 0);
+
+ cout << "ok" << endl;
+}
+
QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/run-journal-tests
===================================================================
--- store/trunk/cpp/tests/jrnl/run-journal-tests 2009-12-03 21:01:30 UTC (rev 3735)
+++ store/trunk/cpp/tests/jrnl/run-journal-tests 2009-12-07 18:44:06 UTC (rev 3736)
@@ -21,13 +21,16 @@
#
# The GNU Lesser General Public License is available in the file COPYING.
+if test x${TMP_DATA_DIR} == x; then
+ export TMP_DATA_DIR=/tmp
+fi
fail=0
num_jrnls=3
# Run jtt using default test set
echo
echo "===== Mode 1: New journal instance, no recover ====="
-jtt/jtt --analyzer ../../tools/store_chk ${TMP_DATA_DIR} --csv jtt/jtt.csv --format-chk --num-jrnls ${num_jrnls} || fail=1
+jtt/jtt --analyzer ../../tools/store_chk --jrnl-dir ${TMP_DATA_DIR} --csv jtt/jtt.csv --format-chk --num-jrnls ${num_jrnls} || fail=1
rm -rf ${TMP_DATA_DIR}/test_0*
echo
echo "===== Mode 2: Re-use journal instance, no recover ====="
15 years