You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2012/06/21 00:59:07 UTC
svn commit: r1352363 - in /activemq/activemq-apollo/trunk:
apollo-amqp/src/test-swiftmq/ apollo-amqp/src/test-swiftmq/scala/
apollo-amqp/src/test-swiftmq/scala/org/
apollo-amqp/src/test-swiftmq/scala/org/apache/
apollo-amqp/src/test-swiftmq/scala/org/a...
Author: chirino
Date: Wed Jun 20 22:59:07 2012
New Revision: 1352363
URL: http://svn.apache.org/viewvc?rev=1352363&view=rev
Log:
Only compile the switfmq client tests when it's available and update lic. headers.
Added:
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/
activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/SwiftMQClientTest.scala
Modified:
activemq/activemq-apollo/trunk/apollo-amqp/src/test/scala/org/apache/activemq/apollo/amqp/AmqpTest.scala
activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/dto/MembershipMonitorDTO.java
Added: activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/SwiftMQClientTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/SwiftMQClientTest.scala?rev=1352363&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/SwiftMQClientTest.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-amqp/src/test-swiftmq/scala/org/apache/activemq/apollo/amqp/SwiftMQClientTest.scala Wed Jun 20 22:59:07 2012
@@ -0,0 +1,97 @@
+/**
+ * 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.apache.activemq.apollo.amqp
+
+import com.swiftmq.amqp.AMQPContext
+import com.swiftmq.amqp.v100.client.Connection
+import com.swiftmq.amqp.v100.client.QoS
+import com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue
+import com.swiftmq.amqp.v100.types.AMQPString
+import com.swiftmq.amqp.v100.client.ExceptionListener
+
+class SwiftMQClientTest extends AmqpTestSupport {
+
+ test("broker") {
+
+// val port = 5672
+// val queue = "testqueue"
+
+ val queue = "/queue/testqueue"
+
+ val nMsgs = 1
+ val qos = QoS.AT_MOST_ONCE
+ val ctx = new AMQPContext(AMQPContext.CLIENT);
+
+ try {
+
+ val connection = new Connection(ctx, "127.0.0.1", port, false)
+ connection.setContainerId("client")
+ connection.setIdleTimeout(-1)
+ connection.setMaxFrameSize(1024*4)
+ connection.setExceptionListener(new ExceptionListener(){
+ def onException(e: Exception) {
+ e.printStackTrace();
+ }
+ })
+ connection.connect;
+ {
+ var data = "x" * 10 // 1024*20
+
+ var session = connection.createSession(10, 10)
+ var p = {
+ session.createProducer(queue, qos)
+ }
+ for (i <- 0 until nMsgs) {
+ var msg = new com.swiftmq.amqp.v100.messaging.AMQPMessage
+ var s = "Message #" + (i + 1)
+ println("Sending " + s)
+ msg.setAmqpValue(new AmqpValue(new AMQPString(s+", data: "+data)))
+ p.send(msg)
+ }
+ p.close()
+ session.close()
+ }
+ {
+ var session = connection.createSession(10, 10)
+ val c = session.createConsumer(queue, 100, qos, true, null);
+
+ // Receive messages non-transacted
+ for (i <- 0 until nMsgs)
+ {
+ val msg = c.receive();
+ if (msg == null)
+
+ msg.getAmqpValue().getValue match {
+ case value:AMQPString =>
+ println("Received: " + value.getValue());
+ }
+ if (!msg.isSettled())
+ msg.accept();
+ }
+ c.close()
+ session.close()
+ }
+ connection.close()
+ } catch {
+ case e: Exception => {
+ e.printStackTrace
+ }
+ }
+
+ }
+}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-amqp/src/test/scala/org/apache/activemq/apollo/amqp/AmqpTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-amqp/src/test/scala/org/apache/activemq/apollo/amqp/AmqpTest.scala?rev=1352363&r1=1352362&r2=1352363&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-amqp/src/test/scala/org/apache/activemq/apollo/amqp/AmqpTest.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-amqp/src/test/scala/org/apache/activemq/apollo/amqp/AmqpTest.scala Wed Jun 20 22:59:07 2012
@@ -22,7 +22,6 @@ import org.apache.activemq.apollo.broker
import java.io.FileInputStream
import org.apache.activemq.apollo.util.FileSupport._
import org.fusesource.amqp.codec.AMQPProtocolCodec
-import com.swiftmq.amqp.v100.client.ExceptionListener
import java.lang.Exception
class AmqpTestSupport extends BrokerFunSuiteSupport with ShouldMatchers with BeforeAndAfterEach {
@@ -159,110 +158,3 @@ class AmqpTestSupport extends BrokerFunS
// }
}
-import com.swiftmq.amqp.AMQPContext
-import com.swiftmq.amqp.v100.client.Connection
-import com.swiftmq.amqp.v100.client.QoS
-import com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue
-import com.swiftmq.amqp.v100.types.AMQPString
-
-object PrintAMQPStream {
- def main(args: Array[String]) {
- for( arg <- args ) {
- println("--------------------------------------------------------")
- println(" File: "+arg)
- println("--------------------------------------------------------")
- using(new FileInputStream(arg)) { is =>
- val codec = new AMQPProtocolCodec
- codec.setReadableByteChannel(is.getChannel)
- // codec.skipProtocolHeader()
-
- var pos = 0L
- var frame = codec.read()
- var counter = 0
- while( frame !=null ) {
- var next_pos = codec.getReadCounter - codec.getReadBytesPendingDecode
- counter += 1
- println("@"+pos+" "+frame)
- pos = next_pos;
- frame = try {
- codec.read()
- } catch {
- case e:java.io.EOFException => null
- }
- }
- }
- }
- }
-}
-
-class AmqpTest extends AmqpTestSupport {
-
- test("broker") {
-
-// val port = 5672
-// val queue = "testqueue"
-
- val queue = "/queue/testqueue"
-
- val nMsgs = 1
- val qos = QoS.AT_MOST_ONCE
- val ctx = new AMQPContext(AMQPContext.CLIENT);
-
- try {
-
- val connection = new Connection(ctx, "127.0.0.1", port, false)
- connection.setContainerId("client")
- connection.setIdleTimeout(-1)
- connection.setMaxFrameSize(1024*4)
- connection.setExceptionListener(new ExceptionListener(){
- def onException(e: Exception) {
- e.printStackTrace();
- }
- })
- connection.connect;
- {
- var data = "x" * 10 // 1024*20
-
- var session = connection.createSession(10, 10)
- var p = {
- session.createProducer(queue, qos)
- }
- for (i <- 0 until nMsgs) {
- var msg = new com.swiftmq.amqp.v100.messaging.AMQPMessage
- var s = "Message #" + (i + 1)
- println("Sending " + s)
- msg.setAmqpValue(new AmqpValue(new AMQPString(s+", data: "+data)))
- p.send(msg)
- }
- p.close()
- session.close()
- }
- {
- var session = connection.createSession(10, 10)
- val c = session.createConsumer(queue, 100, qos, true, null);
-
- // Receive messages non-transacted
- for (i <- 0 until nMsgs)
- {
- val msg = c.receive();
- if (msg == null)
-
- msg.getAmqpValue().getValue match {
- case value:AMQPString =>
- println("Received: " + value.getValue());
- }
- if (!msg.isSettled())
- msg.accept();
- }
- c.close()
- session.close()
- }
- connection.close()
- } catch {
- case e: Exception => {
- e.printStackTrace
- }
- }
-
- }
-}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/dto/MembershipMonitorDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/dto/MembershipMonitorDTO.java?rev=1352363&r1=1352362&r2=1352363&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/dto/MembershipMonitorDTO.java (original)
+++ activemq/activemq-apollo/trunk/apollo-network/src/main/scala/org/apache/activemq/apollo/broker/network/dto/MembershipMonitorDTO.java Wed Jun 20 22:59:07 2012
@@ -1,3 +1,20 @@
+/**
+ * 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.apache.activemq.apollo.broker.network.dto;
import org.apache.activemq.apollo.dto.ApolloTypeIdResolver;