Return-Path: Delivered-To: apmail-incubator-thrift-commits-archive@minotaur.apache.org Received: (qmail 79412 invoked from network); 7 Apr 2009 20:52:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Apr 2009 20:52:10 -0000 Received: (qmail 62712 invoked by uid 500); 7 Apr 2009 20:52:10 -0000 Delivered-To: apmail-incubator-thrift-commits-archive@incubator.apache.org Received: (qmail 62694 invoked by uid 500); 7 Apr 2009 20:52:10 -0000 Mailing-List: contact thrift-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: thrift-dev@incubator.apache.org Delivered-To: mailing list thrift-commits@incubator.apache.org Received: (qmail 62671 invoked by uid 99); 7 Apr 2009 20:52:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 20:52:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Tue, 07 Apr 2009 20:52:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 729CD23889B2; Tue, 7 Apr 2009 20:51:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r762957 - in /incubator/thrift/trunk: lib/java/test/org/apache/thrift/test/Fixtures.java test/DebugProtoTest.thrift Date: Tue, 07 Apr 2009 20:51:49 -0000 To: thrift-commits@incubator.apache.org From: dreiss@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090407205149.729CD23889B2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dreiss Date: Tue Apr 7 20:51:48 2009 New Revision: 762957 URL: http://svn.apache.org/viewvc?rev=762957&view=rev Log: THRIFT-356. Improve CompactProtocolTestStruct - Remove the default values from CompactProtocolTestStruct - Add a const CompactProtocolTestStruct that contains those values This has a short-term benefit and a long-term benefit. The short-term benefit is that it removes the list-as-map-key (etc.) values from the "types" generated file and puts it into the "constants" generated file. This gets them out of the way of the Python tests, so they pass again. The long term benefit is that is strengthens the Java TCompactProtocol test. Before, it was reading the "full" CompactProtocolTestStruct into a CompactProtocolTestStruct that was just constructed, but the latter was already almost equal to the former. This change makes it much easier to create an empty CompactProtocolTestStruct to read the serialized data into. Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java incubator/thrift/trunk/test/DebugProtoTest.thrift Modified: incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java?rev=762957&r1=762956&r2=762957&view=diff ============================================================================== --- incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java (original) +++ incubator/thrift/trunk/lib/java/test/org/apache/thrift/test/Fixtures.java Tue Apr 7 20:51:48 2009 @@ -117,11 +117,11 @@ holyMoley.bonks.put("poe", stage2); // superhuge compact proto test struct - compactProtoTestStruct = new CompactProtoTestStruct(); + 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); } } -} \ No newline at end of file +} Modified: incubator/thrift/trunk/test/DebugProtoTest.thrift URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/DebugProtoTest.thrift?rev=762957&r1=762956&r2=762957&view=diff ============================================================================== --- incubator/thrift/trunk/test/DebugProtoTest.thrift (original) +++ incubator/thrift/trunk/test/DebugProtoTest.thrift Tue Apr 7 20:51:48 2009 @@ -99,65 +99,118 @@ struct CompactProtoTestStruct { // primitive fields - 1: byte a_byte = 127; - 2: i16 a_i16 = 32000; - 3: i32 a_i32 = 1000000000; - 4: i64 a_i64 = 0xffffffffff; - 5: double a_double = 5.6789; - 6: string a_string = "my string"; + 1: byte a_byte; + 2: i16 a_i16; + 3: i32 a_i32; + 4: i64 a_i64; + 5: double a_double; + 6: string a_string; 7: binary a_binary; - 8: bool true_field = 1; - 9: bool false_field = 0; - 10: Empty empty_struct_field = {}; + 8: bool true_field; + 9: bool false_field; + 10: Empty empty_struct_field; // primitives in lists - 11: list byte_list = [-127, -1, 0, 1, 127]; - 12: list i16_list = [-1, 0, 1, 0x7fff]; - 13: list i32_list = [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff]; - 14: list i64_list = [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff]; - 15: list double_list = [0.1, 0.2, 0.3]; - 16: list string_list = ["first", "second", "third"]; + 11: list byte_list; + 12: list i16_list; + 13: list i32_list; + 14: list i64_list; + 15: list double_list; + 16: list string_list; 17: list binary_list; - 18: list boolean_list = [1, 1, 1, 0, 0, 0]; - 19: list struct_list = [{}, {}]; + 18: list boolean_list; + 19: list struct_list; // primitives in sets - 20: set byte_set = [-127, -1, 0, 1, 127]; - 21: set i16_set = [-1, 0, 1, 0x7fff]; - 22: set i32_set = [1, 2, 3]; - 23: set i64_set = [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff]; - 24: set double_set = [0.1, 0.2, 0.3]; - 25: set string_set = ["first", "second", "third"]; + 20: set byte_set; + 21: set i16_set; + 22: set i32_set; + 23: set i64_set; + 24: set double_set; + 25: set string_set; 26: set binary_set; - 27: set boolean_set = [1, 0]; - 28: set struct_set = [{}]; + 27: set boolean_set; + 28: set struct_set; // maps // primitives as keys - 29: map byte_byte_map = {1 : 2}; - 30: map i16_byte_map = {1 : 1, -1 : 1, 0x7fff : 1}; - 31: map i32_byte_map = {1 : 1, -1 : 1, 0x7fffffff : 1}; - 32: map i64_byte_map = {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1}; - 33: map double_byte_map = {-1.1 : 1, 1.1 : 1}; - 34: map string_byte_map = {"first" : 1, "second" : 2, "third" : 3, "" : 0}; + 29: map byte_byte_map; + 30: map i16_byte_map; + 31: map i32_byte_map; + 32: map i64_byte_map; + 33: map double_byte_map; + 34: map string_byte_map; 35: map binary_byte_map; - 36: map boolean_byte_map = {1 : 1, 0 : 0}; + 36: map boolean_byte_map; // primitives as values - 37: map byte_i16_map = {1 : 1, 2 : -1, 3 : 0x7fff}; - 38: map byte_i32_map = {1 : 1, 2 : -1, 3 : 0x7fffffff}; - 39: map byte_i64_map = {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff}; - 40: map byte_double_map = {1 : 0.1, 2 : -0.1, 3 : 1000000.1}; - 41: map byte_string_map = {1 : "", 2 : "blah", 3 : "loooooooooooooong string"}; + 37: map byte_i16_map; + 38: map byte_i32_map; + 39: map byte_i64_map; + 40: map byte_double_map; + 41: map byte_string_map; 42: map byte_binary_map; - 43: map byte_boolean_map = {1 : 1, 2 : 0}; + 43: map byte_boolean_map; // collections as keys - 44: map, byte> list_byte_map = {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}; - 45: map, byte> set_byte_map = {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}; - 46: map, byte> map_byte_map = {{1 : 1} : 1, {2 : 2} : 2, {} : 0}; + 44: map, byte> list_byte_map; + 45: map, byte> set_byte_map; + 46: map, byte> map_byte_map; // collections as values - 47: map> byte_map_map = {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}}; - 48: map> byte_set_map = {0 : [], 1 : [1], 2 : [1, 2]}; - 49: map> byte_list_map = {0 : [], 1 : [1], 2 : [1, 2]}; + 47: map> byte_map_map; + 48: map> byte_set_map; + 49: map> byte_list_map; +} + + +const CompactProtoTestStruct COMPACT_TEST = { + 'a_byte' : 127, + 'a_i16' : 32000, + 'a_i32' : 1000000000, + 'a_i64' : 0xffffffffff, + 'a_double' : 5.6789, + 'a_string' : "my string", +//'a_binary,' + 'true_field' : 1, + 'false_field' : 0, + 'empty_struct_field' : {}, + 'byte_list' : [-127, -1, 0, 1, 127], + 'i16_list' : [-1, 0, 1, 0x7fff], + 'i32_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff], + 'i64_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff], + 'double_list' : [0.1, 0.2, 0.3], + 'string_list' : ["first", "second", "third"], +//'binary_list,' + 'boolean_list' : [1, 1, 1, 0, 0, 0], + 'struct_list' : [{}, {}], + 'byte_set' : [-127, -1, 0, 1, 127], + 'i16_set' : [-1, 0, 1, 0x7fff], + 'i32_set' : [1, 2, 3], + 'i64_set' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff], + 'double_set' : [0.1, 0.2, 0.3], + 'string_set' : ["first", "second", "third"], +//'binary_set,' + 'boolean_set' : [1, 0], + 'struct_set' : [{}], + 'byte_byte_map' : {1 : 2}, + 'i16_byte_map' : {1 : 1, -1 : 1, 0x7fff : 1}, + 'i32_byte_map' : {1 : 1, -1 : 1, 0x7fffffff : 1}, + 'i64_byte_map' : {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1}, + 'double_byte_map' : {-1.1 : 1, 1.1 : 1}, + 'string_byte_map' : {"first" : 1, "second" : 2, "third" : 3, "" : 0}, +//'binary_byte_map,' + 'boolean_byte_map' : {1 : 1, 0 : 0}, + 'byte_i16_map' : {1 : 1, 2 : -1, 3 : 0x7fff}, + 'byte_i32_map' : {1 : 1, 2 : -1, 3 : 0x7fffffff}, + 'byte_i64_map' : {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff}, + 'byte_double_map' : {1 : 0.1, 2 : -0.1, 3 : 1000000.1}, + 'byte_string_map' : {1 : "", 2 : "blah", 3 : "loooooooooooooong string"}, +//'byte_binary_map,' + 'byte_boolean_map' : {1 : 1, 2 : 0}, + 'list_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}, + 'set_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}, + 'map_byte_map' : {{1 : 1} : 1, {2 : 2} : 2, {} : 0}, + 'byte_map_map' : {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}}, + 'byte_set_map' : {0 : [], 1 : [1], 2 : [1, 2]}, + 'byte_list_map' : {0 : [], 1 : [1], 2 : [1, 2]}, }