activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r674845 - in /activemq/trunk/activemq-protocol-buffer: pom.xml src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java
Date Tue, 08 Jul 2008 14:45:20 GMT
Author: jstrachan
Date: Tue Jul  8 07:45:20 2008
New Revision: 674845

URL: http://svn.apache.org/viewvc?rev=674845&view=rev
Log:
fixed test case

Added:
    activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java
      - copied, changed from r674841, activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
Modified:
    activemq/trunk/activemq-protocol-buffer/pom.xml

Modified: activemq/trunk/activemq-protocol-buffer/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-protocol-buffer/pom.xml?rev=674845&r1=674844&r2=674845&view=diff
==============================================================================
--- activemq/trunk/activemq-protocol-buffer/pom.xml (original)
+++ activemq/trunk/activemq-protocol-buffer/pom.xml Tue Jul  8 07:45:20 2008
@@ -70,6 +70,9 @@
           <forkMode>pertest</forkMode>
           <childDelegation>false</childDelegation>
           <useFile>true</useFile>
+          <excludes>
+            <exclude>**/PerformanceTest.java</exclude>
+          </excludes>
         </configuration>
       </plugin>
 

Copied: activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java
(from r674841, activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java?p2=activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java&p1=activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java&r1=674841&r2=674845&rev=674845&view=diff
==============================================================================
--- activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
(original)
+++ activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/Performance2Test.java
Tue Jul  8 07:45:20 2008
@@ -27,14 +27,13 @@
 /**
  * @version $Revision: 1.1 $
  */
-public class PerformanceTest extends TestCase {
+public class Performance2Test extends TestCase {
     protected int messageCount = 10;
-    protected String fileName = "target/messages.openwire";
+    protected String fileName = "target/messages2.openwire";
 
 
     public void testPerformance() throws Exception {
         FileOutputStream out = new FileOutputStream(fileName);
-        CodedOutputStream cout = CodedOutputStream.newInstance(out);
         OpenWire.Destination destination = OpenWire.Destination.newBuilder().setName("FOO.BAR").setType(OpenWire.Destination.DestinationType.QUEUE).build();
 
         for (int i = 0; i < messageCount; i++) {
@@ -47,19 +46,25 @@
                     .build();
 
             System.out.println("Writing message: " + i + " = " + message);
-            message.writeTo(cout);
-            cout.flush();
+            byte[] bytes = message.toByteArray();
+            int size = bytes.length;
+            out.write(size);
+            System.out.println("writing bytes: " + size);
+            out.write(bytes);
         }
+        out.flush();
         out.close();
 
         // now lets try read them!
         FileInputStream in = new FileInputStream(fileName);
-        CodedInputStream cin = CodedInputStream.newInstance(in);
         for (int i = 0; i < messageCount; i++) {
-            OpenWire.Message message = OpenWire.Message.parseFrom(cin);
+            int size = in.read();
+            byte[] data = new byte[size];
+            in.read(data);
+            OpenWire.Message message = OpenWire.Message.parseFrom(data);
             System.out.println("Reading message: " + i + " = " + message);
         }
         in.close();
     }
 
-}
+}
\ No newline at end of file



Mime
View raw message