rhmessaging commits: r2102 - in store/trunk: specs and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-06-02 12:02:23 -0400 (Mon, 02 Jun 2008)
New Revision: 2102
Modified:
store/trunk/cpp/lib/gen/qpid/management/Journal.cpp
store/trunk/cpp/lib/gen/qpid/management/Journal.h
store/trunk/cpp/lib/gen/qpid/management/Store.cpp
store/trunk/cpp/lib/gen/qpid/management/Store.h
store/trunk/specs/management-schema.xml
Log:
Update to match schema-generation changes in qpid
Modified: store/trunk/cpp/lib/gen/qpid/management/Journal.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Journal.cpp 2008-06-02 14:29:56 UTC (rev 2101)
+++ store/trunk/cpp/lib/gen/qpid/management/Journal.cpp 2008-06-02 16:02:23 UTC (rev 2102)
@@ -36,7 +36,7 @@
string Journal::packageName = string ("mrgstore");
string Journal::className = string ("journal");
uint8_t Journal::md5Sum[16] =
- {0xef,0x11,0x33,0x24,0xfb,0x0,0x5e,0x3e,0xe5,0x3c,0x58,0x81,0x1f,0xfb,0x36,0x66};
+ {0xcd,0x98,0xdb,0x90,0xd7,0x0,0xc5,0x9f,0x17,0x0,0x50,0x0,0xfc,0xc2,0x45,0x86};
Journal::Journal (Manageable* _core) :
ManagementObject(_core)
@@ -99,12 +99,12 @@
buf.putShortString (packageName); // Package Name
buf.putShortString (className); // Class Name
buf.putBin128 (md5Sum); // Schema Hash
- buf.putShort (7); // Config Element Count
+ buf.putShort (8); // Config Element Count
buf.putShort (27); // Inst Element Count
buf.putShort (1); // Method Count
buf.putShort (0); // Event Count
- // Config Elements
+ // Properties
ft = FieldTable ();
ft.setString (NAME, "name");
ft.setInt (TYPE, TYPE_SSTR);
@@ -113,6 +113,13 @@
buf.put (ft);
ft = FieldTable ();
+ ft.setString (NAME, "queueRef");
+ ft.setInt (TYPE, TYPE_REF);
+ ft.setInt (ACCESS, ACCESS_RO);
+ ft.setInt (INDEX, 0);
+ buf.put (ft);
+
+ ft = FieldTable ();
ft.setString (NAME, "journalDirectory");
ft.setInt (TYPE, TYPE_SSTR);
ft.setInt (ACCESS, ACCESS_RO);
@@ -165,7 +172,7 @@
buf.put (ft);
- // Inst Elements
+ // Statistics
ft = FieldTable ();
ft.setString (NAME, "initialFileCount");
ft.setInt (TYPE, TYPE_U16);
@@ -382,6 +389,7 @@
writeTimestamps (buf);
buf.putShortString (name);
+ buf.putLongLong (queueRef);
buf.putShortString (journalDirectory);
buf.putShortString (journalBaseFileName);
buf.putLong (journalWritePageSize);
Modified: store/trunk/cpp/lib/gen/qpid/management/Journal.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Journal.h 2008-06-02 14:29:56 UTC (rev 2101)
+++ store/trunk/cpp/lib/gen/qpid/management/Journal.h 2008-06-02 16:02:23 UTC (rev 2102)
@@ -27,6 +27,7 @@
#include "qpid/management/ManagementObject.h"
#include "qpid/framing/FieldTable.h"
#include "qpid/framing/Uuid.h"
+#include "qpid/sys/AtomicCount.h"
namespace qpid {
namespace management {
@@ -39,8 +40,9 @@
static std::string className;
static uint8_t md5Sum[16];
- // Configuration Elements
+ // Properties
std::string name;
+ uint64_t queueRef;
std::string journalDirectory;
std::string journalBaseFileName;
uint32_t journalWritePageSize;
@@ -48,7 +50,7 @@
uint32_t journalReadPageSize;
uint32_t journalReadPages;
- // Instrumentation Elements
+ // Statistics
uint16_t initialFileCount;
uint32_t dataFileSize;
uint32_t journalCurrentFileCount;
@@ -96,6 +98,9 @@
Journal (Manageable* coreObject);
~Journal (void);
+ void setReference(uint64_t objectId) { queueRef = objectId; }
+
+
std::string getPackageName (void) { return packageName; }
std::string getClassName (void) { return className; }
uint8_t* getMd5Sum (void) { return md5Sum; }
@@ -109,6 +114,11 @@
name = val;
configChanged = true;
}
+ inline void set_queueRef (uint64_t val){
+ sys::Mutex::ScopedLock mutex(accessLock);
+ queueRef = val;
+ configChanged = true;
+ }
inline void set_journalDirectory (std::string val){
sys::Mutex::ScopedLock mutex(accessLock);
journalDirectory = val;
@@ -155,13 +165,19 @@
instChanged = true;
}
inline void inc_journalRecordDepth (uint32_t by = 1){
- journalRecordDepth += by;
+ if (by == 1)
+ ++journalRecordDepth;
+ else
+ journalRecordDepth += by;
if (journalRecordDepthHigh < journalRecordDepth)
journalRecordDepthHigh = journalRecordDepth;
instChanged = true;
}
inline void dec_journalRecordDepth (uint32_t by = 1){
- journalRecordDepth -= by;
+ if (by == 1)
+ journalRecordDepth--;
+ else
+ journalRecordDepth -= by;
if (journalRecordDepthLow > journalRecordDepth)
journalRecordDepthLow = journalRecordDepth;
instChanged = true;
@@ -176,11 +192,17 @@
instChanged = true;
}
inline void inc_journalRecordEnqueues (uint64_t by = 1){
- journalRecordEnqueues += by;
+ if (by == 1)
+ ++journalRecordEnqueues;
+ else
+ journalRecordEnqueues += by;
instChanged = true;
}
inline void dec_journalRecordEnqueues (uint64_t by = 1){
- journalRecordEnqueues -= by;
+ if (by == 1)
+ journalRecordEnqueues--;
+ else
+ journalRecordEnqueues -= by;
instChanged = true;
}
inline void set_journalRecordEnqueues (uint64_t val){
@@ -189,11 +211,17 @@
instChanged = true;
}
inline void inc_journalRecordDequeues (uint64_t by = 1){
- journalRecordDequeues += by;
+ if (by == 1)
+ ++journalRecordDequeues;
+ else
+ journalRecordDequeues += by;
instChanged = true;
}
inline void dec_journalRecordDequeues (uint64_t by = 1){
- journalRecordDequeues -= by;
+ if (by == 1)
+ journalRecordDequeues--;
+ else
+ journalRecordDequeues -= by;
instChanged = true;
}
inline void set_journalRecordDequeues (uint64_t val){
@@ -202,13 +230,19 @@
instChanged = true;
}
inline void inc_journalOutstandingAIOs (uint32_t by = 1){
- journalOutstandingAIOs += by;
+ if (by == 1)
+ ++journalOutstandingAIOs;
+ else
+ journalOutstandingAIOs += by;
if (journalOutstandingAIOsHigh < journalOutstandingAIOs)
journalOutstandingAIOsHigh = journalOutstandingAIOs;
instChanged = true;
}
inline void dec_journalOutstandingAIOs (uint32_t by = 1){
- journalOutstandingAIOs -= by;
+ if (by == 1)
+ journalOutstandingAIOs--;
+ else
+ journalOutstandingAIOs -= by;
if (journalOutstandingAIOsLow > journalOutstandingAIOs)
journalOutstandingAIOsLow = journalOutstandingAIOs;
instChanged = true;
@@ -223,13 +257,19 @@
instChanged = true;
}
inline void inc_journalFreeFileCount (uint32_t by = 1){
- journalFreeFileCount += by;
+ if (by == 1)
+ ++journalFreeFileCount;
+ else
+ journalFreeFileCount += by;
if (journalFreeFileCountHigh < journalFreeFileCount)
journalFreeFileCountHigh = journalFreeFileCount;
instChanged = true;
}
inline void dec_journalFreeFileCount (uint32_t by = 1){
- journalFreeFileCount -= by;
+ if (by == 1)
+ journalFreeFileCount--;
+ else
+ journalFreeFileCount -= by;
if (journalFreeFileCountLow > journalFreeFileCount)
journalFreeFileCountLow = journalFreeFileCount;
instChanged = true;
@@ -244,13 +284,19 @@
instChanged = true;
}
inline void inc_journalAvailableFileCount (uint32_t by = 1){
- journalAvailableFileCount += by;
+ if (by == 1)
+ ++journalAvailableFileCount;
+ else
+ journalAvailableFileCount += by;
if (journalAvailableFileCountHigh < journalAvailableFileCount)
journalAvailableFileCountHigh = journalAvailableFileCount;
instChanged = true;
}
inline void dec_journalAvailableFileCount (uint32_t by = 1){
- journalAvailableFileCount -= by;
+ if (by == 1)
+ journalAvailableFileCount--;
+ else
+ journalAvailableFileCount -= by;
if (journalAvailableFileCountLow > journalAvailableFileCount)
journalAvailableFileCountLow = journalAvailableFileCount;
instChanged = true;
@@ -265,11 +311,17 @@
instChanged = true;
}
inline void inc_journalWriteWaitFailures (uint64_t by = 1){
- journalWriteWaitFailures += by;
+ if (by == 1)
+ ++journalWriteWaitFailures;
+ else
+ journalWriteWaitFailures += by;
instChanged = true;
}
inline void dec_journalWriteWaitFailures (uint64_t by = 1){
- journalWriteWaitFailures -= by;
+ if (by == 1)
+ journalWriteWaitFailures--;
+ else
+ journalWriteWaitFailures -= by;
instChanged = true;
}
inline void set_journalWriteWaitFailures (uint64_t val){
@@ -278,11 +330,17 @@
instChanged = true;
}
inline void inc_journalWriteBusyFailures (uint64_t by = 1){
- journalWriteBusyFailures += by;
+ if (by == 1)
+ ++journalWriteBusyFailures;
+ else
+ journalWriteBusyFailures += by;
instChanged = true;
}
inline void dec_journalWriteBusyFailures (uint64_t by = 1){
- journalWriteBusyFailures -= by;
+ if (by == 1)
+ journalWriteBusyFailures--;
+ else
+ journalWriteBusyFailures -= by;
instChanged = true;
}
inline void set_journalWriteBusyFailures (uint64_t val){
@@ -291,11 +349,17 @@
instChanged = true;
}
inline void inc_journalReadRecordCount (uint64_t by = 1){
- journalReadRecordCount += by;
+ if (by == 1)
+ ++journalReadRecordCount;
+ else
+ journalReadRecordCount += by;
instChanged = true;
}
inline void dec_journalReadRecordCount (uint64_t by = 1){
- journalReadRecordCount -= by;
+ if (by == 1)
+ journalReadRecordCount--;
+ else
+ journalReadRecordCount -= by;
instChanged = true;
}
inline void set_journalReadRecordCount (uint64_t val){
@@ -304,11 +368,17 @@
instChanged = true;
}
inline void inc_journalReadBusyFailures (uint64_t by = 1){
- journalReadBusyFailures += by;
+ if (by == 1)
+ ++journalReadBusyFailures;
+ else
+ journalReadBusyFailures += by;
instChanged = true;
}
inline void dec_journalReadBusyFailures (uint64_t by = 1){
- journalReadBusyFailures -= by;
+ if (by == 1)
+ journalReadBusyFailures--;
+ else
+ journalReadBusyFailures -= by;
instChanged = true;
}
inline void set_journalReadBusyFailures (uint64_t val){
@@ -317,13 +387,19 @@
instChanged = true;
}
inline void inc_journalWritePageCacheDepth (uint32_t by = 1){
- journalWritePageCacheDepth += by;
+ if (by == 1)
+ ++journalWritePageCacheDepth;
+ else
+ journalWritePageCacheDepth += by;
if (journalWritePageCacheDepthHigh < journalWritePageCacheDepth)
journalWritePageCacheDepthHigh = journalWritePageCacheDepth;
instChanged = true;
}
inline void dec_journalWritePageCacheDepth (uint32_t by = 1){
- journalWritePageCacheDepth -= by;
+ if (by == 1)
+ journalWritePageCacheDepth--;
+ else
+ journalWritePageCacheDepth -= by;
if (journalWritePageCacheDepthLow > journalWritePageCacheDepth)
journalWritePageCacheDepthLow = journalWritePageCacheDepth;
instChanged = true;
@@ -338,13 +414,19 @@
instChanged = true;
}
inline void inc_journalReadPageCacheDepth (uint32_t by = 1){
- journalReadPageCacheDepth += by;
+ if (by == 1)
+ ++journalReadPageCacheDepth;
+ else
+ journalReadPageCacheDepth += by;
if (journalReadPageCacheDepthHigh < journalReadPageCacheDepth)
journalReadPageCacheDepthHigh = journalReadPageCacheDepth;
instChanged = true;
}
inline void dec_journalReadPageCacheDepth (uint32_t by = 1){
- journalReadPageCacheDepth -= by;
+ if (by == 1)
+ journalReadPageCacheDepth--;
+ else
+ journalReadPageCacheDepth -= by;
if (journalReadPageCacheDepthLow > journalReadPageCacheDepth)
journalReadPageCacheDepthLow = journalReadPageCacheDepth;
instChanged = true;
Modified: store/trunk/cpp/lib/gen/qpid/management/Store.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Store.cpp 2008-06-02 14:29:56 UTC (rev 2101)
+++ store/trunk/cpp/lib/gen/qpid/management/Store.cpp 2008-06-02 16:02:23 UTC (rev 2102)
@@ -35,7 +35,7 @@
string Store::packageName = string ("mrgstore");
string Store::className = string ("store");
uint8_t Store::md5Sum[16] =
- {0x67,0x86,0x77,0xd2,0x1e,0x27,0x3e,0x46,0xf9,0xec,0x38,0xa4,0x9a,0xf5,0xf9,0x89};
+ {0x91,0xcf,0xc4,0xa7,0x9b,0x4a,0x2a,0x88,0x32,0x6f,0xef,0xec,0x82,0xd7,0x12,0x6a};
Store::Store (Manageable* _core, Manageable* _parent) :
ManagementObject(_core)
@@ -76,7 +76,7 @@
buf.putShort (0); // Method Count
buf.putShort (0); // Event Count
- // Config Elements
+ // Properties
ft = FieldTable ();
ft.setString (NAME, "brokerRef");
ft.setInt (TYPE, TYPE_REF);
@@ -119,7 +119,7 @@
buf.put (ft);
- // Inst Elements
+ // Statistics
// Methods
Modified: store/trunk/cpp/lib/gen/qpid/management/Store.h
===================================================================
--- store/trunk/cpp/lib/gen/qpid/management/Store.h 2008-06-02 14:29:56 UTC (rev 2101)
+++ store/trunk/cpp/lib/gen/qpid/management/Store.h 2008-06-02 16:02:23 UTC (rev 2102)
@@ -27,6 +27,7 @@
#include "qpid/management/ManagementObject.h"
#include "qpid/framing/FieldTable.h"
#include "qpid/framing/Uuid.h"
+#include "qpid/sys/AtomicCount.h"
namespace qpid {
namespace management {
@@ -39,14 +40,14 @@
static std::string className;
static uint8_t md5Sum[16];
- // Configuration Elements
+ // Properties
uint64_t brokerRef;
std::string location;
uint8_t async;
uint16_t defaultInitialFileCount;
uint32_t defaultDataFileSize;
- // Instrumentation Elements
+ // Statistics
// Private Methods
static void writeSchema (qpid::framing::Buffer& buf);
@@ -69,6 +70,8 @@
Store (Manageable* coreObject, Manageable* _parent);
~Store (void);
+
+
std::string getPackageName (void) { return packageName; }
std::string getClassName (void) { return className; }
uint8_t* getMd5Sum (void) { return md5Sum; }
Modified: store/trunk/specs/management-schema.xml
===================================================================
--- store/trunk/specs/management-schema.xml 2008-06-02 14:29:56 UTC (rev 2101)
+++ store/trunk/specs/management-schema.xml 2008-06-02 16:02:23 UTC (rev 2102)
@@ -3,42 +3,43 @@
<!--
License Text
-->
- <class name="store">
- <configElement name="brokerRef" type="objId" access="RO" index="y" parentRef="y"/>
- <configElement name="location" type="sstr" access="RO" desc="Logical directory on disk"/>
- <configElement name="async" type="bool" access="RO" desc="Asynchronous IO"/>
- <configElement name="defaultInitialFileCount" type="uint16" access="RO" unit="file" desc="Default number of files initially allocated to each journal"/>
- <configElement name="defaultDataFileSize" type="uint32" access="RO" unit="RdPg" desc="Default size of each journal data file"/>
+ <class name="Store">
+ <property name="brokerRef" type="objId" references="qpid.Broker" access="RO" index="y" parentRef="y"/>
+ <property name="location" type="sstr" access="RO" desc="Logical directory on disk"/>
+ <property name="async" type="bool" access="RO" desc="Asynchronous IO"/>
+ <property name="defaultInitialFileCount" type="uint16" access="RO" unit="file" desc="Default number of files initially allocated to each journal"/>
+ <property name="defaultDataFileSize" type="uint32" access="RO" unit="RdPg" desc="Default size of each journal data file"/>
</class>
- <class name="journal">
- <configElement name="name" type="sstr" access="RO" index="y"/>
- <configElement name="journalDirectory" type="sstr" access="RO" desc="Directory containing journal files"/>
- <configElement name="journalBaseFileName" type="sstr" access="RO" desc="Base filename prefix for journal"/>
- <configElement name="journalWritePageSize" type="uint32" access="RO" unit="byte" desc="Page size in write-page-cache"/>
- <configElement name="journalWritePages" type="uint32" access="RO" unit="wpage" desc="Number of pages in write-page-cache"/>
- <configElement name="journalReadPageSize" type="uint32" access="RO" unit="byte" desc="Page size in read-page-cache"/>
- <configElement name="journalReadPages" type="uint32" access="RO" unit="rpage" desc="Number of pages in read-page-cache"/>
+ <class name="Journal">
+ <property name="name" type="sstr" access="RO" index="y"/>
+ <property name="queueRef" type="objId" access="RO" references="qpid.Queue" isGeneralReference="y"/>
+ <property name="journalDirectory" type="sstr" access="RO" desc="Directory containing journal files"/>
+ <property name="journalBaseFileName" type="sstr" access="RO" desc="Base filename prefix for journal"/>
+ <property name="journalWritePageSize" type="uint32" access="RO" unit="byte" desc="Page size in write-page-cache"/>
+ <property name="journalWritePages" type="uint32" access="RO" unit="wpage" desc="Number of pages in write-page-cache"/>
+ <property name="journalReadPageSize" type="uint32" access="RO" unit="byte" desc="Page size in read-page-cache"/>
+ <property name="journalReadPages" type="uint32" access="RO" unit="rpage" desc="Number of pages in read-page-cache"/>
- <instElement name="initialFileCount" type="uint16" unit="file" desc="Number of files initially allocated to this journal"/>
- <instElement name="dataFileSize" type="uint32" unit="byte" desc="Size of each journal data file"/>
- <instElement name="journalCurrentFileCount" type="uint32" unit="file" desc="Number of files currently allocated to this journal"/>
- <instElement name="journalRecordDepth" type="hilo32" unit="record" desc="Number of enqueued records (durable messages)"/>
- <instElement name="journalRecordEnqueues" type="count64" unit="record" desc="Total enqueued records on journal"/>
- <instElement name="journalRecordDequeues" type="count64" unit="record" desc="Total dequeued records on journal"/>
- <instElement name="journalOutstandingAIOs" type="hilo32" unit="aio_op" desc="Number of outstanding AIO requests in Async IO system"/>
+ <statistic name="initialFileCount" type="uint16" unit="file" desc="Number of files initially allocated to this journal"/>
+ <statistic name="dataFileSize" type="uint32" unit="byte" desc="Size of each journal data file"/>
+ <statistic name="journalCurrentFileCount" type="uint32" unit="file" desc="Number of files currently allocated to this journal"/>
+ <statistic name="journalRecordDepth" type="hilo32" unit="record" desc="Number of enqueued records (durable messages)"/>
+ <statistic name="journalRecordEnqueues" type="count64" unit="record" desc="Total enqueued records on journal"/>
+ <statistic name="journalRecordDequeues" type="count64" unit="record" desc="Total dequeued records on journal"/>
+ <statistic name="journalOutstandingAIOs" type="hilo32" unit="aio_op" desc="Number of outstanding AIO requests in Async IO system"/>
<!--
The following are not yet "wired up" in JournalImpl.cpp
-->
- <instElement name="journalFreeFileCount" type="hilo32" unit="file" desc="Number of files free on this journal. Includes free files trapped in holes."/>
- <instElement name="journalAvailableFileCount" type="hilo32" unit="file" desc="Number of files available to be written. Excluding holes"/>
- <instElement name="journalWriteWaitFailures" type="count64" unit="record" desc="AIO Wait failures on write"/>
- <instElement name="journalWriteBusyFailures" type="count64" unit="record" desc="AIO Busy failures on write"/>
- <instElement name="journalReadRecordCount" type="count64" unit="record" desc="Records read from the journal"/>
- <instElement name="journalReadBusyFailures" type="count64" unit="record" desc="AIO Busy failures on read"/>
- <instElement name="journalWritePageCacheDepth" type="hilo32" unit="wpage" desc="Current depth of write-page-cache"/>
- <instElement name="journalReadPageCacheDepth" type="hilo32" unit="rpage" desc="Current depth of read-page-cache"/>
+ <statistic name="journalFreeFileCount" type="hilo32" unit="file" desc="Number of files free on this journal. Includes free files trapped in holes."/>
+ <statistic name="journalAvailableFileCount" type="hilo32" unit="file" desc="Number of files available to be written. Excluding holes"/>
+ <statistic name="journalWriteWaitFailures" type="count64" unit="record" desc="AIO Wait failures on write"/>
+ <statistic name="journalWriteBusyFailures" type="count64" unit="record" desc="AIO Busy failures on write"/>
+ <statistic name="journalReadRecordCount" type="count64" unit="record" desc="Records read from the journal"/>
+ <statistic name="journalReadBusyFailures" type="count64" unit="record" desc="AIO Busy failures on read"/>
+ <statistic name="journalWritePageCacheDepth" type="hilo32" unit="wpage" desc="Current depth of write-page-cache"/>
+ <statistic name="journalReadPageCacheDepth" type="hilo32" unit="rpage" desc="Current depth of read-page-cache"/>
<method name="expand" desc="Increase number of files allocated for this journal">
<arg name="by" type="uint32" dir="I" desc="Number of files to increase journal size by"/>
16 years, 7 months
rhmessaging commits: r2101 - in store/branches/java/M2.x/java/bdbstore: src/test/java/org/apache/qpid/server/store/berkeleydb and 3 other directories.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-06-02 10:29:56 -0400 (Mon, 02 Jun 2008)
New Revision: 2101
Added:
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/QueueDeleteWhilstRoutingTest.java
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/BDBVMTestCase.java
Modified:
store/branches/java/M2.x/java/bdbstore/pom.xml
store/branches/java/M2.x/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java
Log:
QPID-1101, QPID-1103 :Added BDBVMTestCase to allow the clean up of BDB files on disk for InVM brokers based using persistentn configuration. Updated StoreContextRaceConditionTest.java to utilise these methods.
QueueDeleteWhilstRoutingTest added to check against one cause of MetaData exceptions.
BDBStoreTest.java also edited to extends BDBVMTestCase.java to utilise deleteDirectory method.
Known issues: VMTestCase still creates an inVMBroker in the setUp method. This is to easy development on Qpid M2x but results in additional work directory being created on disk.
Modified: store/branches/java/M2.x/java/bdbstore/pom.xml
===================================================================
--- store/branches/java/M2.x/java/bdbstore/pom.xml 2008-05-30 20:41:48 UTC (rev 2100)
+++ store/branches/java/M2.x/java/bdbstore/pom.xml 2008-06-02 14:29:56 UTC (rev 2101)
@@ -52,10 +52,6 @@
</dependency>
<dependency>
<groupId>org.apache.qpid</groupId>
- <artifactId>qpid-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.qpid</groupId>
<artifactId>qpid-perftests</artifactId>
</dependency>
<dependency>
@@ -88,12 +84,24 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <forkMode>always</forkMode>
<systemProperties>
<property>
<name>QPID_HOME</name>
- <value>${basedir}/${topDirectoryLocation}/broker</value>
+ <value>${basedir}\${topDirectoryLocation}\broker</value>
</property>
+ <property>
+ <name>BDB_WORK</name>
+ <value>${basedir}\${topDirectoryLocation}\bdbstore\target\qpidWork</value>
+ </property>
+ <property>
+ <name>amqj.logging.level</name>
+ <value>${amqj.logging.level}</value>
+ </property>
</systemProperties>
+ <excludes>
+ <exclude>**/BDBVMTestCase.class</exclude>
+ </excludes>
</configuration>
</plugin>
Modified: store/branches/java/M2.x/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java
===================================================================
--- store/branches/java/M2.x/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-05-30 20:41:48 UTC (rev 2100)
+++ store/branches/java/M2.x/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBStoreTest.java 2008-06-02 14:29:56 UTC (rev 2101)
@@ -19,36 +19,40 @@
import com.sleepycat.je.DatabaseException;
import junit.framework.Assert;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.log4j.Logger;
import org.apache.mina.common.ByteBuffer;
import org.apache.qpid.AMQException;
-import org.apache.qpid.framing.*;
-import org.apache.qpid.framing.abstraction.MessagePublishInfo;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.BasicContentHeaderProperties;
+import org.apache.qpid.framing.ContentHeaderBody;
+import org.apache.qpid.framing.MethodRegistry;
+import org.apache.qpid.framing.ProtocolVersion;
import org.apache.qpid.framing.abstraction.ContentChunk;
+import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.server.RequiredDeliveryException;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-import org.apache.qpid.server.store.StoreContext;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.MessageMetaData;
-import org.apache.qpid.server.queue.QueueRegistry;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.store.StoreContext;
import org.apache.qpid.server.txn.NonTransactionalContext;
import org.apache.qpid.server.txn.TransactionalContext;
import org.apache.qpid.server.util.NullApplicationRegistry;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.etp.qpid.testutil.BDBVMTestCase;
import java.io.File;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.HashSet;
-public class BDBStoreTest extends TestCase
+public class BDBStoreTest extends BDBVMTestCase
{
private static final Logger _log = Logger.getLogger(BDBStoreTest.class);
private BDBMessageStore _store;
+ private String STORE_LOCATION = System.getProperty("BDB_WORK") + "/bdbTestEnv";
private StoreContext _storeContext = new StoreContext();
private VirtualHost _virtualHost;
@@ -65,16 +69,10 @@
{
ApplicationRegistry.initialise(new NullApplicationRegistry());
- File bdbDir = new File("bdbTestEnv");
- if (bdbDir.exists())
- {
- File[] entries = bdbDir.listFiles();
- for (File f : entries)
- {
- f.delete();
- }
- bdbDir.delete();
- }
+ File bdbDir = new File(STORE_LOCATION);
+
+ deleteDirectory(bdbDir);
+
bdbDir.mkdirs();
_store = new BDBMessageStore();
@@ -386,7 +384,7 @@
PropertiesConfiguration env = new PropertiesConfiguration();
- env.addProperty("store.environment-path", "bdbTestEnv");
+ env.addProperty("store.environment-path", STORE_LOCATION);
env.addProperty("store.class", "org.apache.qpid.server.store.berkeleydb.BDBMessageStore");
_virtualHost = new VirtualHost("test", env);
Added: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/QueueDeleteWhilstRoutingTest.java
===================================================================
--- store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/QueueDeleteWhilstRoutingTest.java (rev 0)
+++ store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/QueueDeleteWhilstRoutingTest.java 2008-06-02 14:29:56 UTC (rev 2101)
@@ -0,0 +1,206 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with 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.
+ *
+ */
+package org.etp.qpid.server;
+
+import org.apache.log4j.Logger;
+import org.etp.qpid.testutil.BDBVMTestCase;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.NamingException;
+import java.io.File;
+
+public class QueueDeleteWhilstRoutingTest extends BDBVMTestCase
+{
+ private static final Logger _logger = Logger.getLogger(QueueDeleteWhilstRoutingTest.class);
+
+ protected Queue _queue;
+ MessageConsumer _consumer1, _consumer2;
+ Session _clientSession1;
+ Connection _producerConnection, _clientConnection1;
+
+ int brokerID = 2;
+
+ /**
+ * Issue analysis:
+ * When an Exclusive NonDurable queue is created a queueDelete task is added to the sessionCloseTaskList
+ * When the last consumer on an autodelete queue closes queueDelete is called.
+ *
+ * Hence the queue is delted twice. Which would hurt the ref counting of all messages in the consumers
+ * unacked map
+ *
+ * Test Plan:
+ *
+ * Create two subscribers same topic
+ *
+ * Send two messages
+ *
+ * consume one from each consumer to validate that all is good
+ *
+ * Shutdown persistent broker
+ *
+ * restart.
+ *
+ * Expecting failure in broker startup.
+ */
+ public void test() throws NamingException, JMSException
+ {
+ _logger.debug("Performing receives");
+
+ Message msg1 = _consumer1.receive(1000);
+
+ assertNotNull(msg1);
+
+ //Check message recevied ok
+ assertEquals("Message 1 not received on consumer 1", "Message: 1", ((TextMessage) msg1).getText());
+
+ _consumer1.close();
+
+ _clientConnection1.close();
+
+ _producerConnection.close();
+
+ try
+ {
+ _logger.debug("Shutdown broker in 1 second");
+ Thread.sleep(4000);
+ }
+ catch (InterruptedException e)
+ {
+ fail(e.getMessage());
+ }
+
+ //Stop the broker
+ stopVMBroker(brokerID);
+
+ try
+ {
+ _logger.debug("Restart broker in 2 second");
+ Thread.sleep(4000);
+ }
+ catch (InterruptedException e)
+ {
+ fail(e.getMessage());
+ }
+
+ //Start the broker
+ try
+ {
+ startVMBroker(brokerID, _persistentConfigFile);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ //Test Connection
+ _clientConnection1 = ((ConnectionFactory) _context.lookup("connection2")).createConnection();
+
+ _clientConnection1.close();
+ }
+
+ public void setUp() throws Exception
+ {
+ _connections.put("connection2", "amqp://guest:guest@" + this.getClass().getName() + "/test?brokerlist='vm://:" + brokerID + "'");
+
+ super.setUp();
+
+ startVMBroker(brokerID, _persistentConfigFile);
+
+ // Initialise ACLs.
+
+ //Create Consumers
+ //Create consumer on the temp queue
+ Queue requestQueue = (Queue) _context.lookup("queue");
+
+ _clientConnection1 = ((ConnectionFactory) _context.lookup("connection2")).createConnection();
+ _clientSession1 = _clientConnection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ _queue = _clientSession1.createTemporaryQueue();
+
+ _consumer1 = _clientSession1.createConsumer(_queue);
+
+ //Start the connection
+ _clientConnection1.start();
+
+ //Create Producer
+ _producerConnection = ((ConnectionFactory) _context.lookup("connection2")).createConnection();
+ final Session producerSession = _producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Create a listener for the messages
+ producerSession.createConsumer(requestQueue).setMessageListener(new MessageListener()
+ {
+ public void onMessage(final Message message)
+ {
+ try
+ {
+ Destination responseQueue = message.getJMSReplyTo();
+
+ //Send a response to the message
+ producerSession.createProducer(responseQueue)
+ .send(producerSession.createTextMessage(((TextMessage) message).getText()));
+ }
+ catch (JMSException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+ });
+ //Start the connection
+ _producerConnection.start();
+
+ //Send two messages
+
+ MessageProducer _clientProducer = _clientSession1.createProducer(requestQueue);
+ Message msg = _clientSession1.createTextMessage("Message: 1");
+ msg.setJMSReplyTo(_queue);
+ _clientProducer.send(msg);
+
+ msg = _clientSession1.createTextMessage("Message: 2");
+ msg.setJMSReplyTo(_queue);
+ _clientProducer.send(msg);
+ }
+
+ public void tearDown() throws Exception
+ {
+ //Stop the broker
+ try
+ {
+ stopVMBroker(brokerID);
+ }
+ catch (Exception e)
+ {
+ fail(e.getMessage());
+ }
+
+ super.tearDown();
+ }
+
+}
Property changes on: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/QueueDeleteWhilstRoutingTest.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java
===================================================================
--- store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java 2008-05-30 20:41:48 UTC (rev 2100)
+++ store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/server/StoreContextRaceConditionTest.java 2008-06-02 14:29:56 UTC (rev 2101)
@@ -24,11 +24,10 @@
import org.apache.commons.configuration.Configuration;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.log4j.BasicConfigurator;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.test.VMTestCase;
+import org.etp.qpid.testutil.BDBVMTestCase;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -41,7 +40,7 @@
import javax.naming.NamingException;
import java.io.File;
-public class StoreContextRaceConditionTest extends VMTestCase
+public class StoreContextRaceConditionTest extends BDBVMTestCase
{
private static final Logger _logger = Logger.getLogger(StoreContextRaceConditionTest.class);
private long _TimeToLive = 0L;
@@ -55,26 +54,13 @@
{
//Disable the logging
_loggingOriginal = System.getProperty(LOGGING_KEY);
- System.setProperty(LOGGING_KEY, "WARN");
+ System.setProperty(LOGGING_KEY, Level.WARN.toString());
- // Initialise ACLs.
- final String qpidHome = System.getProperty("QPID_HOME");
+ //Set the Work Directory
+ setupWorkDirectory();
- final File defaultaclConfigFile = new File(qpidHome, "etc/persistent_config.xml");
+ Configuration configuration = ConfigurationFileApplicationRegistry.config(_persistentConfigFile);
- if (!defaultaclConfigFile.exists())
- {
- System.err.println("Configuration file not found:" + defaultaclConfigFile);
- fail("Configuration file not found:" + defaultaclConfigFile);
- }
-
- if (System.getProperty("QPID_HOME") == null)
- {
- fail("QPID_HOME not set");
- }
-
- Configuration configuration = ConfigurationFileApplicationRegistry.config(defaultaclConfigFile);
-
//Reset the housekeeping threads to run every second.
configuration.setProperty("virtualhosts.virtualhost.test.housekeeping.expiredMessageCheckPeriod", 10 * SECOND);
configuration.setProperty("management.enabled", "false");
@@ -96,9 +82,11 @@
_queue = (Queue) _context.lookup("queue");
}
- public void tearDown()
+ public void tearDown() throws Exception
{
System.setProperty(LOGGING_KEY, _loggingOriginal);
+
+ super.tearDown();
}
protected static final String MESSAGE_ID_PROPERTY = "MessageIDProperty";
@@ -172,8 +160,8 @@
try
{
- int run = 1;
- while (true)
+ int run = 0;
+ while (run < 1)
{
try
{
@@ -215,8 +203,6 @@
sendMessages(50);
_logger.info("***** SENT TTL msgs");
- System.err.println("********************************* Running test again (" + run +
- ")in attempt to cause race condition.");
run++;
}
catch (JMSException e)
Added: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/BDBVMTestCase.java
===================================================================
--- store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/BDBVMTestCase.java (rev 0)
+++ store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/BDBVMTestCase.java 2008-06-02 14:29:56 UTC (rev 2101)
@@ -0,0 +1,107 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with 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.
+ *
+ */
+package org.etp.qpid.testutil;
+
+import org.apache.qpid.test.VMTestCase;
+
+import java.io.File;
+
+public class BDBVMTestCase extends VMTestCase
+{
+ public static final String BDB_WORK = "BDB_WORK";
+ public static final String QPID_WORK = "QPID_WORK";
+
+ protected String testWork = null;
+
+ protected String BDB_WORK_PRE_TEST;
+ protected String QPID_WORK_PRE_TEST;
+
+ protected final String QpidHome = System.getProperty("QPID_HOME");
+ protected final File _persistentConfigFile = new File(QpidHome, "etc/persistent_config.xml");
+
+ public void setUp() throws Exception
+ {
+ setupWorkDirectory();
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (testWork != null)
+ {
+ // Clean up the BDB store
+ deleteDirectory(new File(testWork));
+ testWork = null;
+ }
+
+ //Reset BDB_WORK
+ System.setProperty(BDB_WORK, BDB_WORK_PRE_TEST == null ? "" : BDB_WORK_PRE_TEST);
+
+ //Reset QPID_WORK
+ System.setProperty(QPID_WORK, QPID_WORK_PRE_TEST == null ? "" : QPID_WORK_PRE_TEST);
+ }
+
+ public void setupWorkDirectory()
+ {
+ if (System.getProperty(BDB_WORK) == null)
+ {
+ fail("BDB_WORK required for BDB tests");
+ }
+
+ BDB_WORK_PRE_TEST = System.getProperty(BDB_WORK);
+ QPID_WORK_PRE_TEST = System.getProperty(QPID_WORK);
+
+ //IF BDB_WORK is set but not QPID_WORK then set QPID_WORK to BDB_WORK
+ if (QPID_WORK_PRE_TEST == null && BDB_WORK_PRE_TEST != null)
+ {
+ System.setProperty(QPID_WORK, BDB_WORK_PRE_TEST);
+ }
+ }
+
+ public void startVMBroker(int vmID, File configFile)
+ {
+ testWork = BDB_WORK_PRE_TEST + "-" + vmID;
+ System.setProperty(BDB_WORK, testWork);
+ System.setProperty(QPID_WORK, testWork);
+
+ super.startVMBroker(vmID, configFile);
+ }
+
+ public boolean deleteDirectory(File dir)
+ {
+ if (dir.isDirectory())
+ {
+ String[] children = dir.list();
+ for (int i = 0; i < children.length; i++)
+ {
+ if (!deleteDirectory(new File(dir, children[i])))
+ {
+ return false;
+ }
+ }
+ }
+
+ return (dir.delete());
+ }
+
+}
Property changes on: store/branches/java/M2.x/java/bdbstore/src/test/java/org/etp/qpid/testutil/BDBVMTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
16 years, 7 months