activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1245933 - in /activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire: DurableSubscriberTest.scala OpenwireTestSupport.scala QueueTest.scala SecurityTest.scala TempDestinationTest.scala
Date Sat, 18 Feb 2012 14:49:15 GMT
Author: chirino
Date: Sat Feb 18 14:49:15 2012
New Revision: 1245933

URL: http://svn.apache.org/viewvc?rev=1245933&view=rev
Log:
Added test to the non-tight, non-cache encoded messages.

Modified:
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/DurableSubscriberTest.scala
    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
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/SecurityTest.scala
    activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/TempDestinationTest.scala

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/DurableSubscriberTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/DurableSubscriberTest.scala?rev=1245933&r1=1245932&r2=1245933&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/DurableSubscriberTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/DurableSubscriberTest.scala
Sat Feb 18 14:49:15 2012
@@ -24,7 +24,7 @@ class DurableSubscriberTest extends Open
   test("Topic /w Durable sub retains messages.") {
 
     def create_durable_sub() {
-      val connection = connect(false)
+      val connection = connect("", false)
       connection.setClientID("test")
       connection.start()
       val session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)
@@ -38,7 +38,7 @@ class DurableSubscriberTest extends Open
 
     create_durable_sub()
 
-    connect(false)
+    connect("", false)
     default_connection.setClientID("test")
     default_connection.start()
     val session = default_connection.createSession(false, Session.AUTO_ACKNOWLEDGE)

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=1245933&r1=1245932&r2=1245933&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
Sat Feb 18 14:49:15 2012
@@ -35,7 +35,6 @@ class OpenwireTestSupport extends FunSui
   val broker_config_uri = "xml:classpath:apollo-openwire.xml"
   val transport_scheme = "tcp"
   val transport_host = "localhost"
-  val uri_options = ""//"?wireFormat.maxInactivityDuration=1000000&wireFormat.maxInactivityDurationInitalDelay=1000000"
 
   override protected def beforeAll() {
     info("Loading broker configuration from the classpath with URI: " + broker_config_uri)
@@ -59,14 +58,14 @@ class OpenwireTestSupport extends FunSui
   }
 
 //  def connection_uri = transportScheme + "://localhost:%d?wireFormat.maxInactivityDuration=1000000&wireFormat.maxInactivityDurationInitalDelay=1000000".format(port)
-  def connection_uri = (transport_scheme + "://" + transport_host + ":%d" + uri_options).format(port)
-  def create_connection_factory = new ActiveMQConnectionFactory(connection_uri)
-  def create_connection: Connection = create_connection_factory.createConnection
+  def connection_uri(uri_options:String="") = (transport_scheme + "://" + transport_host
+ ":%d" + uri_options).format(port)
+  def create_connection_factory(uri_options:String="") = new ActiveMQConnectionFactory(connection_uri(uri_options))
+  def create_connection(uri_options:String=""): Connection = create_connection_factory(uri_options).createConnection
   def queue(value:String) = new ActiveMQQueue(value);
   def topic(value:String) = new ActiveMQTopic(value);
 
-  def connect(start:Boolean=true) = {
-    val connection = create_connection
+  def connect(uri_options:String="", start:Boolean=true) = {
+    val connection = create_connection(uri_options)
     connections ::= connection
     if(default_connection==null) {
       default_connection = connection

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=1245933&r1=1245932&r2=1245933&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
Sat Feb 18 14:49:15 2012
@@ -20,6 +20,29 @@ import javax.jms.{Message, TextMessage, 
 
 class QueueTest extends OpenwireTestSupport {
 
+  test("Queue Message Cached") {
+
+    connect("?wireFormat.cacheEnabled=false&wireFormat.tightEncodingEnabled=false")
+
+    val session = default_connection.createSession(false, Session.AUTO_ACKNOWLEDGE)
+    val producer = session.createProducer(queue("example"))
+    def put(id:Int) {
+      producer.send(session.createTextMessage("message:"+id))
+    }
+
+    List(1,2,3).foreach(put _)
+
+    val consumer = session.createConsumer(queue("example"))
+
+    def get(id:Int) {
+      val m = consumer.receive().asInstanceOf[TextMessage]
+      m.getJMSDestination should equal(queue("example"))
+      m.getText should equal ("message:"+id)
+    }
+
+    List(1,2,3).foreach(get _)
+  }
+
   test("Queue order preserved") {
 
     connect()

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/SecurityTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/SecurityTest.scala?rev=1245933&r1=1245932&r2=1245933&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/SecurityTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/SecurityTest.scala
Sat Feb 18 14:49:15 2012
@@ -38,7 +38,7 @@ class ConnectionFailureWithValidCredenti
 
   test("Connect with valid id password but can't connect") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_not_connect", "can_not_connect")
 
     intercept[JMSException] {
@@ -51,7 +51,7 @@ class CoonectionFailsWhenNoCredentialsGi
 
   test("Connect with no id password") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection()
 
     intercept[JMSException] {
@@ -63,7 +63,7 @@ class CoonectionFailsWhenNoCredentialsGi
 class ConnectionFailsWhenCredentialsAreInvlaid extends SecurityTest {
 
   test("Connect with invalid id password") {
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("foo", "bar")
 
     intercept[JMSException] {
@@ -73,12 +73,9 @@ class ConnectionFailsWhenCredentialsAreI
 }
 
 class ConnectionSucceedsWithValidCredentials extends SecurityTest {
-
-  override def connection_uri = super.connection_uri + "&jms.alwaysSyncSend=true"
-  
   test("Connect with valid id password that can connect") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory("?jms.alwaysSyncSend=true")
     val connection = factory.createConnection("can_only_connect", "can_only_connect")
 
     try {
@@ -92,7 +89,7 @@ class ConnectionSucceedsWithValidCredent
 
 class SendFailsWhenNotAuthorized extends SecurityTest {
   test("Send not authorized") {
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_only_connect", "can_only_connect")
 
     try {
@@ -114,7 +111,7 @@ class SendFailsWhenNotAuthorizedToCreate
 
   test("Send authorized but not create") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_send_queue", "can_send_queue")
 
     try {
@@ -136,7 +133,7 @@ class ConsumeFailsWhenNotAuthroizedToCre
 
   test("Consume authorized but not create") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_consume_queue", "can_consume_queue")
 
     try {
@@ -156,7 +153,7 @@ class ConsumeFailsWhenNotAuthroizedToCre
 
 class SendSucceedsWhenCreateQueueAthorized extends SecurityTest {
   test("Send and create authorized") {
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_send_create_queue", "can_send_create_queue")
 
     try {
@@ -177,7 +174,7 @@ class SendSucceedsWhenCreateQueueAthoriz
 
   test("Can send and once created") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_send_queue", "can_send_queue")
 
     try {
@@ -201,7 +198,7 @@ class SubscribeFailsForConnectionOnlyAut
 
   test("Consume not authorized") {
 
-    val factory = create_connection_factory
+    val factory = create_connection_factory()
     val connection = factory.createConnection("can_only_connect", "can_only_connect")
 
     try {

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/TempDestinationTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/TempDestinationTest.scala?rev=1245933&r1=1245932&r2=1245933&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/TempDestinationTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/TempDestinationTest.scala
Sat Feb 18 14:49:15 2012
@@ -31,7 +31,7 @@ class TempDestinationTest extends Openwi
   def test_temp_destination(func:(Session)=>Destination) = {
     connect()
 
-    val connection2 = connect(true)
+    val connection2 = connect("", true)
     val session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE)
 
     val session = default_connection.createSession(false, Session.AUTO_ACKNOWLEDGE)



Mime
View raw message