Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 85096 invoked from network); 1 Jul 2006 00:32:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Jul 2006 00:32:48 -0000 Received: (qmail 7982 invoked by uid 500); 1 Jul 2006 00:32:48 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 7960 invoked by uid 500); 1 Jul 2006 00:32:48 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 7950 invoked by uid 99); 1 Jul 2006 00:32:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jun 2006 17:32:48 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jun 2006 17:32:47 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3CC071A983A; Fri, 30 Jun 2006 17:32:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r418424 - /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java Date: Sat, 01 Jul 2006 00:32:26 -0000 To: activemq-commits@geronimo.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060701003227.3CC071A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: chirino Date: Fri Jun 30 17:32:26 2006 New Revision: 418424 URL: http://svn.apache.org/viewvc?rev=418424&view=rev Log: Trying to get this to pass more reliably on linux Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java?rev=418424&r1=418423&r2=418424&view=diff ============================================================================== --- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java (original) +++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java Fri Jun 30 17:32:26 2006 @@ -77,11 +77,11 @@ stompSocket = new Socket("localhost", 61613); inputBuffer = new ByteArrayOutputStream(); - String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n" + Stomp.NULL; + String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; sendFrame(connect_frame); String f = receiveFrame(100000); - String frame = "SUBSCRIBE\n" + "destination:/queue/" + getDestinationName() + "\n" + "ack:client\n\n" + Stomp.NULL; + String frame = "SUBSCRIBE\n" + "destination:/queue/" + getDestinationName() + "\n" + "ack:client\n\n"; sendFrame(frame); int messagesCount = 0; int count = 0; @@ -107,7 +107,7 @@ } String messageId = line.substring(line.indexOf(':') + 1); messageId = messageId.trim(); - String ackmessage = "ACK\n" + "message-id:" + messageId + "\n\n" + Stomp.NULL; + String ackmessage = "ACK\n" + "message-id:" + messageId + "\n\n"; sendFrame(ackmessage); log.debug(receiveFrame); //Thread.sleep(1000); @@ -115,25 +115,20 @@ ++count; } stompSocket.close(); - Thread.sleep(10000); - - // for (int idx = 0; idx < 500; ++idx) { - // producer.send(message); - // log.debug("Sending: " +idx); - // } stompSocket = new Socket("localhost", 61613); inputBuffer = new ByteArrayOutputStream(); - connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n" + Stomp.NULL; + connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "\n"; sendFrame(connect_frame); - f = receiveFrame(100000); - frame = "SUBSCRIBE\n" + "destination:/queue/" + getDestinationName() + "\n" + "ack:client\n\n" + Stomp.NULL; + f = receiveFrame(5000); + + frame = "SUBSCRIBE\n" + "destination:/queue/" + getDestinationName() + "\n" + "ack:client\n\n"; sendFrame(frame); try { while (count != 2000) { - String receiveFrame = receiveFrame(10000); + String receiveFrame = receiveFrame(5000); DataInput input = new DataInputStream(new ByteArrayInputStream(receiveFrame.getBytes())); String line; while (true) { @@ -148,13 +143,14 @@ } } } + line = input.readLine(); if (line == null) { throw new IOException("connection was closed"); } String messageId = line.substring(line.indexOf(':') + 1); messageId = messageId.trim(); - String ackmessage = "ACK\n" + "message-id:" + messageId + "\n\n" + Stomp.NULL; + String ackmessage = "ACK\n" + "message-id:" + messageId + "\n\n"; sendFrame(ackmessage); log.debug("Received: " + receiveFrame); //Thread.sleep(1000); @@ -164,10 +160,12 @@ } catch (IOException ex) { - // timeout + ex.printStackTrace(); } + stompSocket.close(); broker.stop(); + log.info("Total messages received: " + messagesCount); assertTrue("Messages received after connection loss: " + messagesCount, messagesCount >= 2000); @@ -181,9 +179,8 @@ public void sendFrame(String data) throws Exception { byte[] bytes = data.getBytes("UTF-8"); OutputStream outputStream = stompSocket.getOutputStream(); - for (int i = 0; i < bytes.length; i++) { - outputStream.write(bytes[i]); - } + outputStream.write(bytes); + outputStream.write(0); outputStream.flush(); }