You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/03/27 00:45:41 UTC

svn commit: r928103 - in /incubator/thrift/trunk/lib/java/test/org/apache/thrift: ./ protocol/ test/

Author: bryanduxbury
Date: Fri Mar 26 23:45:41 2010
New Revision: 928103

URL: http://svn.apache.org/viewvc?rev=928103&view=rev
Log:
java: get rid of old OverloadNonblockingServer.java (since it's not actually a test), move Fixtures up to o.a.thrift

Added:
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/Fixtures.java
Removed:
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/OverloadNonblockingServer.java
Modified:
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/TestTDeserializer.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/DeepCopyTest.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/IdentityTest.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/ReadStruct.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/SerializationBenchmark.java
    incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/WriteStruct.java

Added: incubator/thrift/trunk/lib/java/test/org/apache/thrift/Fixtures.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/Fixtures.java?rev=928103&view=auto
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/Fixtures.java (added)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/Fixtures.java Fri Mar 26 23:45:41 2010
@@ -0,0 +1,121 @@
+/*
+ * 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.thrift;
+
+import java.util.*;
+import thrift.test.*;
+
+public class Fixtures {
+  public static final OneOfEach oneOfEach;
+  public static final Nesting nesting;
+  public static final HolyMoley holyMoley;
+  public static final CompactProtoTestStruct compactProtoTestStruct;
+  
+  private static final byte[] kUnicodeBytes = {
+    (byte)0xd3, (byte)0x80, (byte)0xe2, (byte)0x85, (byte)0xae, (byte)0xce,
+    (byte)0x9d, (byte)0x20, (byte)0xd0, (byte)0x9d, (byte)0xce, (byte)0xbf,
+    (byte)0xe2, (byte)0x85, (byte)0xbf, (byte)0xd0, (byte)0xbe, (byte)0xc9,
+    (byte)0xa1, (byte)0xd0, (byte)0xb3, (byte)0xd0, (byte)0xb0, (byte)0xcf,
+    (byte)0x81, (byte)0xe2, (byte)0x84, (byte)0x8e, (byte)0x20, (byte)0xce,
+    (byte)0x91, (byte)0x74, (byte)0x74, (byte)0xce, (byte)0xb1, (byte)0xe2,
+    (byte)0x85, (byte)0xbd, (byte)0xce, (byte)0xba, (byte)0x83, (byte)0xe2,
+    (byte)0x80, (byte)0xbc
+  };
+
+  static {
+    try {
+      oneOfEach = new OneOfEach();
+      oneOfEach.im_true = true;
+      oneOfEach.im_false = false;
+      oneOfEach.a_bite = (byte) 0xd6;
+      oneOfEach.integer16 = 27000;
+      oneOfEach.integer32 = 1 << 24;
+      oneOfEach.integer64 = (long) 6000 * 1000 * 1000;
+      oneOfEach.double_precision = Math.PI;
+      oneOfEach.some_characters = "JSON THIS! \"\1";
+      oneOfEach.zomg_unicode = new String(kUnicodeBytes, "UTF-8");
+      oneOfEach.base64 = "base64".getBytes();
+      // byte, i16, and i64 lists are populated by default constructor
+
+      Bonk bonk = new Bonk();
+      bonk.type = 31337;
+      bonk.message = "I am a bonk... xor!";
+      nesting = new Nesting(bonk, oneOfEach);
+
+      holyMoley = new HolyMoley();
+      holyMoley.big = new ArrayList<OneOfEach>();
+      holyMoley.big.add(new OneOfEach(oneOfEach));
+      holyMoley.big.add(nesting.my_ooe);
+      holyMoley.big.get(0).a_bite = (byte) 0x22;
+      holyMoley.big.get(1).a_bite = (byte) 0x23;
+
+      holyMoley.contain = new HashSet<List<String>>();
+      ArrayList<String> stage1 = new ArrayList<String>(2);
+      stage1.add("and a one");
+      stage1.add("and a two");
+      holyMoley.contain.add(stage1);
+      stage1 = new ArrayList<String>(3);
+      stage1.add("then a one, two");
+      stage1.add("three!");
+      stage1.add("FOUR!!");
+      holyMoley.contain.add(stage1);
+      stage1 = new ArrayList<String>(0);
+      holyMoley.contain.add(stage1);
+
+      ArrayList<Bonk> stage2 = new ArrayList<Bonk>();
+      holyMoley.bonks = new HashMap<String, List<Bonk>>();
+      // one empty
+      holyMoley.bonks.put("zero", stage2);
+      
+      // one with two
+      stage2 = new ArrayList<Bonk>();
+      Bonk b = new Bonk();
+      b.type = 1;
+      b.message = "Wait.";
+      stage2.add(b);
+      b = new Bonk();
+      b.type = 2;
+      b.message = "What?";
+      stage2.add(b);      
+      holyMoley.bonks.put("two", stage2);
+      
+      // one with three
+      stage2 = new ArrayList<Bonk>();
+      b = new Bonk();
+      b.type = 3;
+      b.message = "quoth";
+      b = new Bonk();
+      b.type = 4;
+      b.message = "the raven";
+      b = new Bonk();
+      b.type = 5;
+      b.message = "nevermore";
+      holyMoley.bonks.put("three", stage2);
+
+      // superhuge compact proto test struct
+      compactProtoTestStruct = new CompactProtoTestStruct(thrift.test.Constants.COMPACT_TEST);
+      compactProtoTestStruct.a_binary = new byte[]{0,1,2,3,4,5,6,7,8};
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+  
+}

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/TestTDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/TestTDeserializer.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/TestTDeserializer.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/TestTDeserializer.java Fri Mar 26 23:45:41 2010
@@ -22,7 +22,6 @@ import org.apache.thrift.protocol.TBinar
 import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.protocol.TJSONProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.test.Fixtures;
 
 import thrift.test.Backwards;
 import thrift.test.OneOfEach;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java Fri Mar 26 23:45:41 2010
@@ -23,11 +23,11 @@ import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.TBase;
 import org.apache.thrift.TDeserializer;
 import org.apache.thrift.TException;
 import org.apache.thrift.TSerializer;
-import org.apache.thrift.test.Fixtures;
 import org.apache.thrift.transport.TMemoryBuffer;
 
 import thrift.test.CompactProtoTestStruct;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/DeepCopyTest.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/DeepCopyTest.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/DeepCopyTest.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/DeepCopyTest.java Fri Mar 26 23:45:41 2010
@@ -20,6 +20,7 @@
 
 package org.apache.thrift.test;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.TDeserializer;
 import org.apache.thrift.TSerializer;
 import org.apache.thrift.protocol.TBinaryProtocol;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/IdentityTest.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/IdentityTest.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/IdentityTest.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/IdentityTest.java Fri Mar 26 23:45:41 2010
@@ -29,6 +29,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.TDeserializer;
 import org.apache.thrift.TSerializer;
 import org.apache.thrift.protocol.TBinaryProtocol;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/ReadStruct.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/ReadStruct.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/ReadStruct.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/ReadStruct.java Fri Mar 26 23:45:41 2010
@@ -22,6 +22,7 @@ package org.apache.thrift.test;
 import java.io.BufferedInputStream;
 import java.io.FileInputStream;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
 import org.apache.thrift.transport.TIOStreamTransport;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/SerializationBenchmark.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/SerializationBenchmark.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/SerializationBenchmark.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/SerializationBenchmark.java Fri Mar 26 23:45:41 2010
@@ -20,6 +20,7 @@
 
 package org.apache.thrift.test;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.TBase;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;

Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/WriteStruct.java
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/WriteStruct.java?rev=928103&r1=928102&r2=928103&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/WriteStruct.java (original)
+++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/WriteStruct.java Fri Mar 26 23:45:41 2010
@@ -22,6 +22,7 @@ package org.apache.thrift.test;
 import java.io.BufferedOutputStream;
 import java.io.FileOutputStream;
 
+import org.apache.thrift.Fixtures;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
 import org.apache.thrift.transport.TIOStreamTransport;