Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0C24CD274 for ; Wed, 20 Jun 2012 22:59:33 +0000 (UTC) Received: (qmail 66221 invoked by uid 500); 20 Jun 2012 22:59:33 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 66177 invoked by uid 500); 20 Jun 2012 22:59:32 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 66165 invoked by uid 99); 20 Jun 2012 22:59:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 22:59:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 22:59:29 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2361D23888CD for ; Wed, 20 Jun 2012 22:59:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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... Date: Wed, 20 Jun 2012 22:59:07 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120620225908.2361D23888CD@eris.apache.org> 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;