Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 30602 invoked from network); 15 Aug 2007 17:33:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Aug 2007 17:33:27 -0000 Received: (qmail 32002 invoked by uid 500); 15 Aug 2007 17:33:25 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 31975 invoked by uid 500); 15 Aug 2007 17:33:25 -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 31966 invoked by uid 99); 15 Aug 2007 17:33:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2007 10:33:25 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2007 17:33:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 83B951A981A; Wed, 15 Aug 2007 10:33:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r566277 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java Date: Wed, 15 Aug 2007 17:33:06 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070815173306.83B951A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: chirino Date: Wed Aug 15 10:33:05 2007 New Revision: 566277 URL: http://svn.apache.org/viewvc?view=rev&rev=566277 Log: Improved the STOMP test case a little to verify that killed stomp clients redeliver un acked messages Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?view=diff&rev=566277&r1=566276&r2=566277 ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java Wed Aug 15 10:33:05 2007 @@ -20,6 +20,8 @@ import java.net.Socket; import java.net.SocketTimeoutException; import java.net.URI; +import java.net.URISyntaxException; +import java.net.UnknownHostException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -60,8 +62,7 @@ connector = broker.addConnector(bindAddress); broker.start(); - URI connectUri = connector.getConnectUri(); - stompConnection.open("127.0.0.1", connectUri.getPort()); + stompConnect(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost"); connection = cf.createConnection(); @@ -70,6 +71,11 @@ connection.start(); } + private void stompConnect() throws IOException, URISyntaxException, UnknownHostException { + URI connectUri = connector.getConnectUri(); + stompConnection.open("127.0.0.1", connectUri.getPort()); + } + protected Socket createSocket(URI connectUri) throws IOException { return new Socket(); } @@ -80,10 +86,17 @@ protected void tearDown() throws Exception { connection.close(); - stompConnection.close(); + stompDisconnect(); broker.stop(); } + private void stompDisconnect() throws IOException { + if (stompConnection != null) { + stompConnection.close(); + stompConnection = null; + } + } + public void sendMessage(String msg) throws Exception { sendMessage(msg, "foo", "xyz"); } @@ -188,8 +201,8 @@ frame = stompConnection.receiveFrame(); assertTrue(frame.startsWith("CONNECTED")); - frame = "SEND\n" + "correlation-id:c123\n" + "priority:3\n" + "type:t345\n" + "JMSXGroupID:abc\n" + "foo:abc\n" + "bar:123\n" + "destination:/queue/" + getQueueName() - + "\n\n" + "Hello World" + Stomp.NULL; + frame = "SEND\n" + "correlation-id:c123\n" + "priority:3\n" + "type:t345\n" + "JMSXGroupID:abc\n" + "foo:abc\n" + "bar:123\n" + "destination:/queue/" + getQueueName() + "\n\n" + "Hello World" + + Stomp.NULL; stompConnection.sendFrame(frame); @@ -238,7 +251,9 @@ frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; stompConnection.sendFrame(frame); - sendBytesMessage(new byte[] {1, 2, 3, 4, 5}); + sendBytesMessage(new byte[] { + 1, 2, 3, 4, 5 + }); frame = stompConnection.receiveFrame(); assertTrue(frame.startsWith("MESSAGE")); @@ -363,8 +378,7 @@ frame = stompConnection.receiveFrame(); assertTrue(frame.startsWith("MESSAGE")); - frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL; - stompConnection.sendFrame(frame); + stompDisconnect(); // message should be received since message was not acknowledged MessageConsumer consumer = session.createConsumer(queue);