Return-Path: X-Original-To: apmail-avro-commits-archive@www.apache.org Delivered-To: apmail-avro-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA20C10DF1 for ; Tue, 20 Aug 2013 19:14:18 +0000 (UTC) Received: (qmail 44656 invoked by uid 500); 20 Aug 2013 19:14:18 -0000 Delivered-To: apmail-avro-commits-archive@avro.apache.org Received: (qmail 44622 invoked by uid 500); 20 Aug 2013 19:14:18 -0000 Mailing-List: contact commits-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list commits@avro.apache.org Received: (qmail 44615 invoked by uid 99); 20 Aug 2013 19:14:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Aug 2013 19:14:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,WEIRD_QUOTING 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, 20 Aug 2013 19:14:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D0ABF2388A4A; Tue, 20 Aug 2013 19:13:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1515933 [3/4] - in /avro/trunk: ./ lang/csharp/ lang/csharp/lib/main/ lang/csharp/src/apache/codegen/ lang/csharp/src/apache/codegen/Properties/ lang/csharp/src/apache/ipc/ lang/csharp/src/apache/ipc/Generic/ lang/csharp/src/apache/ipc/Pro... Date: Tue, 20 Aug 2013 19:13:41 -0000 To: commits@avro.apache.org From: cutting@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130820191344.D0ABF2388A4A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: avro/trunk/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs?rev=1515933&r1=1515932&r2=1515933&view=diff ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs (original) +++ avro/trunk/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs Tue Aug 20 19:13:39 2013 @@ -98,21 +98,36 @@ namespace Avro.Test } } - + [Test] public void CanCodeGenTraceProtocol() { - var traceProtocol = System.IO.File.ReadAllText("../../../../../share/schemas/org/apache/avro/ipc/trace/avroTrace.avpr"); + var traceProtocol = + System.IO.File.ReadAllText("../../../../../share/schemas/org/apache/avro/ipc/trace/avroTrace.avpr"); Protocol protocol = Protocol.Parse(traceProtocol); var compilerResults = GenerateProtocol(protocol); // instantiate object - var types = compilerResults.CompiledAssembly.GetTypes().Select(t => t.FullName); - Assert.That(4, Is.EqualTo(types.Count())); - Assert.That(types.Contains("org.apache.avro.ipc.trace.ID"), "Should have contained ID type"); - Assert.That(types.Contains("org.apache.avro.ipc.trace.Span"), "Should have contained Span type"); - Assert.That(types.Contains("org.apache.avro.ipc.trace.SpanEvent"), "Should have contained SpanEvent type"); - Assert.That(types.Contains("org.apache.avro.ipc.trace.TimestampedEvent"), "Should have contained TimestampedEvent type"); + List types = GetTypeFullNames(compilerResults.CompiledAssembly.GetTypes()); + Assert.AreEqual(6, types.Count); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.ID"), "Should have contained ID type"); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.Span"), "Should have contained Span type"); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.SpanEvent"), "Should have contained SpanEvent type"); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.TimestampedEvent"), + "Should have contained TimestampedEvent type"); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.AvroTrace"), "Should have contained SpanEvent type"); + Assert.IsTrue(types.Contains("org.apache.avro.ipc.trace.AvroTraceCallback"), + "Should have contained TimestampedEvent type"); + } + + private static List GetTypeFullNames(Type[] types) + { + var typeFullNames = new List(); + foreach (var type in types) + { + typeFullNames.Add(type.FullName); + } + return typeFullNames; } Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,95 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + /// + /// * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. + /// + public abstract class All : Avro.Specific.ISpecificProtocol + { + private static readonly Avro.Protocol protocol = Avro.Protocol.Parse("{\r\n \"protocol\": \"All\",\r\n \"namespace\": \"org.apache.avro.test\",\r\n \"doc\": \"* Lice" + + "nsed to the Apache Software Foundation (ASF) under one\\\\r\\\\n * or more contribut" + + "or license agreements. See the NOTICE file\\\\r\\\\n * distributed with this work f" + + "or additional information\\\\r\\\\n * regarding copyright ownership. The ASF licens" + + "es this file\\\\r\\\\n * to you under the Apache License, Version 2.0 (the\\\\r\\\\n * \\" + + "\\\\\"License\\\\\\\"); you may not use this file except in compliance\\\\r\\\\n * with the" + + " License. You may obtain a copy of the License at\\\\r\\\\n *\\\\r\\\\n * http://ww" + + "w.apache.org/licenses/LICENSE-2.0\\\\r\\\\n *\\\\r\\\\n * Unless required by applicable " + + "law or agreed to in writing, software\\\\r\\\\n * distributed under the License is d" + + "istributed on an \\\\\\\"AS IS\\\\\\\" BASIS,\\\\r\\\\n * WITHOUT WARRANTIES OR CONDITIONS O" + + "F ANY KIND, either express or implied.\\\\r\\\\n * See the License for the specific " + + "language governing permissions and\\\\r\\\\n * limitations under the License.\",\r\n \"" + + "types\": [\r\n {\r\n \"type\": \"enum\",\r\n \"name\": \"AllEnum\",\r\n \"namesp" + + "ace\": \"org.apache.avro.test\",\r\n \"symbols\": [\r\n \"FOO\",\r\n \"BAR\"" + + "\r\n ]\r\n },\r\n {\r\n \"type\": \"fixed\",\r\n \"name\": \"FixedTest\",\r\n " + + " \"namespace\": \"org.apache.avro.test\",\r\n \"size\": 10\r\n },\r\n {\r\n " + + " \"type\": \"record\",\r\n \"name\": \"AllTestRecord\",\r\n \"namespace\": \"org.apac" + + "he.avro.test\",\r\n \"fields\": [\r\n {\r\n \"name\": \"booleanTest\",\r\n" + + " \"type\": \"boolean\"\r\n },\r\n {\r\n \"name\": \"intTest\"," + + "\r\n \"type\": \"int\"\r\n },\r\n {\r\n \"name\": \"longTest\",\r" + + "\n \"type\": \"long\"\r\n },\r\n {\r\n \"name\": \"floatTest\"," + + "\r\n \"type\": \"float\"\r\n },\r\n {\r\n \"name\": \"doubleTes" + + "t\",\r\n \"type\": \"double\"\r\n },\r\n {\r\n \"name\": \"bytes" + + "Test\",\r\n \"type\": \"bytes\"\r\n },\r\n {\r\n \"name\": \"str" + + "ingTest\",\r\n \"type\": \"string\"\r\n },\r\n {\r\n \"name\": " + + "\"enumTest\",\r\n \"type\": \"AllEnum\"\r\n },\r\n {\r\n \"name" + + "\": \"fixedTest\",\r\n \"type\": \"FixedTest\"\r\n },\r\n {\r\n " + + " \"name\": \"arrayTest\",\r\n \"type\": {\r\n \"type\": \"array\",\r\n " + + " \"items\": \"long\"\r\n }\r\n },\r\n {\r\n \"name\": \"ma" + + "pTest\",\r\n \"type\": {\r\n \"type\": \"map\",\r\n \"values\": " + + "\"long\"\r\n }\r\n },\r\n {\r\n \"name\": \"nestedTest\",\r\n " + + " \"type\": [\r\n \"AllTestRecord\",\r\n \"null\"\r\n ]\r" + + "\n }\r\n ]\r\n }\r\n ],\r\n \"messages\": {\r\n \"echo\": {\r\n \"request" + + "\": [\r\n {\r\n \"name\": \"allTest\",\r\n \"type\": \"AllTestRecord\"" + + "\r\n }\r\n ],\r\n \"response\": \"AllTestRecord\"\r\n },\r\n \"echoParam" + + "eters\": {\r\n \"request\": [\r\n {\r\n \"name\": \"booleanTest\",\r\n " + + " \"type\": \"boolean\"\r\n },\r\n {\r\n \"name\": \"intTest\",\r\n " + + " \"type\": \"int\"\r\n },\r\n {\r\n \"name\": \"longTest\",\r\n " + + " \"type\": \"long\"\r\n },\r\n {\r\n \"name\": \"floatTest\",\r\n " + + " \"type\": \"float\"\r\n },\r\n {\r\n \"name\": \"doubleTest\",\r" + + "\n \"type\": \"double\"\r\n },\r\n {\r\n \"name\": \"bytesTest" + + "\",\r\n \"type\": \"bytes\"\r\n },\r\n {\r\n \"name\": \"stringT" + + "est\",\r\n \"type\": \"string\"\r\n },\r\n {\r\n \"name\": \"enu" + + "mTest\",\r\n \"type\": \"AllEnum\"\r\n },\r\n {\r\n \"name\": \"" + + "fixedTest\",\r\n \"type\": \"FixedTest\"\r\n },\r\n {\r\n \"na" + + "me\": \"arrayTest\",\r\n \"type\": {\r\n \"type\": \"array\",\r\n " + + " \"items\": \"long\"\r\n }\r\n },\r\n {\r\n \"name\": \"mapTes" + + "t\",\r\n \"type\": {\r\n \"type\": \"map\",\r\n \"values\": \"lon" + + "g\"\r\n }\r\n },\r\n {\r\n \"name\": \"nestedTest\",\r\n " + + " \"type\": \"AllTestRecord\"\r\n }\r\n ],\r\n \"response\": \"AllTestRecor" + + "d\"\r\n }\r\n }\r\n}"); + public Avro.Protocol Protocol + { + get + { + return protocol; + } + } + public void Request(Avro.Specific.ICallbackRequestor requestor, string messageName, object[] args, object callback) + { + switch(messageName) + { + case "echo": + requestor.Request(messageName, args, callback); + break; + + case "echoParameters": + requestor.Request(messageName, args, callback); + break; + }; + } + public abstract org.apache.avro.test.AllTestRecord echo(org.apache.avro.test.AllTestRecord allTest); + public abstract org.apache.avro.test.AllTestRecord echoParameters(bool booleanTest, int intTest, long longTest, float floatTest, double doubleTest, byte[] bytesTest, string stringTest, org.apache.avro.test.AllEnum enumTest, org.apache.avro.test.FixedTest fixedTest, IList arrayTest, IDictionary mapTest, org.apache.avro.test.AllTestRecord nestedTest); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,24 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + /// + /// * Licensed to the Apache Software Foundation (ASF) under one\r\n * or more contributor license agreements. See the NOTICE file\r\n * distributed with this work for additional information\r\n * regarding copyright ownership. The ASF licenses this file\r\n * to you under the Apache License, Version 2.0 (the\r\n * \"License\"); you may not use this file except in compliance\r\n * with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License. + /// + public abstract class AllCallback : All + { + public abstract void echo(org.apache.avro.test.AllTestRecord allTest, Avro.IO.ICallback callback); + public abstract void echoParameters(bool booleanTest, int intTest, long longTest, float floatTest, double doubleTest, byte[] bytesTest, string stringTest, org.apache.avro.test.AllEnum enumTest, org.apache.avro.test.FixedTest fixedTest, IList arrayTest, IDictionary mapTest, org.apache.avro.test.AllTestRecord nestedTest, Avro.IO.ICallback callback); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,21 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public enum AllEnum + { + FOO, + BAR, + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,209 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class AllTestRecord : ISpecificRecord + { + private static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""AllTestRecord"",""namespace"":""org.apache.avro.test"",""fields"":[{""name"":""booleanTest"",""type"":""boolean""},{""name"":""intTest"",""type"":""int""},{""name"":""longTest"",""type"":""long""},{""name"":""floatTest"",""type"":""float""},{""name"":""doubleTest"",""type"":""double""},{""name"":""bytesTest"",""type"":""bytes""},{""name"":""stringTest"",""type"":""string""},{""name"":""enumTest"",""type"":{""type"":""enum"",""name"":""AllEnum"",""namespace"":""org.apache.avro.test"",""symbols"":[""FOO"",""BAR""]}},{""name"":""fixedTest"",""type"":{""type"":""fixed"",""name"":""FixedTest"",""namespace"":""org.apache.avro.test"",""size"":10}},{""name"":""arrayTest"",""type"":{""type"":""array"",""items"":""long""}},{""name"":""mapTest"",""type"":{""type"":""map"",""values"":""long""}},{""name"":""nestedTest"",""type"":[""AllTestRecord"",""null""]}]}"); + private bool _booleanTest; + private int _intTest; + private long _longTest; + private float _floatTest; + private double _doubleTest; + private byte[] _bytesTest; + private string _stringTest; + private org.apache.avro.test.AllEnum _enumTest; + private org.apache.avro.test.FixedTest _fixedTest; + private IList _arrayTest; + private IDictionary _mapTest; + private org.apache.avro.test.AllTestRecord _nestedTest; + public virtual Schema Schema + { + get + { + return AllTestRecord._SCHEMA; + } + } + public bool booleanTest + { + get + { + return this._booleanTest; + } + set + { + this._booleanTest = value; + } + } + public int intTest + { + get + { + return this._intTest; + } + set + { + this._intTest = value; + } + } + public long longTest + { + get + { + return this._longTest; + } + set + { + this._longTest = value; + } + } + public float floatTest + { + get + { + return this._floatTest; + } + set + { + this._floatTest = value; + } + } + public double doubleTest + { + get + { + return this._doubleTest; + } + set + { + this._doubleTest = value; + } + } + public byte[] bytesTest + { + get + { + return this._bytesTest; + } + set + { + this._bytesTest = value; + } + } + public string stringTest + { + get + { + return this._stringTest; + } + set + { + this._stringTest = value; + } + } + public org.apache.avro.test.AllEnum enumTest + { + get + { + return this._enumTest; + } + set + { + this._enumTest = value; + } + } + public org.apache.avro.test.FixedTest fixedTest + { + get + { + return this._fixedTest; + } + set + { + this._fixedTest = value; + } + } + public IList arrayTest + { + get + { + return this._arrayTest; + } + set + { + this._arrayTest = value; + } + } + public IDictionary mapTest + { + get + { + return this._mapTest; + } + set + { + this._mapTest = value; + } + } + public org.apache.avro.test.AllTestRecord nestedTest + { + get + { + return this._nestedTest; + } + set + { + this._nestedTest = value; + } + } + public virtual object Get(int fieldPos) + { + switch (fieldPos) + { + case 0: return this.booleanTest; + case 1: return this.intTest; + case 2: return this.longTest; + case 3: return this.floatTest; + case 4: return this.doubleTest; + case 5: return this.bytesTest; + case 6: return this.stringTest; + case 7: return this.enumTest; + case 8: return this.fixedTest; + case 9: return this.arrayTest; + case 10: return this.mapTest; + case 11: return this.nestedTest; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()"); + }; + } + public virtual void Put(int fieldPos, object fieldValue) + { + switch (fieldPos) + { + case 0: this.booleanTest = (System.Boolean)fieldValue; break; + case 1: this.intTest = (System.Int32)fieldValue; break; + case 2: this.longTest = (System.Int64)fieldValue; break; + case 3: this.floatTest = (System.Single)fieldValue; break; + case 4: this.doubleTest = (System.Double)fieldValue; break; + case 5: this.bytesTest = (System.Byte[])fieldValue; break; + case 6: this.stringTest = (System.String)fieldValue; break; + case 7: this.enumTest = (org.apache.avro.test.AllEnum)fieldValue; break; + case 8: this.fixedTest = (org.apache.avro.test.FixedTest)fieldValue; break; + case 9: this.arrayTest = (IList)fieldValue; break; + case 10: this.mapTest = (IDictionary)fieldValue; break; + case 11: this.nestedTest = (org.apache.avro.test.AllTestRecord)fieldValue; break; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()"); + }; + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,50 @@ +using System.Linq; + +namespace org.apache.avro.test +{ + public partial class AllTestRecord + { + protected bool Equals(AllTestRecord other) + { + bool arrayEqual = _arrayTest.SequenceEqual(other._arrayTest); + bool mapEqual = _mapTest.SequenceEqual(other._mapTest); + bool bytesEqual = _bytesTest.SequenceEqual(other._bytesTest); + + return Equals(_nestedTest, other._nestedTest) && mapEqual && + arrayEqual + && Equals(_fixedTest, other._fixedTest) && + _enumTest == other._enumTest && string.Equals(_stringTest, other._stringTest) && + bytesEqual && _doubleTest.Equals(other._doubleTest) && + _floatTest.Equals(other._floatTest) && _longTest == other._longTest && _intTest == other._intTest && + _booleanTest.Equals(other._booleanTest); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((AllTestRecord) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (_nestedTest != null ? _nestedTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (_mapTest != null ? _mapTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (_arrayTest != null ? _arrayTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (_fixedTest != null ? _fixedTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (int) _enumTest; + hashCode = (hashCode*397) ^ (_stringTest != null ? _stringTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (_bytesTest != null ? _bytesTest.GetHashCode() : 0); + hashCode = (hashCode*397) ^ _doubleTest.GetHashCode(); + hashCode = (hashCode*397) ^ _floatTest.GetHashCode(); + hashCode = (hashCode*397) ^ _longTest.GetHashCode(); + hashCode = (hashCode*397) ^ _intTest; + hashCode = (hashCode*397) ^ _booleanTest.GetHashCode(); + return hashCode; + } + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,39 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class FixedTest : SpecificFixed + { + private static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"fixed\",\"name\":\"FixedTest\",\"namespace\":\"org.apache.avro.test\",\"size\":10}"); + private static uint fixedSize = 10; + public FixedTest() : + base(fixedSize) + { + } + public override Schema Schema + { + get + { + return FixedTest._SCHEMA; + } + } + public static uint FixedSize + { + get + { + return FixedTest.fixedSize; + } + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,22 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public enum Kind + { + FOO, + BAR, + BAZ, + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,40 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class MD5 : SpecificFixed + { + private static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"fixed\",\"name\":\"MD5\",\"namespace\":\"org.apache.avro.test\",\"size\":16,\"javaAn" + + "notation\":\"org.apache.avro.TestAnnotation\"}"); + private static uint fixedSize = 16; + public MD5() : + base(fixedSize) + { + } + public override Schema Schema + { + get + { + return MD5._SCHEMA; + } + } + public static uint FixedSize + { + get + { + return MD5.fixedSize; + } + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,87 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public abstract class Mail : Avro.Specific.ISpecificProtocol + { + private static readonly Avro.Protocol protocol = Avro.Protocol.Parse(@"{ + ""protocol"": ""Mail"", + ""namespace"": ""org.apache.avro.test"", + ""types"": [ + { + ""type"": ""record"", + ""name"": ""Message"", + ""namespace"": ""org.apache.avro.test"", + ""fields"": [ + { + ""name"": ""to"", + ""type"": ""string"" + }, + { + ""name"": ""from"", + ""type"": ""string"" + }, + { + ""name"": ""body"", + ""type"": ""string"" + } + ] + } + ], + ""messages"": { + ""send"": { + ""request"": [ + { + ""name"": ""message"", + ""type"": ""Message"" + } + ], + ""response"": ""string"" + }, + ""fireandforget"": { + ""request"": [ + { + ""name"": ""message"", + ""type"": ""Message"" + } + ], + ""response"": ""null"", + ""one-way"": true + } + } +}"); + public Avro.Protocol Protocol + { + get + { + return protocol; + } + } + public void Request(Avro.Specific.ICallbackRequestor requestor, string messageName, object[] args, object callback) + { + switch(messageName) + { + case "send": + requestor.Request(messageName, args, callback); + break; + + case "fireandforget": + requestor.Request(messageName, args, callback); + break; + }; + } + public abstract string send(org.apache.avro.test.Message message); + public abstract void fireandforget(org.apache.avro.test.Message message); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,20 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public abstract class MailCallback : Mail + { + public abstract void send(org.apache.avro.test.Message message, Avro.IO.ICallback callback); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,85 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class Message : ISpecificRecord + { + private static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"record\",\"name\":\"Message\",\"namespace\":\"org.apache.avro.test\",\"fields\":[{\"" + + "name\":\"to\",\"type\":\"string\"},{\"name\":\"from\",\"type\":\"string\"},{\"name\":\"body\",\"type" + + "\":\"string\"}]}"); + private string _to; + private string _from; + private string _body; + public virtual Schema Schema + { + get + { + return Message._SCHEMA; + } + } + public string to + { + get + { + return this._to; + } + set + { + this._to = value; + } + } + public string from + { + get + { + return this._from; + } + set + { + this._from = value; + } + } + public string body + { + get + { + return this._body; + } + set + { + this._body = value; + } + } + public virtual object Get(int fieldPos) + { + switch (fieldPos) + { + case 0: return this.to; + case 1: return this.from; + case 2: return this.body; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()"); + }; + } + public virtual void Put(int fieldPos, object fieldValue) + { + switch (fieldPos) + { + case 0: this.to = (System.String)fieldValue; break; + case 1: this.from = (System.String)fieldValue; break; + case 2: this.body = (System.String)fieldValue; break; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()"); + }; + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,103 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + /// + /// Protocol used for testing. + /// + public abstract class Simple : Avro.Specific.ISpecificProtocol + { + private static readonly Avro.Protocol protocol = Avro.Protocol.Parse("{\r\n \"protocol\": \"Simple\",\r\n \"namespace\": \"org.apache.avro.test\",\r\n \"doc\": \"Pro" + + "tocol used for testing.\",\r\n \"types\": [\r\n {\r\n \"type\": \"enum\",\r\n \"na" + + "me\": \"Kind\",\r\n \"namespace\": \"org.apache.avro.test\",\r\n \"symbols\": [\r\n " + + " \"FOO\",\r\n \"BAR\",\r\n \"BAZ\"\r\n ],\r\n \"javaAnnotation\": \"" + + "org.apache.avro.TestAnnotation\"\r\n },\r\n {\r\n \"type\": \"fixed\",\r\n \"n" + + "ame\": \"MD5\",\r\n \"namespace\": \"org.apache.avro.test\",\r\n \"size\": 16,\r\n " + + " \"javaAnnotation\": \"org.apache.avro.TestAnnotation\"\r\n },\r\n {\r\n \"typ" + + "e\": \"record\",\r\n \"name\": \"TestRecord\",\r\n \"namespace\": \"org.apache.avro." + + "test\",\r\n \"fields\": [\r\n {\r\n \"name\": \"name\",\r\n \"type" + + "\": \"string\",\r\n \"javaAnnotation\": \"org.apache.avro.TestAnnotation\"\r\n " + + " },\r\n {\r\n \"name\": \"kind\",\r\n \"type\": \"Kind\"\r\n " + + "},\r\n {\r\n \"name\": \"hash\",\r\n \"type\": \"MD5\"\r\n }\r\n " + + " ],\r\n \"javaAnnotation\": \"org.apache.avro.TestAnnotation\"\r\n },\r\n {\r" + + "\n \"type\": \"error\",\r\n \"name\": \"TestError\",\r\n \"namespace\": \"org.apa" + + "che.avro.test\",\r\n \"fields\": [\r\n {\r\n \"name\": \"message\",\r\n " + + " \"type\": \"string\"\r\n }\r\n ]\r\n },\r\n {\r\n \"type\": \"recor" + + "d\",\r\n \"name\": \"TestRecordWithUnion\",\r\n \"namespace\": \"org.apache.avro.t" + + "est\",\r\n \"fields\": [\r\n {\r\n \"name\": \"kind\",\r\n \"type\"" + + ": [\r\n \"null\",\r\n \"Kind\"\r\n ]\r\n },\r\n {" + + "\r\n \"name\": \"value\",\r\n \"type\": [\r\n \"null\",\r\n " + + " \"string\"\r\n ]\r\n }\r\n ]\r\n }\r\n ],\r\n \"messages\": {\r\n " + + " \"hello\": {\r\n \"doc\": \"Send a greeting\",\r\n \"request\": [\r\n {\r\n " + + " \"name\": \"greeting\",\r\n \"type\": \"string\"\r\n }\r\n ],\r\n " + + " \"response\": \"string\"\r\n },\r\n \"echo\": {\r\n \"doc\": \"Pretend you\'re in " + + "a cave!\",\r\n \"request\": [\r\n {\r\n \"name\": \"record\",\r\n " + + " \"type\": \"TestRecord\"\r\n }\r\n ],\r\n \"response\": \"TestRecord\"\r\n " + + "},\r\n \"add\": {\r\n \"request\": [\r\n {\r\n \"name\": \"arg1\",\r\n " + + " \"type\": \"int\"\r\n },\r\n {\r\n \"name\": \"arg2\",\r\n " + + " \"type\": \"int\"\r\n }\r\n ],\r\n \"response\": \"int\"\r\n },\r\n \"echoB" + + "ytes\": {\r\n \"request\": [\r\n {\r\n \"name\": \"data\",\r\n \"t" + + "ype\": \"bytes\"\r\n }\r\n ],\r\n \"response\": \"bytes\"\r\n },\r\n \"erro" + + "r\": {\r\n \"doc\": \"Always throws an error.\",\r\n \"request\": [],\r\n \"res" + + "ponse\": \"null\",\r\n \"errors\": [\r\n \"TestError\"\r\n ]\r\n },\r\n \"a" + + "ck\": {\r\n \"doc\": \"Send a one way message\",\r\n \"request\": [],\r\n \"res" + + "ponse\": \"null\",\r\n \"one-way\": true\r\n }\r\n }\r\n}"); + public Avro.Protocol Protocol + { + get + { + return protocol; + } + } + public void Request(Avro.Specific.ICallbackRequestor requestor, string messageName, object[] args, object callback) + { + switch(messageName) + { + case "hello": + requestor.Request(messageName, args, callback); + break; + + case "echo": + requestor.Request(messageName, args, callback); + break; + + case "add": + requestor.Request(messageName, args, callback); + break; + + case "echoBytes": + requestor.Request(messageName, args, callback); + break; + + case "error": + requestor.Request(messageName, args, callback); + break; + + case "ack": + requestor.Request(messageName, args, callback); + break; + }; + } + // Send a greeting + public abstract string hello(string greeting); + // Pretend you're in a cave! + public abstract org.apache.avro.test.TestRecord echo(org.apache.avro.test.TestRecord record); + public abstract int add(int arg1, int arg2); + public abstract byte[] echoBytes(byte[] data); + // Always throws an error. + public abstract object error(); + // Send a one way message + public abstract void ack(); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,30 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + /// + /// Protocol used for testing. + /// + public abstract class SimpleCallback : Simple + { + // Send a greeting + public abstract void hello(string greeting, Avro.IO.ICallback callback); + // Pretend you're in a cave! + public abstract void echo(org.apache.avro.test.TestRecord record, Avro.IO.ICallback callback); + public abstract void add(int arg1, int arg2, Avro.IO.ICallback callback); + public abstract void echoBytes(byte[] data, Avro.IO.ICallback callback); + // Always throws an error. + public abstract void error(Avro.IO.ICallback callback); + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,56 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class TestError : SpecificException + { + private static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"error\",\"name\":\"TestError\",\"namespace\":\"org.apache.avro.test\",\"fields\":[{" + + "\"name\":\"message\",\"type\":\"string\"}]}"); + private string _message; + public override Schema Schema + { + get + { + return TestError._SCHEMA; + } + } + public string message + { + get + { + return this._message; + } + set + { + this._message = value; + } + } + public override object Get(int fieldPos) + { + switch (fieldPos) + { + case 0: return this.message; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()"); + }; + } + public override void Put(int fieldPos, object fieldValue) + { + switch (fieldPos) + { + case 0: this.message = (System.String)fieldValue; break; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()"); + }; + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,83 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class TestRecord : ISpecificRecord + { + private static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""TestRecord"",""namespace"":""org.apache.avro.test"",""fields"":[{""name"":""name"",""type"":""string"",""javaAnnotation"":""org.apache.avro.TestAnnotation""},{""name"":""kind"",""type"":{""type"":""enum"",""name"":""Kind"",""namespace"":""org.apache.avro.test"",""symbols"":[""FOO"",""BAR"",""BAZ""],""javaAnnotation"":""org.apache.avro.TestAnnotation""}},{""name"":""hash"",""type"":{""type"":""fixed"",""name"":""MD5"",""namespace"":""org.apache.avro.test"",""size"":16,""javaAnnotation"":""org.apache.avro.TestAnnotation""}}],""javaAnnotation"":""org.apache.avro.TestAnnotation""}"); + private string _name; + private org.apache.avro.test.Kind _kind; + private org.apache.avro.test.MD5 _hash; + public virtual Schema Schema + { + get + { + return TestRecord._SCHEMA; + } + } + public string name + { + get + { + return this._name; + } + set + { + this._name = value; + } + } + public org.apache.avro.test.Kind kind + { + get + { + return this._kind; + } + set + { + this._kind = value; + } + } + public org.apache.avro.test.MD5 hash + { + get + { + return this._hash; + } + set + { + this._hash = value; + } + } + public virtual object Get(int fieldPos) + { + switch (fieldPos) + { + case 0: return this.name; + case 1: return this.kind; + case 2: return this.hash; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()"); + }; + } + public virtual void Put(int fieldPos, object fieldValue) + { + switch (fieldPos) + { + case 0: this.name = (System.String)fieldValue; break; + case 1: this.kind = (org.apache.avro.test.Kind)fieldValue; break; + case 2: this.hash = (org.apache.avro.test.MD5)fieldValue; break; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()"); + }; + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,29 @@ +namespace org.apache.avro.test +{ + public partial class TestRecord + { + protected bool Equals(TestRecord other) + { + return string.Equals(_name, other._name) && _kind == other._kind && Equals(_hash, other._hash); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((TestRecord) obj); + } + + public override int GetHashCode() + { + unchecked + { + int hashCode = (_name != null ? _name.GetHashCode() : 0); + hashCode = (hashCode*397) ^ (int) _kind; + hashCode = (hashCode*397) ^ (_hash != null ? _hash.GetHashCode() : 0); + return hashCode; + } + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,69 @@ +// ------------------------------------------------------------------------------ +// +// Generated by avrogen.vshost.exe, version 0.9.0.0 +// Changes to this file may cause incorrect behavior and will be lost if code +// is regenerated +// +// ------------------------------------------------------------------------------ +namespace org.apache.avro.test +{ + using System; + using System.Collections.Generic; + using System.Text; + using Avro; + using Avro.Specific; + + public partial class TestRecordWithUnion : ISpecificRecord + { + private static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""TestRecordWithUnion"",""namespace"":""org.apache.avro.test"",""fields"":[{""name"":""kind"",""type"":[""null"",{""type"":""enum"",""name"":""Kind"",""namespace"":""org.apache.avro.test"",""symbols"":[""FOO"",""BAR"",""BAZ""],""javaAnnotation"":""org.apache.avro.TestAnnotation""}]},{""name"":""value"",""type"":[""null"",""string""]}]}"); + private System.Nullable _kind; + private string _value; + public virtual Schema Schema + { + get + { + return TestRecordWithUnion._SCHEMA; + } + } + public System.Nullable kind + { + get + { + return this._kind; + } + set + { + this._kind = value; + } + } + public string @value + { + get + { + return this._value; + } + set + { + this._value = value; + } + } + public virtual object Get(int fieldPos) + { + switch (fieldPos) + { + case 0: return this.kind; + case 1: return this.@value; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()"); + }; + } + public virtual void Put(int fieldPos, object fieldValue) + { + switch (fieldPos) + { + case 0: this.kind = fieldValue == null ? (System.Nullable)null : (org.apache.avro.test.Kind)fieldValue; break; + case 1: this.@value = (System.String)fieldValue; break; + default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()"); + }; + } + } +} Added: avro/trunk/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,72 @@ +/** + * 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. + */ + +using System; +using Avro.Generic; +using Avro.IO; +using Avro.ipc; +using Avro.ipc.Generic; +using NUnit.Framework; + +namespace Avro.Test.Ipc +{ + [TestFixture] + public class LocalTransceiverTest + { + [TestCase] + public void TestSingleRpc() + { + Transceiver t = new LocalTransceiver(new TestResponder(protocol)); + var p = new GenericRecord(protocol.Messages["m"].Request); + p.Add("x", "hello"); + var r = new GenericRequestor(t, protocol); + + for (int x = 0; x < 5; x++) + { + object request = r.Request("m", p); + Assert.AreEqual("there", request); + } + } + + + private readonly Protocol protocol = Protocol.Parse("" + "{\"protocol\": \"Minimal\", " + + "\"messages\": { \"m\": {" + + + " \"request\": [{\"name\": \"x\", \"type\": \"string\"}], " + + " \"response\": \"string\"} } }"); + + public class TestResponder : GenericResponder + { + public TestResponder(Protocol local) + : base(local) + { + } + + public override object Respond(Message message, object request) + { + Assert.AreEqual("hello", ((GenericRecord) request)["x"]); + return "there"; + } + + public override void WriteError(Schema schema, object error, Encoder output) + { + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/MailResponder.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/MailResponder.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/MailResponder.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/MailResponder.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,102 @@ +/** + * 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. + */ + +using System; +using System.IO; +using System.Reflection; +using Avro.Generic; +using Avro.IO; +using Avro.ipc; +using Avro.ipc.Generic; +using NUnit.Framework; + +namespace Avro.Test.Ipc +{ + public class MailResponder : GenericResponder + { + private static Protocol protocol; + private CountdownLatch allMessages = new CountdownLatch(5); + + public MailResponder() + : base(Protocol) + { + } + + public static Protocol Protocol + { + get + { + if (protocol == null) + { + string readAllLines; + using ( + Stream stream = + Assembly.GetExecutingAssembly().GetManifestResourceStream("Avro.test.Ipc.mail.avpr")) + using (var reader = new StreamReader(stream)) + { + readAllLines = reader.ReadToEnd(); + } + + protocol = Protocol.Parse(readAllLines); + } + + return protocol; + } + } + + public override object Respond(Message message, object request) + { + if (message.Name == "send") + { + var genericRecord = (GenericRecord) ((GenericRecord) request)["message"]; + + return "Sent message to [" + genericRecord["to"] + + "] from [" + genericRecord["from"] + "] with body [" + + genericRecord["body"] + "]"; + } + if (message.Name == "fireandforget") + { + allMessages.Signal(); + return null; + } + + throw new NotSupportedException(); + } + + public void Reset() + { + allMessages = new CountdownLatch(5); + } + + public void AwaitMessages() + { + allMessages.Wait(2000); + } + + public void AssertAllMessagesReceived() + { + Assert.AreEqual(0, allMessages.CurrentCount); + } + + + public override void WriteError(Schema schema, object error, Encoder output) + { + Assert.Fail(error.ToString()); + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/SerializationTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/SerializationTest.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/SerializationTest.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/SerializationTest.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,153 @@ +/** + * 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. + */ + +using System.Collections.Generic; +using Avro.ipc; +using Avro.ipc.Generic; +using Avro.ipc.Specific; +using NUnit.Framework; +using org.apache.avro.test; + +namespace Avro.Test.Ipc +{ + [TestFixture] + public class SerializationTest + { + class AllImpl :All + { + public override AllTestRecord echo(AllTestRecord allTest) + { + return allTest; + } + + public override AllTestRecord echoParameters(bool booleanTest, int intTest, long longTest, float floatTest, double doubleTest, + byte[] bytesTest, string stringTest, AllEnum enumTest, FixedTest fixedTest, IList arrayTest, + IDictionary mapTest, AllTestRecord nestedTest) + { + return new AllTestRecord + { + stringTest = stringTest, + booleanTest = booleanTest, + intTest = intTest, + arrayTest = arrayTest, + bytesTest = bytesTest, + doubleTest = doubleTest, + enumTest = enumTest, + fixedTest = fixedTest, + floatTest = floatTest, + longTest = longTest, + mapTest = mapTest, + nestedTest = nestedTest + }; + } + } + private SocketServer server; + private SocketTransceiver transceiver; + private All simpleClient; + + [TestFixtureSetUp] + public void Init() + { + var mailResponder = new SpecificResponder(new AllImpl()); + + server = new SocketServer("localhost", 0, mailResponder); + server.Start(); + + transceiver = new SocketTransceiver("localhost", server.Port); + + simpleClient = SpecificRequestor.CreateClient(transceiver); + } + + [TestFixtureTearDown] + public void Cleanup() + { + server.Stop(); + + transceiver.Disconnect(); + } + + [Test] + public void EchoClass() + { + AllTestRecord expected = CreateExpectedTestData(); + AllTestRecord actual = simpleClient.echo(expected); + + Assert.AreEqual(expected, actual); + } + + [Test] + public void EchoParameters() + { + AllTestRecord expected = CreateExpectedTestData(); + + AllTestRecord actual = simpleClient.echoParameters( + expected.booleanTest, + expected.intTest, + expected.longTest, + expected.floatTest, + expected.doubleTest, + expected.bytesTest, + expected.stringTest, + expected.enumTest, + expected.fixedTest, + expected.arrayTest, + expected.mapTest, + expected.nestedTest); + + Assert.AreEqual(expected, actual); + } + + private static AllTestRecord CreateExpectedTestData() + { + var fixedTestData = new FixedTest(); + fixedTestData.Value[0] = 5; + + return new AllTestRecord + { + arrayTest = new List { 1, 2, 3, 4 }, + booleanTest = true, + bytesTest = new byte[] { 1, 2, 3, 4 }, + doubleTest = 5.0, + enumTest = AllEnum.BAR, + fixedTest = fixedTestData, + floatTest = 99.0f, + intTest = 3, + longTest = 4, + stringTest = "required", + mapTest = new Dictionary + { + { "foo", 1}, + { "bar", 2} + }, + nestedTest = new AllTestRecord + { + booleanTest = true, + bytesTest = new byte[] { 1 }, + stringTest = "required", + fixedTest = fixedTestData, + arrayTest = new List { 1, 2, 3, 4 }, + mapTest = new Dictionary + { + { "foo", 1}, + { "bar", 2} + }, + } + }; + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,146 @@ +/** + * 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. + */ + +using System; +using System.Threading; +using Avro.Generic; +using Avro.IO; +using Avro.ipc; +using Avro.ipc.Generic; +using NUnit.Framework; + +namespace Avro.Test.Ipc +{ + [TestFixture] + public class SocketServerConcurrentExecutionTest + { + private SocketServer server; + + private SocketTransceiver transceiver; + private GenericRequestor proxy; + + //[TearDown] + public void Cleanup() + { + try + { + if (transceiver != null) + { + transceiver.Disconnect(); + } + } + catch + { + } + + try + { + server.Stop(); + } + catch + { + } + } + + // AVRO-625 [Test] + // Currently, SocketTransceiver does not permit out-of-order requests on a stateful connection. + public void Test() + { + var waitLatch = new CountdownLatch(1); + var simpleResponder = new SimpleResponder(waitLatch); + server = new SocketServer("localhost", 0, simpleResponder); + + server.Start(); + + int port = server.Port; + + transceiver = new SocketTransceiver("localhost", port); + proxy = new GenericRequestor(transceiver, SimpleResponder.Protocol); + + // Step 1: + proxy.GetRemote(); // force handshake + + new Thread(x => + { + // Step 2a: + waitLatch.Wait(); + + var ack = new GenericRecord(SimpleResponder.Protocol.Messages["ack"].Request); + // Step 2b: + proxy.Request("ack", ack); + + }).Start(); + + + /* + * 3. Execute the Client.hello("wait") RPC, which will block until the + * Client.ack() call has completed in the background thread. + */ + + var request = new GenericRecord(SimpleResponder.Protocol.Messages["hello"].Request); + request.Add("greeting", "wait"); + + var response = (string)proxy.Request("hello", request); + + // 4. If control reaches here, both RPCs have executed concurrently + Assert.AreEqual("wait", response); + } + + private class SimpleResponder : GenericResponder + { + private readonly CountdownLatch waitLatch; + private readonly CountdownLatch ackLatch = new CountdownLatch(1); + + static readonly public Protocol Protocol = Protocol.Parse("{\"protocol\":\"Simple\",\"namespace\":\"org.apache.avro.test\",\"doc\":\"Protocol used for testing.\",\"version\":\"1.6.2\",\"javaAnnotation\":[\"javax.annotation.Generated(\\\"avro\\\")\",\"org.apache.avro.TestAnnotation\"],\"types\":[{\"type\":\"enum\",\"name\":\"Kind\",\"symbols\":[\"FOO\",\"BAR\",\"BAZ\"],\"javaAnnotation\":\"org.apache.avro.TestAnnotation\"},{\"type\":\"fixed\",\"name\":\"MD5\",\"size\":16,\"javaAnnotation\":\"org.apache.avro.TestAnnotation\"},{\"type\":\"record\",\"name\":\"TestRecord\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"order\":\"ignore\",\"javaAnnotation\":\"org.apache.avro.TestAnnotation\"},{\"name\":\"kind\",\"type\":\"Kind\",\"order\":\"descending\"},{\"name\":\"hash\",\"type\":\"MD5\"}],\"javaAnnotation\":\"org.apache.avro.TestAnnotation\"},{\"type\":\"error\",\"name\":\"TestError\",\"fields\":[{\"name\":\"message\",\"type\ ":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"TestRecordWithUnion\",\"fields\":[{\"name\":\"kind\",\"type\":[\"null\",\"Kind\"]},{\"name\":\"value\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]}]}],\"messages\":{\"hello\":{\"doc\":\"Send a greeting\",\"request\":[{\"name\":\"greeting\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}],\"response\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},\"echo\":{\"doc\":\"Pretend you're in a cave!\",\"request\":[{\"name\":\"record\",\"type\":\"TestRecord\"}],\"response\":\"TestRecord\"},\"add\":{\"specialProp\":\"test\",\"request\":[{\"name\":\"arg1\",\"type\":\"int\"},{\"name\":\"arg2\",\"type\":\"int\"}],\"response\":\"int\"},\"echoBytes\":{\"request\":[{\"name\":\"data\",\"type\":\"bytes\"}],\"response\":\"bytes\"},\"error\":{\"doc\":\"Always throws an error.\",\"request\":[],\"response\":\"null\",\"errors\":[\"TestError\"]},\"ack\":{\"doc\":\ "Send a one way message\",\"javaAnnotation\":\"org.apache.avro.TestAnnotation\",\"request\":[],\"response\":\"null\",\"one-way\":true}}}"); + + public SimpleResponder(CountdownLatch waitLatch) + : base(Protocol) + { + this.waitLatch = waitLatch; + } + + public override object Respond(Message message, object request) + { + if (message.Name == "hello") + { + string greeting = ((GenericRecord)request)["greeting"].ToString(); + if (greeting == "wait") + { + // Step 3a: + waitLatch.Signal(); + + // Step 3b: + ackLatch.Wait(); + } + return greeting; + } + if (message.Name == "ack") + { + ackLatch.Signal(); + } + + throw new NotSupportedException(); + } + + public override void WriteError(Schema schema, object error, Encoder output) + { + throw new System.NotImplementedException(); + } + } + } +} \ No newline at end of file Added: avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs?rev=1515933&view=auto ============================================================================== --- avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs (added) +++ avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs Tue Aug 20 19:13:39 2013 @@ -0,0 +1,187 @@ +/** + * 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. + */ + +using System; +using System.Net.Sockets; +using Avro.Generic; +using Avro.ipc; +using Avro.ipc.Generic; +using NUnit.Framework; + +namespace Avro.Test.Ipc +{ + [TestFixture] + public class SocketServerTest + { + private SocketServer server; + private MailResponder mailResponder; + private SocketTransceiver transceiver; + private GenericRequestor proxy; + + [TestFixtureSetUp] + public void Init() + { + mailResponder = new MailResponder(); + + server = new SocketServer("localhost", 0, mailResponder); + server.Start(); + + transceiver = new SocketTransceiver("localhost", server.Port); + proxy = new GenericRequestor(transceiver, MailResponder.Protocol); + } + + [TestFixtureTearDown] + public void Cleanup() + { + server.Stop(); + + transceiver.Disconnect(); + } + + public void Reset() + { + Cleanup(); + Init(); + } + + private string Send(GenericRecord message) + { + var request = new GenericRecord(MailResponder.Protocol.Messages["send"].Request); + request.Add("message", message); + + var result = (string) proxy.Request("send", request); + return result; + } + + private static void FireAndForget(GenericRequestor proxy, GenericRecord genericRecord) + { + var request = new GenericRecord(MailResponder.Protocol.Messages["fireandforget"].Request); + request.Add("message", genericRecord); + + proxy.Request("fireandforget", request); + } + + private void FireAndForget(GenericRecord genericRecord) + { + FireAndForget(proxy, genericRecord); + } + + private static byte[] GetBytes(string str) + { + var bytes = new byte[str.Length*sizeof (char)]; + Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); + return bytes; + } + + private static GenericRecord CreateMessage() + { + // The first and only type in the list is the Message type. + var recordSchema = (RecordSchema) MailResponder.Protocol.Types[0]; + var record = new GenericRecord(recordSchema); + + record.Add("to", "wife"); + record.Add("from", "husband"); + record.Add("body", "I love you!"); + + return record; + } + + private static void VerifyResponse(string result) + { + Assert.AreEqual( + "Sent message to [wife] from [husband] with body [I love you!]", + result); + } + + [Test] + public void TestBadRequest() + { + int port = server.Port; + const string msg = "GET /status HTTP/1.1\n\n"; + var clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + clientSocket.Connect("localhost", port); + + clientSocket.Send(GetBytes(msg)); + var buf = new byte[2048]; + + try + { + clientSocket.Receive(buf); + } + catch (SocketException ex) + { + Assert.AreEqual(ex.ErrorCode, (int)SocketError.ConnectionReset); + } + } + + [Test] + public void TestMixtureOfRequests() + { + mailResponder.Reset(); + for (int x = 0; x < 5; x++) + { + var createMessage = CreateMessage(); + FireAndForget(createMessage); + + var result = Send(createMessage); + VerifyResponse(result); + } + mailResponder.AwaitMessages(); + mailResponder.AssertAllMessagesReceived(); + } + + [Test] + public void TestMultipleConnectionsCount() + { + Reset(); + + var transceiver2 = new SocketTransceiver("localhost", server.Port); + + var proxy2 = new GenericRequestor(transceiver2, MailResponder.Protocol); + + FireAndForget(proxy, CreateMessage()); + FireAndForget(proxy2, CreateMessage()); + transceiver2.Disconnect(); + } + + [Test] + public void TestOneway() + { + Reset(); + for (int x = 0; x < 5; x++) + { + GenericRecord genericRecord = CreateMessage(); + FireAndForget(genericRecord); + } + mailResponder.AwaitMessages(); + mailResponder.AssertAllMessagesReceived(); + } + + [Test] + public void TestRequestResponse() + { + for (int x = 0; x < 5; x++) + { + var message = CreateMessage(); + + var result = Send(message); + VerifyResponse(result); + } + } + } +} \ No newline at end of file