activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1291173 - in /activemq/activemq-apollo/trunk/apollo-openwire/src/test: resources/ scala/org/apache/activemq/apollo/openwire/
Date Mon, 20 Feb 2012 10:03:07 GMT
Author: chirino
Date: Mon Feb 20 10:03:06 2012
New Revision: 1291173

URL: http://svn.apache.org/viewvc?rev=1291173&view=rev
Log:
Added test case to verify openwire client prefetch and client ack.

Added:
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml
      - copied, changed from r1291172, activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-custom-dest-delimiters.xml
Removed:
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-custom-dest-delimiters.xml
Modified:
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-secure.xml
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl-secure.xml
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl.xml
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/log4j.properties
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/OpenwireTestSupport.scala
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/QueueTest.scala

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml
Mon Feb 20 10:03:06 2012
@@ -18,7 +18,7 @@
 <broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
   <notes>Has a BDB store enabled.</notes>
 
-  <virtual_host id="default" purge_on_startup="true">
+  <virtual_host id="default">
     <host_name>localhost</host_name>
 
     <queue name="mirrored.**" mirrored="true"/>
@@ -26,7 +26,7 @@
     <bdb_store directory="${basedir}/target/test-data"/>
   </virtual_host>
 
-  <web_admin bind="http://127.0.0.1:0"/>
-  <connector id="tcp" protocol="openwire" bind="tcp://0.0.0.0:0"/>
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="tcp" bind="tcp://0.0.0.0:0"/>
 
 </broker>
\ No newline at end of file

Copied: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml
(from r1291172, activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-custom-dest-delimiters.xml)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml?p2=activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml&p1=activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-custom-dest-delimiters.xml&r1=1291172&r2=1291173&rev=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-custom-dest-delimiters.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml
Mon Feb 20 10:03:06 2012
@@ -16,17 +16,17 @@
     limitations under the License.
 -->
 <broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
-  <notes>This broker configuration is what the unit tests in this module load up.</notes>
+  <notes>Has a BDB store enabled.</notes>
 
-  <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
+  <virtual_host id="default">
     <host_name>localhost</host_name>
 
     <queue name="mirrored.**" mirrored="true"/>
 
+    <leveldb_store directory="${basedir}/target/test-data"/>
   </virtual_host>
 
-  <connector id="tcp" protocol="openwire" bind="tcp://0.0.0.0:0">
-    <stomp path_separator="/"/>
-  </connector>
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="tcp" bind="tcp://0.0.0.0:0"/>
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-secure.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-secure.xml?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-secure.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-secure.xml
Mon Feb 20 10:03:06 2012
@@ -19,7 +19,7 @@
 
   <authentication domain="OpenwireSecurityTest"/>
 
-  <virtual_host id="default" purge_on_startup="true">
+  <virtual_host id="default">
     <host_name>localhost</host_name>
 
     <acl>
@@ -57,8 +57,8 @@
     </queue>
   </virtual_host>
 
-  <connector id="tcp" protocol="openwire" bind="tcp://0.0.0.0:0">
-    <stomp add_user_header="JMSXUserID"/>
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="tcp" bind="tcp://0.0.0.0:0">
   </connector>
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl-secure.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl-secure.xml?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl-secure.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl-secure.xml
Mon Feb 20 10:03:06 2012
@@ -20,7 +20,7 @@
 
   <authentication domain="OpenwireSslSecurityTest"/>
 
-  <virtual_host id="default" purge_on_startup="true">
+  <virtual_host id="default">
     <host_name>localhost</host_name>
 
     <acl>
@@ -30,6 +30,8 @@
   </virtual_host>
 
   <key_storage file="${basedir}/src/test/resources/apollo.ks" password="password" key_password="password"/>
-  <connector id="ssl" protocol="openwire" bind="ssl://0.0.0.0:0" />
+
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="ssl" bind="ssl://0.0.0.0:0" />
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl.xml?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-ssl.xml
Mon Feb 20 10:03:06 2012
@@ -17,12 +17,14 @@
 -->
 <broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
 
-    <notes>The config for the ssl stomp tests.</notes>
-    <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
-        <host_name>localhost</host_name>
-    </virtual_host>
+  <notes>The config for the ssl stomp tests.</notes>
+  <virtual_host id="default">
+      <host_name>localhost</host_name>
+  </virtual_host>
 
-    <key_storage file="${basedir}/src/test/resources/apollo.ks" password="password" key_password="password"/>
-    <connector id="ssl" protocol="openwire" bind="ssl://0.0.0.0:0" />
+  <key_storage file="${basedir}/src/test/resources/apollo.ks" password="password" key_password="password"/>
+
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="ssl" bind="ssl://0.0.0.0:0" />
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml
Mon Feb 20 10:03:06 2012
@@ -17,13 +17,13 @@
 -->
 <broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
 
-    <notes>This broker configuration is what the unit tests in this module load up.</notes>
+  <notes>This broker configuration is what the unit tests in this module load up.</notes>
 
-    <virtual_host id="default" purge_on_startup="true" auto_create_queues="true" >
-        <host_name>localhost</host_name>
-    </virtual_host>
+  <virtual_host id="default">
+      <host_name>localhost</host_name>
+  </virtual_host>
 
-    <connector id="tcp" protocol="openwire" bind="tcp://0.0.0.0:0"/>
-    <!--<web_admin bind="http://127.0.0.1:61680"/>-->
+  <web_admin bind="http://0.0.0.0:0"/>
+  <connector id="tcp" bind="tcp://0.0.0.0:0"/>
 
 </broker>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/log4j.properties?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/log4j.properties (original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/log4j.properties Mon
Feb 20 10:03:06 2012
@@ -19,7 +19,7 @@
 # Setup the default logging levels
 #
 log4j.rootLogger=WARN, console, logfile
-#log4j.logger.org.apache.activemq.apollo=INFO
+log4j.logger.org.apache.activemq.apollo=INFO
 
 #
 # Uncomment one of the following to enable debug logging
@@ -38,7 +38,7 @@ log4j.appender.console.threshold=TRACE
 
 # File Settings
 log4j.appender.logfile=org.apache.log4j.RollingFileAppender
-log4j.appender.logfile.file=${apollo.base}/log/apollo.log
+log4j.appender.logfile.file=target/log/apollo.log
 log4j.appender.logfile.maxFileSize=5MB
 log4j.appender.logfile.maxBackupIndex=5
 log4j.appender.logfile.append=true

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/OpenwireTestSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/OpenwireTestSupport.scala?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/OpenwireTestSupport.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/OpenwireTestSupport.scala
Mon Feb 20 10:03:06 2012
@@ -32,7 +32,7 @@ class OpenwireTestSupport extends FunSui
   var broker: Broker = null
   var port = 0
 
-  val broker_config_uri = "xml:classpath:apollo-openwire.xml"
+  def broker_config_uri = "xml:classpath:apollo-openwire.xml"
   val transport_scheme = "tcp"
   val transport_host = "localhost"
 

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/QueueTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/QueueTest.scala?rev=1291173&r1=1291172&r2=1291173&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/QueueTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/QueueTest.scala
Mon Feb 20 10:03:06 2012
@@ -16,10 +16,60 @@
  */
 package org.apache.activemq.apollo.openwire
 
-import javax.jms.{Message, TextMessage, Session}
+import javax.jms.{DeliveryMode, Message, TextMessage, Session}
 
-class QueueTest extends OpenwireTestSupport {
 
+class BDBQueueTest extends OpenwireTestSupport {
+
+  override def broker_config_uri = "xml:classpath:apollo-openwire-bdb.xml"
+
+  test("Queue Prefetch and Client Ack") {
+
+    connect("?jms.useAsyncSend=true")
+
+    val session = default_connection.createSession(false, Session.CLIENT_ACKNOWLEDGE)
+    val producer = session.createProducer(queue("prefetch"))
+    producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT)
+    def put(id:Int) {
+      val msg = session.createBytesMessage()
+      msg.writeBytes(new Array[Byte](1024*4))
+      producer.send(msg)
+    }
+
+    for(i <- 1 to 1000) {
+      put(i)
+    }
+
+    val consumer = session.createConsumer(queue("prefetch"))
+    def get(id:Int) {
+      val m = consumer.receive()
+      expect(true, "Did not get message: "+id)(m!=null)
+    }
+    for(i <- 1 to 1000) {
+      get(i)
+    }
+    default_connection.close()
+    default_connection = null
+
+    // All those messages should get redelivered since they were not previously
+    // acked.
+    connect()
+    val session2 = default_connection.createSession(false, Session.CLIENT_ACKNOWLEDGE)
+    val consumer2 = session2.createConsumer(queue("prefetch"))
+    def get2(id:Int) {
+      val m = consumer2.receive()
+      expect(true, "Did not get message: "+id)(m!=null)
+    }
+    for(i <- 1 to 1000) {
+      get2(i)
+    }
+
+
+  }
+}
+
+class QueueTest extends OpenwireTestSupport {
+  
   test("Queue Message Cached") {
 
     connect("?wireFormat.cacheEnabled=false&wireFormat.tightEncodingEnabled=false")



Mime
View raw message