geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [35/51] [partial] geode git commit: Software Grant Agreement (SGA) from Pivotal for Apache Geode
Date Fri, 13 Jan 2017 22:46:19 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/CacheServPoolRedun3.xml
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/CacheServPoolRedun3.xml b/src/clicache/integration-test/CacheServPoolRedun3.xml
new file mode 100644
index 0000000..75eee18
--- /dev/null
+++ b/src/clicache/integration-test/CacheServPoolRedun3.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+
+<cache xmlns="http://geode.apache.org/schema/cache"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
+       version="1.0">
+	<!--cache-server host="cod" port="24682" /-->
+    <cache-server port="HOST_PORT3">
+	<group>ServerGroup1</group>
+	</cache-server>
+	<region name="PoolRegion1">
+		<region-attributes scope="distributed-ack" data-policy="replicate"/>
+	</region>
+	<region name="PoolRegion2">
+			<region-attributes scope="distributed-ack" data-policy="replicate"/>
+	</region>
+	<region name="PoolRegion3">
+			<region-attributes scope="distributed-ack" data-policy="replicate"/>
+	</region>
+</cache> 

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/CacheServerMsgs.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/CacheServerMsgs.cs b/src/clicache/integration-test/CacheServerMsgs.cs
new file mode 100644
index 0000000..4256edb
--- /dev/null
+++ b/src/clicache/integration-test/CacheServerMsgs.cs
@@ -0,0 +1,48 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+
+namespace GemStone.GemFire.Cache.UnitTests
+{
+  using NUnit.Framework;
+  using GemStone.GemFire.DUnitFramework;
+
+  [TestFixture]
+  [Category("unicast_only")]
+  public class CacheServerMsgs : UnitTests
+  {
+    Cache m_cache = null;
+
+    protected override ClientBase[] GetClients()
+    {
+      return null;
+    }
+
+    [TestFixtureSetUp]
+    public override void InitTests()
+    {
+      base.InitTests();
+      CacheHelper.InitConfig("MessagesTest", "theCache", "SERVER", null,
+        null, null);
+      m_cache = CacheHelper.DCache;
+    }
+
+    [TestFixtureTearDown]
+    public override void EndTests()
+    {
+      try
+      {
+        CacheHelper.Close();
+      }
+      finally
+      {
+        base.EndTests();
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/CacheableWrapper.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/CacheableWrapper.cs b/src/clicache/integration-test/CacheableWrapper.cs
new file mode 100644
index 0000000..293f051
--- /dev/null
+++ b/src/clicache/integration-test/CacheableWrapper.cs
@@ -0,0 +1,198 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace GemStone.GemFire.Cache.UnitTests
+{
+  using NUnit.Framework;
+
+  /// <summary>
+  /// Interface class for wrappers of gemfire cacheable types.
+  /// </summary>
+  /// <remarks>
+  /// This interface has various useful functions like setting value randomly,
+  /// and finding checksum.
+  /// </remarks>
+  public abstract class CacheableWrapper
+  {
+    #region Protected members
+
+    protected IGFSerializable m_cacheableObject = null;
+    protected uint m_typeId;
+
+    #endregion
+
+    public virtual IGFSerializable Cacheable
+    {
+      get
+      {
+        return m_cacheableObject;
+      }
+    }
+
+    public uint TypeId
+    {
+      get
+      {
+        return m_typeId;
+      }
+      set
+      {
+        m_typeId = value;
+      }
+    }
+
+    public abstract void InitRandomValue(int maxSize);
+    
+    public abstract uint GetChecksum(IGFSerializable cacheableObject);
+
+    public virtual uint GetChecksum()
+    {
+      return GetChecksum(m_cacheableObject);
+    }
+  }
+
+  /// <summary>
+  /// Interface class for wrappers of gemfire cacheable key types.
+  /// </summary>
+  /// <remarks>
+  /// This interface has various useful functions like setting value randomly,
+  /// and finding checksum, initializing key etc.
+  /// </remarks>
+  public abstract class CacheableKeyWrapper : CacheableWrapper
+  {
+    public override IGFSerializable Cacheable
+    {
+      get
+      {
+        return m_cacheableObject;
+      }
+    }
+
+    public virtual ICacheableKey CacheableKey
+    {
+      get
+      {
+        return (ICacheableKey)m_cacheableObject;
+      }
+    }
+
+    public abstract int MaxKeys
+    {
+      get;
+    }
+
+    public abstract void InitKey(int keyIndex, int maxSize);
+  }
+
+  public delegate CacheableWrapper CacheableWrapperDelegate();
+  public delegate CacheableKeyWrapper CacheableKeyWrapperDelegate();
+
+  /// <summary>
+  /// Factory class to create <c>CacheableWrapper</c> objects.
+  /// </summary>
+  public static class CacheableWrapperFactory
+  {
+    #region Private members
+
+    private static Dictionary<UInt32, CacheableKeyWrapperDelegate>
+      m_registeredKeyTypeIdMap =
+      new Dictionary<UInt32, CacheableKeyWrapperDelegate>();
+    private static Dictionary<UInt32, Delegate>
+      m_registeredValueTypeIdMap = new Dictionary<UInt32, Delegate>();
+    private static Dictionary<UInt32, Type>
+      m_typeIdNameMap = new Dictionary<UInt32, Type>();
+
+    #endregion
+
+    #region Public methods
+
+    public static CacheableWrapper CreateInstance(UInt32 typeId)
+    {
+      Delegate wrapperDelegate;
+      lock (((ICollection)m_registeredValueTypeIdMap).SyncRoot)
+      {
+        if (m_registeredValueTypeIdMap.TryGetValue(typeId,
+          out wrapperDelegate))
+        {
+          CacheableWrapper wrapper =
+            (CacheableWrapper)wrapperDelegate.DynamicInvoke(null);
+          wrapper.TypeId = typeId;
+          return wrapper;
+        }
+      }
+      return null;
+    }
+
+    public static CacheableKeyWrapper CreateKeyInstance(UInt32 typeId)
+    {
+      CacheableKeyWrapperDelegate wrapperDelegate;
+      lock (((ICollection)m_registeredKeyTypeIdMap).SyncRoot)
+      {
+        if (m_registeredKeyTypeIdMap.TryGetValue(typeId,
+          out wrapperDelegate))
+        {
+          CacheableKeyWrapper wrapper = wrapperDelegate();
+          wrapper.TypeId = typeId;
+          return wrapper;
+        }
+      }
+      return null;
+    }
+
+    public static void RegisterType(UInt32 typeId,
+      Type type, CacheableWrapperDelegate wrapperDelegate)
+    {
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+    }
+
+    public static void RegisterKeyType(UInt32 typeId,
+      Type type, CacheableKeyWrapperDelegate wrapperDelegate)
+    {
+      m_registeredKeyTypeIdMap[typeId] = wrapperDelegate;
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+    }
+
+    public static void ClearStatics()
+    {
+      m_registeredKeyTypeIdMap.Clear();
+      m_registeredValueTypeIdMap.Clear();
+      m_typeIdNameMap.Clear();
+    }
+
+    public static Type GetTypeForId(UInt32 typeId)
+    {
+      Type type;
+      lock (((ICollection)m_typeIdNameMap).SyncRoot)
+      {
+        if (m_typeIdNameMap.TryGetValue(typeId, out type))
+        {
+          return type;
+        }
+      }
+      return null;
+    }
+
+    public static ICollection<UInt32> GetRegisteredKeyTypeIds()
+    {
+      return m_registeredKeyTypeIdMap.Keys;
+    }
+
+    public static ICollection<UInt32> GetRegisteredValueTypeIds()
+    {
+      return m_registeredValueTypeIdMap.Keys;
+    }
+
+    #endregion
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/CacheableWrapperN.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/CacheableWrapperN.cs b/src/clicache/integration-test/CacheableWrapperN.cs
new file mode 100644
index 0000000..89137f4
--- /dev/null
+++ b/src/clicache/integration-test/CacheableWrapperN.cs
@@ -0,0 +1,259 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace GemStone.GemFire.Cache.UnitTests.NewAPI
+{
+  
+  using NUnit.Framework;
+  using GemStone.GemFire.Cache.Generic;
+  /// <summary>
+  /// Interface class for wrappers of gemfire cacheable types.
+  /// </summary>
+  /// <remarks>
+  /// This interface has various useful functions like setting value randomly,
+  /// and finding checksum.
+  /// </remarks>
+  public abstract class CacheableWrapper
+  {
+    #region Protected members
+
+    protected object m_cacheableObject = null;
+    protected uint m_typeId;
+
+    #endregion
+
+    public virtual object Cacheable
+    {
+      get
+      {
+        return m_cacheableObject;
+      }
+    }
+
+    public uint TypeId
+    {
+      get
+      {
+        return m_typeId;
+      }
+      set
+      {
+        m_typeId = value;
+      }
+    }
+
+    public abstract void InitRandomValue(int maxSize);
+    
+    public abstract uint GetChecksum(object cacheableObject);
+
+    public virtual int GetHashCodeN(object cacheableObject)
+    {
+      return cacheableObject.GetHashCode();
+    }
+
+    public virtual uint GetChecksum()
+    {
+      return GetChecksum(m_cacheableObject);
+    }
+
+    public virtual int GetHashCodeN()
+    {
+      return GetHashCodeN(m_cacheableObject);
+    }
+
+  }
+
+  /// <summary>
+  /// Interface class for wrappers of gemfire cacheable key types.
+  /// </summary>
+  /// <remarks>
+  /// This interface has various useful functions like setting value randomly,
+  /// and finding checksum, initializing key etc.
+  /// </remarks>
+  public abstract class CacheableKeyWrapper : CacheableWrapper
+  {
+    public override object Cacheable
+    {
+      get
+      {
+        return m_cacheableObject;
+      }
+    }
+
+    public virtual object CacheableKey
+    {
+      get
+      {
+        return (object)m_cacheableObject;
+      }
+    }
+
+    public abstract int MaxKeys
+    {
+      get;
+    }
+
+    public abstract void InitKey(int keyIndex, int maxSize);
+  }
+
+  public delegate CacheableWrapper CacheableWrapperDelegate();
+  public delegate CacheableKeyWrapper CacheableKeyWrapperDelegate();
+
+  /// <summary>
+  /// Factory class to create <c>CacheableWrapper</c> objects.
+  /// </summary>
+  public static class CacheableWrapperFactory
+  {
+    #region Private members
+
+    private static Dictionary<UInt32, CacheableKeyWrapperDelegate>
+      m_registeredKeyTypeIdMap =
+      new Dictionary<UInt32, CacheableKeyWrapperDelegate>();
+    private static Dictionary<UInt32, Delegate>
+      m_registeredValueTypeIdMap = new Dictionary<UInt32, Delegate>();
+    private static Dictionary<UInt32, Type>
+      m_typeIdNameMap = new Dictionary<UInt32, Type>();
+    private static Dictionary<Type, UInt32>
+      m_dotnetTypeVsCKWDelegate =
+      new Dictionary<Type, UInt32>();
+
+    #endregion
+
+    #region Public methods
+
+    public static CacheableWrapper CreateInstance(UInt32 typeId)
+    {
+      Delegate wrapperDelegate;
+      lock (((ICollection)m_registeredValueTypeIdMap).SyncRoot)
+      {
+        if (m_registeredValueTypeIdMap.TryGetValue(typeId,
+          out wrapperDelegate))
+        {
+          CacheableWrapper wrapper =
+            (CacheableWrapper)wrapperDelegate.DynamicInvoke(null);
+          wrapper.TypeId = typeId;
+          return wrapper;
+        }
+      }
+      return null;
+    }
+
+    public static CacheableWrapper CreateInstance(Object obj)
+    {
+      UInt32 typeId;
+      lock (((ICollection)m_registeredValueTypeIdMap).SyncRoot)
+      {
+        if (m_dotnetTypeVsCKWDelegate.TryGetValue(obj.GetType(),
+          out typeId))
+        {
+          return CreateInstance(typeId);
+        }
+      }
+      return null;
+    }
+
+    public static CacheableKeyWrapper CreateKeyInstance(UInt32 typeId)
+    {
+      CacheableKeyWrapperDelegate wrapperDelegate;
+      lock (((ICollection)m_registeredKeyTypeIdMap).SyncRoot)
+      {
+        if (m_registeredKeyTypeIdMap.TryGetValue(typeId,
+          out wrapperDelegate))
+        {
+          CacheableKeyWrapper wrapper = wrapperDelegate();
+          wrapper.TypeId = typeId;
+          return wrapper;
+        }
+      }
+      return null;
+    }
+
+    public static CacheableKeyWrapper CreateKeyInstance(object obj)
+    {
+      uint typeId;
+      lock (((ICollection)m_dotnetTypeVsCKWDelegate).SyncRoot)
+      {
+        if (m_dotnetTypeVsCKWDelegate.TryGetValue(obj.GetType(),
+          out typeId))
+        {
+          return CreateKeyInstance(typeId);
+        }
+      }
+      return null;
+    }
+
+    public static void RegisterType(UInt32 typeId,
+      Type type, CacheableWrapperDelegate wrapperDelegate)
+    {
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+    }
+
+    public static void RegisterType(UInt32 typeId,
+      Type type, CacheableWrapperDelegate wrapperDelegate, Type dotnetType)
+    {
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+      m_dotnetTypeVsCKWDelegate[dotnetType] = typeId;
+    }
+
+    public static void RegisterKeyType(UInt32 typeId,
+      Type type, CacheableKeyWrapperDelegate wrapperDelegate)
+    {
+      m_registeredKeyTypeIdMap[typeId] = wrapperDelegate;
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+    }
+
+    public static void RegisterKeyType(UInt32 typeId,
+      Type type, CacheableKeyWrapperDelegate wrapperDelegate, Type dotnetType)
+    {
+      m_registeredKeyTypeIdMap[typeId] = wrapperDelegate;
+      m_registeredValueTypeIdMap[typeId] = wrapperDelegate;
+      m_typeIdNameMap[typeId] = type;
+      m_dotnetTypeVsCKWDelegate[dotnetType] = typeId;
+    }
+
+    public static void ClearStaticVaraiables()
+    {
+      m_registeredKeyTypeIdMap.Clear();
+      m_registeredValueTypeIdMap.Clear();
+      m_typeIdNameMap.Clear();
+      m_dotnetTypeVsCKWDelegate.Clear();
+
+    }
+    public static Type GetTypeForId(UInt32 typeId)
+    {
+      Type type;
+      lock (((ICollection)m_typeIdNameMap).SyncRoot)
+      {
+        if (m_typeIdNameMap.TryGetValue(typeId, out type))
+        {
+          return type;
+        }
+      }
+      return null;
+    }
+
+    public static ICollection<UInt32> GetRegisteredKeyTypeIds()
+    {
+      return m_registeredKeyTypeIdMap.Keys;
+    }
+
+    public static ICollection<UInt32> GetRegisteredValueTypeIds()
+    {
+      return m_registeredValueTypeIdMap.Keys;
+    }
+
+    #endregion
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/CachelessTestsN.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/CachelessTestsN.cs b/src/clicache/integration-test/CachelessTestsN.cs
new file mode 100644
index 0000000..ab45d7a
--- /dev/null
+++ b/src/clicache/integration-test/CachelessTestsN.cs
@@ -0,0 +1,147 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+using System.Threading;
+
+namespace GemStone.GemFire.Cache.UnitTests.NewAPI
+{
+  using NUnit.Framework;
+  using GemStone.GemFire.DUnitFramework;
+  using GemStone.GemFire.Cache.Generic;
+
+  [TestFixture]
+  [Category("generics")]
+  public class CachelessTests : UnitTests
+  {
+    private const string RegionName = "DistRegionAck";
+    private RegionWrapper m_regionw;
+    private TallyListener<object, object> m_listener;
+
+    private UnitProcess m_client1, m_client2, m_client3, m_client4;
+
+    protected override ClientBase[] GetClients()
+    {
+      m_client1 = new UnitProcess();
+      m_client2 = new UnitProcess();
+      m_client3 = new UnitProcess();
+      m_client4 = new UnitProcess();
+      return new ClientBase[] { m_client1, m_client2, m_client3, m_client4 };
+    }
+
+    public void CreateRegion(string locators,
+      bool caching, bool listener)
+    {
+      if (listener)
+      {
+        m_listener = new TallyListener<object, object>();
+      }
+      else
+      {
+        m_listener = null;
+      }
+      IRegion<object, object> region = null;
+
+      region = CacheHelper.CreateTCRegion_Pool<object, object>(RegionName, true, caching,
+        m_listener, locators, "__TESTPOOL1_", true);
+      m_regionw = new RegionWrapper(region);
+    }
+
+    public void NoEvents()
+    {
+      Util.Log("Verifying TallyListener has received nothing.");
+      Assert.AreEqual(0, m_listener.Creates, "Should be no creates");
+      Assert.AreEqual(0, m_listener.Updates, "Should be no updates");
+      Assert.IsNull(m_listener.LastKey, "Should be no key");
+      Assert.IsNull(m_listener.LastValue, "Should be no value");
+    }
+
+    public void SendPut(int key, int val)
+    {
+      m_regionw.Put(key, val);
+    }
+
+
+
+    public void CheckEmpty()
+    {
+      Util.Log("check s2p2-subset is still empty.");
+      Thread.Sleep(100); //let it do receiving...
+      m_regionw.Test(1, -1);
+      Assert.AreEqual(0, m_listener.Creates, "Should be no creates");
+      Assert.AreEqual(0, m_listener.Updates, "Should be no updates");
+      m_regionw.Put(2, 1);
+      Assert.AreEqual(1, m_listener.ExpectCreates(1), "Should have been 1 create.");
+      Assert.AreEqual(0, m_listener.ExpectUpdates(0), "Should be no updates");
+    }
+
+    void runCacheless()
+    {
+      CacheHelper.SetupJavaServers(true,
+        "cacheserver_notify_subscription.xml");
+      CacheHelper.StartJavaLocator(1, "GFELOC");
+      Util.Log("Locator started");
+      CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+      Util.Log("Cacheserver 1 started.");
+      Util.Log("Creating region in s1p1-pusher, no-ack, no-cache,  no-listener");
+      m_client1.Call(CreateRegion, CacheHelper.Locators,
+        false, true);
+
+      Util.Log("Creating region in s1p2-listener, no-ack, no-cache, with-listener");
+      m_client2.Call(CreateRegion, CacheHelper.Locators,
+        false, true);
+
+      Util.Log("Creating region in s2p1-storage, no-ack, cache, no-listener");
+      m_client3.Call(CreateRegion, CacheHelper.Locators,
+        true, true);
+
+      Util.Log("Creating region in s2p2-subset, no-ack, cache,  no-listener");
+      m_client4.Call(CreateRegion, CacheHelper.Locators,
+        true, true);
+
+      Util.Log("createRegion seems to return before peers have handshaked... waiting a while.");
+      Thread.Sleep(10000);
+      Util.Log("tired of waiting....");
+
+      m_client2.Call(NoEvents);
+
+      Util.Log("put(1,1) from s1p1-pusher");
+      m_client1.Call(SendPut, 1, 1);
+
+      Util.Log("update from s2p1-storage");
+      m_client3.Call(SendPut, 1, 2);
+
+      m_client2.Call(CheckEmpty);
+
+      m_client1.Call(CacheHelper.Close);
+      m_client2.Call(CacheHelper.Close);
+      m_client3.Call(CacheHelper.Close);
+      m_client4.Call(CacheHelper.Close);
+
+      CacheHelper.StopJavaServer(1);
+      Util.Log("Cacheserver 1 stopped.");
+
+      CacheHelper.StopJavaLocator(1);
+      Util.Log("Locator stopped");
+
+      CacheHelper.ClearEndpoints();
+      CacheHelper.ClearLocators();
+    }
+
+    [TearDown]
+    public override void EndTest()
+    {
+      base.EndTest();
+    }
+
+    [Test]
+    public void Cacheless()
+    {
+      runCacheless();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/DataIOTests.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/DataIOTests.cs b/src/clicache/integration-test/DataIOTests.cs
new file mode 100644
index 0000000..c5d8fd9
--- /dev/null
+++ b/src/clicache/integration-test/DataIOTests.cs
@@ -0,0 +1,231 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace GemStone.GemFire.Cache.UnitTests
+{
+  using NUnit.Framework;
+  using GemStone.GemFire.DUnitFramework;
+
+  [TestFixture]
+  [Category("unicast_only")]
+  public class DataIOTests : UnitTests
+  {
+    XmlNodeReaderWriter settings = Util.DefaultSettings;
+
+    protected override ClientBase[] GetClients()
+    {
+      return null;
+    }
+
+    [Test]
+    public void Byte()
+    {
+      List<Dictionary<string, string>> testbytes = settings.GetValues(MethodBase.GetCurrentMethod(), "byte");
+      if (testbytes != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testbytes)
+        {
+          DataOutput dataOutput = new DataOutput();
+          byte testbyte = Util.String2Byte(dEntry["value"]);
+          dataOutput.WriteByte(testbyte);
+          byte[] buffer = dataOutput.GetBuffer();
+          Assert.AreEqual(testbyte, buffer[0]);
+
+          DataInput dataInput = new DataInput(buffer);
+          byte result = dataInput.ReadByte();
+          Assert.AreEqual(testbyte, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Boolean()
+    {
+      List<Dictionary<string, string>> testbools = settings.GetValues(MethodBase.GetCurrentMethod(), "bool");
+      if (testbools != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testbools)
+        {
+          DataOutput dataOutput = new DataOutput();
+          bool testbool = bool.Parse(dEntry["value"]);
+          dataOutput.WriteBoolean(testbool);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          bool result = dataInput.ReadBoolean();
+          Assert.AreEqual(testbool, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Int16()
+    {
+      List<Dictionary<string, string>> testshorts = settings.GetValues(MethodBase.GetCurrentMethod(), "short");
+      if (testshorts != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testshorts)
+        {
+          DataOutput dataOutput = new DataOutput();
+          short testshort = Util.String2Int16(dEntry["value"]);
+          dataOutput.WriteInt16(testshort);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          short result = dataInput.ReadInt16();
+          Assert.AreEqual(testshort, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Int32()
+    {
+      List<Dictionary<string, string>> testints = settings.GetValues(MethodBase.GetCurrentMethod(), "int");
+      if (testints != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testints)
+        {
+          DataOutput dataOutput = new DataOutput();
+          int testint = Util.String2Int32(dEntry["value"]);
+          dataOutput.WriteInt32(testint);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          int result = dataInput.ReadInt32();
+          Assert.AreEqual(testint, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Int64()
+    {
+      List<Dictionary<string, string>> testints = settings.GetValues(MethodBase.GetCurrentMethod(), "int");
+      if (testints != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testints)
+        {
+          DataOutput dataOutput = new DataOutput();
+          long testlong = Util.String2Int64(dEntry["value"]);
+          dataOutput.WriteInt64(testlong);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          long result = dataInput.ReadInt64();
+          Assert.AreEqual(testlong, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Float()
+    {
+      List<Dictionary<string, string>> testfloats = settings.GetValues(MethodBase.GetCurrentMethod(), "float");
+      if (testfloats != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testfloats)
+        {
+          DataOutput dataOutput = new DataOutput();
+          float testfloat = float.Parse(dEntry["value"]);
+          dataOutput.WriteFloat(testfloat);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          float result = dataInput.ReadFloat();
+          Assert.AreEqual(testfloat, result);
+        }
+      }
+    }
+
+    [Test]
+    public void Double()
+    {
+      List<Dictionary<string, string>> testdoubles = settings.GetValues(MethodBase.GetCurrentMethod(), "double");
+      if (testdoubles != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testdoubles)
+        {
+          DataOutput dataOutput = new DataOutput();
+          double testdouble = double.Parse(dEntry["value"]);
+          dataOutput.WriteDouble(testdouble);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          double result = dataInput.ReadDouble();
+          Assert.AreEqual(testdouble, result);
+        }
+      }
+    }
+
+    [Test]
+    public void ASCIIString()
+    {
+      List<Dictionary<string, string>> testasciis = settings.GetValues(MethodBase.GetCurrentMethod(), "ascii");
+      if (testasciis != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testasciis)
+        {
+          DataOutput dataOutput = new DataOutput();
+          string testascii = dEntry["value"];
+          dataOutput.WriteUTF(testascii);
+          byte[] buffer = dataOutput.GetBuffer();
+          Assert.AreEqual(Util.String2Byte(dEntry["byte0"]), buffer[0]);
+          Assert.AreEqual(Util.String2Byte(dEntry["byte1"]), buffer[1]);
+          for (int i = 0; i < testascii.Length; i++)
+          {
+            Assert.AreEqual(testascii[i], buffer[i + 2]);
+          }
+
+          DataInput dataInput = new DataInput(buffer);
+          string result = dataInput.ReadUTF();
+          Assert.AreEqual(testascii.Length, result.Length);
+          Assert.AreEqual(testascii, result);
+        }
+      }
+    }
+
+    [Test]
+    public void UTFString()
+    {
+      List<Dictionary<string, string>> testutfs = settings.GetValues(MethodBase.GetCurrentMethod(), "utf");
+      if (testutfs != null)
+      {
+        foreach (Dictionary<string, string> dEntry in testutfs)
+        {
+          DataOutput dataOutput = new DataOutput();
+          string testutf = Util.String2String(dEntry["value"]);
+          dataOutput.WriteUTF(testutf);
+          byte[] buffer = dataOutput.GetBuffer();
+          byte[] expectedBytes = Util.String2Bytes(dEntry["bytes"]);
+          Util.CompareTestArrays(expectedBytes, buffer);
+
+          DataInput dataInput = new DataInput(buffer);
+          string result = dataInput.ReadUTF();
+          Assert.AreEqual(testutf.Length, result.Length);
+          Assert.AreEqual(testutf, result);
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/DataOutputTests.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/DataOutputTests.cs b/src/clicache/integration-test/DataOutputTests.cs
new file mode 100755
index 0000000..75aa148
--- /dev/null
+++ b/src/clicache/integration-test/DataOutputTests.cs
@@ -0,0 +1,42 @@
+´╗┐using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace GemStone.GemFire.Cache.UnitTests.NewAPI
+{
+    using NUnit.Framework;
+    using GemStone.GemFire.DUnitFramework;
+    using GemStone.GemFire.Cache.Generic;
+
+    [TestFixture]
+    [Category("unicast_only")]
+    public class DataOutputTests : UnitTests
+    {
+        XmlNodeReaderWriter settings = Util.DefaultSettings;
+
+        protected override ClientBase[] GetClients()
+        {
+            return null;
+        }
+
+        [Test]
+        public void StringExcedesBufferCapacity()
+        {
+
+            DataOutput dataOutput = new DataOutput();
+
+            // Chcek that native buffer is unused and get initial capacity.
+            Assert.AreEqual(0, dataOutput.BufferLength);
+            int bufferSize = dataOutput.GetRemainingBufferLength();
+
+            // New string equal to buffer capacity.
+            string s = "".PadRight(bufferSize, 'a');
+            dataOutput.WriteUTF(s);
+
+            // Checks native buffer capacity, remaining length should be capacity since wrapper has not flushed to native yet.
+            Assert.GreaterOrEqual(dataOutput.GetRemainingBufferLength(), bufferSize + 2, "Buffer should have been resized to account for string + 2 bytes of length");
+            // Forces native buffer to be updated and gets length of used buffers.
+            Assert.AreEqual(bufferSize + 2, dataOutput.BufferLength, "Buffer length should be string plus 2 bytes for length.");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/DefaultCacheable.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/DefaultCacheable.cs b/src/clicache/integration-test/DefaultCacheable.cs
new file mode 100755
index 0000000..80917c3
--- /dev/null
+++ b/src/clicache/integration-test/DefaultCacheable.cs
@@ -0,0 +1,198 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using GemStone.GemFire.Cache.Generic;
+
+namespace GemStone.GemFire.Cache.UnitTests
+{
+  [Serializable]
+  class CustomSerializableObject
+  {
+    public String key;
+    public String value;
+
+    public CustomSerializableObject()
+    {
+      key = "key";
+      value = "value";
+    }
+  }
+  class DefaultCacheable : GemStone.GemFire.Cache.Generic.IGFSerializable
+  {
+    GemStone.GemFire.Cache.Generic.CacheableBoolean m_cacheableBoolean = null;
+    GemStone.GemFire.Cache.Generic.CacheableInt32 m_cacheableInt32 = null;
+    GemStone.GemFire.Cache.Generic.CacheableInt32Array m_cacheableInt32Array = null;
+    GemStone.GemFire.Cache.Generic.CacheableFileName m_cacheableFileName = null;
+    GemStone.GemFire.Cache.Generic.CacheableString m_CacheableStringASCII = null;
+    GemStone.GemFire.Cache.Generic.CacheableStringArray m_cacheableStringArray = null;
+    GemStone.GemFire.Cache.Generic.CacheableHashSet m_cacheableHashSet = null;
+    GemStone.GemFire.Cache.Generic.CacheableHashMap m_cacheableHashMap = null;
+    GemStone.GemFire.Cache.Generic.CacheableDate m_cacheableDate = null;
+    GemStone.GemFire.Cache.Generic.CacheableVector m_cacheableVector = null;
+    GemStone.GemFire.Cache.Generic.CacheableObject m_cacheableObject = null;
+
+    bool m_initialized = false;
+
+    public DefaultCacheable()
+    { 
+    
+    }
+
+    public DefaultCacheable(bool initialized)
+    {
+      if (initialized)
+      {
+        GemStone.GemFire.Cache.Generic.Log.Fine(" in constructor");
+        m_initialized = true;
+
+        m_cacheableBoolean = GemStone.GemFire.Cache.Generic.CacheableBoolean.Create(true);
+
+        m_cacheableInt32 = GemStone.GemFire.Cache.Generic.CacheableInt32.Create(1000);
+
+        m_cacheableInt32Array = GemStone.GemFire.Cache.Generic.CacheableInt32Array.Create(new Int32[] { 1, 2, 3 });
+
+        m_cacheableFileName = GemStone.GemFire.Cache.Generic.CacheableFileName.Create("gemstone.txt");
+
+        m_CacheableStringASCII = GemStone.GemFire.Cache.Generic.CacheableString.Create("asciistring");
+
+        m_cacheableStringArray = GemStone.GemFire.Cache.Generic.CacheableStringArray.Create(new string[] { "one", "two" });
+
+        m_cacheableHashSet = GemStone.GemFire.Cache.Generic.CacheableHashSet.Create(2);
+        m_cacheableHashSet.Add(GemStone.GemFire.Cache.Generic.CacheableString.Create("first"));
+        m_cacheableHashSet.Add(GemStone.GemFire.Cache.Generic.CacheableString.Create("second"));
+
+        m_cacheableHashMap = new GemStone.GemFire.Cache.Generic.CacheableHashMap(new Dictionary<string, string>() {{ "key-hm", "value-hm" }});
+
+        m_cacheableDate = (CacheableDate)CacheableDate.Create(DateTime.Now);
+
+        m_cacheableVector = new GemStone.GemFire.Cache.Generic.CacheableVector(new List<string>() { "one-vec", "two-vec" });
+
+        m_cacheableObject = GemStone.GemFire.Cache.Generic.CacheableObject.Create(new CustomSerializableObject());
+      } 
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableBoolean CBool
+    {
+      get { return m_cacheableBoolean; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableInt32 CInt
+    {
+      get { return m_cacheableInt32; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableInt32Array CIntArray
+    {
+      get { return m_cacheableInt32Array; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableFileName CFileName
+    {
+      get { return m_cacheableFileName; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableString CString
+    {
+      get { return m_CacheableStringASCII; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableStringArray CStringArray
+    {
+      get { return m_cacheableStringArray; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableHashSet CHashSet
+    {
+      get { return m_cacheableHashSet; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableHashMap CHashMap
+    {
+      get { return m_cacheableHashMap; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableDate CDate
+    {
+      get { return m_cacheableDate; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableVector CVector
+    {
+      get { return m_cacheableVector; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.CacheableObject CObject
+    {
+      get { return m_cacheableObject; }
+    }
+
+    #region IGFSerializable Members
+
+    public uint ClassId
+    {
+      get { return 0x04; }
+    }
+
+    public GemStone.GemFire.Cache.Generic.IGFSerializable FromData(GemStone.GemFire.Cache.Generic.DataInput input)
+    {
+      if (!m_initialized)
+      {
+        m_cacheableBoolean = (GemStone.GemFire.Cache.Generic.CacheableBoolean)CacheableBoolean.CreateDeserializable();
+        m_cacheableInt32 = (GemStone.GemFire.Cache.Generic.CacheableInt32)CacheableInt32.CreateDeserializable();
+        m_cacheableInt32Array = (GemStone.GemFire.Cache.Generic.CacheableInt32Array)CacheableInt32Array.CreateDeserializable();
+       // m_cacheableFileName = (CacheableFileName)CacheableFileName.CreateDeserializable();
+        //m_CacheableStringASCII = (CacheableString)CacheableString.CreateDeserializable();
+        m_cacheableStringArray = (GemStone.GemFire.Cache.Generic.CacheableStringArray)CacheableStringArray.CreateDeserializable();
+        m_cacheableHashSet = (GemStone.GemFire.Cache.Generic.CacheableHashSet)CacheableHashSet.CreateDeserializable();
+        m_cacheableHashMap = (GemStone.GemFire.Cache.Generic.CacheableHashMap)CacheableHashMap.CreateDeserializable();
+        m_cacheableDate = (CacheableDate)CacheableDate.CreateDeserializable();
+        m_cacheableVector = (GemStone.GemFire.Cache.Generic.CacheableVector)CacheableVector.CreateDeserializable();
+        m_cacheableObject = (GemStone.GemFire.Cache.Generic.CacheableObject)CacheableObject.CreateDeserializable();
+      }
+
+      m_cacheableBoolean.FromData(input);
+      m_cacheableInt32.FromData(input); ;
+      m_cacheableInt32Array.FromData(input);
+      //m_cacheableFileName.FromData(input);
+      //m_CacheableStringASCII.FromData(input);
+      m_cacheableStringArray.FromData(input);
+      m_cacheableHashSet.FromData(input);
+      m_cacheableHashMap.FromData(input);
+      m_cacheableDate.FromData(input);
+      m_cacheableVector.FromData(input);
+      m_cacheableObject.FromData(input);
+      return this;
+    }
+
+    public uint ObjectSize
+    {
+      get { return 100; }//need to implement
+    }
+
+    public void ToData(GemStone.GemFire.Cache.Generic.DataOutput output)
+    {
+      if (m_initialized)
+      {
+        m_cacheableBoolean.ToData(output);
+        m_cacheableInt32.ToData(output);
+        m_cacheableInt32Array.ToData(output);
+        //m_cacheableFileName.ToData(output);
+        //m_CacheableStringASCII.ToData(output);
+        m_cacheableStringArray.ToData(output);
+        m_cacheableHashSet.ToData(output);
+        m_cacheableHashMap.ToData(output);
+        m_cacheableDate.ToData(output);
+        m_cacheableVector.ToData(output);
+        m_cacheableObject.ToData(output);
+      }
+    }
+
+    #endregion
+
+    public static GemStone.GemFire.Cache.Generic.IGFSerializable CreateDeserializable()
+    {
+      return new DefaultCacheable();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/DefaultCacheableN.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/DefaultCacheableN.cs b/src/clicache/integration-test/DefaultCacheableN.cs
new file mode 100644
index 0000000..f976559
--- /dev/null
+++ b/src/clicache/integration-test/DefaultCacheableN.cs
@@ -0,0 +1,244 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace GemStone.GemFire.Cache.UnitTests.NewAPI
+{
+  using GemStone.GemFire.Cache.Generic;
+
+  [Serializable]
+  class CustomSerializableObject
+  {
+    public String key;
+    public String value;
+
+    public CustomSerializableObject()
+    {
+      key = "key";
+      value = "value";
+    }
+  }
+
+  // VJR: TODO: IGFSerializable should be replaced by IPdxSerializable when ready
+  class DefaultType : IGFSerializable
+  {
+    bool m_cacheableBoolean;
+    int m_cacheableInt32;
+    int[] m_cacheableInt32Array = null;
+    string m_cacheableFileName = null;
+    string m_CacheableStringASCII = null;
+    string[] m_cacheableStringArray = null;
+    //CacheableHashSet m_cacheableHashSet = null;
+    Dictionary<Object, Object> m_cacheableHashMap;
+    //DateTime m_cacheableDate = null;
+    IList<object> m_cacheableVector = null;
+    object m_cacheableObject = null;
+
+    bool m_initialized = false;
+
+    public DefaultType()
+    { 
+    
+    }
+
+    public DefaultType(bool initialized)
+    {
+      if (initialized)
+      {
+        Log.Fine("DefaultType in constructor");
+        m_initialized = true;
+        
+        m_cacheableBoolean = true;
+        
+        m_cacheableInt32 = 1000;
+        
+        m_cacheableInt32Array =new int[]{1,2,3};
+        
+        m_cacheableFileName = "gemstone.txt";
+        
+        m_CacheableStringASCII = "asciistring";
+        
+        m_cacheableStringArray = new string[] { "one", "two" };
+        
+        /*
+        m_cacheableHashSet = CacheableHashSet.Create(2);
+        m_cacheableHashSet.Add(CacheableString.Create("first"));
+        m_cacheableHashSet.Add(CacheableString.Create("second"));
+         * */
+        
+        m_cacheableHashMap = new Dictionary<Object, Object>();
+        m_cacheableHashMap.Add("key-hm", "value-hm");
+        
+        //m_cacheableDate = DateTime.Now;
+
+        m_cacheableVector = new List<object>();
+        m_cacheableVector.Add("one-vec");
+        m_cacheableVector.Add("two-vec");
+
+        //m_cacheableObject = new CustomSerializableObject();
+      } 
+    }
+
+    public bool CBool
+    {
+      get { return m_cacheableBoolean; }
+    }
+
+    public int CInt
+    {
+      get { return m_cacheableInt32; }
+    }
+
+    public int[] CIntArray
+    {
+      get { return m_cacheableInt32Array; }
+    }
+
+    public string CFileName
+    {
+      get { return m_cacheableFileName; }
+    }
+
+    public string CString
+    {
+      get { return m_CacheableStringASCII; }
+    }
+
+    public string[] CStringArray
+    {
+      get { return m_cacheableStringArray; }
+    }
+
+    /*
+    public CacheableHashSet CHashSet
+    {
+      get { return m_cacheableHashSet; }
+    }
+     * */
+
+    public IDictionary<object, object> CHashMap
+    {
+      get { return m_cacheableHashMap; }
+    }
+
+    /*
+    public DateTime CDate
+    {
+      get { return m_cacheableDate; }
+    }
+     * */
+
+    public IList<object> CVector
+    {
+      get { return m_cacheableVector; }
+    }
+
+    public object CObject
+    {
+      get { return m_cacheableObject; }
+    }
+
+    #region IGFSerializable Members
+
+    public uint ClassId
+    {
+      get { return 0x04; }
+    }
+
+    public IGFSerializable FromData(DataInput input)
+    {
+      if (!m_initialized)
+      {
+        /*
+        m_cacheableBoolean = (CacheableBoolean)CacheableBoolean.CreateDeserializable();
+        m_cacheableInt32 = (CacheableInt32)CacheableInt32.CreateDeserializable();
+        m_cacheableInt32Array = (CacheableInt32Array)CacheableInt32Array.CreateDeserializable();
+       // m_cacheableFileName = (CacheableFileName)CacheableFileName.CreateDeserializable();
+        //m_CacheableStringASCII = (CacheableString)CacheableString.CreateDeserializable();
+        m_cacheableStringArray = (CacheableStringArray)CacheableStringArray.CreateDeserializable();
+        m_cacheableHashSet = (CacheableHashSet)CacheableHashSet.CreateDeserializable();
+        m_cacheableHashMap = (CacheableHashMap)CacheableHashMap.CreateDeserializable();
+        m_cacheableDate = (CacheableDate)CacheableDate.CreateDeserializable();
+        m_cacheableVector = (CacheableVector)CacheableVector.CreateDeserializable();
+        m_cacheableObject = (CacheableObject)CacheableObject.CreateDeserializable();
+         * */
+      }
+
+      m_cacheableBoolean = input.ReadBoolean();
+      m_cacheableInt32 = input.ReadInt32();
+      int arraylen = input.ReadArrayLen();
+      m_cacheableInt32Array = new int[arraylen];
+      for (int item = 0; item < arraylen; item++)
+      {
+        m_cacheableInt32Array[item] = input.ReadInt32();
+      }
+      //m_cacheableFileName.FromData(input);
+      //m_CacheableStringASCII.FromData(input);
+      m_cacheableFileName = input.ReadUTF();
+      m_CacheableStringASCII = input.ReadUTF();
+      arraylen = input.ReadArrayLen();
+      m_cacheableStringArray = new string[arraylen];
+      for (int item = 0; item < arraylen; item++)
+      {
+        m_cacheableStringArray[item] = input.ReadUTF();
+      }
+      //m_cacheableHashSet.FromData(input);
+      m_cacheableHashMap = new Dictionary<Object, Object>();
+      input.ReadDictionary((System.Collections.IDictionary)m_cacheableHashMap);
+      //m_cacheableHashMap = input.ReadDictionary();
+      //m_cacheableDate = input.ReadDate();
+      arraylen = input.ReadArrayLen();
+      m_cacheableVector = new object[arraylen];
+      for (int item = 0; item < arraylen; item++)
+      {
+        m_cacheableVector[item] = input.ReadObject();
+      }
+      //m_cacheableObject = input.ReadObject();
+      return this;
+    }
+
+    public uint ObjectSize
+    {
+      get { return 100; }//need to implement
+    }
+
+    public void ToData(DataOutput output)
+    {
+      if (m_initialized)
+      {
+        output.WriteBoolean(m_cacheableBoolean);
+        output.WriteInt32(m_cacheableInt32);
+        output.WriteArrayLen(m_cacheableInt32Array.Length);
+        foreach (int item in m_cacheableInt32Array)
+        {
+          output.WriteInt32(item);
+        }
+        //m_cacheableFileName.ToData(output);
+        //m_CacheableStringASCII.ToData(output);
+        output.WriteUTF(m_cacheableFileName);
+        output.WriteUTF(m_CacheableStringASCII);
+        output.WriteArrayLen(m_cacheableStringArray.Length);
+        foreach (string item in m_cacheableStringArray)
+        {
+          output.WriteUTF(item);
+        }
+        //m_cacheableHashSet.ToData(output);
+        output.WriteDictionary((System.Collections.IDictionary)m_cacheableHashMap);
+        //output.WriteDate(m_cacheableDate);
+        output.WriteArrayLen(m_cacheableVector.Count);
+        foreach (object item in m_cacheableVector)
+        {
+          output.WriteObject(item);
+        }
+        //output.WriteObject(m_cacheableObject);
+      }
+    }
+
+    #endregion
+
+    public static IGFSerializable CreateDeserializable()
+    {
+      return new DefaultType();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/2d4a7ecd/src/clicache/integration-test/DistGetTests.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/DistGetTests.cs b/src/clicache/integration-test/DistGetTests.cs
new file mode 100644
index 0000000..be87a62
--- /dev/null
+++ b/src/clicache/integration-test/DistGetTests.cs
@@ -0,0 +1,181 @@
+//=========================================================================
+// Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
+// This product is protected by U.S. and international copyright
+// and intellectual property laws. Pivotal products are covered by
+// more patents listed at http://www.pivotal.io/patents.
+//========================================================================
+
+using System;
+using System.Threading;
+
+namespace GemStone.GemFire.Cache.UnitTests
+{
+  using NUnit.Framework;
+  using GemStone.GemFire.DUnitFramework;
+
+  [TestFixture]
+  public class DistGetTests : UnitTests
+  {
+    private const string RootRegion = "DistGet";
+    private const string SomeDistRegion = "SomeDistReg";
+    private const string GetRegion = "GetWithInvalid";
+    private const string GetILRegion = "GetWithInvalid_IL";
+
+    private const int InvBeginKey = 2006;
+    private const int InvEndKey = 2260;
+    private const int Inv2BeginKey = 4006;
+    private const int Inv2EndKey = 4260;
+
+    private Region m_region;
+    private UnitProcess m_dataHolder, m_getter, m_invalidOne, m_invalidTwo;
+
+    protected override ClientBase[] GetClients()
+    {
+      m_dataHolder = new UnitProcess();
+      m_getter = new UnitProcess();
+      m_invalidOne = new UnitProcess();
+      m_invalidTwo = new UnitProcess();
+      return new ClientBase[] { m_dataHolder, m_getter, m_invalidOne, m_invalidTwo };
+    }
+
+    #region Functions used by the tests
+
+    public void Puts()
+    {
+      m_region = CacheHelper.CreateDistRegion(RootRegion,
+        ScopeType.DistributedAck, SomeDistRegion, 10);
+      Util.Log("Beginning puts.");
+      m_region.Put("findme", "hello");
+
+      CacheableString cRes = m_region.Get("findme") as CacheableString;
+      Assert.AreEqual("hello", cRes.Value);
+    }
+
+    public void FindItems()
+    {
+      m_region = CacheHelper.CreateDistRegion(RootRegion,
+        ScopeType.DistributedAck, SomeDistRegion, 10);
+
+      Util.Log("Created second process region.");
+
+      CacheableString cKey = new CacheableString("findme");
+      CacheableString cRes = m_region.Get(cKey) as CacheableString;
+      Assert.AreEqual("hello", cRes.Value);
+      Util.Log("Received value for findme: {0}", cRes.Value);
+
+      m_region.LocalInvalidateRegion();
+      Util.Log("invalidated region");
+      Assert.IsTrue(m_region.ContainsKey(cKey));
+      Assert.IsFalse(m_region.ContainsValueForKey(cKey));
+      Util.Log("passed invalid assertions.");
+
+      cRes = m_region.Get(cKey) as CacheableString;
+      Util.Log("get completed.");
+      Assert.AreEqual("hello", cRes.Value);
+      Util.Log("Received value for findme: {0}", cRes.Value);
+    }
+
+    public void MakeDataTwo(string regionName)
+    {
+      m_region = CacheHelper.CreateILRegion(regionName, true, true, null);
+      CacheableInt32 cKey;
+      for (int i = InvBeginKey; i <= InvEndKey; i++)
+      {
+        cKey = new CacheableInt32(i);
+        m_region.Put(cKey, cKey);
+      }
+    }
+
+    public void Join(string regionName)
+    {
+      m_region = CacheHelper.CreateILRegion(regionName, true, true, null);
+      CacheableInt32 cVal;
+      for (int i = InvBeginKey; i <= InvEndKey; i++)
+      {
+        cVal = m_region.Get(i) as CacheableInt32;
+        Assert.IsNotNull(cVal);
+        Assert.AreEqual(i, cVal.Value);
+      }
+      m_region.LocalInvalidateRegion();
+    }
+
+    public void CheckNotValid(string regionName)
+    {
+      m_region = CacheHelper.CreateILRegion(regionName, true, true, null);
+      CacheableInt32 cVal;
+      for (int i = InvBeginKey; i <= InvEndKey; i++)
+      {
+        cVal = m_region.Get(i) as CacheableInt32;
+        Assert.IsNotNull(cVal);
+        Assert.AreEqual(i, cVal.Value);
+      }
+      for (int i = InvBeginKey; i <= InvEndKey; i++)
+      {
+        m_region.Put(i, -i);
+      }
+      for (int i = InvBeginKey; i <= InvEndKey; i++)
+      {
+        cVal = m_region.Get(i) as CacheableInt32;
+        Assert.IsNotNull(cVal);
+        Assert.AreEqual(-i, cVal.Value);
+      }
+    }
+
+    public void PutKeys(int start, int end, int factor, bool invalidate)
+    {
+      for (int i = start; i <= end; i++)
+      {
+        m_region.Put(i, i * factor);
+        if (invalidate)
+        {
+          m_region.LocalInvalidate(i);
+        }
+      }
+    }
+
+    public void CheckKeys(int start, int end, int factor, bool invalidate, bool netSearch)
+    {
+      CacheableInt32 cKey, cVal;
+      for (int i = start; i <= end; i++)
+      {
+        cKey = new CacheableInt32(i);
+        if (netSearch)
+        {
+          Assert.IsFalse(m_region.ContainsKey(cKey));
+        }
+        else
+        {
+          Assert.IsTrue(m_region.ContainsValueForKey(cKey));
+        }
+        cVal = m_region.Get(cKey) as CacheableInt32;
+        Assert.IsNotNull(cVal);
+        Assert.AreEqual(i * factor, cVal.Value);
+        if (invalidate)
+        {
+          m_region.LocalInvalidate(cKey);
+        }
+      }
+    }
+
+    #endregion
+
+    [Test]
+    public void DistReg()
+    {
+      m_dataHolder.Call(Puts);
+      m_getter.Call(FindItems);
+    }
+
+    [Test]
+    public void GetWithInvalid()
+    {
+      m_dataHolder.Call(MakeDataTwo, GetRegion);
+      m_invalidOne.Call(Join, GetRegion);
+      m_invalidTwo.Call(Join, GetRegion);
+      m_getter.Call(CheckNotValid, GetRegion);
+
+      m_invalidTwo.Call(CheckKeys, InvBeginKey, InvEndKey, -1, false, false);
+      m_invalidOne.Call(CheckKeys, InvBeginKey, InvEndKey, -1, false, false);
+    }
+  }
+}


Mime
View raw message