You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by ni...@apache.org on 2017/12/29 17:10:13 UTC
[03/19] avro git commit: AVRO-2117: Cleanup C# - Remove trailing
spaces
http://git-wip-us.apache.org/repos/asf/avro/blob/42afa621/lang/csharp/src/apache/test/Schema/AliasTest.cs
----------------------------------------------------------------------
diff --git a/lang/csharp/src/apache/test/Schema/AliasTest.cs b/lang/csharp/src/apache/test/Schema/AliasTest.cs
index e8aeed7..96dec9e 100644
--- a/lang/csharp/src/apache/test/Schema/AliasTest.cs
+++ b/lang/csharp/src/apache/test/Schema/AliasTest.cs
@@ -30,35 +30,35 @@ namespace Avro.Test
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""namespace"":""com"", ""aliases"":[""c"",""foo.y""],
""fields"":
[{""name"":""f1"",""type"":""long"", ""extraprop"":""important"", ""id"":""1029"", ""aliases"":[""a"",""b"",""c""] },
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
true)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[""Alias1""],
""fields"":[{""name"":""f1"",""type"":""long"", ""order"":""junk"" },
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
false)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[""Alias1""], ""customprop"":""123456"",
""fields"":[{""name"":""f1"",""type"":""long"", ""order"":""ascending"", ""fprop"":""faaa"" },
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
true)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[""Alias1""],
""fields"":[{""name"":""f1"",""type"":""long""},
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
true)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[""Alias1"",""Alias2""],
""fields"":[{""name"":""f1"",""type"":""long""},
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
true)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[""Alias1"",9],
""fields"":[{""name"":""f1"",""type"":""long""},
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
false)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"":[1, 2],
""fields"":[{""name"":""f1"",""type"":""long"", ""default"": ""100""},
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
false)]
[TestCase(@"{""type"":""record"",""name"":""LongList"", ""aliases"": ""wrong alias format"",
""fields"":[{""name"":""value"",""type"":""long"", ""default"": ""100""},
- {""name"":""next"",""type"":[""LongList"",""null""]}]}",
+ {""name"":""next"",""type"":[""LongList"",""null""]}]}",
false)]
public void TestAliases(string s, bool valid) // also tests properties, default, order
{
@@ -137,84 +137,84 @@ namespace Avro.Test
}
// Records
- [TestCase(1,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(1,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
- {""name"":""f2"",""type"": ""int""}]}",
+ {""name"":""f2"",""type"": ""int""}]}",
true)]
- [TestCase(2,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(2,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
- @"{""type"":""record"",""name"":""NewRec"",
+ @"{""type"":""record"",""name"":""NewRec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
false)]
[TestCase(3,@"{""type"":""record"",""name"":""Rec"", ""aliases"":[""NewRec""],
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
- @"{""type"":""record"",""name"":""NewRec"",
+ @"{""type"":""record"",""name"":""NewRec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
true)]
[TestCase(4,@"{""type"":""record"",""name"":""Rec"", ""aliases"":[""OtherRec"",""DiffRec""],
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
- @"{""type"":""record"",""name"":""NewRec"",
+ @"{""type"":""record"",""name"":""NewRec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
false)]
- [TestCase(5,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(5,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f3"",""type"": ""int""}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
false)]
- [TestCase(6,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(6,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f3"",""type"": ""int"", ""aliases"":[""f2""]}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
true)]
- [TestCase(7,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(7,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f3"",""type"": ""int"", ""aliases"":[""f4"",""f5""]}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"":""long"" },
{""name"":""f2"",""type"": ""int""}]}",
false)]
- [TestCase(8,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(8,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""symbols"":[""A""] }}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}",
false)]
- [TestCase(9,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(9,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}",
true)]
- [TestCase(10,@"{""type"":""record"",""name"":""Rec"",
+ [TestCase(10,@"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""DiffSymbol""], ""symbols"":[""A""] }}]}",
- @"{""type"":""record"",""name"":""Rec"",
+ @"{""type"":""record"",""name"":""Rec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}",
false)]
- [TestCase(11,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""],
+ [TestCase(11,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""],
""fields"":[{""name"":""f2"",""aliases"":[""f1""],""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }},
{""name"":""f3"",""aliases"":[""f4""],""type"": {""type"":""fixed"", ""name"":""Fixed"", ""aliases"":[""NewFixed""], ""size"": 1 }}
]}",
- @"{""type"":""record"",""name"":""NewRec"",
+ @"{""type"":""record"",""name"":""NewRec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }},
{""name"":""f4"",""type"": {""type"":""fixed"", ""name"":""NewFixed"", ""size"": 1 }}
]}",
true)]
- [TestCase(12,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""],
+ [TestCase(12,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""],
""fields"":[{""name"":""f2"",""aliases"":[""f1""],""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }},
{""name"":""f3"",""aliases"":[""f4""],""type"": {""type"":""fixed"", ""name"":""Fixed"", ""aliases"":[""NewFixed""], ""size"":1 }}
]}",
- @"{""type"":""record"",""name"":""NewRec"",
+ @"{""type"":""record"",""name"":""NewRec"",
""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A"",""B""] }},
{""name"":""f4"",""type"": {""type"":""fixed"", ""name"":""NewFixed"", ""size"":1 }}
]}",
http://git-wip-us.apache.org/repos/asf/avro/blob/42afa621/lang/csharp/src/apache/test/Schema/SchemaTests.cs
----------------------------------------------------------------------
diff --git a/lang/csharp/src/apache/test/Schema/SchemaTests.cs b/lang/csharp/src/apache/test/Schema/SchemaTests.cs
index b124831..7931d40 100644
--- a/lang/csharp/src/apache/test/Schema/SchemaTests.cs
+++ b/lang/csharp/src/apache/test/Schema/SchemaTests.cs
@@ -96,7 +96,7 @@ namespace Avro.Test
[TestCase("[{\"type\": \"array\", \"items\": \"long\"}, {\"type\": \"array\", \"items\": \"string\"}]",
Description = "Duplicate type", ExpectedException = typeof(SchemaParseException))]
[TestCase("{\"type\":[\"string\", \"null\", \"long\"]}")]
-
+
// Fixed
[TestCase("{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}")]
[TestCase("{\"type\": \"fixed\", \"name\": \"MyFixed\", \"namespace\": \"org.apache.hadoop.avro\", \"size\": 1}")]
@@ -118,7 +118,7 @@ namespace Avro.Test
[TestCase("double", Schema.Type.Double)]
[TestCase("bytes", Schema.Type.Bytes)]
[TestCase("string", Schema.Type.String)]
-
+
[TestCase("{ \"type\": \"null\" }", Schema.Type.Null)]
[TestCase("{ \"type\": \"boolean\" }", Schema.Type.Boolean)]
[TestCase("{ \"type\": \"int\" }", Schema.Type.Int)]
@@ -221,7 +221,7 @@ namespace Avro.Test
Assert.AreEqual(Schema.Type.Array, sc.Tag);
ArraySchema ars = sc as ArraySchema;
Assert.AreEqual(item, ars.ItemSchema.Name);
-
+
testEquality(s, sc);
testToString(sc);
}
http://git-wip-us.apache.org/repos/asf/avro/blob/42afa621/lang/csharp/src/apache/test/Specific/SpecificTests.cs
----------------------------------------------------------------------
diff --git a/lang/csharp/src/apache/test/Specific/SpecificTests.cs b/lang/csharp/src/apache/test/Specific/SpecificTests.cs
index e324945..a39168d 100644
--- a/lang/csharp/src/apache/test/Specific/SpecificTests.cs
+++ b/lang/csharp/src/apache/test/Specific/SpecificTests.cs
@@ -41,7 +41,7 @@ namespace Avro.Test
[TestCase(@"{
""protocol"" : ""MyProtocol"",
""namespace"" : ""com.foo"",
- ""types"" : [
+ ""types"" : [
{
""type"" : ""record"",
""name"" : ""A"",
@@ -53,14 +53,14 @@ namespace Avro.Test
""symbols"" : [ ""A"", ""B"", ""C"" ]
},
{
- ""type"": ""fixed"",
- ""size"": 16,
+ ""type"": ""fixed"",
+ ""size"": 16,
""name"": ""MyFixed""
},
{
""type"" : ""record"",
""name"" : ""Z"",
- ""fields"" :
+ ""fields"" :
[
{ ""name"" : ""myUInt"", ""type"" : [ ""int"", ""null"" ] },
{ ""name"" : ""myULong"", ""type"" : [ ""long"", ""null"" ] },
@@ -89,7 +89,7 @@ namespace Avro.Test
{ ""name"" : ""myObject"", ""type"" : [ ""MyEnum"", ""A"", ""null"" ] },
{ ""name"" : ""myArray3"", ""type"" : { ""type"" : ""array"", ""items"" : { ""type"" : ""array"", ""items"" : [ ""double"", ""string"", ""null"" ] } } }
]
- }
+ }
]
}"
, new object[] {3, // index of the schema to serialize
@@ -100,19 +100,19 @@ namespace Avro.Test
string bytes = ""bytes sample text"";
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
- myUInt=1;
- myULong=2;
- myUBool=true;
- myUDouble=(double)3;
- myUFloat=(float)4.5;
+ myUInt=1;
+ myULong=2;
+ myUBool=true;
+ myUDouble=(double)3;
+ myUFloat=(float)4.5;
myUBytes = encoding.GetBytes(bytes);
- myUString=""Hello"";
+ myUString=""Hello"";
- myInt=1;
- myLong=2;
- myBool=true;
- myDouble=(double)3;
- myFloat=(float)4.5;
+ myInt=1;
+ myLong=2;
+ myBool=true;
+ myDouble=(double)3;
+ myFloat=(float)4.5;
myBytes=encoding.GetBytes(bytes);
myString=""Hello"";
myNull=null;
@@ -229,7 +229,7 @@ namespace Avro.Test
[TestCase]
public void TestEnumResolution()
{
- Schema writerSchema = Schema.Parse("{\"type\":\"record\",\"name\":\"EnumRecord\",\"namespace\":\"Avro.Test\"," +
+ Schema writerSchema = Schema.Parse("{\"type\":\"record\",\"name\":\"EnumRecord\",\"namespace\":\"Avro.Test\"," +
"\"fields\":[{\"name\":\"enumType\",\"type\": { \"type\": \"enum\", \"name\": \"EnumType\", \"symbols\": [\"FIRST\", \"SECOND\"]} }]}");
var testRecord = new EnumRecord();
@@ -285,7 +285,7 @@ namespace Avro.Test
var e = new BinaryEncoder(ms);
writer.Write(value, e);
var output = ms.ToArray();
-
+
Assert.AreEqual(expected.Length, output.Length);
Assert.True(expected.SequenceEqual(output));
}
@@ -359,7 +359,7 @@ namespace Avro.Test
{
get
{
- return Schema.Parse("{\"type\":\"record\",\"name\":\"EnumRecord\",\"namespace\":\"Avro.Test\"," +
+ return Schema.Parse("{\"type\":\"record\",\"name\":\"EnumRecord\",\"namespace\":\"Avro.Test\"," +
"\"fields\":[{\"name\":\"enumType\",\"type\": { \"type\": \"enum\", \"name\":" +
" \"EnumType\", \"symbols\": [\"THIRD\", \"FIRST\", \"SECOND\"]} }]}");
}
http://git-wip-us.apache.org/repos/asf/avro/blob/42afa621/lang/csharp/src/apache/test/Utils/CaseFinder.cs
----------------------------------------------------------------------
diff --git a/lang/csharp/src/apache/test/Utils/CaseFinder.cs b/lang/csharp/src/apache/test/Utils/CaseFinder.cs
index ed0d7cf..3189d01 100644
--- a/lang/csharp/src/apache/test/Utils/CaseFinder.cs
+++ b/lang/csharp/src/apache/test/Utils/CaseFinder.cs
@@ -105,7 +105,7 @@ namespace Avro.Test.Utils
}
return singleLineText.Substring(1);
}
-
+
// Process multi-line heredocs
var sb = new StringBuilder();
string line = streamReader.ReadLine();