You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/10/12 16:20:00 UTC
[2/2] ignite git commit: IGNITE-1655: Finished .Net part.
IGNITE-1655: Finished .Net part.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c1952acb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c1952acb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c1952acb
Branch: refs/heads/ignite-1655
Commit: c1952acbfbe4d8f6c21998e1512b99c801402159
Parents: bf8ff94
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 12 17:20:39 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 12 17:20:39 2015 +0300
----------------------------------------------------------------------
.../Portable/PortableApiSelfTest.cs | 26 +++-----------------
.../Portable/Metadata/PortableMetadataImpl.cs | 8 +++---
.../Impl/Portable/PortableBuilderImpl.cs | 12 +++------
.../Impl/Portable/PortableSystemHandlers.cs | 10 ++++----
.../Impl/Portable/PortableUtils.cs | 12 ++++-----
.../Impl/Portable/PortableWriterImpl.cs | 12 ++++-----
.../Portable/PortableTypeNames.cs | 10 ++++++--
7 files changed, 36 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
index 009a2da..419cbd9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs
@@ -800,17 +800,13 @@ namespace Apache.Ignite.Core.Tests.Portable
[Test]
public void TestStringDateGuidEnum()
{
- DateTime date = DateTime.Now.ToUniversalTime();
DateTime? nDate = DateTime.Now.ToUniversalTime();
- Guid guid = Guid.NewGuid();
Guid? nGuid = Guid.NewGuid();
IPortableObject portObj = _grid.GetPortables().GetBuilder(typeof(StringDateGuidEnum))
.SetField("fStr", "str")
- .SetField("fDate", date)
.SetField("fNDate", nDate)
- .SetField("fGuid", guid)
.SetField("fNGuid", nGuid)
.SetField("fEnum", TestEnum.One)
.SetField("fStrArr", new[] { "str" })
@@ -826,23 +822,19 @@ namespace Apache.Ignite.Core.Tests.Portable
Assert.AreEqual(typeof(StringDateGuidEnum).Name, meta.TypeName);
- Assert.AreEqual(10, meta.Fields.Count);
+ Assert.AreEqual(8, meta.Fields.Count);
Assert.AreEqual(PortableTypeNames.TypeNameString, meta.GetFieldTypeName("fStr"));
- Assert.AreEqual(PortableTypeNames.TypeNameDate, meta.GetFieldTypeName("fDate"));
- Assert.AreEqual(PortableTypeNames.TypeNameDate, meta.GetFieldTypeName("fNDate"));
- Assert.AreEqual(PortableTypeNames.TypeNameGuid, meta.GetFieldTypeName("fGuid"));
+ Assert.AreEqual(PortableTypeNames.TypeNameTimestamp, meta.GetFieldTypeName("fNDate"));
Assert.AreEqual(PortableTypeNames.TypeNameGuid, meta.GetFieldTypeName("fNGuid"));
Assert.AreEqual(PortableTypeNames.TypeNameEnum, meta.GetFieldTypeName("fEnum"));
Assert.AreEqual(PortableTypeNames.TypeNameArrayString, meta.GetFieldTypeName("fStrArr"));
- Assert.AreEqual(PortableTypeNames.TypeNameArrayDate, meta.GetFieldTypeName("fDateArr"));
+ Assert.AreEqual(PortableTypeNames.TypeNameArrayTimestamp, meta.GetFieldTypeName("fDateArr"));
Assert.AreEqual(PortableTypeNames.TypeNameArrayGuid, meta.GetFieldTypeName("fGuidArr"));
Assert.AreEqual(PortableTypeNames.TypeNameArrayEnum, meta.GetFieldTypeName("fEnumArr"));
Assert.AreEqual("str", portObj.GetField<string>("fStr"));
- Assert.AreEqual(date, portObj.GetField<DateTime>("fDate"));
Assert.AreEqual(nDate, portObj.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(guid, portObj.GetField<Guid>("fGuid"));
Assert.AreEqual(nGuid, portObj.GetField<Guid?>("fNGuid"));
Assert.AreEqual(TestEnum.One, portObj.GetField<TestEnum>("fEnum"));
Assert.AreEqual(new[] { "str" }, portObj.GetField<string[]>("fStrArr"));
@@ -853,9 +845,7 @@ namespace Apache.Ignite.Core.Tests.Portable
StringDateGuidEnum obj = portObj.Deserialize<StringDateGuidEnum>();
Assert.AreEqual("str", obj.FStr);
- Assert.AreEqual(date, obj.FDate);
Assert.AreEqual(nDate, obj.FnDate);
- Assert.AreEqual(guid, obj.FGuid);
Assert.AreEqual(nGuid, obj.FnGuid);
Assert.AreEqual(TestEnum.One, obj.FEnum);
Assert.AreEqual(new[] { "str" }, obj.FStrArr);
@@ -864,17 +854,13 @@ namespace Apache.Ignite.Core.Tests.Portable
Assert.AreEqual(new[] { TestEnum.One }, obj.FEnumArr);
// Overwrite.
- date = DateTime.Now.ToUniversalTime();
nDate = DateTime.Now.ToUniversalTime();
- guid = Guid.NewGuid();
nGuid = Guid.NewGuid();
portObj = _grid.GetPortables().GetBuilder(typeof(StringDateGuidEnum))
.SetField("fStr", "str2")
- .SetField("fDate", date)
.SetField("fNDate", nDate)
- .SetField("fGuid", guid)
.SetField("fNGuid", nGuid)
.SetField("fEnum", TestEnum.Two)
.SetField("fStrArr", new[] { "str2" })
@@ -887,9 +873,7 @@ namespace Apache.Ignite.Core.Tests.Portable
Assert.AreEqual(200, portObj.GetHashCode());
Assert.AreEqual("str2", portObj.GetField<string>("fStr"));
- Assert.AreEqual(date, portObj.GetField<DateTime>("fDate"));
Assert.AreEqual(nDate, portObj.GetField<DateTime?>("fNDate"));
- Assert.AreEqual(guid, portObj.GetField<Guid>("fGuid"));
Assert.AreEqual(nGuid, portObj.GetField<Guid?>("fNGuid"));
Assert.AreEqual(TestEnum.Two, portObj.GetField<TestEnum>("fEnum"));
Assert.AreEqual(new[] { "str2" }, portObj.GetField<string[]>("fStrArr"));
@@ -900,9 +884,7 @@ namespace Apache.Ignite.Core.Tests.Portable
obj = portObj.Deserialize<StringDateGuidEnum>();
Assert.AreEqual("str2", obj.FStr);
- Assert.AreEqual(date, obj.FDate);
Assert.AreEqual(nDate, obj.FnDate);
- Assert.AreEqual(guid, obj.FGuid);
Assert.AreEqual(nGuid, obj.FnGuid);
Assert.AreEqual(TestEnum.Two, obj.FEnum);
Assert.AreEqual(new[] { "str2" }, obj.FStrArr);
@@ -1481,9 +1463,7 @@ namespace Apache.Ignite.Core.Tests.Portable
public class StringDateGuidEnum
{
public string FStr;
- public DateTime FDate;
public DateTime? FnDate;
- public Guid FGuid;
public Guid? FnGuid;
public TestEnum FEnum;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
index 06578c0..0c97ed2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
@@ -71,8 +71,8 @@ namespace Apache.Ignite.Core.Impl.Portable.Metadata
return PortableTypeNames.TypeNameString;
case PortableUtils.TypeGuid:
return PortableTypeNames.TypeNameGuid;
- case PortableUtils.TypeDate:
- return PortableTypeNames.TypeNameDate;
+ case PortableUtils.TypeTimestamp:
+ return PortableTypeNames.TypeNameTimestamp;
case PortableUtils.TypeEnum:
return PortableTypeNames.TypeNameEnum;
case PortableUtils.TypePortable:
@@ -100,8 +100,8 @@ namespace Apache.Ignite.Core.Impl.Portable.Metadata
return PortableTypeNames.TypeNameArrayString;
case PortableUtils.TypeArrayGuid:
return PortableTypeNames.TypeNameArrayGuid;
- case PortableUtils.TypeArrayDate:
- return PortableTypeNames.TypeNameArrayDate;
+ case PortableUtils.TypeArrayTimestamp:
+ return PortableTypeNames.TypeNameArrayTimestamp;
case PortableUtils.TypeArrayEnum:
return PortableTypeNames.TypeNameArrayEnum;
case PortableUtils.TypeArray:
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
index c65038c..38faf20 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
@@ -98,16 +98,12 @@ namespace Apache.Ignite.Core.Impl.Portable
TypeIds[typeof(string[])] = PortableUtils.TypeArrayString;
// 3. Guid.
- TypeIds[typeof(Guid)] = PortableUtils.TypeGuid;
TypeIds[typeof(Guid?)] = PortableUtils.TypeGuid;
- TypeIds[typeof(Guid[])] = PortableUtils.TypeArrayGuid;
TypeIds[typeof(Guid?[])] = PortableUtils.TypeArrayGuid;
// 4. Date.
- TypeIds[typeof(DateTime)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime?)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime[])] = PortableUtils.TypeArrayDate;
- TypeIds[typeof(DateTime?[])] = PortableUtils.TypeArrayDate;
+ TypeIds[typeof(DateTime?)] = PortableUtils.TypeTimestamp;
+ TypeIds[typeof(DateTime?[])] = PortableUtils.TypeArrayTimestamp;
}
/// <summary>
@@ -631,7 +627,7 @@ namespace Apache.Ignite.Core.Impl.Portable
break;
- case PortableUtils.TypeDate:
+ case PortableUtils.TypeTimestamp:
TransferBytes(inStream, outStream, 12);
break;
@@ -679,7 +675,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case PortableUtils.TypeArrayDecimal:
case PortableUtils.TypeArrayString:
case PortableUtils.TypeArrayGuid:
- case PortableUtils.TypeArrayDate:
+ case PortableUtils.TypeArrayTimestamp:
case PortableUtils.TypeArrayEnum:
case PortableUtils.TypeArray:
int arrLen = inStream.ReadInt();
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
index 6b5e20d..feac916 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
@@ -90,7 +90,7 @@ namespace Apache.Ignite.Core.Impl.Portable
ReadHandlers[PortableUtils.TypeDecimal] = new PortableSystemReader<decimal?>(PortableUtils.ReadDecimal);
// 2. Date.
- ReadHandlers[PortableUtils.TypeDate] = new PortableSystemReader<DateTime?>(s => PortableUtils.ReadDate(s, false));
+ ReadHandlers[PortableUtils.TypeTimestamp] = new PortableSystemReader<DateTime?>(s => PortableUtils.ReadDate(s, false));
// 3. String.
ReadHandlers[PortableUtils.TypeString] = new PortableSystemReader<string>(PortableUtils.ReadString);
@@ -128,7 +128,7 @@ namespace Apache.Ignite.Core.Impl.Portable
new PortableSystemReader<decimal?[]>(PortableUtils.ReadDecimalArray);
// 6. Date array.
- ReadHandlers[PortableUtils.TypeArrayDate] =
+ ReadHandlers[PortableUtils.TypeArrayTimestamp] =
new PortableSystemReader<DateTime?[]>(s => PortableUtils.ReadDateArray(s, false));
// 7. String array.
@@ -332,7 +332,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="obj">Value.</param>
private static void WriteDate(PortableWriterImpl ctx, object obj)
{
- ctx.Stream.WriteByte(PortableUtils.TypeDate);
+ ctx.Stream.WriteByte(PortableUtils.TypeTimestamp);
PortableUtils.WriteDate((DateTime)obj, ctx.Stream);
}
@@ -524,7 +524,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="obj">Value.</param>
private static void WriteDateArray(PortableWriterImpl ctx, object obj)
{
- ctx.Stream.WriteByte(PortableUtils.TypeArrayDate);
+ ctx.Stream.WriteByte(PortableUtils.TypeArrayTimestamp);
PortableUtils.WriteDateArray((DateTime[])obj, ctx.Stream);
}
@@ -536,7 +536,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="obj">Value.</param>
private static void WriteNullableDateArray(PortableWriterImpl ctx, object obj)
{
- ctx.Stream.WriteByte(PortableUtils.TypeArrayDate);
+ ctx.Stream.WriteByte(PortableUtils.TypeArrayTimestamp);
PortableUtils.WriteDateArray((DateTime?[])obj, ctx.Stream);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
index f80a199..644ff1f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
@@ -89,7 +89,7 @@ namespace Apache.Ignite.Core.Impl.Portable
public const byte TypeGuid = 10;
/** Type: date. */
- public const byte TypeDate = 11;
+ public const byte TypeTimestamp = 33;
/** Type: unsigned byte array. */
public const byte TypeArrayByte = 12;
@@ -125,7 +125,7 @@ namespace Apache.Ignite.Core.Impl.Portable
public const byte TypeArrayGuid = 21;
/** Type: date array. */
- public const byte TypeArrayDate = 22;
+ public const byte TypeArrayTimestamp = 34;
/** Type: object array. */
public const byte TypeArray = 23;
@@ -675,7 +675,7 @@ namespace Apache.Ignite.Core.Impl.Portable
foreach (DateTime val in vals)
{
- stream.WriteByte(TypeDate);
+ stream.WriteByte(TypeTimestamp);
WriteDate(val, stream);
}
@@ -694,7 +694,7 @@ namespace Apache.Ignite.Core.Impl.Portable
{
if (val.HasValue)
{
- stream.WriteByte(TypeDate);
+ stream.WriteByte(TypeTimestamp);
WriteDate(val.Value, stream);
}
@@ -1586,7 +1586,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case TypeDecimal:
case TypeString:
case TypeGuid:
- case TypeDate:
+ case TypeTimestamp:
case TypeEnum:
case TypeArrayByte:
case TypeArrayShort:
@@ -1599,7 +1599,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case TypeArrayDecimal:
case TypeArrayString:
case TypeArrayGuid:
- case TypeArrayDate:
+ case TypeArrayTimestamp:
case TypeArrayEnum:
case TypeArray:
case TypeCollection:
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
index b490460..b8f3d90 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
@@ -621,7 +621,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="val">Date value.</param>
public void WriteDate(string fieldName, DateTime? val)
{
- WriteFieldId(fieldName, PU.TypeDate);
+ WriteFieldId(fieldName, PU.TypeTimestamp);
if (val == null)
WriteNullField();
@@ -629,7 +629,7 @@ namespace Apache.Ignite.Core.Impl.Portable
{
_stream.WriteInt(PU.LengthTypeId + 12);
- _stream.WriteByte(PortableUtils.TypeDate);
+ _stream.WriteByte(PortableUtils.TypeTimestamp);
PortableUtils.WriteDate(val.Value, _stream);
}
}
@@ -644,7 +644,7 @@ namespace Apache.Ignite.Core.Impl.Portable
WriteNullRawField();
else
{
- _stream.WriteByte(PortableUtils.TypeDate);
+ _stream.WriteByte(PortableUtils.TypeTimestamp);
PortableUtils.WriteDate(val.Value, _stream);
}
}
@@ -656,7 +656,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="val">Date array.</param>
public void WriteDateArray(string fieldName, DateTime?[] val)
{
- WriteFieldId(fieldName, PU.TypeDate);
+ WriteFieldId(fieldName, PU.TypeTimestamp);
if (val == null)
WriteNullField();
@@ -664,7 +664,7 @@ namespace Apache.Ignite.Core.Impl.Portable
{
int pos = SkipFieldLength();
- _stream.WriteByte(PortableUtils.TypeArrayDate);
+ _stream.WriteByte(PortableUtils.TypeArrayTimestamp);
PortableUtils.WriteDateArray(val, _stream);
WriteFieldLength(_stream, pos);
@@ -681,7 +681,7 @@ namespace Apache.Ignite.Core.Impl.Portable
WriteNullRawField();
else
{
- _stream.WriteByte(PortableUtils.TypeArrayDate);
+ _stream.WriteByte(PortableUtils.TypeArrayTimestamp);
PortableUtils.WriteDateArray(val, _stream);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1952acb/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
index ed792c3..14d9da9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
@@ -55,9 +55,12 @@ namespace Apache.Ignite.Core.Portable
/** Type name: UUID. */
public const string TypeNameGuid = "UUID";
- /** Type name: Date. */
+ /** Type name: date. */
public const string TypeNameDate = "Date";
+ /** Type name: timestamp. */
+ public const string TypeNameTimestamp = "Timestamp";
+
/** Type name: Enum. */
public const string TypeNameEnum = "Enum";
@@ -97,9 +100,12 @@ namespace Apache.Ignite.Core.Portable
/** Type name: UUID array. */
public const string TypeNameArrayGuid = "UUID[]";
- /** Type name: Date array. */
+ /** Type name: timestamp array. */
public const string TypeNameArrayDate = "Date[]";
+ /** Type name: timestamp array. */
+ public const string TypeNameArrayTimestamp = "Timestamp[]";
+
/** Type name: Enum array. */
public const string TypeNameArrayEnum = "Enum[]";