You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/08/11 23:52:17 UTC
[01/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Repository: geode-native
Updated Branches:
refs/heads/develop da389793e -> 44635ffa9
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxInstanceImpl.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxInstanceImpl.cpp b/clicache/src/impl/PdxInstanceImpl.cpp
new file mode 100755
index 0000000..785d997
--- /dev/null
+++ b/clicache/src/impl/PdxInstanceImpl.cpp
@@ -0,0 +1,1432 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "begin_native.hpp"
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include <CacheImpl.hpp>
+#include "end_native.hpp"
+
+#include "PdxInstanceImpl.hpp"
+#include "PdxHelper.hpp"
+#include "PdxTypeRegistry.hpp"
+#include "../GeodeClassIds.hpp"
+#include "PdxType.hpp"
+#include "PdxLocalWriter.hpp"
+#include "../DataInput.hpp"
+#include "DotNetTypes.hpp"
+#include "PdxType.hpp"
+
+using namespace System::Text;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ //this is for PdxInstanceFactory
+ PdxInstanceImpl::PdxInstanceImpl(Dictionary<String^, Object^>^ fieldVsValue, PdxType^ pdxType, CachePerfStats* cachePerfStats, const native::Cache* cache)
+ {
+ m_updatedFields = fieldVsValue;
+ m_typeId = 0;
+ m_own = false;
+ m_buffer = NULL;
+ m_bufferLength = 0;
+ m_pdxType = pdxType;
+ m_cache = cache;
+ m_cachePerfStats = cachePerfStats;
+ m_pdxType->InitializeType();//to generate static position map
+
+ //need to initiailize stream. this will call todata and in toData we will have stream
+ auto output = m_cache->createDataOutput();
+
+ Apache::Geode::Client::DataOutput mg_output(output.get(), true);
+ Apache::Geode::Client::Internal::PdxHelper::SerializePdx(%mg_output, this);
+ }
+
+ String^ PdxInstanceImpl::GetClassName()
+ {
+ if (m_typeId != 0)
+ {
+ PdxType^ pdxtype = Internal::PdxTypeRegistry::GetPdxType(m_typeId);
+ if (pdxtype == nullptr)//will it ever happen
+ throw gcnew IllegalStateException("PdxType is not defined for PdxInstance: " + m_typeId);
+ return pdxtype->PdxClassName;
+ }
+ //will it ever happen
+ throw gcnew IllegalStateException("PdxInstance typeid is not defined yet, to get classname.");
+ }
+ Object^ PdxInstanceImpl::GetObject()
+ {
+ DataInput^ dataInput = gcnew DataInput(m_buffer, m_bufferLength, m_cache);
+ dataInput->setRootObjectPdx(true);
+ System::Int64 sampleStartNanos = Utils::startStatOpTime();
+ Object^ ret = Internal::PdxHelper::DeserializePdx(dataInput, true, m_typeId, m_bufferLength, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ //dataInput->ResetPdx(0);
+
+ if(m_cachePerfStats)
+ {
+ Utils::updateStatOpTime(m_cachePerfStats->getStat(),
+ m_cachePerfStats->getPdxInstanceDeserializationTimeId(),
+ sampleStartNanos);
+ m_cachePerfStats->incPdxInstanceDeserializations();
+ }
+ return ret;
+ }
+
+ bool PdxInstanceImpl::HasField(String^ fieldName)
+ {
+ PdxType^ pt = getPdxType();
+ return pt->GetPdxField(fieldName) != nullptr;
+ }
+
+ IList<String^>^ PdxInstanceImpl::GetFieldNames()
+ {
+ PdxType^ pt = getPdxType();
+
+ IList<PdxFieldType^>^ pdxFieldList = pt->PdxFieldList;
+ IList<String^>^ retList = gcnew List<String^>();
+
+ for (int i = 0; i < pdxFieldList->Count; i++)
+ {
+ PdxFieldType^ currPf = pdxFieldList[i];
+ retList->Add(currPf->FieldName);
+ }
+
+ return retList;
+ }
+
+ bool PdxInstanceImpl::IsIdentityField(String^ fieldName)
+ {
+ PdxType^ pt = getPdxType();
+ PdxFieldType^ pft = pt->GetPdxField(fieldName);
+
+ return pft != nullptr && pft->IdentityField;
+ }
+
+ Object^ PdxInstanceImpl::GetField(String^ fieldName)
+ {
+ PdxType^ pt = getPdxType();
+
+ PdxFieldType^ pft = pt->GetPdxField(fieldName);
+
+ if (pft == nullptr)
+ {
+ // throw gcnew IllegalStateException("PdxInstance doesn't has field " + fieldName);
+ return nullptr;
+ }
+
+ {
+ DataInput^ dataInput = gcnew DataInput(m_buffer, m_bufferLength, m_cache);
+ dataInput->setPdxdeserialization(true);
+
+ int pos = getOffset(dataInput, pt, pft->SequenceId);
+ //Log::Debug("PdxInstanceImpl::GetField object pos " + (pos + 8) );
+ dataInput->ResetAndAdvanceCursorPdx(pos);
+
+ Object^ tmp = this->readField(dataInput, fieldName, pft->TypeId);
+
+ //dataInput->ResetPdx(0);
+
+ return tmp;
+ }
+ return nullptr;
+ }
+
+ void PdxInstanceImpl::setOffsetForObject(DataInput^ dataInput, PdxType^ pt, int sequenceId)
+ {
+ int pos = getOffset(dataInput, pt, sequenceId);
+ dataInput->ResetAndAdvanceCursorPdx(pos);
+ }
+
+ int PdxInstanceImpl::getOffset(DataInput^ dataInput, PdxType^ pt, int sequenceId)
+ {
+ dataInput->ResetPdx(0);
+
+ int offsetSize = 0;
+ int serializedLength = 0;
+ int pdxSerializedLength = dataInput->GetPdxBytes();
+ if (pdxSerializedLength <= 0xff)
+ offsetSize = 1;
+ else if (pdxSerializedLength <= 0xffff)
+ offsetSize = 2;
+ else
+ offsetSize = 4;
+
+ if (pt->NumberOfVarLenFields > 0)
+ serializedLength = pdxSerializedLength - ((pt->NumberOfVarLenFields - 1) * offsetSize);
+ else
+ serializedLength = pdxSerializedLength;
+
+ System::Byte* offsetsBuffer = dataInput->GetCursor() + serializedLength;
+
+ return pt->GetFieldPosition(sequenceId, offsetsBuffer, offsetSize, serializedLength);
+ }
+
+ int PdxInstanceImpl::getSerializedLength(DataInput^ dataInput, PdxType^ pt)
+ {
+ dataInput->ResetPdx(0);
+
+ int offsetSize = 0;
+ int serializedLength = 0;
+ int pdxSerializedLength = dataInput->GetPdxBytes();
+ if (pdxSerializedLength <= 0xff)
+ offsetSize = 1;
+ else if (pdxSerializedLength <= 0xffff)
+ offsetSize = 2;
+ else
+ offsetSize = 4;
+
+ if (pt->NumberOfVarLenFields > 0)
+ serializedLength = pdxSerializedLength - ((pt->NumberOfVarLenFields - 1) * offsetSize);
+ else
+ serializedLength = pdxSerializedLength;
+
+ return serializedLength;
+ }
+
+ bool PdxInstanceImpl::Equals(Object^ other)
+ {
+ if (other == nullptr)
+ return false;
+
+ PdxInstanceImpl^ otherPdx = dynamic_cast<PdxInstanceImpl^>(other);
+
+ if (otherPdx == nullptr)
+ return false;
+
+ PdxType^ myPdxType = getPdxType();
+ PdxType^ otherPdxType = otherPdx->getPdxType();
+
+ if (!otherPdxType->PdxClassName->Equals(myPdxType->PdxClassName))
+ return false;
+
+ int hashCode = 1;
+
+ //PdxType^ pt = getPdxType();
+
+ IList<PdxFieldType^>^ myPdxIdentityFieldList = getIdentityPdxFields(myPdxType);
+ IList<PdxFieldType^>^ otherPdxIdentityFieldList = otherPdx->getIdentityPdxFields(otherPdxType);
+
+ equatePdxFields(myPdxIdentityFieldList, otherPdxIdentityFieldList);
+ equatePdxFields(otherPdxIdentityFieldList, myPdxIdentityFieldList);
+
+ DataInput^ myDataInput = gcnew DataInput(m_buffer, m_bufferLength, m_cache);
+ myDataInput->setPdxdeserialization(true);
+ DataInput^ otherDataInput = gcnew DataInput(otherPdx->m_buffer, otherPdx->m_bufferLength, m_cache);
+ otherDataInput->setPdxdeserialization(true);
+
+ bool isEqual = false;
+ int fieldTypeId = -1;
+ for (int i = 0; i < myPdxIdentityFieldList->Count; i++)
+ {
+ PdxFieldType^ myPFT = myPdxIdentityFieldList[i];
+ PdxFieldType^ otherPFT = otherPdxIdentityFieldList[i];
+
+ // Log::Debug("pdxfield " + ((myPFT != Default_PdxFieldType)? myPFT->FieldName: otherPFT->FieldName));
+ if (myPFT == Default_PdxFieldType)
+ {
+ fieldTypeId = otherPFT->TypeId;
+ /*Object^ val = otherPdx->GetField(otherPFT->FieldName);
+ if(val == nullptr || (int)val == 0 || (bool)val == false)
+ continue;*/
+ }
+ else if (otherPFT == Default_PdxFieldType)
+ {
+ fieldTypeId = myPFT->TypeId;
+ /*Object^ val = this->GetField(myPFT->FieldName);
+ if(val == nullptr || (int)val == 0 || (bool)val == false)
+ continue;*/
+ }
+ else
+ {
+ fieldTypeId = myPFT->TypeId;
+ }
+
+ switch (fieldTypeId)
+ {
+ case PdxTypes::CHAR:
+ case PdxTypes::BOOLEAN:
+ case PdxTypes::BYTE:
+ case PdxTypes::SHORT:
+ case PdxTypes::INT:
+ case PdxTypes::LONG:
+ case PdxTypes::DATE:
+ case PdxTypes::FLOAT:
+ case PdxTypes::DOUBLE:
+ case PdxTypes::STRING:
+ case PdxTypes::BOOLEAN_ARRAY:
+ case PdxTypes::CHAR_ARRAY:
+ case PdxTypes::BYTE_ARRAY:
+ case PdxTypes::SHORT_ARRAY:
+ case PdxTypes::INT_ARRAY:
+ case PdxTypes::LONG_ARRAY:
+ case PdxTypes::FLOAT_ARRAY:
+ case PdxTypes::DOUBLE_ARRAY:
+ case PdxTypes::STRING_ARRAY:
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ {
+ if (!compareRawBytes(otherPdx, myPdxType, myPFT, myDataInput, otherPdxType, otherPFT, otherDataInput))
+ return false;
+ break;
+ }
+ case PdxTypes::OBJECT:
+ {
+ Object^ object = nullptr;
+ Object^ otherObject = nullptr;
+ if (myPFT != Default_PdxFieldType)
+ {
+ setOffsetForObject(myDataInput, myPdxType, myPFT->SequenceId);
+ object = myDataInput->ReadObject();
+ }
+
+ if (otherPFT != Default_PdxFieldType)
+ {
+ otherPdx->setOffsetForObject(otherDataInput, otherPdxType, otherPFT->SequenceId);
+ otherObject = otherDataInput->ReadObject();
+ }
+
+
+ if (object != nullptr)
+ {
+ if (object->GetType()->IsArray)
+ {
+ if (object->GetType()->GetElementType()->IsPrimitive)//primitive type
+ {
+ if (!compareRawBytes(otherPdx, myPdxType, myPFT, myDataInput, otherPdxType, otherPFT, otherDataInput))
+ return false;
+ }
+ else//array of objects
+ {
+ if (!deepArrayEquals(object, otherObject))
+ return false;
+ }
+ }
+ else//object but can be hashtable, list etc
+ {
+ if (!deepArrayEquals(object, otherObject))
+ return false;
+ }
+ }
+ else if (otherObject != nullptr)
+ {
+ return false;
+ //hashCode = 31 * hashCode; // this may be issue
+ }
+
+ break;
+ }
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ Object^ objectArray = nullptr;
+ Object^ otherObjectArray = nullptr;
+
+ if (myPFT != Default_PdxFieldType)
+ {
+ setOffsetForObject(myDataInput, myPdxType, myPFT->SequenceId);
+ objectArray = myDataInput->ReadObjectArray();
+ }
+
+ if (otherPFT != Default_PdxFieldType)
+ {
+ otherPdx->setOffsetForObject(otherDataInput, otherPdxType, otherPFT->SequenceId);
+ otherObjectArray = otherDataInput->ReadObjectArray();
+ }
+
+ if (!deepArrayEquals(objectArray, otherObjectArray))
+ return false;
+ break;
+ }
+ default:
+ {
+ throw gcnew IllegalStateException("PdxInstance not found typeid " + myPFT->TypeId);
+ }
+ }
+
+ }
+ return true;
+ }
+
+ bool PdxInstanceImpl::compareRawBytes(PdxInstanceImpl^ other, PdxType^ myPT, PdxFieldType^ myF, DataInput^ myDataInput, PdxType^ otherPT, PdxFieldType^ otherF, DataInput^ otherDataInput)
+ {
+ if (myF != Default_PdxFieldType && otherF != Default_PdxFieldType)
+ {
+ int pos = getOffset(myDataInput, myPT, myF->SequenceId);
+ int nextpos = getNextFieldPosition(myDataInput, myF->SequenceId + 1, myPT);
+ myDataInput->ResetAndAdvanceCursorPdx(pos);
+
+ int otherPos = other->getOffset(otherDataInput, otherPT, otherF->SequenceId);
+ int otherNextpos = other->getNextFieldPosition(otherDataInput, otherF->SequenceId + 1, otherPT);
+ otherDataInput->ResetAndAdvanceCursorPdx(otherPos);
+
+ if ((nextpos - pos) != (otherNextpos - otherPos))
+ return false;
+
+ for (int i = pos; i < nextpos; i++)
+ {
+ if (myDataInput->ReadSByte() != otherDataInput->ReadSByte())
+ return false;
+ }
+ //Log::Debug("compareRawBytes returns true" );
+ return true;
+ }
+ else
+ {
+ DataInput^ tmpDI = nullptr;
+ if (myF == Default_PdxFieldType)
+ {
+ int otherPos = other->getOffset(otherDataInput, otherPT, otherF->SequenceId);
+ int otherNextpos = other->getNextFieldPosition(otherDataInput, otherF->SequenceId + 1, otherPT);
+ return hasDefaultBytes(otherF, otherDataInput, otherPos, otherNextpos);
+ }
+ else
+ {
+ int pos = getOffset(myDataInput, myPT, myF->SequenceId);
+ int nextpos = getNextFieldPosition(myDataInput, myF->SequenceId + 1, myPT);
+ return hasDefaultBytes(myF, myDataInput, pos, nextpos);
+ }
+ }
+ }
+
+ void PdxInstanceImpl::equatePdxFields(IList<PdxFieldType^>^ my, IList<PdxFieldType^>^ other)
+ {
+ //Log::Debug("PdxInstanceImpl::equatePdxFields");
+
+ for (int i = 0; i < my->Count; i++)
+ {
+ PdxFieldType^ myF = my[i];
+ if (myF != Default_PdxFieldType)
+ {
+ Log::Debug("field name " + myF->ToString());
+ int otherIdx = other->IndexOf(myF);
+
+ if (otherIdx == -1)//field not there
+ {
+ if (i < other->Count)
+ {
+ PdxFieldType^ tmp = other[i];
+ other[i] = Default_PdxFieldType;
+ other->Add(tmp);
+ }
+ else
+ {
+ other->Add(Default_PdxFieldType);
+ }
+ }
+ else if (otherIdx != i)
+ {
+ PdxFieldType^ tmp = other[i];
+ other[i] = other[otherIdx];
+ other[otherIdx] = tmp;
+ }
+ }
+ }
+
+ //if(my->Count != other->Count)
+ //{
+ // for(int i = 0; i < other->Count; i++)
+ // {
+ // PdxFieldType^ otherF = other[i];
+ // int myIdx = my->IndexOf(otherF);
+ // if(myIdx == -1)//this is the field not there
+ // {
+ // my[i] = otherF;
+ // }
+ // }
+ //}
+ }
+
+ bool PdxInstanceImpl::deepArrayEquals(Object^ obj, Object^ otherObj)
+ {
+ if (obj == nullptr && otherObj == nullptr)
+ return true;
+ else if (obj == nullptr && otherObj != nullptr)
+ return false;
+ else if (obj != nullptr && otherObj == nullptr)
+ return false;
+
+ Type^ objT = obj->GetType();
+ Type^ otherObjT = otherObj->GetType();
+ if (!objT->Equals(otherObjT))
+ return false;
+
+ if (objT->IsArray)
+ {//array
+ return enumerableEquals((System::Collections::IEnumerable^)obj, (System::Collections::IEnumerable^)otherObj);
+ }
+ else if (objT->GetInterface("System.Collections.IDictionary"))
+ {//map
+ // Log::Debug(" in map");
+ return enumerateDictionaryForEqual((System::Collections::IDictionary^)obj, (System::Collections::IDictionary^)otherObj);
+ }
+ else if (objT->GetInterface("System.Collections.IList"))
+ {//list
+ // Log::Debug(" in list");
+ return enumerableEquals((System::Collections::IEnumerable^)obj, (System::Collections::IEnumerable^)otherObj);
+ }
+ else
+ {
+
+ // Log::Debug("final object hashcode " + obj->GetHashCode());
+
+ return obj->Equals(otherObj);
+ }
+ }
+
+ bool PdxInstanceImpl::enumerableEquals(System::Collections::IEnumerable^ enumObj, System::Collections::IEnumerable^ enumOtherObj)
+ {
+ if (enumObj == nullptr && enumOtherObj == nullptr)
+ return true;
+ else if (enumObj == nullptr && enumOtherObj != nullptr)
+ return false;
+ else if (enumObj != nullptr && enumOtherObj == nullptr)
+ return false;
+
+
+ System::Collections::IEnumerator^ my = enumObj->GetEnumerator();
+ System::Collections::IEnumerator^ other = enumOtherObj->GetEnumerator();
+
+
+ while (true)
+ {
+ bool m = my->MoveNext();
+ bool o = other->MoveNext();
+ if (m && o)
+ {
+ if (!my->Current->Equals(other->Current))
+ return false;
+ }
+ else if (!m && !o)
+ return true;
+ else
+ return false;
+ }
+ // Log::Debug(" in enumerableHashCode FINAL hc " + h);
+ return true;
+ }
+
+ bool PdxInstanceImpl::enumerateDictionaryForEqual(System::Collections::IDictionary^ iDict, System::Collections::IDictionary^ otherIDict)
+ {
+ if (iDict == nullptr && otherIDict == nullptr)
+ return true;
+ else if (iDict == nullptr && otherIDict != nullptr)
+ return false;
+ else if (iDict != nullptr && otherIDict == nullptr)
+ return false;
+
+ if (iDict->Count != otherIDict->Count)
+ return false;
+
+ System::Collections::IDictionaryEnumerator^ dEnum = iDict->GetEnumerator();
+ for each(System::Collections::DictionaryEntry^ de in iDict)
+ {
+ Object^ other = nullptr;
+ if (otherIDict->Contains(de->Key))
+ {
+ if (!deepArrayEquals(de->Value, otherIDict[de->Key]))
+ return false;
+ }
+ else
+ return false;
+ }
+ // Log::Debug(" in enumerateDictionary FINAL hc " + h);
+ return true;
+ }
+
+
+
+ int PdxInstanceImpl::GetHashCode()
+ {
+ int hashCode = 1;
+
+ PdxType^ pt = getPdxType();
+
+ IList<PdxFieldType^>^ pdxIdentityFieldList = getIdentityPdxFields(pt);
+
+ DataInput^ dataInput = gcnew DataInput(m_buffer, m_bufferLength, m_cache);
+ dataInput->setPdxdeserialization(true);
+
+ for (int i = 0; i < pdxIdentityFieldList->Count; i++)
+ {
+ PdxFieldType^ pField = pdxIdentityFieldList[i];
+
+ //Log::Debug("hashcode for pdxfield " + pField->FieldName + " hashcode is " + hashCode);
+ switch (pField->TypeId)
+ {
+ case PdxTypes::CHAR:
+ case PdxTypes::BOOLEAN:
+ case PdxTypes::BYTE:
+ case PdxTypes::SHORT:
+ case PdxTypes::INT:
+ case PdxTypes::LONG:
+ case PdxTypes::DATE:
+ case PdxTypes::FLOAT:
+ case PdxTypes::DOUBLE:
+ case PdxTypes::STRING:
+ case PdxTypes::BOOLEAN_ARRAY:
+ case PdxTypes::CHAR_ARRAY:
+ case PdxTypes::BYTE_ARRAY:
+ case PdxTypes::SHORT_ARRAY:
+ case PdxTypes::INT_ARRAY:
+ case PdxTypes::LONG_ARRAY:
+ case PdxTypes::FLOAT_ARRAY:
+ case PdxTypes::DOUBLE_ARRAY:
+ case PdxTypes::STRING_ARRAY:
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ {
+ int retH = getRawHashCode(pt, pField, dataInput);
+ if (retH != 0)
+ hashCode = 31 * hashCode + retH;
+ break;
+ }
+ case PdxTypes::OBJECT:
+ {
+ setOffsetForObject(dataInput, pt, pField->SequenceId);
+ Object^ object = dataInput->ReadObject();
+
+ if (object != nullptr)
+ {
+ if (object->GetType()->IsArray)
+ {
+ if (object->GetType()->GetElementType()->IsPrimitive)//primitive type
+ {
+ int retH = getRawHashCode(pt, pField, dataInput);
+ if (retH != 0)
+ hashCode = 31 * hashCode + retH;
+ }
+ else//array of objects
+ {
+ hashCode = 31 * hashCode + deepArrayHashCode(object);
+ }
+ }
+ else//object but can be hashtable, list etc
+ {
+ hashCode = 31 * hashCode + deepArrayHashCode(object);
+ }
+ }
+ else
+ {
+ //hashCode = 31 * hashCode; // this may be issue
+ }
+
+ break;
+ }
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ setOffsetForObject(dataInput, pt, pField->SequenceId);
+ Object^ objectArray = dataInput->ReadObjectArray();
+ hashCode = 31 * hashCode + (objectArray != nullptr) ? deepArrayHashCode(objectArray) : 0;
+ break;
+ }
+ default:
+ {
+ throw gcnew IllegalStateException("PdxInstance not found typeid " + pField->TypeId);
+ }
+ }
+
+ }
+ return hashCode;
+ }
+
+
+ int PdxInstanceImpl::deepArrayHashCode(Object^ obj)
+ {
+ if (obj == nullptr)
+ return 0;
+
+ Type^ objT = obj->GetType();
+
+ /*for each(Type^ tmp in objT->GetInterfaces())
+ //Log::Debug("interfaces " + tmp);*/
+
+ if (objT->IsArray)
+ {//array
+ //if(objT->GetElementType()->IsPrimitive)
+ //{//primitive array
+ // return primitiveArrayHashCode((array<int>^)obj);
+ //}
+ //else
+ {//object array
+ return enumerableHashCode((System::Collections::IEnumerable^)obj);
+ }
+ }
+ else if (objT->GetInterface("System.Collections.IDictionary"))
+ {//map
+ // Log::Debug(" in map");
+ return enumerateDictionary((System::Collections::IDictionary^)obj);
+ }
+ else if (objT->GetInterface("System.Collections.IList"))
+ {//list
+ // Log::Debug(" in list");
+ return enumerableHashCode((System::Collections::IEnumerable^)obj);
+ }
+ else
+ {
+
+ // Log::Debug("final object hashcode " + obj->GetHashCode());
+
+ if (obj->GetType()->Equals(DotNetTypes::BooleanType))
+ {
+ if ((bool)obj)
+ return 1231;
+ else
+ return 1237;
+ }
+ else if (obj->GetType()->Equals(DotNetTypes::StringType))
+ {
+ String^ str = (String^)obj;
+ int prime = 31;
+ int h = 0;
+ for (int i = 0; i < str->Length; i++)
+ h = prime*h + str[i];
+ return h;
+ }
+
+ return obj->GetHashCode();
+ }
+ }
+
+ int PdxInstanceImpl::enumerableHashCode(System::Collections::IEnumerable^ enumObj)
+ {
+ int h = 1;
+ for each(Object^ o in enumObj)
+ {
+ h = h * 31 + deepArrayHashCode(o);
+ // Log::Debug(" in enumerableHashCode hc " + h);
+ }
+ // Log::Debug(" in enumerableHashCode FINAL hc " + h);
+ return h;
+ }
+
+ int PdxInstanceImpl::enumerateDictionary(System::Collections::IDictionary^ iDict)
+ {
+ int h = 0;
+ System::Collections::IDictionaryEnumerator^ dEnum = iDict->GetEnumerator();
+ for each(System::Collections::DictionaryEntry^ de in iDict)
+ {
+ //System::Collections::DictionaryEntry^ de = (System::Collections::DictionaryEntry^)o;
+ h = h + ((deepArrayHashCode(de->Key)) ^ ((de->Value != nullptr) ? deepArrayHashCode(de->Value) : 0));
+ }
+ // Log::Debug(" in enumerateDictionary FINAL hc " + h);
+ return h;
+ }
+
+ generic <class T>
+ int PdxInstanceImpl::primitiveArrayHashCode(T objArray)
+ {
+ if (objArray == nullptr)
+ return 0;
+
+ bool isBooleanType = false;
+ if (objArray->Count > 0 && objArray->GetType()->GetElementType()->Equals(DotNetTypes::BooleanType))
+ isBooleanType = true;
+
+ //Log::Debug("primitiveArrayHashCode isbool " + isBooleanType);
+ int h = 1;
+ for each(Object^ o in objArray)
+ {
+ if (isBooleanType)
+ {
+ if ((bool)o)
+ h = h * 31 + 1231;
+ else
+ h = h * 31 + 1237;
+ }
+ else
+ h = h * 31 + o->GetHashCode();
+ }
+
+ // Log::Debug(" primitiveArrayHashCode final hc " + h);
+
+ return h;
+ }
+
+ int PdxInstanceImpl::getRawHashCode(PdxType^ pt, PdxFieldType^ pField, DataInput^ dataInput)
+ {
+ int pos = getOffset(dataInput, pt, pField->SequenceId);
+ int nextpos = getNextFieldPosition(dataInput, pField->SequenceId + 1, pt);
+
+ if (hasDefaultBytes(pField, dataInput, pos, nextpos))
+ return 0;//matched default bytes
+
+ dataInput->ResetAndAdvanceCursorPdx(nextpos - 1);
+
+ int h = 1;
+ for (int i = nextpos - 1; i >= pos; i--)
+ {
+ h = 31 * h + (int)dataInput->ReadSByte();
+ dataInput->ResetAndAdvanceCursorPdx(i - 1);
+ }
+ //Log::Debug("getRawHashCode nbytes " + (nextpos - pos) + " final hashcode" + h);
+ return h;
+ }
+
+ bool PdxInstanceImpl::compareDefaulBytes(DataInput^ dataInput, int start, int end, array<SByte>^ defaultBytes)
+ {
+ if ((end - start) != defaultBytes->Length)
+ return false;
+
+ dataInput->ResetAndAdvanceCursorPdx(start);
+ int j = 0;
+ for (int i = start; i < end; i++)
+ {
+ if (defaultBytes[j++] != dataInput->ReadSByte())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool PdxInstanceImpl::hasDefaultBytes(PdxFieldType^ pField, DataInput^ dataInput, int start, int end)
+ {
+ switch (pField->TypeId)
+ {
+ case PdxTypes::INT:
+ {
+ return compareDefaulBytes(dataInput, start, end, Int_DefaultBytes);
+ }
+ case PdxTypes::STRING:
+ {
+ return compareDefaulBytes(dataInput, start, end, String_DefaultBytes);
+ }
+ case PdxTypes::BOOLEAN:
+ {
+ return compareDefaulBytes(dataInput, start, end, Boolean_DefaultBytes);
+ }
+ case PdxTypes::FLOAT:
+ {
+ return compareDefaulBytes(dataInput, start, end, Float_DefaultBytes);
+ }
+ case PdxTypes::DOUBLE:
+ {
+ return compareDefaulBytes(dataInput, start, end, Double_DefaultBytes);
+ }
+ case PdxTypes::CHAR:
+ {
+ return compareDefaulBytes(dataInput, start, end, Char_DefaultBytes);
+ }
+ case PdxTypes::BYTE:
+ {
+ return compareDefaulBytes(dataInput, start, end, Byte_DefaultBytes);
+ }
+ case PdxTypes::SHORT:
+ {
+ return compareDefaulBytes(dataInput, start, end, Short_DefaultBytes);
+ }
+ case PdxTypes::LONG:
+ {
+ return compareDefaulBytes(dataInput, start, end, Long_DefaultBytes);
+ }
+ case PdxTypes::BYTE_ARRAY:
+ case PdxTypes::DOUBLE_ARRAY:
+ case PdxTypes::FLOAT_ARRAY:
+ case PdxTypes::SHORT_ARRAY:
+ case PdxTypes::INT_ARRAY:
+ case PdxTypes::LONG_ARRAY:
+ case PdxTypes::BOOLEAN_ARRAY:
+ case PdxTypes::CHAR_ARRAY:
+ case PdxTypes::STRING_ARRAY:
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ return compareDefaulBytes(dataInput, start, end, NULL_ARRAY_DefaultBytes);
+ }
+ case PdxTypes::DATE:
+ {
+ return compareDefaulBytes(dataInput, start, end, Date_DefaultBytes);
+ }
+ case PdxTypes::OBJECT:
+ {
+ return compareDefaulBytes(dataInput, start, end, Object_DefaultBytes);
+ }
+ default://object
+ {
+ throw gcnew IllegalStateException("hasDefaultBytes unable to find typeID " + pField->TypeId);
+ }
+ }
+ }
+
+ bool PdxInstanceImpl::isPrimitiveArray(Object^ object)
+ {
+ Type^ type = object->GetType();
+
+ if (type->IsArray)
+ {
+ return type->GetElementType()->IsPrimitive;
+ }
+ return false;
+ }
+
+ IList<PdxFieldType^>^ PdxInstanceImpl::getIdentityPdxFields(PdxType^ pt)
+ {
+ System::Comparison<PdxFieldType^>^ cd = gcnew System::Comparison<PdxFieldType^>(PdxInstanceImpl::comparePdxField);
+ IList<PdxFieldType^>^ pdxFieldList = pt->PdxFieldList;
+ List<PdxFieldType^>^ retList = gcnew List<PdxFieldType^>();
+
+ for (int i = 0; i < pdxFieldList->Count; i++)
+ {
+ PdxFieldType^ pft = pdxFieldList[i];
+ if (pft->IdentityField)
+ retList->Add(pft);
+ }
+
+ if (retList->Count > 0)
+ {
+ retList->Sort(cd);
+ return retList;
+ }
+
+ for (int i = 0; i < pdxFieldList->Count; i++)
+ {
+ PdxFieldType^ pft = pdxFieldList[i];
+ retList->Add(pft);
+ }
+
+ retList->Sort(cd);
+ return retList;
+ }
+
+ int PdxInstanceImpl::comparePdxField(PdxFieldType^ a, PdxFieldType^ b)
+ {
+ return a->FieldName->CompareTo(b->FieldName);
+ }
+
+ String^ PdxInstanceImpl::ToString()
+ {
+ PdxType^ pt = getPdxType();
+
+ StringBuilder^ result = gcnew StringBuilder();
+ result->Append("PDX[")->Append(pt->TypeId)->Append(",")->Append(pt->PdxClassName)
+ ->Append("]{");
+ bool firstElement = true;
+ for each(PdxFieldType^ fieldType in getIdentityPdxFields(pt))
+ {
+ if (firstElement)
+ {
+ firstElement = false;
+ }
+ else
+ {
+ result->Append(", ");
+ }
+ result->Append(fieldType->FieldName);
+ result->Append("=");
+ try
+ {
+ // TODO check to see if getField returned an array and if it did use Arrays.deepToString
+ result->Append(GetField(fieldType->FieldName));
+ }
+ catch (System::Exception^ e)
+ {
+ result->Append(e->Message);
+ }
+ }
+ result->Append("}");
+ return result->ToString();
+ }
+
+ IWritablePdxInstance^ PdxInstanceImpl::CreateWriter()
+ {
+ //dataInput->ResetPdx(0);
+ return gcnew PdxInstanceImpl(m_buffer, m_bufferLength, m_typeId, false, m_cache);//need to create duplicate byte stream
+ }
+
+ void PdxInstanceImpl::SetField(String^ fieldName, Object^ value)
+ {
+ PdxType^ pt = getPdxType();
+ PdxFieldType^ pft = pt->GetPdxField(fieldName);
+
+ if (pft != nullptr && checkType(value->GetType(), pft->TypeId))//TODO::need to check typeas well
+ {
+ if (m_updatedFields == nullptr)
+ {
+ m_updatedFields = gcnew Dictionary<String^, Object^>();
+ }
+ m_updatedFields[fieldName] = value;
+ return;
+ }
+
+ throw gcnew IllegalStateException("PdxInstance doesn't has field " + fieldName + " or type of field not matched " + (pft != nullptr ? pft->ToString() : ""));
+ }
+
+ void PdxInstanceImpl::ToData(IPdxWriter^ writer)
+ {
+ PdxType^ pt = getPdxType();
+
+ IList<PdxFieldType^>^ pdxFieldList = pt->PdxFieldList;
+
+ int position = 0;//ignore typeid and length
+ int nextFieldPosition;
+
+ if (m_buffer != NULL)
+ {
+ System::Byte* copy = m_buffer;
+
+ if (!m_own)
+ copy = apache::geode::client::DataInput::getBufferCopy(m_buffer, m_bufferLength);
+
+ DataInput^ dataInput = gcnew DataInput(copy, m_bufferLength, m_cache);//this will delete buffer
+ dataInput->setPdxdeserialization(true);
+ //but new stream is set for this from pdxHelper::serialize function
+
+ for (int i = 0; i < pdxFieldList->Count; i++)
+ {
+ PdxFieldType^ currPf = pdxFieldList[i];
+
+ Object^ value = nullptr;
+ m_updatedFields->TryGetValue(currPf->FieldName, value);
+ //Log::Debug("field name " + currPf->FieldName);
+ if (value != nullptr)
+ {//
+ //Log::Debug("field updating " + value);
+ writeField(writer, currPf->FieldName, currPf->TypeId, value);
+ position = getNextFieldPosition(dataInput, i + 1, pt);
+ }
+ else
+ {
+ if (currPf->IsVariableLengthType)
+ {//need to add offset
+ (static_cast<PdxLocalWriter^>(writer))->AddOffset();
+ }
+
+ //write raw byte array...
+ nextFieldPosition = getNextFieldPosition(dataInput, i + 1, pt);
+
+ writeUnmodifieldField(dataInput, position, nextFieldPosition, static_cast<PdxLocalWriter^>(writer));
+
+ position = nextFieldPosition;//mark next field;
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < pdxFieldList->Count; i++)
+ {
+ PdxFieldType^ currPf = pdxFieldList[i];
+
+ Object^ value = m_updatedFields[currPf->FieldName];
+
+ //Log::Debug("field updating " + value);
+ writeField(writer, currPf->FieldName, currPf->TypeId, value);
+ }
+ }
+
+ m_updatedFields->Clear();
+
+ //now update the raw data...which will happen in PdxHelper
+ }
+
+ void PdxInstanceImpl::cleanup()
+ {
+ if (m_own)
+ {
+ m_own = false;
+ apache::geode::client::DataOutput::safeDelete(m_buffer);
+ }
+ }
+
+ void PdxInstanceImpl::updatePdxStream(System::Byte* newPdxStream, int len)
+ {
+ m_buffer = newPdxStream;
+ m_own = true;
+ m_bufferLength = len;
+ }
+
+ void PdxInstanceImpl::writeUnmodifieldField(DataInput^ dataInput, int startPos, int endPos, PdxLocalWriter^ localWriter)
+ {
+ //Log::Debug("writeUnmodifieldField startpos " + startPos + " endpos " + endPos);
+ dataInput->ResetPdx(startPos);
+ for (; startPos < endPos; startPos++)
+ {
+ localWriter->WriteByte(dataInput->ReadByte());
+ }
+ }
+
+ int PdxInstanceImpl::getNextFieldPosition(DataInput^ dataInput, int fieldId, PdxType^ pt)
+ {
+ if (fieldId == pt->Totalfields)
+ {//return serialized length
+ return getSerializedLength(dataInput, pt);
+ }
+ else
+ {
+ return getOffset(dataInput, pt, fieldId);
+ }
+ }
+
+ void PdxInstanceImpl::FromData(IPdxReader^ reader)
+ {
+ throw gcnew IllegalStateException("PdxInstance::FromData( .. ) shouldn't have called");
+ }
+
+ PdxType^ PdxInstanceImpl::getPdxType()
+ {
+ if (m_typeId == 0)
+ {
+ if (m_pdxType == nullptr)
+ {
+ throw gcnew IllegalStateException("PdxType should not be null..");
+ }
+ return m_pdxType;
+ }
+ /*m_dataInput->ResetAndAdvanceCursorPdx(0);
+ int typeId= Internal::PdxHelper::ReadInt32(m_dataInput->GetCursor() + 4);
+
+ PdxType^ pType = Internal::PdxTypeRegistry::GetPdxType(typeId);*/
+ PdxType^ pType = Internal::PdxTypeRegistry::GetPdxType(m_typeId);
+
+ return pType;
+ }
+
+ void PdxInstanceImpl::setPdxId(Int32 typeId)
+ {
+ if (m_typeId == 0)
+ {
+ m_typeId = typeId;
+ m_pdxType = nullptr;
+ }
+ else
+ {
+ throw gcnew IllegalStateException("PdxInstance's typeId is already set.");
+ }
+ }
+
+ Object^ PdxInstanceImpl::readField(DataInput^ dataInput, String^ fieldName, int typeId)
+ {
+ switch (typeId)
+ {
+ case PdxTypes::INT:
+ {
+ return dataInput->ReadInt32();
+ }
+ case PdxTypes::STRING:
+ {
+ return dataInput->ReadString();
+ }
+ case PdxTypes::BOOLEAN:
+ {
+ return dataInput->ReadBoolean();
+ }
+ case PdxTypes::FLOAT:
+ {
+ return dataInput->ReadFloat();
+ }
+ case PdxTypes::DOUBLE:
+ {
+ return dataInput->ReadDouble();
+ }
+ case PdxTypes::CHAR:
+ {
+ return dataInput->ReadChar();
+ }
+ case PdxTypes::BYTE:
+ {
+ return dataInput->ReadSByte();
+ }
+ case PdxTypes::SHORT:
+ {
+ return dataInput->ReadInt16();
+ }
+ case PdxTypes::LONG:
+ {
+ return dataInput->ReadInt64();
+ }
+ case PdxTypes::BYTE_ARRAY:
+ {
+ return dataInput->ReadBytes();
+ }
+ case PdxTypes::DOUBLE_ARRAY:
+ {
+ return dataInput->ReadDoubleArray();
+ }
+ case PdxTypes::FLOAT_ARRAY:
+ {
+ return dataInput->ReadFloatArray();
+ }
+ case PdxTypes::SHORT_ARRAY:
+ {
+ return dataInput->ReadShortArray();
+ }
+ case PdxTypes::INT_ARRAY:
+ {
+ return dataInput->ReadIntArray();
+ }
+ case PdxTypes::LONG_ARRAY:
+ {
+ return dataInput->ReadLongArray();
+ }
+ case PdxTypes::BOOLEAN_ARRAY:
+ {
+ return dataInput->ReadBooleanArray();
+ }
+ case PdxTypes::CHAR_ARRAY:
+ {
+ return dataInput->ReadCharArray();
+ }
+ case PdxTypes::STRING_ARRAY:
+ {
+ return dataInput->ReadStringArray();
+ }
+ case PdxTypes::DATE:
+ {
+ return dataInput->ReadDate();
+ }
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ {
+ return dataInput->ReadArrayOfByteArrays();
+ }
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ return dataInput->ReadObjectArray();
+ }
+ default://object
+ {
+ return dataInput->ReadObject();
+ //throw gcnew IllegalStateException("ReadField unable to de-serialize "
+ // + fieldName + " of " + type);
+ }
+ }
+ }
+
+ bool PdxInstanceImpl::checkType(Type^ type, int typeId)
+ {
+ // Log::Fine("PdxInstanceImpl::checkType1 " + type->ToString() + " " + typeId);
+ switch (typeId)
+ {
+ case PdxTypes::INT:
+ {
+ // Log::Fine("PdxInstanceImpl::checkType " + type->ToString() + " : " +DotNetTypes::IntType->ToString());
+ return type->Equals(DotNetTypes::IntType);
+ }
+ case PdxTypes::STRING:
+ {
+ return type->Equals(DotNetTypes::StringType);
+ }
+ case PdxTypes::BOOLEAN:
+ {
+ return type->Equals(DotNetTypes::BooleanType);
+ }
+ case PdxTypes::FLOAT:
+ {
+ return type->Equals(DotNetTypes::FloatType);
+ }
+ case PdxTypes::DOUBLE:
+ {
+ return type->Equals(DotNetTypes::DoubleType);
+ }
+ case PdxTypes::CHAR:
+ {
+ return type->Equals(DotNetTypes::CharType);
+ }
+ case PdxTypes::BYTE:
+ {
+ return type->Equals(DotNetTypes::SByteType);
+ }
+ case PdxTypes::SHORT:
+ {
+ return type->Equals(DotNetTypes::ShortType);
+ }
+ case PdxTypes::LONG:
+ {
+ return type->Equals(DotNetTypes::LongType);
+ }
+ case PdxTypes::BYTE_ARRAY:
+ {
+ return type->Equals(DotNetTypes::ByteArrayType);
+ }
+ case PdxTypes::DOUBLE_ARRAY:
+ {
+ return type->Equals(DotNetTypes::DoubleArrayType);
+ }
+ case PdxTypes::FLOAT_ARRAY:
+ {
+ return type->Equals(DotNetTypes::FloatArrayType);
+ }
+ case PdxTypes::SHORT_ARRAY:
+ {
+ return type->Equals(DotNetTypes::ShortArrayType);
+ }
+ case PdxTypes::INT_ARRAY:
+ {
+ return type->Equals(DotNetTypes::IntArrayType);
+ }
+ case PdxTypes::LONG_ARRAY:
+ {
+ return type->Equals(DotNetTypes::LongArrayType);
+ }
+ case PdxTypes::BOOLEAN_ARRAY:
+ {
+ return type->Equals(DotNetTypes::BoolArrayType);
+ }
+ case PdxTypes::CHAR_ARRAY:
+ {
+ return type->Equals(DotNetTypes::CharArrayType);
+ }
+ case PdxTypes::STRING_ARRAY:
+ {
+ return type->Equals(DotNetTypes::StringArrayType);
+ }
+ case PdxTypes::DATE:
+ {
+ return type->Equals(DotNetTypes::DateType);
+ }
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ {
+ return type->Equals(DotNetTypes::ByteArrayOfArrayType);
+ }
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ return type->Equals(DotNetTypes::ObjectArrayType);
+ }
+ default://object
+ {
+ return true;
+ //throw gcnew IllegalStateException("ReadField unable to de-serialize "
+ // + fieldName + " of " + type);
+ }
+ }
+ }
+
+ void PdxInstanceImpl::writeField(IPdxWriter^ writer, String^ fieldName, int typeId, Object^ value)
+ {
+ switch (typeId)
+ {
+ case PdxTypes::INT:
+ {
+ writer->WriteInt(fieldName, (int)value);
+ break;
+ }
+ case PdxTypes::STRING:
+ {
+ writer->WriteString(fieldName, (String^)value);
+ break;
+ }
+ case PdxTypes::BOOLEAN:
+ {
+ writer->WriteBoolean(fieldName, (bool)value);
+ break;
+ }
+ case PdxTypes::FLOAT:
+ {
+ writer->WriteFloat(fieldName, (float)value);
+ break;
+ }
+ case PdxTypes::DOUBLE:
+ {
+ writer->WriteDouble(fieldName, (double)value);
+ break;
+ }
+ case PdxTypes::CHAR:
+ {
+ writer->WriteChar(fieldName, (Char)value);
+ break;
+ }
+ case PdxTypes::BYTE:
+ {
+ writer->WriteByte(fieldName, (SByte)value);
+ break;
+ }
+ case PdxTypes::SHORT:
+ {
+ writer->WriteShort(fieldName, (short)value);
+ break;
+ }
+ case PdxTypes::LONG:
+ {
+ writer->WriteLong(fieldName, (Int64)value);
+ break;
+ }
+ case PdxTypes::BYTE_ARRAY:
+ {
+ writer->WriteByteArray(fieldName, (array<Byte>^)value);
+ break;
+ }
+ case PdxTypes::DOUBLE_ARRAY:
+ {
+ writer->WriteDoubleArray(fieldName, (array<double>^)value);
+ break;
+ }
+ case PdxTypes::FLOAT_ARRAY:
+ {
+ writer->WriteFloatArray(fieldName, (array<float>^)value);
+ break;
+ }
+ case PdxTypes::SHORT_ARRAY:
+ {
+ writer->WriteShortArray(fieldName, (array<short>^)value);
+ break;
+ }
+ case PdxTypes::INT_ARRAY:
+ {
+ writer->WriteIntArray(fieldName, (array<int>^)value);
+ break;
+ }
+ case PdxTypes::LONG_ARRAY:
+ {
+ writer->WriteLongArray(fieldName, (array<Int64>^)value);
+ break;
+ }
+ case PdxTypes::BOOLEAN_ARRAY:
+ {
+ writer->WriteBooleanArray(fieldName, (array<bool>^)value);
+ break;
+ }
+ case PdxTypes::CHAR_ARRAY:
+ {
+ writer->WriteCharArray(fieldName, (array<Char>^)value);
+ break;
+ }
+ case PdxTypes::STRING_ARRAY:
+ {
+ writer->WriteStringArray(fieldName, (array<String^>^)value);
+ break;
+ }
+ case PdxTypes::DATE:
+ {
+ writer->WriteDate(fieldName, (DateTime)value);
+ break;
+ }
+ case PdxTypes::ARRAY_OF_BYTE_ARRAYS:
+ {
+ writer->WriteArrayOfByteArrays(fieldName, (array<array<Byte>^>^)value);
+ break;
+ }
+ case PdxTypes::OBJECT_ARRAY:
+ {
+ writer->WriteObjectArray(fieldName, (List<Object^>^)value);
+ break;
+ }
+ default:
+ {
+ writer->WriteObject(fieldName, value);
+ //throw gcnew IllegalStateException("ReadField unable to de-serialize "
+ // + fieldName + " of " + type);
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+ }
+ }
+}
[45/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DistOpsStepsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DistOpsStepsN.cs b/clicache/integration-test/DistOpsStepsN.cs
new file mode 100644
index 0000000..91868cd
--- /dev/null
+++ b/clicache/integration-test/DistOpsStepsN.cs
@@ -0,0 +1,2372 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+using System.Reflection;
+using System.Collections;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ public abstract class DistOpsSteps : UnitTests
+ {
+ #region Protected utility functions used by the tests
+
+ protected virtual void VerifyAll(string regionName, string key,
+ string val, bool noKey)
+ {
+ VerifyAll(regionName, key, val, noKey, false, true);
+ }
+
+ protected virtual void VerifyAll(string regionName, string key,
+ string val, bool noKey, bool isCreated, bool checkVal)
+ {
+ // Verify key and value exist in this region, in this process.
+ string logStr = null;
+ if (!isCreated)
+ {
+ if (noKey)
+ {
+ logStr = string.Format(
+ "Verify key {0} does not exist in region {1}", key, regionName);
+ }
+ else if (val == null)
+ {
+ logStr = string.Format(
+ "Verify value for key {0} does not exist in region {1}",
+ key, regionName);
+ }
+ else
+ {
+ logStr = string.Format(
+ "Verify value for key {0} is: {1} in region {2}",
+ key, val, regionName);
+ }
+ Util.Log(logStr);
+ }
+
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ //CacheableString cKey = new CacheableString(key);
+ string cKey = key;
+ //Util.Log("REGION NAME = {0} cKey = {1} ", regionName, cKey);
+ Thread.Sleep(100); // give distribution threads a chance to run
+
+ // if the region is no ack, then we may need to wait...
+ if (!isCreated)
+ {
+ if (!noKey)
+ { // need to find the key!
+ Assert.IsTrue(region.GetLocalView().ContainsKey(cKey), "Key not found in region.");
+ }
+ if (val != null && checkVal)
+ { // need to have a value!
+ Assert.IsTrue(region.GetLocalView().ContainsValueForKey(cKey), "Value not found in region.");
+ }
+ }
+
+ // loop up to maxLoop times, testing condition
+ int maxLoop = 1000;
+ int sleepMillis = 50; // milliseconds
+ int containsKeyCnt = 0;
+ int containsValueCnt = 0;
+ int testValueCnt = 0;
+
+ for (int i = 1; i <= maxLoop; i++)
+ {
+ if (isCreated)
+ {
+ if (!region.GetLocalView().ContainsKey(cKey))
+ containsKeyCnt++;
+ else
+ break;
+ Assert.Less(containsKeyCnt, maxLoop, "Key has not been created in region.");
+ }
+ else
+ {
+ if (noKey)
+ {
+ if (region.GetLocalView().ContainsKey(cKey))
+ containsKeyCnt++;
+ else
+ break;
+ Assert.Less(containsKeyCnt, maxLoop, "Key found in region.");
+ }
+ if (val == null)
+ {
+ if (region.GetLocalView().ContainsValueForKey(cKey))
+ containsValueCnt++;
+ else
+ break;
+ Assert.Less(containsValueCnt, maxLoop, "Value found in region.");
+ }
+ else
+ {
+ string cVal = region.Get(cKey, true).ToString();
+ Assert.IsNotNull(cVal, "Value should not be null.");
+ if (cVal != val)
+ testValueCnt++;
+ else
+ break;
+ Assert.Less(testValueCnt, maxLoop,
+ "Incorrect value found. Expected: '{0}' ; Got: '{1}'",
+ val, cVal);
+ }
+ }
+ Thread.Sleep(sleepMillis);
+ }
+ }
+
+ protected virtual void VerifyInvalid(string regionName, string key)
+ {
+ VerifyAll(regionName, key, null, false);
+ }
+
+ protected virtual void VerifyDestroyed(string regionName, string key)
+ {
+ VerifyAll(regionName, key, null, true);
+ }
+
+ protected virtual void VerifyEntry(string regionName, string key,
+ string val)
+ {
+ VerifyAll(regionName, key, val, false, false, true);
+ }
+
+ protected virtual void VerifyEntry(string regionName, string key,
+ string val, bool checkVal)
+ {
+ VerifyAll(regionName, key, val, false, false, checkVal);
+ }
+
+ protected virtual void VerifyCreated(string regionName, string key)
+ {
+ VerifyAll(regionName, key, null, false, true, false);
+ }
+
+ protected virtual object GetEntry(string regionName, string key)
+ {
+ object val = CacheHelper.GetVerifyRegion<string, string>(regionName).Get(key, null);
+ if (val != null)
+ {
+ Util.Log(
+ "GetEntry returned value: ({0}) for key: ({1}) in region: ({2})",
+ val, key, regionName);
+ }
+ else
+ {
+ Util.Log("GetEntry return NULL value for key: ({0}) in region: ({1})",
+ key, regionName);
+ }
+ return val;
+ }
+
+ protected virtual void CreateEntry(string regionName, string key, string val)
+ {
+ Util.Log("Creating entry -- key: {0} value: {1} in region {2}",
+ key, val, regionName);
+
+ // Create entry, verify entry is correct
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ if (region.GetLocalView().ContainsKey(key))
+ region[key] = val;
+ else
+ region.Add(key, val);/*Create replaced with new API Add() */
+ VerifyEntry(regionName, key, val);
+ }
+
+ protected virtual void CreateEntryWithLocatorException(string regionName, string key, string val)
+ {
+ bool foundException = false;
+ try
+ {
+ CreateEntry(regionName, key, val);
+ }
+ catch (Apache.Geode.Client.NotConnectedException ex)
+ {
+ if (ex.InnerException is NoAvailableLocatorsException)
+ {
+ Util.Log("Got expected {0}: {1}", ex.GetType().Name, ex.Message);
+ foundException = true;
+ }
+ }
+ if (!foundException)
+ {
+ Assert.Fail("Expected NotConnectedException with inner exception NoAvailableLocatorsException");
+ }
+ }
+
+ protected virtual void UpdateEntry(string regionName, string key,
+ string val, bool checkVal)
+ {
+ Util.Log("Updating entry -- key: {0} value: {1} in region {2}",
+ key, val, regionName);
+
+ // Update entry, verify entry is correct
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ Assert.IsTrue(region.GetLocalView().ContainsKey(key), "Key should have been found in region.");
+ if (checkVal)
+ {
+ Assert.IsTrue(region.ContainsValueForKey(key),
+ "Value should have been found in region.");
+ }
+ region[key] = val;
+ VerifyEntry(regionName, key, val, checkVal);
+ }
+
+ protected virtual void DoNetsearch(string regionName, string key,
+ string val, bool checkNoKey)
+ {
+ Util.Log("Netsearching for entry -- key: {0} " +
+ "expecting value: {1} in region {2}", key, val, regionName);
+
+ // Get entry created in Process A, verify entry is correct
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ if (checkNoKey)
+ {
+ Assert.IsFalse(region.GetLocalView().ContainsKey(key),
+ "Key should not have been found in region.");
+ }
+ string checkVal = (string)region[key];
+ Util.Log("Got value: {0} for key {1}, expecting {2}", checkVal, key, val);
+ VerifyEntry(regionName, key, val);
+ }
+
+ protected virtual void DoCacheLoad(string regionName, string key,
+ string val, bool checkNoKey)
+ {
+ Util.Log("Cache load for entry -- key: {0} " +
+ "expecting value: {1} in region {2}", key, val, regionName);
+
+ // Get entry created in Process A, verify entry is correct
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ if (checkNoKey)
+ {
+ Assert.IsFalse(region.GetLocalView().ContainsKey(key),
+ "Key should not have been found in region.");
+ }
+ string checkVal = null;
+ try
+ {
+ checkVal = (string)region[key];
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException)
+ {
+ // expected?
+ //checkVal = (string)region[key];
+ }
+ Util.Log("Got value: {0} for key {1}, expecting {2}", checkVal, key, val);
+ //VerifyEntry(regionName, key, val);
+ }
+
+ protected virtual void InvalidateEntry(string regionName, string key)
+ {
+ Util.Log("Invalidating entry -- key: {0} in region {1}",
+ key, regionName);
+
+ // Invalidate entry, verify entry is invalidated
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ Assert.IsTrue(region.GetLocalView().ContainsKey(key), "Key should have been found in region.");
+ Assert.IsTrue(region.GetLocalView().ContainsValueForKey(key), "Value should have been found in region.");
+ region.GetLocalView().Invalidate(key);
+ VerifyInvalid(regionName, key);
+ }
+
+ protected virtual void DestroyEntry(string regionName, string key)
+ {
+ Util.Log("Destroying entry -- key: {0} in region {1}",
+ key, regionName);
+
+ // Destroy entry, verify entry is destroyed
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ Assert.IsTrue(region.GetLocalView().ContainsKey(key), "Key should have been found in region.");
+ region.Remove(key); //Destroy() replaced by new API Remove()
+ VerifyDestroyed(regionName, key);
+ }
+
+ #endregion
+
+ #region Protected members
+
+ protected string[] m_keys = { "Key-1", "Key-2", "Key-3", "Key-4",
+ "Key-5", "Key-6" };
+ protected string[] m_vals = { "Value-1", "Value-2", "Value-3", "Value-4",
+ "Value-5", "Value-6" };
+ protected string[] m_nvals = { "New Value-1", "New Value-2", "New Value-3",
+ "New Value-4", "New Value-5" };
+
+ protected string[] m_regionNames;
+
+ #endregion
+
+ #region Various steps for DistOps
+
+ public virtual void CreateRegions(string[] regionNames)
+ {
+ CacheHelper.CreateILRegion<object, object>(regionNames[0], true, true, null);
+ CacheHelper.CreateILRegion<object, object>(regionNames[1], false, true, null);
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions(string[] regionNames, string locators, bool clientNotification)
+ {
+ CacheHelper.CreateTCRegion_Pool<string, string>(regionNames[0], true, true,
+ null, locators, "__TESTPOOL__", clientNotification);
+ CacheHelper.CreateTCRegion_Pool<string, string>(regionNames[1], false, true,
+ null, locators, "__TESTPOOL__", clientNotification);
+ m_regionNames = regionNames;
+ }
+ public virtual void CreateTCRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification)
+ {
+ CreateTCRegions_Pool(regionNames, locators, poolName, clientNotification, false);
+ }
+
+ public virtual void SetHeaplimit(int maxheaplimit, int delta)
+ {
+ CacheHelper.SetHeapLimit(maxheaplimit, delta);
+ }
+
+ public virtual void UnsetHeapLimit()
+ {
+ CacheHelper.UnsetHeapLimit();
+ }
+
+ public virtual void CreateTCRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, true,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, true,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+ }
+
+ //CreateTCRegions_Pool_PDXWithLL
+ public virtual void CreateTCRegions_Pool_PDXWithLL(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ CacheHelper.PdxReadSerialized = true;
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ //Util.Log("CreateTCRegions_Pool_PDXWithLL PdxReadSerialized = " + CacheHelper.DCache.GetPdxReadSerialized());
+ Assert.IsTrue(CacheHelper.DCache.GetPdxReadSerialized());
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions_Pool_PDX(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ CacheHelper.PdxIgnoreUnreadFields = true;
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ Assert.IsTrue(CacheHelper.DCache.GetPdxIgnoreUnreadFields());
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions_Pool_PDX2(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ CacheHelper.PdxReadSerialized = true;
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ Assert.IsTrue(CacheHelper.DCache.GetPdxReadSerialized());
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions_Pool2_WithPartitionResolver(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool pr)
+ {
+ CreateTCRegions_Pool2<object, object>(regionNames, locators, poolName, clientNotification, false, pr);
+ }
+
+ public virtual void CreateTCRegions_Pool2<TKey, TVal>(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool pr)
+ {
+ CreateTCRegions_Pool2<TKey, TVal>(regionNames, locators, poolName, clientNotification, false, pr);
+ }
+
+ public virtual void CreateTCRegions_Pool2<TKey, TVal>(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool pr)
+ {
+ CacheHelper.CreateTCRegion_Pool2<TKey, TVal>(regionNames[0], true, true,
+ null, locators, poolName, clientNotification, ssl, false, pr);
+ CacheHelper.CreateTCRegion_Pool2<TKey, TVal>(regionNames[1], false, true,
+ null, locators, poolName, clientNotification, ssl, false, pr);
+ m_regionNames = regionNames;
+ }
+
+ public virtual void CreateTCRegions_Pool1(string regionNames,
+ string locators, string poolName, bool clientNotification)
+ {
+ CreateTCRegions_Pool1(regionNames, locators, poolName, clientNotification, false);
+ }
+
+ public virtual void CreateTCRegions_Pool1(string regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl)
+ {
+ if (regionNames.Equals("R1"))
+ {
+ Util.Log("R1 P1 added");
+ CustomPartitionResolver1<object> pr = CustomPartitionResolver1<object>.Create();
+ CacheHelper.CreateTCRegion_Pool1<object, object>(regionNames, true, true,
+ null, locators, poolName, clientNotification, ssl, false, pr);
+ }
+ else if (regionNames.Equals("R2"))
+ {
+ Util.Log("R2 P2 added");
+ CustomPartitionResolver2<object> pr = CustomPartitionResolver2<object>.Create();
+ CacheHelper.CreateTCRegion_Pool1<object, object>(regionNames, true, true,
+ null, locators, poolName, clientNotification, ssl, false, pr);
+ }
+ else
+ {
+ Util.Log("R3 P3 added");
+ CustomPartitionResolver3<object> pr = CustomPartitionResolver3<object>.Create();
+ CacheHelper.CreateTCRegion_Pool1<object, object>(regionNames, true, true,
+ null, locators, poolName, clientNotification, ssl, false, pr);
+ }
+ }
+
+ public virtual void CreateTCRegion2(string name, bool ack, bool caching,
+ IPartitionResolver<TradeKey, Object> resolver, string locators, bool clientNotification)
+ {
+ CacheHelper.CreateTCRegion2<TradeKey, Object>(name, ack, caching, resolver,
+ (string)locators, clientNotification);
+ }
+
+ private AppDomain m_firstAppDomain;
+ private AppDomain m_secondAppDomain;
+
+ private CacheHelperWrapper m_chw_forFirstAppDomain;
+ private CacheHelperWrapper m_chw_forSecondAppDomain;
+
+ private PutGetTestsAD m_putGetTests_forFirstAppDomain;
+ private PutGetTestsAD m_putGetTests_forSecondAppDomain;
+
+
+ public void InitializeAppDomain()
+ {
+ m_firstAppDomain = AppDomain.CreateDomain("FIRST_APPDOMAIN");
+ m_secondAppDomain = AppDomain.CreateDomain("SECOND_APPDOMAIN");
+
+ m_chw_forFirstAppDomain = (CacheHelperWrapper)m_firstAppDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "Apache.Geode.Client.UnitTests.CacheHelperWrapper");
+ m_chw_forSecondAppDomain = (CacheHelperWrapper)m_secondAppDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "Apache.Geode.Client.UnitTests.CacheHelperWrapper");
+
+ m_putGetTests_forFirstAppDomain = (PutGetTestsAD)m_firstAppDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "Apache.Geode.Client.UnitTests.PutGetTestsAD");
+ m_putGetTests_forSecondAppDomain = (PutGetTestsAD)m_secondAppDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "Apache.Geode.Client.UnitTests.PutGetTestsAD");
+ }
+
+ public void CloseCacheAD()
+ {
+ try
+ {
+ m_chw_forFirstAppDomain.CloseCache();
+ }
+ catch (Exception e)
+ {
+ Util.Log(e.Message + e.StackTrace);
+ throw e;
+ }
+ m_chw_forSecondAppDomain.CloseCache();
+
+ CacheHelper.CloseCache();
+ }
+
+ //for appdomain
+ public virtual void CreateTCRegions_Pool_AD(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, long dtTime)
+ {
+ CreateTCRegions_Pool_AD2(regionNames, locators, poolName, clientNotification, ssl, true, false);
+
+ CacheableHelper.RegisterBuiltinsAD(dtTime);
+ try
+ {
+ CacheHelperWrapper chw = new CacheHelperWrapper();
+ chw.CreateTCRegions_Pool_AD<object, object>(regionNames, locators, poolName, clientNotification, ssl, true, false);
+ //Util.LogFile = filename;
+ //CacheHelper.ConnectConfig("DSNAME", null);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(" fot exception in main process " + e.Message);
+ }
+ }
+
+ public virtual void CreateTCRegions_Pool_AD2(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool caching, bool pdxReadSerialized)
+ {
+ string filename = Util.DUnitLogDir + System.IO.Path.DirectorySeparatorChar + "tmp" + ".log";
+ m_chw_forFirstAppDomain.SetLogFile(filename);
+ m_chw_forSecondAppDomain.SetLogFile(filename);
+
+ m_chw_forFirstAppDomain.CreateTCRegions_Pool_AD<object, object>(regionNames, locators, poolName, clientNotification, ssl, caching, pdxReadSerialized);
+ // m_chw_forFirstAppDomain.CreateTCRegions_Pool_AD(regionNames, endpoints, locators, poolName, clientNotification, ssl);
+ //m_regionNames = regionNames;
+
+ try
+ {
+
+ // m_chw_forSecondAppDomain.CallDistrinbutedConnect();
+ m_chw_forSecondAppDomain.CreateTCRegions_Pool_AD<object, object>(regionNames, locators, poolName, clientNotification, ssl, caching, pdxReadSerialized);
+ Console.WriteLine("initializing second app domain done");
+ }
+ catch (Exception e)
+ {
+ Util.Log("initializing second app domain goty exception " + e.Message);
+ }
+ try
+ {
+ // m_chw_forSecondAppDomain.CreateTCRegions_Pool_AD(regionNames, endpoints, locators, poolName, clientNotification, ssl);
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ CacheHelperWrapper chw = new CacheHelperWrapper();
+ chw.CreateTCRegions_Pool_AD<object, object>(regionNames, locators, poolName, clientNotification, ssl, caching, pdxReadSerialized);
+ }
+ catch (Exception)
+ {
+ }
+ }
+ public virtual void SetRegionAD(String regionName)
+ {
+ m_putGetTests_forFirstAppDomain.SetRegion(regionName);
+ m_putGetTests_forSecondAppDomain.SetRegion(regionName);
+ }
+
+ public virtual void pdxPutGetTest(bool caching, bool readPdxSerialized)
+ {
+ m_putGetTests_forFirstAppDomain.pdxPutGet(caching, readPdxSerialized);
+ }
+
+ public virtual void pdxGetPutTest(bool caching, bool readPdxSerialized)
+ {
+ m_putGetTests_forSecondAppDomain.pdxGetPut(caching, readPdxSerialized);
+ }
+
+ public virtual void RegisterBuiltinsAD(long dtTime)
+ {
+ m_chw_forFirstAppDomain.RegisterBuiltins(dtTime);
+ m_chw_forSecondAppDomain.RegisterBuiltins(dtTime);
+ }
+
+ public void TestAllKeyValuePairsAD(string regionName, bool runQuery, long dtTime)
+ {
+
+
+ ICollection<UInt32> registeredKeyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> registeredValueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+
+ m_chw_forFirstAppDomain.RegisterBuiltins(dtTime);
+ m_chw_forSecondAppDomain.RegisterBuiltins(dtTime);
+
+ foreach (UInt32 keyTypeId in registeredKeyTypeIds)
+ {
+ int numKeys;
+ numKeys = m_putGetTests_forFirstAppDomain.InitKeys(keyTypeId, PutGetTests.NumKeys, PutGetTests.KeySize);
+ numKeys = m_putGetTests_forSecondAppDomain.InitKeys(keyTypeId, PutGetTests.NumKeys, PutGetTests.KeySize);
+ Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId);
+
+ foreach (UInt32 valueTypeId in registeredValueTypeIds)
+ {
+ m_putGetTests_forFirstAppDomain.InitValues(valueTypeId, numKeys, PutGetTests.ValueSize);
+ m_putGetTests_forSecondAppDomain.InitValues(valueTypeId, numKeys, PutGetTests.ValueSize);
+ Type valueType = CacheableWrapperFactory.GetTypeForId(valueTypeId);
+
+ Util.Log("Starting gets/puts with keyType '{0}' and valueType '{1}'",
+ keyType.Name, valueType.Name);
+ // StartTimer();
+ Util.Log("Running warmup task which verifies the puts.");
+ PutGetStepsAD(regionName, true, runQuery);
+ Util.Log("End warmup task.");
+ /*LogTaskTiming(client1,
+ string.Format("IRegion<object, object>:{0},Key:{1},Value:{2},KeySize:{3},ValueSize:{4},NumOps:{5}",
+ regionName, keyType.Name, valueType.Name, KeySize, ValueSize, 4 * numKeys),
+ 4 * numKeys);
+ */
+ //m_chw_forFirstAppDomain.InvalidateRegion(regionName);
+ // m_chw_forSecondAppDomain.InvalidateRegion(regionName);
+
+ }
+ }
+
+ CloseCacheAD();
+
+ CacheHelper.Close();
+
+ }
+
+ public void PutGetStepsAD(string regionName, bool verifyGets, bool runQuery)
+ {
+ if (verifyGets)
+ {
+ m_putGetTests_forFirstAppDomain.DoPuts();
+ m_putGetTests_forFirstAppDomain.DoKeyChecksumPuts();
+ m_putGetTests_forFirstAppDomain.DoValChecksumPuts();
+ m_putGetTests_forSecondAppDomain.DoGetsVerify();
+ //InvalidateRegion(regionName, client1);
+ //m_chw_forFirstAppDomain.InvalidateRegion(regionName);
+ // m_chw_forSecondAppDomain.InvalidateRegion(regionName);
+ if (runQuery)
+ {
+ // run a query for ThinClient regions to check for deserialization
+ // compability on server
+ m_putGetTests_forFirstAppDomain.DoRunQuery();
+ }
+ m_putGetTests_forSecondAppDomain.DoPuts();
+ m_putGetTests_forSecondAppDomain.DoKeyChecksumPuts();
+ m_putGetTests_forSecondAppDomain.DoValChecksumPuts();
+ m_putGetTests_forFirstAppDomain.DoGetsVerify();
+ }
+ else
+ {
+ m_putGetTests_forFirstAppDomain.DoPuts();
+ m_putGetTests_forSecondAppDomain.DoGets();
+ m_chw_forFirstAppDomain.InvalidateRegion(regionName);
+ m_chw_forSecondAppDomain.InvalidateRegion(regionName);
+ m_putGetTests_forSecondAppDomain.DoPuts();
+ m_putGetTests_forFirstAppDomain.DoGets();
+ }
+ // this query invocation is primarily to delete the entries that cannot
+ // be deserialized by the server
+ if (runQuery)
+ {
+ m_putGetTests_forFirstAppDomain.DoRunQuery();
+ }
+ }
+
+ public virtual void DestroyRegions()
+ {
+ if (m_regionNames != null)
+ {
+ CacheHelper.DestroyRegion<object, object>(m_regionNames[0], false, true);
+ CacheHelper.DestroyRegion<object, object>(m_regionNames[1], false, true);
+ }
+ }
+
+ public virtual void RegisterAllKeysR0WithoutValues()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterAllKeys(false, null, false, false);
+ }
+
+ public virtual void RegisterAllKeysR1WithoutValues()
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region1.GetSubscriptionService().RegisterAllKeys(false, null, false, false);
+ }
+
+ public virtual void StepThree()
+ {
+ CreateEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ CreateEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ }
+
+ public virtual void StepFour()
+ {
+ DoNetsearch(m_regionNames[0], m_keys[0], m_vals[0], false);
+ DoNetsearch(m_regionNames[1], m_keys[2], m_vals[2], false);
+ CreateEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ CreateEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+
+ public virtual void StepFive(bool checkVal)
+ {
+ DoNetsearch(m_regionNames[0], m_keys[1], m_vals[1], false);
+ DoNetsearch(m_regionNames[1], m_keys[3], m_vals[3], false);
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], checkVal);
+ }
+
+ public virtual void StepSix(bool checkVal)
+ {
+ // Some CPU intensive code to test back pressure
+ double y = 100.01;
+ for (int i = 100000000; i > 0; i--)
+ {
+ double x = i * y;
+ y = x / i;
+ }
+
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ UpdateEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ }
+
+ //public virtual void StepSeven()
+ //{
+ // VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ // VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3]);
+ // InvalidateEntry(m_regionNames[0], m_keys[0]);
+ // InvalidateEntry(m_regionNames[1], m_keys[2]);
+ //}
+
+ //public virtual void StepEight()
+ //{
+ // VerifyInvalid(m_regionNames[0], m_keys[0]);
+ // VerifyInvalid(m_regionNames[1], m_keys[2]);
+ // InvalidateEntry(m_regionNames[0], m_keys[1]);
+ // InvalidateEntry(m_regionNames[1], m_keys[3]);
+ //}
+
+ //public virtual void StepNine()
+ //{
+ // VerifyInvalid(m_regionNames[0], m_keys[1]);
+ // VerifyInvalid(m_regionNames[1], m_keys[3]);
+ // DestroyEntry(m_regionNames[0], m_keys[0]);
+ // DestroyEntry(m_regionNames[1], m_keys[2]);
+ //}
+
+ public virtual void StepTen()
+ {
+ VerifyDestroyed(m_regionNames[0], m_keys[0]);
+ VerifyDestroyed(m_regionNames[1], m_keys[2]);
+ DestroyEntry(m_regionNames[0], m_keys[1]);
+ DestroyEntry(m_regionNames[1], m_keys[3]);
+ }
+
+ public virtual void StepEleven()
+ {
+ VerifyDestroyed(m_regionNames[0], m_keys[1]);
+ VerifyDestroyed(m_regionNames[1], m_keys[3]);
+ }
+
+
+
+ public virtual void RemoveStepFive()
+ {
+ IRegion<object, object> reg0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> reg1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ ICollection<KeyValuePair<Object, Object>> IcollectionRegion0 = reg0;
+ ICollection<KeyValuePair<Object, Object>> IcollectionRegion1 = reg1;
+
+ // Try removing non-existent entry from regions, result should be false.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[4], m_vals[4])), "Result of Remove should be false, as this entry is not present in first region.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[4], m_vals[4])), "Result of Remove should be false, as this entry is not present in second region.");
+
+ // Try removing non-existent key, but existing value from regions, result should be false.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[4], m_vals[0])), "Result of Remove should be false, as this key is not present in first region.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[4], m_vals[0])), "Result of Remove should be false, as this key is not present in second region.");
+
+ // Try removing existent key, but non-existing value from regions, result should be false.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[4])), "Result of Remove should be false, as this value is not present in first region.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[4])), "Result of Remove should be false, as this value is not present in second region.");
+
+ // Try removing existent key, and existing value from regions, result should be true.
+ Assert.IsTrue(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[0])), "Result of Remove should be true, as this entry is present in first region.");
+ Assert.IsTrue(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[2], m_vals[2])), "Result of Remove should be true, as this entry is present in second region.");
+ Assert.IsFalse(reg0.ContainsKey(m_keys[0]), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[0]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey(m_keys[2]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[2]), "GetLocalView().ContainsKey should be false");
+
+ // Try removing already deleted entry from regions, result should be false, but no exception.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[0])), "Result of Remove should be false, as this entry is not present in first region.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[0])), "Result of Remove should be false, as this entry is not present in second region.");
+
+ // Try locally destroying already deleted entry from regions, It should result into exception.
+ Assert.IsFalse(reg0.GetLocalView().Remove(m_keys[0], null), "local Destroy on already removed key should have returned false");
+ Assert.IsFalse(reg1.GetLocalView().Remove(m_keys[0], null), "local Destroy on already removed key should have returned false");
+
+ Util.Log("StepFive complete.");
+ }
+
+ public virtual void RemoveStepSix()
+ {
+ IRegion<object, object> reg0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> reg1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ ICollection<KeyValuePair<Object, Object>> IcollectionRegion0 = reg0;
+ ICollection<KeyValuePair<Object, Object>> IcollectionRegion1 = reg1;
+
+ reg0[m_keys[1]] = m_nvals[1];
+ reg1[m_keys[3]] = m_nvals[3];
+
+ // Try removing value that is present on client as well as server, result should be true.
+ Assert.IsTrue(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_nvals[1])), "Result of Remove should be true, as this value is present locally, & also present on server.");
+ Assert.IsTrue(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_nvals[3])), "Result of Remove should be true, as this value is present locally, & also present on server.");
+ Assert.IsFalse(reg0.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step 6.1 complete.");
+
+ // Try removing value that is present on client but not on server, result should be false.
+ reg0[m_keys[1]] = m_vals[1];
+ reg1[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView()[m_keys[1]] = m_nvals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_nvals[3];
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_nvals[1])), "Result of Remove should be false, as this value is present locally, but not present on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_nvals[3])), "Result of Remove should be false, as this value is present locally, but not present on server.");
+ Assert.IsTrue(reg0.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg1.ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 6.2 complete.");
+
+ // Try removing value that is not present on client but present on server, result should be false.
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ reg0[m_keys[1]] = m_vals[1];
+ reg1[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView()[m_keys[1]] = m_nvals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_nvals[3];
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsTrue(reg0.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg1.ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 6.3 complete.");
+
+ // Try removing value that is invalidated on client but exists on server, result should be false.
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ reg0[m_keys[1]] = m_vals[1];
+ reg1[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Invalidate(m_keys[1]);
+ reg1.GetLocalView().Invalidate(m_keys[3]);
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_nvals[1])), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_nvals[3])), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsTrue(reg0.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg1.ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 6.4 complete.");
+
+ // Try removing null value, that is invalidated on client but exists on the server, result should be false.
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ reg0[m_keys[1]] = m_vals[1];
+ reg1[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Invalidate(m_keys[1]);
+ reg1.GetLocalView().Invalidate(m_keys[3]);
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], null)), "Result of Remove should be false, as this value is not present locally, but present only on server.");
+ Assert.IsTrue(reg0.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg1.ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 6.5 complete.");
+
+ // Try removing a entry (value) which is not present on client as well as server, result should be false.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>("NewKey1", "NewValue1")), "Result of Remove should be false, as this value is not present locally, and not present on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>("NewKey3", "NewValue3")), "Result of Remove should be false, as this value is not present locally, and not present on server.");
+ Assert.IsFalse(reg0.ContainsKey("NewKey1"), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey("NewKey1"), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey("NewKey3"), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey("NewKey3"), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step 6.6 complete.");
+
+ // Try removing a entry with a null value, which is not present on client as well as server, result should be false.
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>("NewKey1", null)), "Result of Remove should be false, as this value is not present locally, and not present on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>("NewKey3", null)), "Result of Remove should be false, as this value is not present locally, and not present on server.");
+ Assert.IsFalse(reg0.ContainsKey("NewKey1"), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey("NewKey1"), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey("NewKey3"), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey("NewKey3"), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step 6.7 complete.");
+
+ // Try removing a entry (value) which is not present on client but exists on the server, result should be true.
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ reg0[m_keys[1]] = m_nvals[1];
+ reg1[m_keys[3]] = m_nvals[3];
+ reg0.GetLocalView().Remove(m_keys[1]);
+ reg1.GetLocalView().Remove(m_keys[3]);
+ Assert.IsTrue(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_nvals[1])), "Result of Remove should be true, as this value does not exist locally, but exists on server.");
+ Assert.IsTrue(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_nvals[3])), "Result of Remove should be true, as this value does not exist locally, but exists on server.");
+ Assert.IsFalse(reg0.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step6.8 complete.");
+
+ reg0[m_keys[1]] = m_nvals[1];
+ reg1[m_keys[3]] = m_nvals[3];
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be false, as this value does not exist locally, but exists on server.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], null)), "Result of Remove should be false, as this value does not exist locally, but exists on server.");
+ Assert.IsFalse(reg0.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step6.8.1 complete.");
+
+ // Try locally removing an entry which is locally destroyed with a NULL.
+ reg0[m_keys[1]] = m_vals[1];
+ reg1[m_keys[3]] = m_vals[3];
+ Assert.IsTrue(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be true, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(reg0.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Util.Log("Step6.8.2 complete.");
+
+ //-------------------------------------GetLocalView().Remove Testcases------------------------------------------------
+
+ ICollection<KeyValuePair<Object, Object>> IcollectionLocalRegion0 = reg0.GetLocalView();
+ ICollection<KeyValuePair<Object, Object>> IcollectionLocalRegion1 = reg1.GetLocalView();
+
+ // Try locally removing an entry (value) which is present on the client.
+ reg0.Remove(m_keys[1]);
+ reg1.Remove(m_keys[3]);
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ Assert.IsTrue(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be true, as this value exists locally.");
+ Assert.IsTrue(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be true, as this value exists locally.");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Util.Log("Step6.9 complete.");
+ Assert.IsFalse(reg0.GetLocalView().Remove(m_keys[1], null), "local Destroy on already removed key should have returned false");
+ Assert.IsFalse(reg1.GetLocalView().Remove(m_keys[3], null), "local Destroy on already removed key should have returned false");
+
+ Util.Log("Step6.10 complete.");
+
+ // Try locally removing an entry (value) which is not present on the client (value mismatch).
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_nvals[1])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_nvals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Util.Log("Step6.11 complete.");
+
+ // Try locally removing an entry (value) which is invalidated with a value.
+ reg0.GetLocalView().Remove(m_keys[1]);
+ reg1.GetLocalView().Remove(m_keys[3]);
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Invalidate(m_keys[1]);
+ reg1.GetLocalView().Invalidate(m_keys[3]);
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Util.Log("Step6.12 complete.");
+
+ // Try locally removing an entry (value) which is invalidated with a NULL.
+ reg0.GetLocalView().Remove(m_keys[1]);
+ reg1.GetLocalView().Remove(m_keys[3]);
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Invalidate(m_keys[1]);
+ reg1.GetLocalView().Invalidate(m_keys[3]);
+ Assert.IsTrue(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be true, as this value does not exists locally.");
+ Assert.IsTrue(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], null)), "Result of Remove should be true, as this value does not exists locally.");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Util.Log("Step6.13 complete.");
+
+ // Try locally removing an entry (value) with a NULL.
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], null)), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Util.Log("Step6.14 complete.");
+
+ // Try locally removing an entry which is locally destroyed with a value.
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Remove(m_keys[1]);
+ reg1.GetLocalView().Remove(m_keys[3]);
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be true");
+ Util.Log("Step6.15 complete.");
+
+ // Try locally removing an entry which is locally destroyed with a NULL.
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ reg0.GetLocalView().Remove(m_keys[1]);
+ reg1.GetLocalView().Remove(m_keys[3]);
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], null)), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Util.Log("Step6.16 complete.");
+
+ // Try locally removing an entry which is already removed.
+ reg0.GetLocalView()[m_keys[1]] = m_vals[1];
+ reg1.GetLocalView()[m_keys[3]] = m_vals[3];
+ Assert.IsTrue(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be true, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion0.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(IcollectionLocalRegion1.Remove(new KeyValuePair<Object, Object>(m_keys[3], m_vals[3])), "Result of Remove should be false, as this value does not exists locally.");
+ Assert.IsFalse(reg0.GetLocalView().ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg1.GetLocalView().ContainsKey(m_keys[3]), "ContainsKey should be false");
+ Util.Log("Step6.17 complete.");
+ // Try locally removing an entry when region scope is not null.
+
+ Util.Log("StepSix complete.");
+ }
+
+ public virtual void RemoveStepEight()
+ {
+ IRegion<object, object> reg = CacheHelper.GetVerifyRegion<object, object>("exampleRegion");
+
+ ICollection<KeyValuePair<Object, Object>> IcollectionRegion = reg;
+
+ // Try removing a entry which is present on client (value) but invalidated on the server, result should be false.
+ reg.Remove(m_keys[0]);
+ reg.Remove(m_keys[1]);
+ reg[m_keys[0]] = m_vals[0];
+ reg[m_keys[1]] = m_vals[1];
+ Thread.Sleep(10000); //This is for expiration on server to execute.
+ Assert.IsFalse(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[0], m_vals[0])), "Result of Remove should be false, as this value is present locally, but not present on server.");
+ Assert.IsFalse(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[1], m_vals[1])), "Result of Remove should be false, as this value is present locally, but not present on server.");
+ Assert.IsTrue(reg.ContainsKey(m_keys[0]), "ContainsKey should be true");
+ Assert.IsTrue(reg.GetLocalView().ContainsKey(m_keys[0]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 8.1 complete.");
+
+ // Try removing a entry that is not present on client, but invalidated on server with null value, result should be true.
+ reg.Remove(m_keys[0]);
+ reg.Remove(m_keys[1]);
+ reg[m_keys[0]] = m_nvals[0];
+ reg[m_keys[1]] = m_nvals[1];
+ reg.GetLocalView().Remove(m_keys[0]);
+ reg.GetLocalView().Remove(m_keys[1]);
+ Thread.Sleep(10000); //This is for expiration on server to execute.
+ Assert.IsTrue(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[0], null)), "Result of Remove should be true, as this value is not present locally, & not present on server.");
+ Assert.IsTrue(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be true, as this value is not present locally, & not present on server.");
+ Assert.IsFalse(reg.GetLocalView().ContainsKey(m_keys[0]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg.ContainsKey(m_keys[0]), "ContainsKey should be false");
+ Assert.IsFalse(reg.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be false");
+ Util.Log("Step 8.2 complete.");
+
+ // Try removing a entry with a (value) on client that is invalidated on server with null , result should be false.
+ reg.Remove(m_keys[0]);
+ reg.Remove(m_keys[1]);
+ reg[m_keys[0]] = m_nvals[0];
+ reg[m_keys[1]] = m_nvals[1];
+ Thread.Sleep(10000); //This is for expiration on server to execute.
+ Assert.IsFalse(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[0], null)), "Result of Remove should be false, as this value is present locally, & not present on server.");
+ Assert.IsFalse(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be false, as this value is present locally, & not present on server.");
+ Assert.IsTrue(reg.ContainsKey(m_keys[0]), "ContainsKey should be true");
+ Assert.IsTrue(reg.GetLocalView().ContainsKey(m_keys[0]), "GetLocalView().ContainsKey should be true");
+ Assert.IsTrue(reg.ContainsKey(m_keys[1]), "ContainsKey should be true");
+ Assert.IsTrue(reg.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be true");
+ Util.Log("Step 8.3 complete.");
+
+ // Try removing a entry with a entry that is invalidated on the client as well as on server with a null value, result should be true.
+ reg.Remove(m_keys[0]);
+ reg.Remove(m_keys[1]);
+ reg[m_keys[0]] = m_nvals[0];
+ reg[m_keys[1]] = m_nvals[1];
+ reg.Invalidate(m_keys[0]);
+ reg.Invalidate(m_keys[1]);
+ Thread.Sleep(10000); //This is for expiration on server to execute.
+ Assert.IsTrue(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[0], null)), "Result of Remove should be true, as this value is not present locally, & not present on server.");
+ Assert.IsTrue(IcollectionRegion.Remove(new KeyValuePair<Object, Object>(m_keys[1], null)), "Result of Remove should be true, as this value is not present locally, & not present on server.");
+ Assert.IsFalse(reg.ContainsKey(m_keys[0]), "ContainsKey should be false");
+ Assert.IsFalse(reg.GetLocalView().ContainsKey(m_keys[0]), "GetLocalView().ContainsKey should be false");
+ Assert.IsFalse(reg.ContainsKey(m_keys[1]), "ContainsKey should be false");
+ Assert.IsFalse(reg.GetLocalView().ContainsKey(m_keys[1]), "GetLocalView().ContainsKey should be false");
+
+ // Test case for Bug #639, destroy operation on key that is not present in the region reduces the region's size by 1.
+ // Steps to reproduce: Put 2 entries in to region. Destroy an entry that is not present in the region. Check for the sizes of keys, values and region.
+ // It is observed that regions size is less by 1 from that of keys and values sizes.
+
+ reg["Key100"] = "Value100";
+ reg["Key200"] = "Value200";
+ Util.Log("Region 2 puts complete ");
+ Util.Log("Regions size = {0} ", reg.Count);
+
+ reg.Remove("key300");
+ Assert.IsTrue(reg.Count == 2, "region size should be equal to 2");
+
+ System.Collections.Generic.ICollection<object> keys = reg.Keys;
+ Util.Log("Region keys = {0} ", keys.Count);
+ Assert.IsTrue(keys.Count == reg.Count, "region size should be equal to keys size");
+
+ System.Collections.Generic.ICollection<object> values = reg.Values;
+ Util.Log("Region values = {0} ", values.Count);
+ Assert.IsTrue(values.Count == reg.Count, "region size should be equal to values size");
+
+ reg.Remove("Key100");
+
+ keys = reg.Keys;
+ Util.Log("Region keys = {0} ", keys.Count);
+ Assert.IsTrue(keys.Count == reg.Count, "region size should be equal to keys size");
+
+ values = reg.Values;
+ Util.Log("Region values = {0} ", values.Count);
+ Assert.IsTrue(values.Count == reg.Count, "region size should be equal to values size");
+
+ Util.Log("RemoveStepEight complete.");
+ }
+ public virtual void LocalOpsStepOne()
+ {
+ IRegion<object, object> reg0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> localregion = reg0.GetLocalView();
+ localregion.Add(1, 1);
+ object val = localregion[1];
+ Assert.IsTrue(val.Equals(1), "value should be equal");
+ localregion.Invalidate(1);
+ val = localregion[1];
+ Assert.AreEqual(val, null);
+
+ localregion.Add(2, "IntKeyStringValue");
+ val = localregion[1];
+ Assert.IsTrue(val.Equals("IntKeyStringValue"), "value should be equal");
+
+ try
+ {
+ localregion.Add(1, 1);
+ Assert.Fail("Expected EntryExistException here");
+ }
+ catch (EntryExistsException )
+ {
+ Util.Log(" Expected EntryExistsException exception thrown by localCreate");
+ }
+
+ string key = "LongKeyStringValue";
+ Int64 val1 = 9843754396659L;
+ localregion.Add(key, val1);
+ val = localregion[key];
+ Assert.IsTrue(val.Equals(val1), "value should be equal");
+
+ Int64 key1= 34324242L;
+ string val11 = "LongKeyStringValue";
+ localregion.Add(key1, val11);
+ val = localregion[key1];
+ Assert.IsTrue(val.Equals(val11), "value should be equal");
+
+ Int64 key2 = 34324242L;
+ Int64 val2 = 9843754396659L;
+ localregion.Add(key2, val2);
+ val = localregion[key2];
+ Assert.IsTrue(val.Equals(val2), "value should be equal");
+
+ string key3 = "LongKeyStringValue";
+ string val3 = "LongKeyStringValue";
+ localregion.Add(key3, val3);
+ val = localregion[key3];
+ Assert.IsTrue(val.Equals(val3), "value should be equal");
+
+ string i = "";
+ try
+ {
+ localregion.Add(i, val1);
+ Assert.Fail("Expected IllegalArgumentException here");
+ }
+ catch (IllegalArgumentException )
+ {
+ Util.Log(" Expected IllegalArgumentException exception thrown by localCreate");
+ }
+ try
+ {
+ localregion[i] = val1;
+ Assert.Fail("Expected IllegalArgumentException here");
+ }
+ catch (IllegalArgumentException )
+ {
+ Util.Log(" Expected IllegalArgumentException exception thrown by localCreate");
+ }
+ try
+ {
+ localregion.Remove(i);
+ Assert.Fail("Expected IllegalArgumentException here");
+ }
+ catch (IllegalArgumentException )
+ {
+ Util.Log(" Expected IllegalArgumentException exception thrown by localCreate");
+ }
+ try
+ {
+ localregion.Invalidate(i);
+ Assert.Fail("Expected IllegalArgumentException here");
+ }
+ catch (IllegalArgumentException)
+ {
+ Util.Log(" Expected IllegalArgumentException exception thrown by localCreate");
+ }
+
+
+ Util.Log("LocalOpsStepOne complete.");
+ }
+ public virtual void IdictionaryRegionNullKeyOperations(String RegionName)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ IRegion<object, object> localRegion = region.GetLocalView();
+
+ RegionNullKeyOperations(region, true);
+ RegionNullKeyOperations(localRegion, false);
+ }
+
+ public virtual void RegionNullKeyOperations(IRegion<object, object> region, bool isRemoteInstance)
+ {
+ // chk for IllegalArgumentException.
+ object value = 0;
+ object NullKey = null;
+ try
+ {
+ region.TryGetValue(NullKey, out value); //null
+ Assert.Fail("Should have got IllegalArgumentException for null key arguement.");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got expected IllegalArgumentException for null key arguement. {0} ", ex);
+ }
+ Util.Log("RegionNullKeyOperations TryGetValue Step complete.");
+
+ // Try adding using Add, an entry in region with key as null, should get IllegalArgumentException.
+ try
+ {
+ region.Add(NullKey, value); // null
+ Assert.Fail("Should have got IllegalArgumentException.");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got expected IllegalArgumentException {0}", ex);
+ }
+
+ try
+ {
+ region.Add(new KeyValuePair<object, object>(NullKey, value));//null
+ Assert.Fail("Should have got IllegalArgumentException.");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got expected IllegalArgumentException {0}", ex);
+ }
+ Util.Log("RegionNullKeyOperations Add Step complete.");
+
+ // Try putting using Item_Set, an entry in region with key as null, should get IllegalArgumentException.
+ try
+ {
+ region[NullKey] = value; //null key
+ Assert.Fail("Should have got IllegalArgumentException");
+ }
+ catch (IllegalArgumentException)
+ {
+ Util.Log("Got expected IllegalArgumentException ");
+ }
+ Util.Log("RegionNullKeyOperations Item_Set Step complete.");
+
+ // Try putting using Item_Set, an entry in region with key as null, should get IllegalArgumentException.
+ try
+ {
+ Object val = region[NullKey];//null
+ Assert.Fail("Should have got IllegalArgumentException");
+ }
+ catch (IllegalArgumentException)
+ {
+ Util.Log("Got expected IllegalArgumentException ");
+ }
+ Util.Log("RegionNullKeyOperations Item_Get Step complete.");
+
+ // Try contains with null key, i should throw exception.
+ try
+ {
+ region.Contains(new KeyValuePair<object, object>(NullKey, value));//null key
+ Assert.Fail("Should have got IllegalArgumentException");
+
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got expected IllegalArgumentException {0} ", ex);
+ }
+ Util.Log("RegionNullKeyOperations Contains Step complete.");
+ // Try removing entry with null key, should throw IllegalArgumentException.
+ try
+ {
+ region.Remove(NullKey);//null
+ Assert.Fail("Should have got IllegalArgumentException.");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got expected IllegalArgumentException {0} ", ex);
+ }
+
+ Util.Log("RegionNullKeyOperations Remove Step complete.");
+
+ try
+ {
+ Object val = region[1];
+ Assert.Fail("Should have got KeyNotFoundException");
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException ex)
+ {
+ Util.Log("Got expected KeyNotFoundException {0} ", ex);
+ }
+ region[1] = 1;
+
+ //Invalidate an entry and then do a get on to it, should throw EntryNotFoundException.
+ region.Invalidate(1);
+ try
+ {
+ Object val = region[1];
+ if (!isRemoteInstance)
+ {
+ Assert.Fail("Should have got KeyNotFoundException");
+ }
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException ex)
+ {
+ Util.Log("Got expected KeyNotFoundException {0} ", ex);
+ }
+ region.Remove(1);
+
+ //Remove an entry and then do a get on to it, should throw KeyNotFoundException.
+ try
+ {
+ Object val = region[1];
+ Assert.Fail("Should have got KeyNotFoundException");
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException ex)
+ {
+ Util.Log("Got expected KeyNotFoundException {0} ", ex);
+ }
+
+ }
+ public virtual void IdictionaryRegionArrayOperations(String RegionName)
+ {
+ TypesClass type = new TypesClass();
+
+ IdictionaryGenericRegionArrayOperations<int, bool[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.BoolArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, char[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.CharArrayId, false);
+ // IdictionaryGenericRegionArrayOperations<int, sbyte[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.SbyteArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<int, uint[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UintArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<int, ulong[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UlongArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<int, ushort[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UshortArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, string[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.StringArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, byte[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.ByteArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, double[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.DoubleArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, float[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.FloatArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, int[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.IntArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, long[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.LongArrayId, false);
+ IdictionaryGenericRegionArrayOperations<int, short[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.ShortArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<int, object[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.ObjectArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<int, decimal[]>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.DecimalArrayId, false);
+
+ IdictionaryGenericRegionArrayOperations<string, bool[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.BoolArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, char[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.CharArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, sbyte[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.SbyteArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, uint[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.UintArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, ulong[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.UlongArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, ushort[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.UshortArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, string[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.StringArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, byte[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.ByteArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, double[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.DoubleArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, float[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.FloatArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, int[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.IntArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, long[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.LongArrayId, false);
+ IdictionaryGenericRegionArrayOperations<string, short[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.ShortArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, object[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.ObjectArrayId, false);
+ //IdictionaryGenericRegionArrayOperations<string, decimal[]>(RegionName, type, (int)TypesClass.TypeIds.StringId, (int)TypesClass.TypeIds.DecimalArrayId, false);
+
+ }
+
+ public virtual void IdictionaryGenericRegionArrayOperations<TKey, TValue>(String RegionName, TypesClass type, int KeyId, int ValueId, bool IsValByRef)
+ {
+ //Create region and local Region instances.
+ IRegion<TKey, TValue> region = CacheHelper.GetVerifyRegion<TKey, TValue>(RegionName);
+ IRegion<TKey, TValue> localRegion = region.GetLocalView();
+
+ // Test CopyTo with remote region & local region instances.
+ Idictionary_Array_CopyTo_Step<TKey, TValue>(region, type, KeyId, ValueId);
+ Idictionary_Array_CopyTo_Step<TKey, TValue>(localRegion, type, KeyId, ValueId);
+ Util.Log("IdictionaryRegionOperations array CopyTo complete.");
+
+ // Test TryGetValue with remote region & local region instances.
+ Idictionary_Array_TryGetValue_Step<TKey, TValue>(region, type, KeyId, ValueId, IsValByRef);
+ Idictionary_Array_TryGetValue_Step<TKey, TValue>(localRegion, type, KeyId, ValueId, IsValByRef);
+ Util.Log("IdictionaryRegionOperations array TryGetValue complete.");
+
+ // Test generic & non-generic GetEnumerator with remote region & local region instances.
+ Idictionary_Array_GetEnumerator_Step<TKey, TValue>(region, type, KeyId, ValueId);
+ Idictionary_Array_GetEnumerator_Step<TKey, TValue>(localRegion, type, KeyId, ValueId);
+ Util.Log("IdictionaryRegionOperations array GetEnumerator complete.");
+
+ // Test generic Add/Put/Get/Remove/Contains with remote region & local region instances.
+ Idictionary_Array_Item_Add_Get_Set_Remove_Step<TKey, TValue>(region, type, KeyId, ValueId);
+ Idictionary_Array_Item_Add_Get_Set_Remove_Step<TKey, TValue>(localRegion, type, KeyId, ValueId);
+ Util.Log("IdictionaryRegionOperations array Add/Put/Get/Remove/Contains complete.");
+
+ region.Clear();
+ localRegion.Clear();
+ }
+
+ public virtual void IdictionaryRegionOperations(String RegionName)
+ {
+ TypesClass type = new TypesClass();
+
+ //IdictionaryGenericRegionOperations<byte, sbyte>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.ByteId, false);
+ ////IdictionaryGenericRegionOperations<byte, sbyte>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<byte, bool>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.BoolId, false);
+ //IdictionaryGenericRegionOperations<byte, char>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.CharId, false);
+ //IdictionaryGenericRegionOperations<byte, float>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.FloatId, false);
+ //IdictionaryGenericRegionOperations<byte, double>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.DoubleId, false);
+ //IdictionaryGenericRegionOperations<byte, int>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.IntId, false);
+ ////IdictionaryGenericRegionOperations<byte, uint>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.UintId, false);
+ //IdictionaryGenericRegionOperations<byte, long>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.LongId, false);
+ ////IdictionaryGenericRegionOperations<byte, ulong>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.UlongId, false);
+ //IdictionaryGenericRegionOperations<byte, object>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.ObjectId, true);
+ //IdictionaryGenericRegionOperations<byte, string>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.StringId, true);
+ //IdictionaryGenericRegionOperations<byte, short>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.ShortId, false);
+ ////IdictionaryGenericRegionOperations<byte, ushort>(RegionName, type, (int)TypesClass.TypeIds.ByteId, (int)TypesClass.TypeIds.UshortId, false);
+
+ //IdictionaryGenericRegionOperations<sbyte, byte>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.ByteId, false);
+ IdictionaryGenericRegionOperations<sbyte, sbyte>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.SbyteId, false);
+ IdictionaryGenericRegionOperations<sbyte, bool>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.BoolId, false);
+ IdictionaryGenericRegionOperations<sbyte, char>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.CharId, false);
+ IdictionaryGenericRegionOperations<sbyte, float>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.FloatId, false);
+ IdictionaryGenericRegionOperations<sbyte, double>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.DoubleId, false);
+ IdictionaryGenericRegionOperations<sbyte, int>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.IntId, false);
+ //IdictionaryGenericRegionOperations<sbyte, uint>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.UintId, false);
+ IdictionaryGenericRegionOperations<sbyte, long>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.LongId, false);
+ //IdictionaryGenericRegionOperations<sbyte, ulong>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.UlongId, false);
+ IdictionaryGenericRegionOperations<sbyte, object>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.ObjectId, true);
+ IdictionaryGenericRegionOperations<sbyte, string>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.StringId, true);
+ IdictionaryGenericRegionOperations<sbyte, short>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.ShortId, false);
+ //IdictionaryGenericRegionOperations<sbyte, ushort>(RegionName, type, (int)TypesClass.TypeIds.SbyteId, (int)TypesClass.TypeIds.UshortId, false);
+
+ IdictionaryGenericRegionOperations<short, sbyte>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<short, sbyte>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.SbyteId, false);
+ IdictionaryGenericRegionOperations<short, bool>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.BoolId, false);
+ IdictionaryGenericRegionOperations<short, char>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.CharId, false);
+ IdictionaryGenericRegionOperations<short, float>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.FloatId, false);
+ IdictionaryGenericRegionOperations<short, double>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.DoubleId, false);
+ IdictionaryGenericRegionOperations<short, int>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.IntId, false);
+ //IdictionaryGenericRegionOperations<short, uint>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.UintId, false);
+ IdictionaryGenericRegionOperations<short, long>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.LongId, false);
+ //IdictionaryGenericRegionOperations<short, ulong>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.UlongId, false);
+ IdictionaryGenericRegionOperations<short, object>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.ObjectId, true);
+ IdictionaryGenericRegionOperations<short, string>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.StringId, true);
+ IdictionaryGenericRegionOperations<short, short>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.ShortId, false);
+ // IdictionaryGenericRegionOperations<short, ushort>(RegionName, type, (int)TypesClass.TypeIds.ShortId, (int)TypesClass.TypeIds.UshortId, false);
+
+ //IdictionaryGenericRegionOperations<ushort, byte>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.ByteId, false);
+ //IdictionaryGenericRegionOperations<ushort, sbyte>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<ushort, bool>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.BoolId, false);
+ //IdictionaryGenericRegionOperations<ushort, char>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.CharId, false);
+ //IdictionaryGenericRegionOperations<ushort, float>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.FloatId, false);
+ //IdictionaryGenericRegionOperations<ushort, double>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.DoubleId, false);
+ //IdictionaryGenericRegionOperations<ushort, int>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.IntId, false);
+ //IdictionaryGenericRegionOperations<ushort, uint>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.UintId, false);
+ //IdictionaryGenericRegionOperations<ushort, long>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.LongId, false);
+ //IdictionaryGenericRegionOperations<ushort, ulong>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.UlongId, false);
+ //IdictionaryGenericRegionOperations<ushort, object>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.ObjectId, true);
+ //IdictionaryGenericRegionOperations<ushort, string>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.StringId, true);
+ //IdictionaryGenericRegionOperations<ushort, short>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.ShortId, false);
+ //IdictionaryGenericRegionOperations<ushort, ushort>(RegionName, type, (int)TypesClass.TypeIds.UshortId, (int)TypesClass.TypeIds.UshortId, false);
+
+ IdictionaryGenericRegionOperations<int, sbyte>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.SbyteId, false);
+ // IdictionaryGenericRegionOperations<int, sbyte>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.SbyteId, false);
+ IdictionaryGenericRegionOperations<int, sbyte>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.SbyteId, false);
+ IdictionaryGenericRegionOperations<int, bool>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.BoolId, false);
+ IdictionaryGenericRegionOperations<int, char>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.CharId, false);
+ IdictionaryGenericRegionOperations<int, float>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.FloatId, false);
+ IdictionaryGenericRegionOperations<int, double>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.DoubleId, false);
+ IdictionaryGenericRegionOperations<int, int>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.IntId, false);
+ //IdictionaryGenericRegionOperations<int, uint>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UintId, false);
+ IdictionaryGenericRegionOperations<int, long>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.LongId, false);
+ //IdictionaryGenericRegionOperations<int, ulong>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UlongId, false);
+ IdictionaryGenericRegionOperations<int, object>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.ObjectId, true);
+ IdictionaryGenericRegionOperations<int, string>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.StringId, true);
+ IdictionaryGenericRegionOperations<int, short>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.ShortId, false);
+ //IdictionaryGenericRegionOperations<int, ushort>(RegionName, type, (int)TypesClass.TypeIds.IntId, (int)TypesClass.TypeIds.UshortId, false);
+
+ //IdictionaryGenericRegionOperations<uint, byte>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.ByteId, false);
+ ////IdictionaryGenericRegionOperations<uint, sbyte>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<uint, bool>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.BoolId, false);
+ //IdictionaryGenericRegionOperations<uint, char>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.CharId, false);
+ //IdictionaryGenericRegionOperations<uint, float>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.FloatId, false);
+ //IdictionaryGenericRegionOperations<uint, double>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.DoubleId, false);
+ //IdictionaryGenericRegionOperations<uint, int>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.IntId, false);
+ ////IdictionaryGenericRegionOperations<uint, uint>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.UintId, false);
+ //IdictionaryGenericRegionOperations<uint, long>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.LongId, false);
+ ////IdictionaryGenericRegionOperations<uint, ulong>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.UlongId, false);
+ //IdictionaryGenericRegionOperations<uint, object>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.ObjectId, true);
+ //IdictionaryGenericRegionOperations<uint, string>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.StringId, true);
+ //IdictionaryGenericRegionOperations<uint, short>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.ShortId, false);
+ ////IdictionaryGenericRegionOperations<uint, ushort>(RegionName, type, (int)TypesClass.TypeIds.UintId, (int)TypesClass.TypeIds.UshortId, false);
+
+ IdictionaryGenericRegionOperations<long, sbyte>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<long, sbyte>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.SbyteId, false);
+ IdictionaryGenericRegionOperations<long, int>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.IntId, false);
+ //IdictionaryGenericRegionOperations<long, uint>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.UintId, false);
+ IdictionaryGenericRegionOperations<long, char>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.CharId, false);
+ IdictionaryGenericRegionOperations<long, bool>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.BoolId, false);
+ IdictionaryGenericRegionOperations<long, float>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.FloatId, false);
+ IdictionaryGenericRegionOperations<long, double>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.DoubleId, false);
+ IdictionaryGenericRegionOperations<long, long>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.LongId, false);
+ //IdictionaryGenericRegionOperations<long, ulong>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.UlongId, false);
+ IdictionaryGenericRegionOperations<long, object>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.ObjectId, true);
+ IdictionaryGenericRegionOperations<long, string>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.StringId, true);
+ IdictionaryGenericRegionOperations<long, short>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.ShortId, false);
+ //IdictionaryGenericRegionOperations<long, ushort>(RegionName, type, (int)TypesClass.TypeIds.LongId, (int)TypesClass.TypeIds.UshortId, false);
+
+ //IdictionaryGenericRegionOperations<ulong, byte>(RegionName, type, (int)TypesClass.TypeIds.UlongId, (int)TypesClass.TypeIds.ByteId, false);
+ //IdictionaryGenericRegionOperations<ulong, sbyte>(RegionName, type, (int)TypesClass.TypeIds.UlongId, (int)TypesClass.TypeIds.SbyteId, false);
+ //IdictionaryGenericRegionOperations<ulong, bool>(RegionN
<TRUNCATED>
[48/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CMakeLists.txt b/clicache/integration-test/CMakeLists.txt
new file mode 100644
index 0000000..be5e424
--- /dev/null
+++ b/clicache/integration-test/CMakeLists.txt
@@ -0,0 +1,120 @@
+# 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.
+cmake_minimum_required(VERSION 3.4)
+project(nativeclient.tests.clicache)
+
+set (NUNIT "C:\\Program Files (x86)\\NUnit 2.6.4")
+
+if (64 EQUAL ${BUILD_BITS})
+ set (NUNIT_CONSOLE "nunit-console")
+else()
+ set (NUNIT_CONSOLE "nunit-console-x86")
+endif()
+
+# Set the .NET Target Framework (Note: This should match the build for Apache.Geode.)
+set (DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2")
+
+foreach(var CMAKE_CURRENT_SOURCE_DIR CMAKE_SOURCE_DIR CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR)
+ file(TO_NATIVE_PATH ${${var}} ${var}_NATIVE)
+endforeach()
+
+file(GLOB_RECURSE CSPROJECTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.csproj.in")
+if(EXISTS "${STRONG_NAME_KEY}")
+ set(STRONG_NAME_KEY_ENABLED true)
+endif()
+
+foreach(FILE ${CSPROJECTS})
+ # TODO: make this a one line MATCH statement
+ string(REGEX REPLACE "\\.csproj.in" "" PROJDIR ${FILE})
+ string(REGEX REPLACE ".*/" "" PROJNAME ${PROJDIR})
+ configure_file(${FILE} ${CMAKE_CURRENT_BINARY_DIR}/${PROJNAME}.csproj)
+ include_external_msproject(
+ ${PROJNAME} ${CMAKE_CURRENT_BINARY_DIR}/${PROJNAME}.csproj
+ TYPE FAE04EC0-301F-11D3-BF4B-00C04F79EFBC)
+ set_target_properties(${PROJNAME} PROPERTIES FOLDER test/cliTests)
+
+endforeach()
+
+enable_testing()
+
+# Function to resolve both config and generate stage variables.
+macro(generate_config INPUT TEMP OUTPUT)
+ configure_file(${INPUT} ${TEMP})
+ file(GENERATE OUTPUT ${OUTPUT}
+ INPUT ${TEMP}
+ CONDITION 1
+ )
+endmacro()
+
+foreach( lib ssl xerces-c sqlite )
+ get_target_property(runtime_path ${lib} INTERFACE_RUNTIME_DIR)
+ set(PATH ${PATH} ${runtime_path})
+endforeach()
+
+file(GLOB SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cs")
+
+foreach(FILE ${SOURCES})
+ # Find all non-deprecated tests
+ file(STRINGS ${FILE} HasTests REGEX "\\[Test\\]")
+
+ LIST(LENGTH HasTests length)
+ if (${length} GREATER 0)
+ file(STRINGS ${FILE} IsDeprecated REGEX "\\[Category.*deprecated.*\\]")
+ if (NOT IsDeprecated)
+
+ # Get the namespace
+ file(STRINGS ${FILE} NameSpaceLine REGEX "namespace Apache.Geode.Client.UnitTests")
+ string(REGEX REPLACE "namespace.*Apache" "Apache" NAMESPACE ${NameSpaceLine})
+
+ string(REGEX REPLACE "\\.cs" "" TEST ${FILE})
+ set(TESTS ${TESTS} ${TEST})
+ set(TEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/.tests/${TEST})
+
+ # Get the test class (NewAPI tests have N in the file name but not test class name)
+ string(REGEX REPLACE "N$" "" TESTCLASS ${TEST})
+
+ set(TEST_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${TEST}.bat)
+ generate_config(${CMAKE_CURRENT_SOURCE_DIR}/test.bat.in ${CMAKE_CURRENT_BINARY_DIR}/.${TEST}.bat.in ${TEST_SCRIPT})
+
+ add_test(NAME ${TEST} COMMAND ${TEST_SCRIPT})
+ set_property(TEST ${TEST} PROPERTY LABELS STABLE)
+ endif()
+ endif()
+endforeach()
+
+# Label any flaky tests here
+set_property(TEST ThinClientCqTestsN PROPERTY LABELS FLAKY)
+
+# Label any tests that always fail here
+set_property(TEST OverflowTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientDeltaTestN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientDurableTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientHARegionTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientPdxTests PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientRegionTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientSecurityAuthTestsMUN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientSecurityAuthTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientSecurityAuthTestsMUN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientSecurityAuthzTestsMUN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientSecurityAuthzTestsN PROPERTY LABELS OMITTED)
+set_property(TEST ThinClientStatisticTestsN PROPERTY LABELS OMITTED)
+
+add_custom_target(run-stable-clicache-integration-tests
+ COMMAND ctest -C $<CONFIGURATION> -L STABLE
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ USES_TERMINAL)
+add_dependencies(run-integration-tests run-stable-clicache-integration-tests)
+set_target_properties(run-stable-clicache-integration-tests PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+
[37/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientPdxTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientPdxTests.cs b/clicache/integration-test/ThinClientPdxTests.cs
new file mode 100755
index 0000000..66a7935
--- /dev/null
+++ b/clicache/integration-test/ThinClientPdxTests.cs
@@ -0,0 +1,6638 @@
+/*
+ * 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.Collections.Generic;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Threading;
+using PdxTests;
+using System.Reflection;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ class ThinClientPdxTests : ThinClientRegionSteps
+ {
+ static bool m_useWeakHashMap = false;
+ #region Private members
+
+ private UnitProcess m_client1, m_client2, m_client3, m_client4;
+
+ #endregion
+
+ 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 };
+ //return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try {
+ m_client1.Call(DestroyRegions);
+ m_client2.Call(DestroyRegions);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ void cleanup()
+ {
+ {
+ CacheHelper.SetExtraPropertiesFile(null);
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ try
+ {
+ client.Call(CacheHelper.Close);
+ }
+ catch (System.Runtime.Remoting.RemotingException)
+ {
+ }
+ catch (System.Net.Sockets.SocketException)
+ {
+ }
+ }
+ }
+ CacheHelper.Close();
+ }
+ }
+
+ void runDistOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateNonExistentRegion, CacheHelper.Locators);
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(CheckServerKeys);
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyPdxInGet()
+ {
+ Serializable.RegisterPdxType(PdxType.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object,object>(m_regionNames[0]);
+
+ region0[1] = new PdxType();
+
+ PdxType pRet = (PdxType)region0[1];
+ checkPdxInstanceToStringAtServer(region0);
+
+ Assert.AreEqual(CacheHelper.DCache.GetPdxReadSerialized(), false, "Pdx read serialized property should be false.");
+
+ }
+
+ void VerifyGetOnly()
+ {
+ Serializable.RegisterPdxType(PdxType.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxType pRet = (PdxType)region0[1];
+ checkPdxInstanceToStringAtServer(region0);
+
+
+ }
+
+ void PutAndVerifyVariousPdxTypes()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes9.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PositionPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.AllPdxTypes.Create);
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ {
+ PdxTypes1 p1 = new PdxTypes1();
+ region0[11] = p1;
+ PdxTypes1 pRet = (PdxTypes1)region0[11];
+ Assert.AreEqual(p1, pRet);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes2 p2 = new PdxTypes2();
+ region0[12] = p2;
+ PdxTypes2 pRet2 = (PdxTypes2)region0[12];
+ Assert.AreEqual(p2, pRet2);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes3 p3 = new PdxTypes3();
+ region0[13] = p3;
+ PdxTypes3 pRet3 = (PdxTypes3)region0[13];
+ Assert.AreEqual(p3, pRet3);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes4 p4 = new PdxTypes4();
+ region0[14] = p4;
+ PdxTypes4 pRet4 = (PdxTypes4)region0[14];
+ Assert.AreEqual(p4, pRet4);
+ checkPdxInstanceToStringAtServer(region0);
+
+ }
+
+ {
+ PdxTypes5 p5 = new PdxTypes5();
+ region0[15] = p5;
+ PdxTypes5 pRet5 = (PdxTypes5)region0[15];
+ Assert.AreEqual(p5, pRet5);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes6 p6 = new PdxTypes6();
+ region0[16] = p6;
+ PdxTypes6 pRet6 = (PdxTypes6)region0[16];
+ Assert.AreEqual(p6, pRet6);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes7 p7 = new PdxTypes7();
+ region0[17] = p7;
+ PdxTypes7 pRet7 = (PdxTypes7)region0[17];
+ Assert.AreEqual(p7, pRet7);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes8 p8 = new PdxTypes8();
+ region0[18] = p8;
+ PdxTypes8 pRet8 = (PdxTypes8)region0[18];
+ Assert.AreEqual(p8, pRet8);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes9 p9 = new PdxTypes9();
+ region0[19] = p9;
+ PdxTypes9 pRet9 = (PdxTypes9)region0[19];
+ Assert.AreEqual(p9, pRet9);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PortfolioPdx pf = new PortfolioPdx(1001, 10);
+ region0[20] = pf;
+ PortfolioPdx retpf = (PortfolioPdx)region0[20];
+ checkPdxInstanceToStringAtServer(region0);
+ //Assert.AreEqual(p9, pRet9);
+ }
+
+ {
+ PortfolioPdx pf = new PortfolioPdx(1001, 10, new string[] { "one", "two", "three" });
+ region0[21] = pf;
+ PortfolioPdx retpf = (PortfolioPdx)region0[21];
+ checkPdxInstanceToStringAtServer(region0);
+ //Assert.AreEqual(p9, pRet9);
+ }
+ {
+ PdxTypes10 p10 = new PdxTypes10();
+ region0[22] = p10;
+ PdxTypes10 pRet10 = (PdxTypes10)region0[22];
+ Assert.AreEqual(p10, pRet10);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ AllPdxTypes apt = new AllPdxTypes(true);
+ region0[23] = apt;
+ AllPdxTypes aptRet = (AllPdxTypes)region0[23];
+ Assert.AreEqual(apt, aptRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ }
+
+ void VerifyVariousPdxGets()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes9.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PositionPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.AllPdxTypes.Create);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ {
+ PdxTypes1 p1 = new PdxTypes1();
+ PdxTypes1 pRet = (PdxTypes1)region0[11];
+ Assert.AreEqual(p1, pRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes2 p2 = new PdxTypes2();
+ PdxTypes2 pRet2 = (PdxTypes2)region0[12];
+ Assert.AreEqual(p2, pRet2);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes3 p3 = new PdxTypes3();
+ PdxTypes3 pRet3 = (PdxTypes3)region0[13];
+ Assert.AreEqual(p3, pRet3);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes4 p4 = new PdxTypes4();
+ PdxTypes4 pRet4 = (PdxTypes4)region0[14];
+ Assert.AreEqual(p4, pRet4);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes5 p5 = new PdxTypes5();
+ PdxTypes5 pRet5 = (PdxTypes5)region0[15];
+ Assert.AreEqual(p5, pRet5);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes6 p6 = new PdxTypes6();
+ PdxTypes6 pRet6 = (PdxTypes6)region0[16];
+ Assert.AreEqual(p6, pRet6);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes7 p7 = new PdxTypes7();
+ PdxTypes7 pRet7 = (PdxTypes7)region0[17];
+ Assert.AreEqual(p7, pRet7);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+
+ {
+ PdxTypes8 p8 = new PdxTypes8();
+ PdxTypes8 pRet8 = (PdxTypes8)region0[18];
+ Assert.AreEqual(p8, pRet8);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes9 p9 = new PdxTypes9();
+ PdxTypes9 pRet9 = (PdxTypes9)region0[19];
+ Assert.AreEqual(p9, pRet9);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PortfolioPdx retpf = (PortfolioPdx)region0[20];
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PortfolioPdx retpf = (PortfolioPdx)region0[21];
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ PdxTypes10 p10 = new PdxTypes10();
+ PdxTypes10 pRet10 = (PdxTypes10)region0[22];
+ Assert.AreEqual(p10, pRet10);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ {
+ AllPdxTypes apt = new AllPdxTypes(true);
+ AllPdxTypes aptRet = (AllPdxTypes)region0[23];
+ Assert.AreEqual(apt, aptRet);
+ checkPdxInstanceToStringAtServer(region0);
+ }
+ }
+
+ void checkPdxInstanceToStringAtServer(Region region)
+ {
+ bool retVal = (bool)region["success"];
+ Assert.IsTrue(retVal);
+ }
+
+ private void DoputAndVerifyClientName()
+ {
+ //CacheableString cVal = new CacheableString(new string('A', 1024));
+ Region region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ string cVal = new string('A', 5);
+
+ Util.Log("Putting key = key-0");
+ region["key-0"] = cVal;
+ Util.Log("Put Operation done successfully");
+
+ //Verify the Client Name.
+ string cReceivedName = region["clientName1"] as string;
+ Util.Log(" DoputAndVerifyClientName Received Client Name = {0} ", cReceivedName);
+ Assert.AreEqual(cReceivedName.Equals("Client-1"), true, "Did not find the expected value.");
+ }
+
+ private void DoGetAndVerifyClientName()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ string cReceivedName = region["clientName2"] as string; ;
+ Util.Log("Get Operation done successfully");
+
+ //Verify the Client Name.
+ Util.Log(" DoGetAndVerifyClientName Received Client Name = {0} ", cReceivedName);
+ Assert.AreEqual(cReceivedName.Equals("Client-2"), true, "Did not find the expected value.");
+ }
+
+ public void ConfigClient1AndCreateRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ //Configure Client "name" for Client-1
+ Properties<string, string> props = Properties<string, string>.Create<string, string>();
+ props.Insert("name", "Client-1");
+ CacheHelper.InitConfig(props);
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+
+ }
+
+ public void ConfigClient2AndCreateRegions_Pool(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool cachingEnable)
+ {
+ //Configure Client "name" for Client-2
+ Properties<string, string> props = Properties<string, string>.Create<string, string>();
+ props.Insert("name", "Client-2");
+ CacheHelper.InitConfig(props);
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, cachingEnable,
+ null, locators, poolName, clientNotification, ssl, false);
+ m_regionNames = regionNames;
+ }
+
+ void runtestForBug866()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ //Client Notification and local caching enabled for clients
+ m_client1.Call(ConfigClient1AndCreateRegions_Pool, RegionNames, CacheHelper.Locators, "__TESTPOOL1_", true, false, true);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(ConfigClient2AndCreateRegions_Pool, RegionNames, CacheHelper.Locators, "__TESTPOOL1_", true, false, true);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(DoputAndVerifyClientName);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(DoGetAndVerifyClientName);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }//END:: testBug866
+
+ void runPdxDistOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(PutAndVerifyPdxInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(PutAndVerifyVariousPdxTypes);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(VerifyVariousPdxGets);
+ Util.Log("StepSeven complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void VerifyDataOutputAdvance()
+ {
+ Serializable.RegisterPdxType(MyClass.Create);
+ Serializable.RegisterPdxType(MyClasses.Create);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ MyClasses mcs = new MyClasses("1", 1000);
+
+ region0[1] = mcs;
+
+ object ret = region0[1];
+
+ Assert.AreEqual(mcs, ret);
+ }
+
+ void runPdxDistOps2()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdxSerializer.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(VerifyDataOutputAdvance);
+ Util.Log("StepThree complete.");
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyNestedPdxInGet()
+ {
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ NestedPdx np = new NestedPdx();
+ region0[1] = np;
+
+ NestedPdx pRet = (NestedPdx)region0[1];
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ void VerifyNestedGetOnly()
+ {
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ NestedPdx orig = new NestedPdx();
+ NestedPdx pRet = (NestedPdx)region0[1];
+
+ Assert.AreEqual(orig, pRet);
+ }
+
+ void runNestedPdxOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(PutAndVerifyNestedPdxInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyNestedGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void PutAndVerifyPdxInIGFSInGet()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ PdxInsideIGeodeSerializable np = new PdxInsideIGeodeSerializable();
+ region0[1] = np;
+
+ PdxInsideIGeodeSerializable pRet = (PdxInsideIGeodeSerializable)region0[1];
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ void VerifyPdxInIGFSGetOnly()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ { }
+
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxInsideIGeodeSerializable orig = new PdxInsideIGeodeSerializable();
+ PdxInsideIGeodeSerializable pRet = (PdxInsideIGeodeSerializable)region0[1];
+
+ Assert.AreEqual(orig, pRet);
+ }
+
+ void runPdxInIGFSOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(PutAndVerifyPdxInIGFSInGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyPdxInIGFSGetOnly);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void JavaPutGet_LinedListType()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ //Do some put to invike attached listener,
+ region0[1] = 123;
+
+ //Get
+ int value = (int)region0[1];
+ //Util.Log("JavaPutGet_LinedListType value received = " + value);
+
+ //verify that listener methods have been called.
+ Assert.IsTrue((bool)region0["success"]);
+
+ //LinkedList validation
+ LinkedList<Object> myList1 = new LinkedList<Object>();
+ myList1.AddFirst("Manan");
+ myList1.AddLast("Nishka");
+
+ //get the JSON document (as PdxInstance) that has been put from java in attached cacheListener code.
+ IPdxInstance ret = (IPdxInstance)region0["jsondoc1"];
+ LinkedList<Object> linkedList = (LinkedList<Object>)ret.GetField("kids");
+
+ //verify sizes
+ Assert.AreEqual((linkedList.Count == myList1.Count), true, " LinkedList size should be equal.");
+
+ LinkedList<Object>.Enumerator e1 = linkedList.GetEnumerator();
+ LinkedList<Object>.Enumerator e2 = myList1.GetEnumerator();
+
+ //verify content of LinkedList
+ while (e1.MoveNext() && e2.MoveNext())
+ {
+ //Util.Log("JavaPutGet_LinedListType Kids = " + e1.Current);
+ PdxType.GenericValCompare(e1.Current, e2.Current);
+ }
+
+ Util.Log("successfully completed JavaPutGet_LinedListType");
+ }
+
+ void JavaPutGet()
+ {
+ try
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ PdxType np = new PdxType();
+ region0[1] = np;
+
+ PdxType pRet = (PdxType)region0[1];
+
+ //Assert.AreEqual(np, pRet);
+
+ Assert.IsTrue((bool)region0["success"]);
+ }
+
+ void JavaGet()
+ {
+ try
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ }
+ catch (Exception )
+ {
+ }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ PdxType np = new PdxType();
+
+ PdxType pRet = (PdxType)region0[1];
+
+ PdxType putFromjava = (PdxType)region0["putFromjava"];
+ }
+
+ void runJavaInterOpsWithLinkedListType()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverForPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool_PDXWithLL, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("Clinet-1 CreateTCRegions_Pool_PDXWithLL (pool with locator) completed.");
+
+ m_client1.Call(JavaPutGet_LinedListType);
+ Util.Log("JavaPutGet_LinedListType complete.");
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runJavaInteroperableOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserverForPdx.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(JavaPutGet);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(JavaGet);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void putallAndGetallPdx()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes7.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes8.CreateDeserializable);
+ }
+ catch (Exception )
+ { }
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IDictionary<object, object> all = new Dictionary<object, object>();
+
+ PdxTypes1 p1 = new PdxTypes1();
+ PdxTypes2 p2 = new PdxTypes2();
+ PdxTypes3 p3 = new PdxTypes3();
+ PdxTypes4 p4 = new PdxTypes4();
+ PdxTypes5 p5 = new PdxTypes5();
+ PdxTypes6 p6 = new PdxTypes6();
+ PdxTypes7 p7 = new PdxTypes7();
+ PdxTypes8 p8 = new PdxTypes8();
+
+ all.Add(21, p1);
+ all.Add(22, p2);
+ all.Add(23, p3);
+ all.Add(24, p4);
+ all.Add(25, p5);
+ all.Add(26, p6);
+ all.Add(27, p7);
+ all.Add(28, p8);
+ region0.PutAll(all);
+
+
+ ICollection<object> keys = new List<object>();
+ IDictionary<object, object> getall = new Dictionary<object, object>();
+
+ keys.Add(21);
+ keys.Add(22);
+ keys.Add(23);
+ keys.Add(24);
+ keys.Add(25);
+ keys.Add(26);
+ keys.Add(27);
+ keys.Add(28);
+ //keys.Add(p1);
+ //keys.Add(p2);
+ region0.GetAll(keys, getall, null);
+ foreach (KeyValuePair<object, object> kv in all)
+ {
+ object key = kv.Key;
+ Util.Log("putall keys "+ key.GetType() + " : " + key);
+ }
+ //IEnumerator<KeyValuePair<object, object>> ie = getall.GetEnumerator();
+ foreach (KeyValuePair<object, object> kv in getall)
+ {
+ object key = kv.Key;
+ if (key != null)
+ Util.Log("got key " + key.GetType() + " : " + key);
+ else
+ Util.Log("got NULL key ");
+ object origVal = all[key];
+ Assert.AreEqual(kv.Value, origVal);
+ }
+ }
+
+
+ void runPutAllGetAllOps()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(putallAndGetallPdx);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(putallAndGetallPdx);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ void LocalOpsStep()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(PdxTests.PdxInsideIGeodeSerializable.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(NestedPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes2.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes3.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes4.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes5.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTypes6.CreateDeserializable);
+
+ }
+ catch (Exception)
+ { }
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> localregion = region0.GetLocalView();
+
+
+ PdxTypes1 p1 = new PdxTypes1();
+ string x = "";
+ localregion.Add(p1, x);
+ object val = localregion[p1];
+ //object val = region0[p1];
+ val = localregion[p1];
+ val = localregion[p1];
+ Assert.IsTrue(val.Equals(x), "value should be equal");
+ Assert.IsTrue(localregion.Remove(new KeyValuePair<Object, Object>(p1, x)), "Result of remove should be true, as this value null exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p1), "containsKey should be false");
+ try
+ {
+ localregion[p1] = null;
+ Assert.Fail("Expected IllegalArgumentException here for put");
+ }
+ catch (IllegalArgumentException)
+ {
+ Util.Log("Got Expected IllegalArgumentException");
+ }
+
+ localregion[p1] = 1;
+ localregion.Invalidate(p1);
+ try
+ {
+ object retVal = localregion[p1];
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException)
+ {
+ Util.Log("Got expected KeyNotFoundException exception");
+ }
+ Assert.IsFalse(localregion.Remove(new KeyValuePair<Object, Object>(p1, 1)), "Result of remove should be false, as this value does not exists locally.");
+ Assert.IsTrue(localregion.ContainsKey(p1), "containsKey should be true");
+ localregion[p1] = 1;
+ Assert.IsTrue(localregion.Remove(p1), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p1), "containsKey should be false");
+
+ PdxTypes2 p2 = new PdxTypes2();
+ localregion.Add(p2, 1);
+ object intVal1 = localregion[p2]; // local get work for pdx object as key but it wont work with caching enable. Throws KeyNotFoundException.
+ Assert.IsTrue(intVal1.Equals(1), "intVal should be 1.");
+
+ PdxTypes3 p3 = new PdxTypes3();
+ localregion.Add(p3, "testString");
+ if (localregion.ContainsKey(p3))
+ {
+ object strVal1 = localregion[p3];
+ Assert.IsTrue(strVal1.Equals("testString"), "strVal should be testString.");
+ }
+
+ try
+ {
+ if (localregion.ContainsKey(p3))
+ {
+ localregion.Add(p3, 11);
+ Assert.Fail("Expected EntryExistException here");
+ }
+ }
+ catch (EntryExistsException)
+ {
+ Util.Log(" Expected EntryExistsException exception thrown by localCreate");
+ }
+
+ PdxTypes4 p4 = new PdxTypes4();
+ localregion.Add(p4, p1);
+ object objVal1 = localregion[p4];
+ Assert.IsTrue(objVal1.Equals(p1), "valObject and objVal should match.");
+ Assert.IsTrue(localregion.Remove(new KeyValuePair<Object, Object>(p4, p1)), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p4), "containsKey should be false");
+ localregion[p4] = p1;
+ Assert.IsTrue(localregion.Remove(p4), "Result of remove should be true, as this value exists locally.");
+ Assert.IsFalse(localregion.ContainsKey(p4), "containsKey should be false");
+
+ PdxTypes5 p5 = new PdxTypes5();
+
+ //object cval = region0[p1]; //this will only work when caching is enable else throws KeyNotFoundException
+
+ localregion.Clear();
+
+ }
+ void runLocalOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, true/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+
+ m_client1.Call(LocalOpsStep);
+ Util.Log("localOps complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ Assembly m_pdxVesionOneAsm;
+ Assembly m_pdxVesionTwoAsm;
+
+ #region "Version Fisrt will be here PdxType1"
+ void initializePdxAssemblyOne(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ IPdxSerializable registerPdxTypeOne()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+ IPdxSerializable registerPdxTypeTwo()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void putAtVersionOne11(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance , null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine( np.ToString());
+ Console.WriteLine( pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ }
+
+ void getPutAtVersionTwo12(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance , null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne13()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo14()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+ public void getPutAtVersionOne15()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ if (m_useWeakHashMap == false)
+ {
+ Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ }
+ else
+ {
+ Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() > 0);
+ }
+ }
+
+ public void getPutAtVersionTwo16()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes1");
+ object np = pt.InvokeMember("PdxTypes1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+
+ if (m_useWeakHashMap == false)
+ {
+ Assert.AreEqual(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData(), 0);
+ }
+ else
+ {
+ //it has extra fields, so no need to preserve data
+ Assert.IsTrue(Client.Internal.PdxTypeRegistry.testNumberOfPreservedData() == 0);
+ }
+ }
+
+ #endregion
+ void runBasicMergeOps()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(putAtVersionOne11, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo12, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(getPutAtVersionOne13);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(getPutAtVersionTwo14);
+ Util.Log("StepSix complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne15);
+ Util.Log("StepSeven complete." + i);
+
+ m_client2.Call(getPutAtVersionTwo16);
+ Util.Log("StepEight complete." + i);
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+
+ void initializePdxAssemblyOnePS(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ //object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ void putFromVersion1_PS(bool useWeakHashmap)
+ {
+ //local cache is on
+ initializePdxAssemblyOnePS(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("Create", BindingFlags.InvokeMethod, null, null, null);
+
+ Serializable.RegisterPdxSerializer((IPdxSerializer)np);
+
+ //created new object
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ Type keytype = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ region0[key] = np;
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ //this should come from local caching
+ pRet = region0.GetLocalView()[key];
+
+ Assert.IsNotNull(pRet);
+
+ region0.GetLocalView().Invalidate(key);
+ bool isKNFE = false;
+ try
+ {
+ pRet = region0.GetLocalView()[key];
+ }
+ catch (Apache.Geode.Client.KeyNotFoundException )
+ {
+ isKNFE = true;
+ }
+
+ Assert.IsTrue(isKNFE);
+
+ pRet = region0[key];
+
+ isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ region0.GetLocalView().Remove(key);
+
+ }
+
+ void initializePdxAssemblyTwoPS(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ //object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ m_useWeakHashMap = useWeakHashmap;
+ }
+
+ void putFromVersion2_PS(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoPS(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+
+ object np = pt.InvokeMember("Create", BindingFlags.InvokeMethod, null, null, null);
+
+ Serializable.RegisterPdxSerializer((IPdxSerializer)np);
+
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ Type keytype = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ region0[key] = np;
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+ region0[key2] = np;
+ }
+
+
+ void getputFromVersion1_PS()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+
+ Type keytype = m_pdxVesionOneAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+
+ object pRet = region0[key];
+
+ Assert.IsTrue(np.Equals(pRet));
+
+ //get then put.. this should merge data back
+ region0[key] = pRet;
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+
+ pRet = region0[key2];
+
+ Assert.IsTrue(np.Equals(pRet));
+
+ //get then put.. this should Not merge data back
+ region0[key2] = np;
+
+ }
+
+ void getAtVersion2_PS()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestDiffTypePdxS");
+ object np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+
+ Type keytype = m_pdxVesionTwoAsm.GetType("PdxVersionTests.TestKey");
+ object key = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-1" });
+
+ bool gotexcep = false;
+ try
+ {
+ object r = region0.GetLocalView()[key];
+ }
+ catch (Exception )
+ {
+ gotexcep = true;
+ }
+ Assert.IsTrue(gotexcep);
+
+ object pRet = region0[key];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ object key2 = keytype.InvokeMember("TestKey", BindingFlags.CreateInstance, null, null, new object[] { "key-2" });
+
+ np = pt.InvokeMember("TestDiffTypePdxS", BindingFlags.CreateInstance, null, null, new object[] { true });
+
+ pRet = region0[key2];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ Assert.IsTrue(!np.Equals(pRet));
+ }
+
+ void runBasicMergeOpsWithPdxSerializer()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserverPdxSerializer.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, true/*local caching true*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putFromVersion1_PS, m_useWeakHashMap);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(putFromVersion2_PS, m_useWeakHashMap);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(getputFromVersion1_PS);
+ Util.Log("Stepthree complete.");
+
+ m_client2.Call(getAtVersion2_PS);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(dinitPdxSerializer);
+ m_client2.Call(dinitPdxSerializer);
+
+ //m_client1.Call(getPutAtVersionOne13);
+ //Util.Log("StepFive complete.");
+
+ //m_client2.Call(getPutAtVersionTwo14);
+ //Util.Log("StepSix complete.");
+
+ //for (int i = 0; i < 10; i++)
+ //{
+ // m_client1.Call(getPutAtVersionOne15);
+ // Util.Log("StepSeven complete." + i);
+
+ // m_client2.Call(getPutAtVersionTwo16);
+ // Util.Log("StepEight complete." + i);
+ //}
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region Basic merge three PDxType2
+
+ void initializePdxAssemblyOne2(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne2);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ IPdxSerializable registerPdxTypeOne2()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo2(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo2);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+ IPdxSerializable registerPdxTypeTwo2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionOne21(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+
+ pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.Pdx1");
+ object pdx1 = pt.InvokeMember("Pdx1", BindingFlags.CreateInstance, null, null, null);
+
+ for (int i = 1000; i < 1010; i++) {
+ region0[i] = pdx1;
+ }
+ }
+
+ public void getPutAtVersionTwo22(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo2(useWeakHashmap);
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+
+ pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.Pdx1");
+ object pdx1 = pt.InvokeMember("Pdx1", BindingFlags.CreateInstance, null, null, null);
+
+ for (int i = 1000; i < 1010; i++)
+ {
+ object ret = region0[i];
+ }
+ }
+ public void getPutAtVersionOne23()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo24()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes2");
+ object np = pt.InvokeMember("PdxTypes2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ void runBasicMergeOps2()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putAtVersionOne21, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo22, m_useWeakHashMap);
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne23);
+ m_client2.Call(getPutAtVersionTwo24);
+
+ Util.Log("step complete " + i);
+ }
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ #endregion
+
+ #region Basic merge three PDxType3
+
+ void initializePdxAssemblyOne3(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOne3);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ IPdxSerializable registerPdxTypeOne3()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxAssemblyTwo3(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwo3);
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+ IPdxSerializable registerPdxTypeTwo3()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionOne31(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOne3(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+ Assert.IsTrue(isEqual);
+ }
+
+ public void getPutAtVersionTwo32(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwo3(useWeakHashmap);
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+ public void getPutAtVersionOne33()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo34()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypes3");
+ object np = pt.InvokeMember("PdxTypes3", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = (object)region0[1];
+
+ Console.WriteLine(np.ToString());
+ Console.WriteLine(pRet.ToString());
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+
+ region0[1] = pRet;
+ }
+
+ void runBasicMergeOps3()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client1.Call(putAtVersionOne31, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(getPutAtVersionTwo32, m_useWeakHashMap);
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client1.Call(getPutAtVersionOne33);
+ m_client2.Call(getPutAtVersionTwo34);
+
+ Util.Log("step complete " + i);
+ }
+
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ #endregion
+
+ #region "Version two will first here"
+
+ void initializePdxAssemblyOneR1(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOneR1);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+
+ }
+
+ IPdxSerializable registerPdxTypeOneR1()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+
+ void initializePdxAssemblyTwoR1(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwoR1);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+
+ IPdxSerializable registerPdxTypeTwoR1()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionTwo1(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoR1(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ }
+
+ public void getPutAtVersionOne2(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOneR1(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo3()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];//get
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne4()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwo5()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOne6()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR1");
+ object np = pt.InvokeMember("PdxTypesR1", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+ #endregion
+
+ void runBasicMergeOpsR1()
+ {
+
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putAtVersionTwo1, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(getPutAtVersionOne2, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(getPutAtVersionTwo3);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(getPutAtVersionOne4);
+ Util.Log("StepSix complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client2.Call(getPutAtVersionTwo5);
+ Util.Log("StepSeven complete." + i);
+
+ m_client1.Call(getPutAtVersionOne6);
+ Util.Log("StepEight complete." + i);
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ IPdxSerializable registerPdxUIV1()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxUIAssemblyOne(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxUIV1);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ public void putV1PdxUI(bool useWeakHashmap)
+ {
+ initializePdxUIAssemblyOne(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+ object pRet = region0[1];
+ region0[1] = pRet;
+
+
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ //Assert.AreEqual(np, pRet);
+ }
+
+ IPdxSerializable registerPdxUIV2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ void initializePdxUIAssemblyTwo(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxUIV2);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+ public void putV2PdxUI(bool useWeakHashmap)
+ {
+ initializePdxUIAssemblyTwo(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ region0[1] = pRet;
+ Console.WriteLine(" " + pRet);
+ }
+
+ public void getV2PdxUI()
+ {
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesIgnoreUnreadFields");
+ object np = pt.InvokeMember("PdxTypesIgnoreUnreadFields", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ Assert.AreEqual(np, pRet);
+ }
+ void runPdxIgnoreUnreadFieldTest()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool_PDX, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool_PDX, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putV2PdxUI, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(putV1PdxUI, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(getV2PdxUI);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region PdxType2 Version two first
+
+ void initializePdxAssemblyOneR2(bool useWeakHashmap)
+ {
+ m_pdxVesionOneAsm = Assembly.LoadFrom("PdxVersion1Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeOneR2);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+
+ }
+
+ IPdxSerializable registerPdxTypeOneR2()
+ {
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+
+ void initializePdxAssemblyTwoR2(bool useWeakHashmap)
+ {
+ m_pdxVesionTwoAsm = Assembly.LoadFrom("PdxVersion2Lib.dll");
+
+ Serializable.RegisterPdxType(registerPdxTypeTwoR2);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("Reset", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { useWeakHashmap });
+ }
+
+
+ IPdxSerializable registerPdxTypeTwoR2()
+ {
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+
+ object ob = pt.InvokeMember("CreateDeserializable", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, null);
+
+ return (IPdxSerializable)ob;
+ }
+
+ public void putAtVersionTwoR21(bool useWeakHashmap)
+ {
+ initializePdxAssemblyTwoR2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+ region0[1] = np;
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool isEqual = np.Equals(pRet);
+
+ Assert.IsTrue(isEqual);
+ }
+
+ public void getPutAtVersionOneR22(bool useWeakHashmap)
+ {
+ initializePdxAssemblyOneR2(useWeakHashmap);
+
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionTwoR23()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionTwoAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];//get
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+ public void getPutAtVersionOneR24()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ Type pt = m_pdxVesionOneAsm.GetType("PdxVersionTests.PdxTypesR2");
+ object np = pt.InvokeMember("PdxTypesR2", BindingFlags.CreateInstance, null, null, null);
+
+ object pRet = region0[1];
+
+ Console.WriteLine(np);
+ Console.WriteLine(pRet);
+
+ bool retVal = np.Equals(pRet);
+ Assert.IsTrue(retVal);
+
+ region0[1] = pRet;
+ }
+
+
+ void runBasicMergeOpsR2()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, false/*local caching false*/);
+ Util.Log("StepTwo (pool locators) complete.");
+
+
+ m_client2.Call(putAtVersionTwoR21, m_useWeakHashMap);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(getPutAtVersionOneR22, m_useWeakHashMap);
+ Util.Log("StepFour complete.");
+
+ for (int i = 0; i < 10; i++)
+ {
+ m_client2.Call(getPutAtVersionTwoR23);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(getPutAtVersionOneR24);
+ Util.Log("StepSix complete.");
+ }
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #endregion
+
+ public void putFromPool1()
+ {
+ Serializable.RegisterPdxType(PdxTypes1.CreateDeserializable);
+ Util.Log("Put from pool-1 started");
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+
+ region0[1] = new PdxTypes1();
+
+ region0[2] = new PdxTests.PdxType();
+ Util.Log("Put from pool-1 Completed");
+ }
+
+ public void putFromPool2()
+ {
+ Util.Log("Put from pool-21 started");
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[1]);
+
+ region0[1] = new PdxTypes1();
+ region0[2] = new PdxTests.PdxType();
+ object ret = region0[1];
+ ret = region0[2];
+ Util.Log("Put from pool-2 completed");
+
+ int pdxIds = Apache.Geode.Client.Internal.PdxTypeRegistry.testGetNumberOfPdxIds();
+
+ Assert.AreEqual(3, pdxIds);
+ }
+
+ public void runMultipleDSTest()
+ {
+ Util.Log("Starting runMultipleDSTest. " );
+
+ CacheHelper.SetupJavaServers(true, "cacheserverMDS1.xml", "cacheserverMDS2.xml");
+ CacheHelper.StartJavaLocator_MDS(1, "GFELOC", null, 1/*ds id is one*/);
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaLocator_MDS(2, "GFELOC2", null, 2/*ds id is one*/);
+ Util.Log("Locator 2 started.");
+
+ CacheHelper.StartJavaServerWithLocator_MDS(1, "GFECS1", 1);
+ Util.Log("Server 1 started with locator 1.");
+
+ CacheHelper.StartJavaServerWithLocator_MDS(2, "GFECS2", 2);
+ Util.Log("Server 2 started with locator 2.");
+
+ //client intialization
+ /*
+ * CreateTCRegion_Pool(string name, bool ack, bool caching,
+ ICacheListener listener, string endpoints, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled)
+ *
+ */
+
+ m_client1.Call(CacheHelper.CreateTCRegion_Pool_MDS,
+ RegionNames[0], true, false,
+ CacheHelper.LocatorFirst, "__TESTPOOL1_",
+ false, false, false);
+
+ Util.Log("StepOne (pool-1 locators) complete. " + CacheHelper.LocatorFirst);
+
+ m_client1.Call(CacheHelper.CreateTCRegion_Pool_MDS,
+ RegionNames[1], false, false,
+ CacheHelper.LocatorSecond, "__TESTPOOL2_",
+ false, false, false);
+
+ Util.Log("StepTwo (pool-2 locators) complete. " + CacheHelper.LocatorSecond);
+
+
+ m_client1.Call(putFromPool1);
+
+ m_client1.Call(putFromPool2);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ //m_client2.Call(Close);
+ //Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ CacheHelper.StopJavaLocator(2);
+ Util.Log("Locator 2 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+
+ }
+
+ void initializePdxSerializer()
+ {
+ Serializable.RegisterPdxSerializer(new PdxSerializer());
+
+ //Serializable.RegisterTypeForPdxSerializer(SerializePdx1.CreateDeserializable);
+ }
+
+ void doPutGetWithPdxSerializer()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ for (int i = 0; i < 10; i++)
+ {
+ object put = new SerializePdx1(true); ;
+
+ region0[i] = put;
+
+ object ret = region0[i];
+
+ Assert.AreEqual(put, ret);
+
+ put = new SerializePdx2(true);
+ region0[i + 10] = put;
+
+
+ ret = region0[i + 10];
+
+ Assert.AreEqual(put, ret);
+
+
+ put = new SerializePdx3(true, i % 2);
+ region0[i + 20] = put;
+
+ ret = region0[i + 20];
+
+ Assert.AreEqual(put, ret);
+
+ }
+ }
+
+ void doGetWithPdxSerializerC2()
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ SerializePdx3 sp3Even = new SerializePdx3(true, 0);
+ SerializePdx3 sp3Odd = new SerializePdx3(true, 1);
+
+ for (int i = 0; i < 10; i++)
+ {
+ object local = new SerializePdx1(true); ;
+
+
<TRUNCATED>
[09/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Serializable.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Serializable.hpp b/clicache/src/Serializable.hpp
new file mode 100644
index 0000000..6f9e51f
--- /dev/null
+++ b/clicache/src/Serializable.hpp
@@ -0,0 +1,696 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
+#include "IGeodeSerializable.hpp"
+#include "IGeodeDelta.hpp"
+#include "impl/ManagedString.hpp"
+#include "native_shared_ptr.hpp"
+#include "impl/EnumInfo.hpp"
+#include "Log.hpp"
+#include <vcclr.h>
+#include "IPdxTypeMapper.hpp"
+
+using namespace System::Reflection;
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IPdxSerializable;
+ interface class IPdxSerializer;
+ ref class Cache;
+
+ /// <summary>
+ /// Signature of native function delegates passed to native
+ /// <c>native::Serializable::registerType</c>.
+ /// Such functions should return an empty instance of the type they
+ /// represent. The instance will typically be initialized immediately
+ /// after creation by a call to native
+ /// <c>native::Serializable::fromData</c>.
+ /// </summary>
+ delegate native::Serializable* TypeFactoryNativeMethodGeneric();
+
+ /// <summary>
+ /// Signature of function delegates passed to
+ /// <see cref="Serializable.RegisterType" />. Such functions should
+ /// return an empty instance of the type they represent.
+ /// The delegate shall be stored in the internal <c>DelegateWrapper</c>
+ /// class and an instance will be initialized in the
+ /// <c>DelegateWrapper.NativeDelegate</c> method by a call to
+ /// <see cref="IGeodeSerializable.FromData" />.
+ /// </summary>
+ public delegate Apache::Geode::Client::IGeodeSerializable^ TypeFactoryMethodGeneric();
+ /// <summary>
+ /// Delegate to wrap a native <c>native::Serializable</c> type.
+ /// </summary>
+ /// <remarks>
+ /// This delegate should return an object of type <c>IGeodeSerializable</c>
+ /// given a native object.
+ /// </remarks>
+ delegate Apache::Geode::Client::IGeodeSerializable^ WrapperDelegateGeneric(native::SerializablePtr obj);
+
+ /// <summary>
+ /// Signature of function delegates passed to
+ /// <see cref="Serializable.RegisterPdxType" />. Such functions should
+ /// return an empty instance of the type they represent.
+ /// New instance will be created during de-serialization of Pdx Types
+ /// <see cref="IPdxSerializable" />.
+ /// </summary>
+ public delegate Apache::Geode::Client::IPdxSerializable^ PdxTypeFactoryMethod();
+
+ /// <summary>
+ /// This class wraps the native C++ <c>native::Serializable</c> objects
+ /// as managed <see cref="IGeodeSerializable" /> objects.
+ /// </summary>
+ public ref class Serializable
+ : public Apache::Geode::Client::IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Serializes this native (C++) object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(Apache::Geode::Client::DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the native (C++) object -- returns an instance of the
+ /// <c>Serializable</c> class with the native object wrapped inside.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual Apache::Geode::Client::IGeodeSerializable^
+ FromData(Apache::Geode::Client::DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// It simply returns the string representation of the underlying
+ /// native object by calling its <c>toString()</c> function.
+ /// </summary>
+ virtual String^ ToString() override;
+
+ // Static conversion function from primitive types string, integer
+ // and byte array.
+
+ /// <summary>
+ /// Implicit conversion operator from a boolean
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (bool value);
+
+ /// <summary>
+ /// Implicit conversion operator from a byte
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Byte value);
+
+ /// <summary>
+ /// Implicit conversion operator from an array of bytes
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Byte>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from an boolean array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<bool>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Double value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Double>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Single value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Single>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (System::Int16 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (Char value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<Char>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int16>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (System::Int32 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int32>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator /*Apache::Geode::Client::*/Serializable^ (System::Int64 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<System::Int64>^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (String^ value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string array
+ /// to a <c>Serializable</c>.
+ /// </summary>
+ static operator Apache::Geode::Client::Serializable^ (array<String^>^ value);
+
+
+ /// <summary>
+ /// Register an instance factory method for a given type.
+ /// This should be used when registering types that implement
+ /// IGeodeSerializable.
+ /// </summary>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if the typeId has already been registered, or there is an error
+ /// in registering the type; check <c>Utils::LastError</c> for more
+ /// information in the latter case.
+ /// </exception>
+ static void RegisterTypeGeneric(TypeFactoryMethodGeneric^ creationMethod, Cache^ cache);
+
+ /// <summary>
+ /// Set the PDX serializer for the cache. If this serializer is set,
+ /// it will be consulted to see if it can serialize any domain classes which are
+ /// added to the cache in portable data exchange format.
+ /// </summary>
+ static void RegisterPdxSerializer(IPdxSerializer^ pdxSerializer);
+
+ /// <summary>
+ /// Register an instance factory method for a given type.
+ /// This should be used when registering types that implement
+ /// IPdxSerializable.
+ /// </summary>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+
+ static void RegisterPdxType(PdxTypeFactoryMethod^ creationMethod);
+
+ /// <summary>
+ /// Register an PdxTypeMapper to map the local types to pdx types
+ /// </summary>
+ /// <param name="pdxTypeMapper">
+ /// Object which implements IPdxTypeMapper interface
+ /// </param>
+
+
+ static void SetPdxTypeMapper(IPdxTypeMapper^ pdxTypeMapper);
+
+ internal:
+
+ static System::Int32 GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, const native::Cache* cache);
+ static IGeodeSerializable^ GetPDXTypeById(const char* poolName, System::Int32 typeId, const native::Cache* cache);
+ static IPdxSerializable^ Serializable::GetPdxType(String^ className);
+ static void RegisterPDXManagedCacheableKey(bool appDomainEnable, Cache^ cache);
+ static bool IsObjectAndPdxSerializerRegistered(String^ className);
+
+ static IPdxSerializer^ GetPdxSerializer();
+ static String^ GetPdxTypeName(String^ localTypeName);
+ static String^ GetLocalTypeName(String^ pdxTypeName);
+ static void Clear();
+
+ static Type^ GetType(String^ className);
+
+ static int GetEnumValue(Internal::EnumInfo^ ei, const native::Cache* cache);
+ static Internal::EnumInfo^ GetEnum(int val, const native::Cache* cache);
+
+ static Dictionary<String^, PdxTypeFactoryMethod^>^ PdxDelegateMap =
+ gcnew Dictionary<String^, PdxTypeFactoryMethod^>();
+
+ static String^ GetString(native::CacheableStringPtr cStr);//native::CacheableString*
+
+ // These are the new static methods to get/put data from c++
+
+ //byte
+ static Byte getByte(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableByte(SByte val);
+
+ //boolean
+ static bool getBoolean(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableBoolean(bool val);
+
+ //widechar
+ static Char getChar(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableWideChar(Char val);
+
+ //double
+ static double getDouble(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableDouble(double val);
+
+ //float
+ static float getFloat(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableFloat(float val);
+
+ //int16
+ static System::Int16 getInt16(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt16(int val);
+
+ //int32
+ static System::Int32 getInt32(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt32(System::Int32 val);
+
+ //int64
+ static System::Int64 getInt64(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableInt64(System::Int64 val);
+
+ //cacheable ascii string
+ static String^ getASCIIString(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableASCIIString(String^ val);
+
+ static native::CacheableKeyPtr getCacheableASCIIString2(String^ val);
+
+ //cacheable ascii string huge
+ static String^ getASCIIStringHuge(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableASCIIStringHuge(String^ val);
+
+ //cacheable string
+ static String^ getUTFString(native::SerializablePtr nativeptr);
+
+ static native::CacheableKeyPtr getCacheableUTFString(String^ val);
+
+
+ //cacheable string huge
+ static String^ getUTFStringHuge(native::SerializablePtr nativeptr);
+
+
+ static native::CacheableKeyPtr getCacheableUTFStringHuge(String^ val);
+
+
+ static native::CacheableStringPtr GetCacheableString(String^ value);
+
+ static native::CacheableStringPtr GetCacheableString2(String^ value);
+
+ /*
+ static String^ GetString(native::CacheableStringPtr cStr)//native::CacheableString*
+ {
+ if (cStr == nullptr) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+ */
+
+ static array<Byte>^ getSByteArray(array<SByte>^ sArray);
+
+ static array<System::Int16>^ getInt16Array(array<System::UInt16>^ sArray);
+
+ static array<System::Int32>^ getInt32Array(array<System::UInt32>^ sArray);
+
+ static array<System::Int64>^ getInt64Array(array<System::UInt64>^ sArray);
+
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline Apache::Geode::Client::Serializable()
+ :Serializable(__nullptr) { }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Apache::Geode::Client::Serializable(native::SerializablePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
+ }
+
+ /// <summary>
+ /// Register an instance factory method for a given type and typeId.
+ /// This should be used when registering types that implement
+ /// IGeodeSerializable.
+ /// </summary>
+ /// <param name="typeId">typeId of the type being registered.</param>
+ /// <param name="creationMethod">
+ /// the creation function to register
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the method is null
+ /// </exception>
+ static void RegisterTypeGeneric(Byte typeId, TypeFactoryMethodGeneric^ creationMethod, Type^ type, Cache^ cache);
+
+
+ /// <summary>
+ /// Unregister the type with the given typeId
+ /// </summary>
+ /// <param name="typeId">typeId of the type to unregister.</param>
+ static void UnregisterTypeGeneric(Byte typeId, Cache^ cache);
+
+ generic<class TValue>
+ static TValue GetManagedValueGeneric(native::SerializablePtr val);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, native::Cache* cache);
+
+ generic<class TKey>
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, bool isAsciiChar, native::Cache* cache);
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// for managed <c>TypeFactoryMethod</c> delegates.
+ /// </summary>
+ static Dictionary<System::Type^, Byte>^ ManagedTypeMappingGeneric =
+ gcnew Dictionary<System::Type^, Byte>();
+
+ static Byte GetManagedTypeMappingGeneric (Type^ type)
+ {
+ Byte retVal = 0;
+ ManagedTypeMappingGeneric->TryGetValue(type, retVal);
+ return retVal;
+ }
+
+ /// <summary>
+ /// Static list of <c>TypeFactoryNativeMethod</c> delegates created
+ /// from registered managed <c>TypeFactoryMethod</c> delegates.
+ /// This is so that the underlying managed objects do not get GCed.
+ /// </summary>
+ static List<TypeFactoryNativeMethodGeneric^>^ NativeDelegatesGeneric =
+ gcnew List<TypeFactoryNativeMethodGeneric^>();
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// from registered managed <c>TypeFactoryMethod</c> delegates.
+ /// This is for cross AppDomain object creations.
+ /// </summary>
+ static Dictionary<UInt32, TypeFactoryMethodGeneric^>^ DelegateMapGeneric =
+ gcnew Dictionary<UInt32, TypeFactoryMethodGeneric^>();
+
+ static Dictionary<UInt32, TypeFactoryMethodGeneric^>^ InternalDelegateMapGeneric =
+ gcnew Dictionary<UInt32, TypeFactoryMethodGeneric^>();
+
+ static TypeFactoryMethodGeneric^ GetTypeFactoryMethodGeneric(UInt32 classid)
+ {
+ // Log::Finer("TypeFactoryMethodGeneric type id " + classid + " domainid :" + System::Threading::Thread::GetDomainID() );
+ if(DelegateMapGeneric->ContainsKey(classid) )
+ return DelegateMapGeneric[classid];
+ else
+ return InternalDelegateMapGeneric[classid];//builtin types
+ }
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryNativeMethod</c> delegates created
+ /// for builtin managed <c>TypeFactoryMethod</c> delegates.
+ /// This is so that the underlying managed objects do not get GCed.
+ /// </summary>
+ static Dictionary<Byte, TypeFactoryNativeMethodGeneric^>^ BuiltInDelegatesGeneric =
+ gcnew Dictionary<Byte, TypeFactoryNativeMethodGeneric^>();
+
+ /// <summary>
+ /// Static map of <c>TypeFactoryMethod</c> delegates created
+ /// for managed <c>TypeFactoryMethod</c> delegates.
+ /// </summary>
+ static Dictionary<System::Int64, TypeFactoryMethodGeneric^>^ ManagedDelegatesGeneric =
+ gcnew Dictionary<System::Int64, TypeFactoryMethodGeneric^>();
+
+ /// <summary>
+ /// This is to get manged delegates.
+ /// </summary>
+ static TypeFactoryMethodGeneric^ GetManagedDelegateGeneric(System::Int64 typeId)
+ {
+ TypeFactoryMethodGeneric^ ret = nullptr;
+ ManagedDelegatesGeneric->TryGetValue(typeId, ret);
+ return ret;
+ }
+
+ static IPdxSerializer^ PdxSerializer = nullptr;
+ static IPdxTypeMapper^ PdxTypeMapper = nullptr;
+ static Object^ LockObj = gcnew Object();
+ static Dictionary<String^, String^>^ PdxTypeNameToLocal =
+ gcnew Dictionary<String^, String^>();
+ static Dictionary<String^, String^>^ LocalTypeNameToPdx =
+ gcnew Dictionary<String^, String^>();
+
+
+ static Object^ ClassNameVsTypeLockObj = gcnew Object();
+ static Dictionary<String^, Type^>^ ClassNameVsType =
+ gcnew Dictionary<String^, Type^>();
+
+ delegate Object^ CreateNewObjectDelegate();
+ static CreateNewObjectDelegate^ CreateNewObjectDelegateF(Type^ type);
+
+ delegate Object^ CreateNewObjectArrayDelegate(int len);
+ static CreateNewObjectArrayDelegate^ CreateNewObjectArrayDelegateF(Type^ type);
+
+ static array<Type^>^ singleIntTypeA = gcnew array<Type^>{ Int32::typeid };
+
+ static Type^ createNewObjectDelegateType = Type::GetType("Apache.Geode.Client.Serializable+CreateNewObjectDelegate");
+ static Type^ createNewObjectArrayDelegateType = Type::GetType("Apache.Geode.Client.Serializable+CreateNewObjectArrayDelegate");
+
+ static array<Type^>^ singleIntType = gcnew array<Type^>(1){Int32::typeid};
+
+ static Object^ CreateObject(String^ className);
+ static Object^ GetArrayObject(String^ className, int len);
+ static Type^ getTypeFromRefrencedAssemblies(String^ className, Dictionary<Assembly^, bool>^ referedAssembly, Assembly^ currentAsm);
+
+ static Dictionary<String^, CreateNewObjectDelegate^>^ ClassNameVsCreateNewObjectDelegate =
+ gcnew Dictionary<String^, CreateNewObjectDelegate^>();
+
+ static Dictionary<String^, CreateNewObjectArrayDelegate^>^ ClassNameVsCreateNewObjectArrayDelegate =
+ gcnew Dictionary<String^, CreateNewObjectArrayDelegate^>();
+
+ static Object^ CreateObjectEx(String^ className);
+ static Object^ GetArrayObjectEx(String^ className, int len);
+ /// <summary>
+ /// Static array of managed <c>WrapperDelegate</c> delegates that
+ /// maintains a mapping of built-in native typeIds to their corresponding
+ /// wrapper type delegates.
+ /// </summary>
+ /// <remarks>
+ /// This is as an array to make lookup as fast as possible, taking
+ /// advantage of the fact that the range of wrapped built-in typeIds is
+ /// small. <b>IMPORTANT:</b> If the built-in native typeIds encompass a
+ /// greater range then change <c>WrapperEnd</c> in this accordingly
+ /// or move to using a Dictionary instead.
+ /// </remarks>
+ static array<WrapperDelegateGeneric^>^ NativeWrappersGeneric =
+ gcnew array<WrapperDelegateGeneric^>(WrapperEndGeneric + 1);
+ literal Byte WrapperEndGeneric = 128;
+
+ /// <summary>
+ /// Static method to register a managed wrapper for a native
+ /// <c>native::Serializable</c> type.
+ /// </summary>
+ /// <param name="wrapperMethod">
+ /// A factory delegate of the managed wrapper class that returns the
+ /// managed object given the native object.
+ /// </param>
+ /// <param name="typeId">The typeId of the native type.</param>
+ /// <seealso cref="NativeWrappers" />
+ static void RegisterWrapperGeneric(WrapperDelegateGeneric^ wrapperMethod,
+ Byte typeId, System::Type^ type);
+
+ /// <summary>
+ /// Internal static method to remove managed artifacts created by
+ /// RegisterType and RegisterWrapper methods when
+ /// <see cref="DistributedSystem.Disconnect" /> is called.
+ /// </summary>
+ static void UnregisterNativesGeneric();
+
+ /// <summary>
+ /// Static method to lookup the wrapper delegate for a given typeId.
+ /// </summary>
+ /// <param name="typeId">
+ /// The typeId of the native <c>native::Serializable</c> type.
+ /// </param>
+ /// <returns>
+ /// If a managed wrapper is registered for the given typeId then the
+ /// wrapper delegate is returned, else this returns null.
+ /// </returns>
+ inline static WrapperDelegateGeneric^ GetWrapperGeneric(Byte typeId)
+ {
+ if (typeId >= 0 && typeId <= WrapperEndGeneric) {
+ return NativeWrappersGeneric[typeId];
+ }
+ return nullptr;
+ }
+
+ static Serializable()
+ {
+ PdxTypeMapper = nullptr;
+ //RegisterPDXManagedCacheableKey();
+
+ {
+ Dictionary<Object^, Object^>^ dic = gcnew Dictionary<Object^, Object^>();
+ ManagedTypeMappingGeneric[dic->GetType()] = native::GeodeTypeIds::CacheableHashMap;
+ ManagedTypeMappingGeneric[dic->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableHashMap;
+ }
+
+ {
+ System::Collections::ArrayList^ arr = gcnew System::Collections::ArrayList();
+ ManagedTypeMappingGeneric[arr->GetType()] = native::GeodeTypeIds::CacheableVector;
+ }
+
+ {
+ System::Collections::Generic::LinkedList<Object^>^ linketList = gcnew System::Collections::Generic::LinkedList<Object^>();
+ ManagedTypeMappingGeneric[linketList->GetType()] = native::GeodeTypeIds::CacheableLinkedList;
+ ManagedTypeMappingGeneric[linketList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableLinkedList;
+ }
+
+ {
+ System::Collections::Generic::IList<Object^>^ iList = gcnew System::Collections::Generic::List<Object^>();
+ ManagedTypeMappingGeneric[iList->GetType()] = native::GeodeTypeIds::CacheableArrayList;
+ ManagedTypeMappingGeneric[iList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableArrayList;
+ }
+
+ //TODO: Linked list, non generic stack, some other map types and see if more
+
+ {
+ System::Collections::Generic::Stack<Object^>^ stack = gcnew System::Collections::Generic::Stack<Object^>();
+ ManagedTypeMappingGeneric[stack->GetType()] = native::GeodeTypeIds::CacheableStack;
+ ManagedTypeMappingGeneric[stack->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableStack;
+ }
+ {
+ ManagedTypeMappingGeneric[SByte::typeid] = native::GeodeTypeIds::CacheableByte;
+ ManagedTypeMappingGeneric[Boolean::typeid] = native::GeodeTypeIds::CacheableBoolean;
+ ManagedTypeMappingGeneric[Char::typeid] = native::GeodeTypeIds::CacheableWideChar;
+ ManagedTypeMappingGeneric[Double::typeid] = native::GeodeTypeIds::CacheableDouble;
+ ManagedTypeMappingGeneric[String::typeid] = native::GeodeTypeIds::CacheableASCIIString;
+ ManagedTypeMappingGeneric[float::typeid] = native::GeodeTypeIds::CacheableFloat;
+ ManagedTypeMappingGeneric[Int16::typeid] = native::GeodeTypeIds::CacheableInt16;
+ ManagedTypeMappingGeneric[Int32::typeid] = native::GeodeTypeIds::CacheableInt32;
+ ManagedTypeMappingGeneric[Int64::typeid] = native::GeodeTypeIds::CacheableInt64;
+ ManagedTypeMappingGeneric[Type::GetType("System.Byte[]")] = native::GeodeTypeIds::CacheableBytes;
+ ManagedTypeMappingGeneric[Type::GetType("System.Double[]")] = native::GeodeTypeIds::CacheableDoubleArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Single[]")] = native::GeodeTypeIds::CacheableFloatArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int16[]")] = native::GeodeTypeIds::CacheableInt16Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int32[]")] = native::GeodeTypeIds::CacheableInt32Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int64[]")] = native::GeodeTypeIds::CacheableInt64Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.String[]")] = native::GeodeTypeIds::CacheableStringArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.DateTime")] = native::GeodeTypeIds::CacheableDate;
+ ManagedTypeMappingGeneric[Type::GetType("System.Collections.Hashtable")] = native::GeodeTypeIds::CacheableHashTable;
+ }
+ }
+
+ protected:
+ native_shared_ptr<native::Serializable>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticDescriptor.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticDescriptor.cpp b/clicache/src/StatisticDescriptor.cpp
new file mode 100644
index 0000000..6e0075c
--- /dev/null
+++ b/clicache/src/StatisticDescriptor.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+
+#include "StatisticDescriptor.hpp"
+#include "impl/ManagedString.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ System::Int32 StatisticDescriptor::ID::get( )
+ {
+ return m_nativeptr->getId();
+ }
+
+ String^ StatisticDescriptor::Name::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getName() );
+ }
+
+ String^ StatisticDescriptor::Description::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getDescription() );
+ }
+
+ int8_t StatisticDescriptor::IsCounter::get( )
+ {
+ return m_nativeptr->isCounter();
+ }
+
+ int8_t StatisticDescriptor::IsLargerBetter::get( )
+ {
+ return m_nativeptr->isLargerBetter();
+ }
+
+ String^ StatisticDescriptor::Unit::get()
+ {
+ return ManagedString::Get(m_nativeptr->getUnit());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticDescriptor.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticDescriptor.hpp b/clicache/src/StatisticDescriptor.hpp
new file mode 100644
index 0000000..6715045
--- /dev/null
+++ b/clicache/src/StatisticDescriptor.hpp
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A class that describes an individual statistic whose value is updated by an
+ /// application and may be archived by Geode. These descriptions are gathered
+ /// together in a <see cref="StatisticsType" /> class.
+ /// </summary>
+ /// <para>
+ /// To get an instance of this interface use an instance of
+ /// <see cref="StatisticsFactory" /> class.
+ /// </para>
+ /// <para>
+ /// StatisticDescriptors are naturally ordered by their name.
+ /// </para>
+ public ref class StatisticDescriptor sealed
+ {
+ public:
+ /// <summary>
+ /// Returns the id of this statistic in a <see cref="StatisticsType" /> class.
+ /// The id is initialized when its statistics
+ /// type is created.
+ /// </summary>
+ virtual property System::Int32 ID
+ {
+ virtual System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the name of this statistic
+ /// </summary>
+ virtual property String^ Name
+ {
+ virtual String^ get();
+ }
+
+ /// <summary>
+ /// Returns the description of this statistic
+ /// </summary>
+ virtual property String^ Description
+ {
+ virtual String^ get();
+ }
+
+ /// <summary>
+ /// Returns true if this statistic is a counter; false if its a gauge.
+ /// Counter statistics have values that always increase.
+ /// Gauge statistics have unconstrained values.
+ /// </summary>
+ virtual property int8_t IsCounter
+ {
+ virtual int8_t get();
+ }
+
+ /// <summary>
+ /// Returns true if a larger statistic value indicates better performance.
+ /// </summary>
+ virtual property int8_t IsLargerBetter
+ {
+ virtual int8_t get();
+ }
+
+ /// <summary>
+ /// Returns the unit in which this statistic is measured.
+ /// </summary>
+ virtual property String^ Unit
+ {
+ virtual String^ get();
+ }
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static StatisticDescriptor^ Create(
+ apache::geode::statistics::StatisticDescriptor* nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticDescriptor( nativeptr );
+ }
+
+ apache::geode::statistics::StatisticDescriptor* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline StatisticDescriptor(apache::geode::statistics::StatisticDescriptor* nativeptr)
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticDescriptor* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Statistics.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Statistics.cpp b/clicache/src/Statistics.cpp
new file mode 100644
index 0000000..e042873
--- /dev/null
+++ b/clicache/src/Statistics.cpp
@@ -0,0 +1,298 @@
+/*
+ * 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.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "Statistics.hpp"
+#include "StatisticDescriptor.hpp"
+#include "StatisticsType.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void Statistics::Close()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->close();
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::NameToId(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->nameToId(mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ Statistics::NameToDescriptor(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr));
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::UniqueId::get( )
+ {
+ return m_nativeptr->getUniqueId();
+ }
+
+ StatisticsType^ Statistics::Type::get( )
+ {
+ return StatisticsType::Create(m_nativeptr->getType());
+ }
+
+ String^ Statistics::TextId::get()
+ {
+ return ManagedString::Get(m_nativeptr->getTextId());
+ }
+
+ System::Int64 Statistics::NumericId::get()
+ {
+ return m_nativeptr->getNumericId();
+ }
+ bool Statistics::IsAtomic::get()
+ {
+ return m_nativeptr->isAtomic();
+ }
+ bool Statistics::IsShared::get()
+ {
+ return m_nativeptr->isShared();
+ }
+ bool Statistics::IsClosed::get()
+ {
+ return m_nativeptr->isClosed();
+ }
+
+ void Statistics::SetInt(System::Int32 id, System::Int32 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetInt(String^ name, System::Int32 value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetInt(StatisticDescriptor^ descriptor, System::Int32 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setInt(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(System::Int32 id, System::Int64 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(StatisticDescriptor^ descriptor, System::Int64 value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetLong(String^ name, System::Int64 value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setLong((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(System::Int32 id, double value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble(id, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(String^ name, double value)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble((char*)mg_name.CharPtr, value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ void Statistics::SetDouble(StatisticDescriptor^ descriptor, double value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_nativeptr->setDouble(descriptor->GetNative(), value);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::GetInt(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getInt((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetLong(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ System::Int64 Statistics::GetLong(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetLong(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getLong((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(System::Int32 id)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble(id);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::GetDouble(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getDouble((char*)mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::GetRawBits(StatisticDescriptor^ descriptor)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->getRawBits(descriptor->GetNative());
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(System::Int32 id, System::Int32 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(StatisticDescriptor^ descriptor, System::Int32 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 Statistics::IncInt(String^ name, System::Int32 delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incInt((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(System::Int32 id, System::Int64 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(StatisticDescriptor^ descriptor, System::Int64 delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int64 Statistics::IncLong(String^ name, System::Int64 delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incLong((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(System::Int32 id, double delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble(id,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(StatisticDescriptor^ descriptor, double delta)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble(descriptor->GetNative(),delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ double Statistics::IncDouble(String^ name, double delta)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->incDouble((char*)mg_name.CharPtr,delta);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Statistics.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Statistics.hpp b/clicache/src/Statistics.hpp
new file mode 100644
index 0000000..0a39bac
--- /dev/null
+++ b/clicache/src/Statistics.hpp
@@ -0,0 +1,541 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/Statistics.hpp>
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include <geode/statistics/StatisticsType.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class StatisticDescriptor;
+ ref class StatisticsType;
+
+ /// <summary>
+ /// An instantiation of an existing <c>StatisticsType</c> object with methods for
+ /// setting, incrementing and getting individual <c>StatisticDescriptor</c> values.
+ /// </summary>
+ public ref class Statistics sealed
+ {
+ public:
+
+ /// <summary>
+ /// Closes these statistics. After statistics have been closed, they
+ /// are no longer archived.
+ /// A value access on a closed statistics always results in zero.
+ /// A value modification on a closed statistics is ignored.
+ /// </summary>
+ virtual void Close();
+
+ /// <summary>
+ /// Returns the id of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the id of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistics instance.
+ /// </exception>
+ /// <see cref="StatisticsType#nameToDescriptor" />
+ virtual System::Int32 NameToId(String^ name);
+
+ /// <summary>
+ /// Returns the descriptor of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the descriptor of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistics instance.
+ /// </exception>
+ /// <see cref="StatisticsType#nameToId" />
+ virtual StatisticDescriptor^ NameToDescriptor(String^ name);
+
+ /// <summary>
+ /// Gets a value that uniquely identifies this statistics.
+ /// </summary>
+ virtual property System::Int64 UniqueId
+ {
+ virtual System::Int64 get( );
+ }
+
+ /// <summary>
+ /// Gets the <see cref="StatisticsType" /> of this instance.
+ /// </summary>
+ virtual property StatisticsType^ Type
+ {
+ virtual StatisticsType^ get( );
+ }
+
+ /// <summary>
+ /// Gets the text associated with this instance that helps identify it.
+ /// </summary>
+ virtual property String^ TextId
+ {
+ virtual String^ get( );
+ }
+
+ /// <summary>
+ /// Gets the number associated with this instance that helps identify it.
+ /// </summary>
+ virtual property System::Int64 NumericId
+ {
+ virtual System::Int64 get( );
+ }
+
+ /// <summary>
+ /// Returns true if modifications are atomic. This means that multiple threads
+ /// can safely modify this instance without additional synchronization.
+ /// </summary>
+ /// <para>
+ /// Returns false if modifications are not atomic. This means that modifications
+ /// to this instance are cheaper but not thread safe.
+ /// </para>
+ /// <para>
+ /// Note that all instances that are <see cref="#isShared" /> shared are also atomic.
+ /// </para>
+ virtual property bool IsAtomic
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Returns true if the data for this instance is stored in shared memory.
+ /// Returns false if the data is store in local memory.
+ /// </summary>
+ /// <para>
+ /// Note that all instances that are <see cref="#isShared" /> shared are also atomic.
+ /// </para>
+ virtual property bool IsShared
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Returns true if the instance has been <see cref="#close" /> closed.
+ /// </summary>
+ virtual property bool IsClosed
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>int</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetInt(System::Int32 id, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>int</c>
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual void SetInt(String^ name, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>int</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="#StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual void SetInt(StatisticDescriptor^ descriptor, System::Int32 value);
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>long</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" />. </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetLong(System::Int32 id, System::Int64 value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>long</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual void SetLong(StatisticDescriptor^ descriptor, System::Int64 value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual void SetLong(String^ name, System::Int64 value);
+
+
+ /// <summary>
+ /// Sets the value of a statistic with the given <c>id</c>
+ /// whose type is <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual void SetDouble(System::Int32 id, double value);
+
+ /// <summary>
+ /// Sets the value of a named statistic of type <c>double</c>
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual void SetDouble(String^ name, double value);
+
+ /// <summary>
+ /// Sets the value of a described statistic of type <c>double</c>
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="value">value to set</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual void SetDouble(StatisticDescriptor^ descriptor, double value);
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>int</c>.
+ /// whose type is <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int32 GetInt(System::Int32 id);
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <code>int</code>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 GetInt(StatisticDescriptor^ descriptor);
+
+
+ /// <summary>
+ /// Returns the value of the statistic of type <code>int</code> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 GetInt(String^ name);
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int64 GetLong(System::Int32 id);
+
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <c>long</c>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 GetLong(StatisticDescriptor^ descriptor);
+
+
+ /// <summary>
+ /// Returns the value of the statistic of type <c>long</c> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 GetLong(String^ name);
+
+
+ /// <summary>
+ /// Returns the value of the identified statistic of type <c>double</c>.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual double GetDouble(System::Int32 id);
+
+ /// <summary>
+ /// Returns the value of the described statistic of type <c>double</c>.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists with the specified <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double GetDouble(StatisticDescriptor^ descriptor);
+
+ /// <summary>
+ /// Returns the value of the statistic of type <c>double</c> at
+ /// the given name.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double GetDouble(String^ name);
+
+ /// <summary>
+ /// Returns the bits that represent the raw value of the described statistic.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the described statistic does not exist
+ /// </exception>
+ virtual System::Int64 GetRawBits(StatisticDescriptor^ descriptor);
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>int</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int32 IncInt(System::Int32 id, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>int</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 IncInt(StatisticDescriptor^ descriptor, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>int</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>int</c>.
+ /// </exception>
+ virtual System::Int32 IncInt(String^ name, System::Int32 delta);
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>long</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual System::Int64 IncLong(System::Int32 id, System::Int64 delta);
+
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>long</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 IncLong(StatisticDescriptor^ descriptor, System::Int64 delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>long</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>long</c>.
+ /// </exception>
+ virtual System::Int64 IncLong(String^ name, System::Int64 delta);
+
+
+ /// <summary>
+ /// Increments the value of the identified statistic of type <c>double</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="id">a statistic id obtained with <see cref="#nameToId" />
+ /// or <see cref="#StatisticsType#nameToId" /> </param>
+ /// <param name="delta">the value of the statistic after it has been incremented</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If the id is invalid.
+ /// </exception>
+ virtual double IncDouble(System::Int32 id, double delta);
+
+ /// <summary>
+ /// Increments the value of the described statistic of type <c>double</c>
+ /// by the given amount.
+ /// </summary>
+ /// <param name="descriptor">a statistic descriptor obtained with <see cref="#nameToDescriptor" />
+ /// or <see cref="StatisticsType#nameToDescriptor" /> </param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists for the given <c>descriptor</c> or
+ /// if the described statistic is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double IncDouble(StatisticDescriptor^ descriptor, double delta);
+
+ /// <summary>
+ /// Increments the value of the statistic of type <c>double</c> with
+ /// the given name by a given amount.
+ /// </summary>
+ /// <param name="name">statistic name</param>
+ /// <param name="delta">change value to be added</param>
+ /// <returns>the value of the statistic after it has been incremented</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// If no statistic exists named <c>name</c> or
+ /// if the statistic with name <c>name</c> is not of
+ /// type <c>double</c>.
+ /// </exception>
+ virtual double IncDouble(String^ name, double delta);
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static Statistics^ Create(
+ apache::geode::statistics::Statistics* nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Statistics( nativeptr );
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Statistics( apache::geode::statistics::Statistics* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+ private:
+ apache::geode::statistics::Statistics* m_nativeptr;
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticsFactory.cpp b/clicache/src/StatisticsFactory.cpp
new file mode 100644
index 0000000..79cfc44
--- /dev/null
+++ b/clicache/src/StatisticsFactory.cpp
@@ -0,0 +1,258 @@
+/*
+ * 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.
+ */
+
+
+#include "begin_native.hpp"
+#include "statistics/StatisticsManager.hpp"
+#include "end_native.hpp"
+
+#include "StatisticsFactory.hpp"
+#include "StatisticsType.hpp"
+#include "StatisticDescriptor.hpp"
+#include "Statistics.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // TODO globals - pass in distributed system
+ //StatisticsFactory^ StatisticsFactory::GetExistingInstance(DistributedSystem^ distributedSystem)
+ //{
+ // _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+
+ // return StatisticsFactory::Create(distributedSystem->getStatisticsManager()->getStatisticsFactory());
+
+ // _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ //}
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntCounter( String^ name, String^ description,String^ units )
+ {
+ return CreateIntCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntCounter(String^ name, String^ description,String^ units, bool largerBetter)
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongCounter( String^ name, String^ description,String^ units )
+ {
+ return CreateLongCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongCounter( String^ name, String^ description,String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleCounter( String^ name, String^ description, String^ units )
+ {
+ return CreateDoubleCounter(name,description,units,true);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleCounter( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateIntGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateIntGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateLongGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateLongGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleGauge( String^ name, String^ description, String^ units )
+ {
+ return CreateDoubleGauge(name,description,units,false);
+ }
+
+ StatisticDescriptor^ StatisticsFactory::CreateDoubleGauge( String^ name, String^ description, String^ units, bool largerBetter )
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ ManagedString mg_units( units );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticsType^ StatisticsFactory::CreateType( String^ name, String^ description,
+ array<StatisticDescriptor^>^ stats, System::Int32 statsLength)
+ {
+ ManagedString mg_name( name );
+ ManagedString mg_description( description );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::statistics::StatisticDescriptor ** nativedescriptors = new apache::geode::statistics::StatisticDescriptor*[statsLength];
+ for (System::Int32 index = 0; index < statsLength; index++)
+ {
+ nativedescriptors[index] = stats[index]->GetNative();
+ }
+ return StatisticsType::Create(m_nativeptr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticsType^ StatisticsFactory::FindType(String^ name)
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return StatisticsType::Create(m_nativeptr->findType(mg_name.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type, String^ textId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type, String^ textId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Statistics^ StatisticsFactory::CreateAtomicStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId)
+ {
+ ManagedString mg_text( textId );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ Statistics^ StatisticsFactory::FindFirstStatisticsByType( StatisticsType^ type )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return Statistics::Create(m_nativeptr->findFirstStatisticsByType(type->GetNative()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ String^ StatisticsFactory::Name::get( )
+ {
+ return ManagedString::Get( m_nativeptr->getName() );
+ }
+
+ System::Int64 StatisticsFactory::ID::get()
+ {
+ return m_nativeptr->getId();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[13/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Properties.cpp b/clicache/src/Properties.cpp
new file mode 100644
index 0000000..af41931
--- /dev/null
+++ b/clicache/src/Properties.cpp
@@ -0,0 +1,356 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include "CacheImpl.hpp"
+#include "SerializationRegistry.hpp"
+#include "end_native.hpp"
+
+#include "Properties.hpp"
+#include "impl/ManagedVisitor.hpp"
+#include "impl/ManagedString.hpp"
+#include "impl/SafeConvert.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ // Visitor class to get string representations of a property object
+ ref class PropertyToString
+ {
+ private:
+
+ String^ m_str;
+
+ public:
+
+ inline PropertyToString( ) : m_str( "{" )
+ { }
+
+ void Visit( Apache::Geode::Client::ICacheableKey^ key, IGeodeSerializable^ value )
+ {
+ if ( m_str->Length > 1 ) {
+ m_str += ",";
+ }
+ m_str += key->ToString( ) + "=" + value;
+ }
+
+ virtual String^ ToString( ) override
+ {
+ return m_str;
+ }
+ };
+
+ generic<class TPropKey, class TPropValue>
+ TPropValue Properties<TPropKey, TPropValue>::Find( TPropKey key)
+ {
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, nullptr);
+ auto nativeptr = m_nativeptr->get()->find(keyptr);
+ return Serializable::GetManagedValueGeneric<TPropValue>(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::Insert( TPropKey key, TPropValue value )
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, true, nullptr);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true, nullptr);
+
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->insert(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::Remove( TPropKey key)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, nullptr);
+
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->remove( keyptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::ForEach( PropertyVisitorGeneric<TPropKey, TPropValue>^ visitor )
+ {
+ if (visitor != nullptr)
+ {
+ native::ManagedVisitorGeneric mg_visitor( visitor );
+
+ auto proxy = gcnew PropertyVisitorProxy<TPropKey, TPropValue>();
+ proxy->SetPropertyVisitorGeneric(visitor);
+
+ auto otherVisitor = gcnew PropertyVisitor(proxy, &PropertyVisitorProxy<TPropKey, TPropValue>::Visit);
+ mg_visitor.setptr(otherVisitor);
+
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->foreach( mg_visitor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ }
+
+ generic<class TPropKey, class TPropValue>
+ System::UInt32 Properties<TPropKey, TPropValue>::Size::get( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->getSize( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::AddAll( Properties<TPropKey, TPropValue>^ other )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->addAll( other->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::Load( String^ fileName )
+ {
+ ManagedString mg_fname( fileName );
+
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->load( mg_fname.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ String^ Properties<TPropKey, TPropValue>::ToString( )
+ {
+ return "";
+ }
+
+ // IGeodeSerializable methods
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::ToData( DataOutput^ output )
+ {
+ if (output->IsManagedObject()) {
+ //TODO::??
+ output->WriteBytesToUMDataOutput();
+ }
+
+ try
+ {
+ auto nativeOutput = output->GetNative();
+ if (nativeOutput != nullptr)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ m_nativeptr->get()->toData(*nativeOutput);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ if (output->IsManagedObject()) {
+ output->SetBuffer();
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(output);
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TPropKey, class TPropValue>
+ IGeodeSerializable^ Properties<TPropKey, TPropValue>::FromData( DataInput^ input )
+ {
+ if(input->IsManagedObject()) {
+ input->AdvanceUMCursor();
+ }
+
+ auto nativeInput = input->GetNative();
+ if (nativeInput != nullptr)
+ {
+ FromData(*nativeInput);
+ }
+
+ if(input->IsManagedObject()) {
+ input->SetBuffer();
+ }
+
+ return this;
+ }
+
+ generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::FromData( native::DataInput& input )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ auto p = static_cast<native::Properties*>(m_nativeptr->get()->fromData(input));
+ if (m_nativeptr->get() != p) {
+ m_nativeptr->get_shared_ptr().reset(p);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
+ System::UInt32 Properties<TPropKey, TPropValue>::ObjectSize::get( )
+ {
+ //TODO::
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->objectSize( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ // ISerializable methods
+
+ //generic<class TPropKey, class TPropValue>
+ //void Properties<TPropKey, TPropValue>::GetObjectData( SerializationInfo^ info,
+ // StreamingContext context )
+ //{
+ // auto output = std::unique_ptr<native::DataOutput>(new native::DataOutput(*m_serializationRegistry->get_shared_ptr()));
+
+ // _GF_MG_EXCEPTION_TRY2
+
+ // try
+ // {
+ // m_nativeptr->get()->toData( *output );
+ // }
+ // finally
+ // {
+ // GC::KeepAlive(m_nativeptr);
+ // }
+
+ // _GF_MG_EXCEPTION_CATCH_ALL2
+
+ // auto bytes = gcnew array<Byte>( output->getBufferLength( ) );
+ // {
+ // pin_ptr<const Byte> pin_bytes = &bytes[0];
+ // memcpy( (System::Byte*)pin_bytes, output->getBuffer( ),
+ // output->getBufferLength( ) );
+ // }
+ // info->AddValue( "bytes", bytes, array<Byte>::typeid );
+ //}
+ //
+ //generic<class TPropKey, class TPropValue>
+ //Properties<TPropKey, TPropValue>::Properties( SerializationInfo^ info,
+ // StreamingContext context, native::SerializationRegistryPtr serializationRegistry)
+ // : Properties(serializationRegistry)
+ //{
+ // array<Byte>^ bytes = nullptr;
+ // try {
+ // bytes = dynamic_cast<array<Byte>^>( info->GetValue( "bytes",
+ // array<Byte>::typeid ) );
+ // }
+ // catch ( System::Exception^ ) {
+ // // could not find the header -- null value
+ // }
+ // if (bytes != nullptr) {
+ // pin_ptr<const Byte> pin_bytes = &bytes[0];
+
+ // _GF_MG_EXCEPTION_TRY2
+
+ // native::DataInput input( (System::Byte*)pin_bytes, bytes->Length, *CacheImpl::getInstance()->getSerializationRegistry().get());
+ // FromData(input);
+ // _GF_MG_EXCEPTION_CATCH_ALL2
+ // }
+ //}
+
+
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Properties.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Properties.hpp b/clicache/src/Properties.hpp
new file mode 100644
index 0000000..c175fff
--- /dev/null
+++ b/clicache/src/Properties.hpp
@@ -0,0 +1,305 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+#include "begin_native.hpp"
+#include <geode/Properties.hpp>
+#include "SerializationRegistry.hpp"
+#include "end_native.hpp"
+
+#include "IGeodeSerializable.hpp"
+#include "ICacheableKey.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+#include "CacheableString.hpp"
+#include "native_shared_ptr.hpp"
+#include "impl/SafeConvert.hpp"
+#include "Serializable.hpp"
+
+using namespace System;
+using namespace System::Runtime::Serialization;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ delegate void PropertyVisitor(Apache::Geode::Client::ICacheableKey^ key, Apache::Geode::Client::IGeodeSerializable^ value);
+
+ generic <class TPropKey, class TPropValue>
+ ref class PropertyVisitorProxy;
+
+ /// <summary>
+ /// Delegate that represents visitor for the <c>Properties</c> class.
+ /// </summary>
+ /// <remarks>
+ /// This delegate is passed to the <c>Properties.ForEach</c> function
+ /// that invokes this delegate for each property having a key
+ /// and a value.
+ /// </remarks>
+ /// <param name="key">The key of the property.</param>
+ /// <param name="value">The value of the property.</param>
+ generic<class TPropKey, class TPropValue>
+ public delegate void PropertyVisitorGeneric( TPropKey key, TPropValue value );
+
+ generic<class TPropKey, class TPropValue>
+ [Serializable]
+ /// <summary>
+ /// Provides a collection of properties, each of which is a key/value
+ /// pair. Each key is a string, and the value may be a string
+ /// or an integer.
+ /// </summary>
+ public ref class Properties sealed
+ : public IGeodeSerializable //,public ISerializable
+ {
+ public:
+
+ /// <summary>
+ /// Default constructor: returns an empty collection.
+ /// </summary>
+ inline Properties()
+ : Properties(native::Properties::create())
+ {
+
+ }
+
+ /// <summary>
+ /// Factory method to create an empty collection of properties.
+ /// </summary>
+ /// <returns>empty collection of properties</returns>
+ generic<class TPropKey, class TPropValue>
+ inline static Properties<TPropKey, TPropValue>^ Create()
+ {
+ return gcnew Properties<TPropKey, TPropValue>();
+ }
+
+
+ /// <summary>
+ /// Return the value for the given key, or NULL if not found.
+ /// </summary>
+ /// <param name="key">the key to find</param>
+ /// <returns>the value for the key</returns>
+ /// <exception cref="NullPointerException">
+ /// if the key is null
+ /// </exception>
+ TPropValue Find( TPropKey key );
+
+ /// <summary>
+ /// Add or update the string value for key.
+ /// </summary>
+ /// <param name="key">the key to insert</param>
+ /// <param name="value">the string value to insert</param>
+ /// <exception cref="NullPointerException">
+ /// if the key is null
+ /// </exception>
+ void Insert( TPropKey key, TPropValue value );
+
+ /// <summary>
+ /// Remove the key from the collection.
+ /// </summary>
+ /// <param name="key">the key to remove</param>
+ /// <exception cref="NullPointerException">
+ /// if the key is null
+ /// </exception>
+ void Remove( TPropKey key );
+
+ /// <summary>
+ /// Execute the Visitor delegate for each entry in the collection.
+ /// </summary>
+ /// <param name="visitor">visitor delegate</param>
+ void ForEach( PropertyVisitorGeneric<TPropKey, TPropValue>^ visitor );
+
+ /// <summary>
+ /// Return the number of entries in the collection.
+ /// </summary>
+ /// <returns>the number of entries</returns>
+ property System::UInt32 Size
+ {
+ System::UInt32 get( );
+ }
+
+ /*/// <summary>
+ /// Adds the contents of <c>other</c> to this instance, replacing
+ /// any existing values with those from other.
+ /// </summary>
+ /// <param name="other">new set of properties</param>*/
+ void AddAll( Properties<TPropKey, TPropValue>^ other );
+
+ /// <summary>
+ /// Reads property values from a file, overriding what is currently
+ /// in the properties object.
+ /// </summary>
+ /// <param name="fileName">the name of the file</param>
+ void Load( String^ fileName );
+
+ /// <summary>
+ /// Returns a string representation of the current
+ /// <c>Properties</c> object.
+ /// </summary>
+ /// <returns>
+ /// A comma separated list of property name,value pairs.
+ /// </returns>
+ virtual String^ ToString( ) override;
+
+ // IGeodeSerializable members
+
+ /// <summary>
+ /// Serializes this Properties object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput stream to use for serialization
+ /// </param>
+ virtual void ToData( DataOutput^ output );
+
+ /// <summary>
+ /// Deserializes this Properties object.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading data
+ /// </param>
+ /// <returns>the deserialized Properties object</returns>
+ virtual IGeodeSerializable^ FromData( DataInput^ input );
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// Returns the classId of this class for serialization.
+ /// </summary>
+ /// <returns>classId of the Properties class</returns>
+ /// <seealso cref="IGeodeSerializable.ClassId" />
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get( )
+ {
+ return GeodeClassIds::Properties;
+ }
+ }
+
+ // End: IGeodeSerializable members
+
+ // ISerializable members
+
+ //virtual void GetObjectData( SerializationInfo^ info,
+ // StreamingContext context);
+
+ // End: ISerializable members
+
+ protected:
+
+ // For deserialization using the .NET serialization (ISerializable)
+ //Properties(SerializationInfo^ info, StreamingContext context, native::SerializationRegistryPtr serializationRegistry);
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ //generic<class TPropKey, class TPropValue>
+ static Properties<TPropKey, TPropValue>^ Create( native::PropertiesPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Properties<TPropKey, TPropValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::Properties> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ inline static IGeodeSerializable^ CreateDeserializable()
+ {
+ return Create<TPropKey, TPropValue>();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Properties( native::PropertiesPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Properties>(nativeptr);
+ }
+
+ native_shared_ptr<native::Properties>^ m_nativeptr;
+
+ void FromData(native::DataInput & input);
+ };
+
+ generic <class TPropKey, class TPropValue>
+ ref class PropertyVisitorProxy
+ {
+ public:
+ void Visit(Apache::Geode::Client::ICacheableKey^ key,
+ Apache::Geode::Client::IGeodeSerializable^ value)
+ {
+ TPropKey tpkey = Apache::Geode::Client::Serializable::
+ GetManagedValueGeneric<TPropKey>(SerializablePtr(SafeMSerializableConvertGeneric(key)));
+ TPropValue tpvalue = Apache::Geode::Client::Serializable::
+ GetManagedValueGeneric<TPropValue>(SerializablePtr(SafeMSerializableConvertGeneric(value)));
+ m_visitor->Invoke(tpkey, tpvalue);
+ }
+
+ void SetPropertyVisitorGeneric(
+ Apache::Geode::Client::PropertyVisitorGeneric<TPropKey, TPropValue>^ visitor)
+ {
+ m_visitor = visitor;
+ }
+
+ private:
+
+ Apache::Geode::Client::PropertyVisitorGeneric<TPropKey, TPropValue>^ m_visitor;
+
+ };
+
+ /* ref class PropertiesFactory {
+ public:
+ PropertiesFactory(native::SerializationRegistryPtr serializationRegistry)
+ {
+ m_serializationRegistry = gcnew native_shared_ptr<native::SerializationRegistry>(serializationRegistry);
+ }
+ IGeodeSerializable^ CreateDeserializable() {
+ return Properties<String^, String^>::CreateDeserializable(m_serializationRegistry->get_shared_ptr());
+ }
+ private:
+ native_shared_ptr<native::SerializationRegistry>^ m_serializationRegistry;
+ };*/
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Query.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Query.cpp b/clicache/src/Query.cpp
new file mode 100644
index 0000000..071c51f
--- /dev/null
+++ b/clicache/src/Query.cpp
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "Query.hpp"
+#include "ISelectResults.hpp"
+#include "ResultSet.hpp"
+#include "StructSet.hpp"
+#include "ExceptionTypes.hpp"
+//#include "Serializable.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::Execute( )
+ {
+ return Execute( DEFAULT_QUERY_RESPONSE_TIMEOUT );
+ }
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::Execute( System::UInt32 timeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return WrapResults( m_nativeptr->get()->execute( timeout ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::Execute( array<Object^>^ paramList)
+ {
+ return Execute(paramList, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::Execute( array<Object^>^ paramList, System::UInt32 timeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ auto rsptr = apache::geode::client::CacheableVector::create();
+ for( int index = 0; index < paramList->Length; index++ )
+ {
+ auto valueptr = Serializable::GetUnmanagedValueGeneric<Object^>(paramList[index]->GetType(), (Object^)paramList[index], nullptr);
+ rsptr->push_back(valueptr);
+ }
+
+ try
+ {
+ return WrapResults( m_nativeptr->get()->execute(rsptr, timeout ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::WrapResults(const apache::geode::client::SelectResultsPtr& selectResults)
+ {
+ if ( __nullptr == selectResults ) return nullptr;
+
+ if (auto resultptr = std::dynamic_pointer_cast<apache::geode::client::ResultSet>(selectResults))
+ {
+ return ResultSet<TResult>::Create(resultptr);
+ }
+ else if (auto structptr = std::dynamic_pointer_cast<apache::geode::client::StructSet>(selectResults))
+ {
+ return StructSet<TResult>::Create(structptr);
+ }
+
+ return nullptr;
+ }
+
+ generic<class TResult>
+ String^ Query<TResult>::QueryString::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getQueryString( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ void Query<TResult>::Compile( )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->compile( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ bool Query<TResult>::IsCompiled::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->isCompiled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Query.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Query.hpp b/clicache/src/Query.hpp
new file mode 100644
index 0000000..951cd2c
--- /dev/null
+++ b/clicache/src/Query.hpp
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Query.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+#include "IGeodeSerializable.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ interface class ISelectResults;
+
+ /// <summary>
+ /// Class to encapsulate a query.
+ /// </summary>
+ /// <remarks>
+ /// A Query is obtained from a QueryService which in turn is obtained
+ /// from the Cache.
+ /// This can be executed to return SelectResults which can be either
+ /// a ResultSet or a StructSet.
+ ///
+ /// This class is intentionally not thread-safe. So multiple threads
+ /// should not operate on the same <c>Query</c> object concurrently
+ /// rather should have their own <c>Query</c> objects.
+ /// </remarks>
+ generic<class TResult>
+ public ref class Query sealed
+ {
+ public:
+
+ /// <summary>
+ /// Executes the OQL Query on the cache server and returns
+ /// the results. The default timeout for the query is 15 secs.
+ /// </summary>
+ /// <exception cref="QueryException">
+ /// if some query error occurred at the server.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if some other error occurred.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if no java cache server is available.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <returns>
+ /// An <see cref="ISelectResults"/> object which can either be a
+ /// <see cref="ResultSet"/> or a <see cref="StructSet"/>.
+ /// </returns>
+ ISelectResults<TResult>^ Execute( );
+
+ /// <summary>
+ /// Executes the OQL Query on the cache server with the specified
+ /// timeout and returns the results.
+ /// </summary>
+ /// <param name="timeout">The time (in seconds) to wait for query response.
+ /// This should be less than or equal to 2^31/1000 i.e. 2147483.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if timeout parameter is greater than 2^31/1000.
+ /// </exception>
+ /// <exception cref="QueryException">
+ /// if some query error occurred at the server.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if some other error occurred.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if no java cache server is available
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <returns>
+ /// An <see cref="ISelectResults"/> object which can either be a
+ /// <see cref="ResultSet"/> or a <see cref="StructSet"/>.
+ /// </returns>
+ ISelectResults<TResult>^ Execute( System::UInt32 timeout );
+
+ /// <summary>
+ /// Executes the OQL Parameterized Query on the cache server with the specified
+ /// paramList & timeout parameters and returns the results.
+ /// </summary>
+ /// <param name="paramList">The Parameter List for the specified Query.
+ /// </param>
+ /// <param name="timeout">The time (in seconds) to wait for query response.
+ /// This should be less than or equal to 2^31/1000 i.e. 2147483.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if timeout parameter is greater than 2^31/1000.
+ /// </exception>
+ /// <exception cref="QueryException">
+ /// if some query error occurred at the server.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if some other error occurred.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if no java cache server is available
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <returns>
+ /// An <see cref="ISelectResults"/> object which can either be a
+ /// <see cref="ResultSet"/> or a <see cref="StructSet"/>.
+ /// </returns>
+ ISelectResults<TResult>^ Execute( array<Object^>^ paramList, System::UInt32 timeout );
+
+ /// <summary>
+ /// Executes the OQL Parameterized Query on the cache server with the specified
+ /// paramList and returns the results. The default timeout for the query is 15 secs.
+ /// </summary>
+ /// <param name="paramList">The Parameter List for the specified Query.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if timeout parameter is greater than 2^31/1000.
+ /// </exception>
+ /// <exception cref="QueryException">
+ /// if some query error occurred at the server.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// if some other error occurred.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if no java cache server is available
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <returns>
+ /// An <see cref="ISelectResults"/> object which can either be a
+ /// <see cref="ResultSet"/> or a <see cref="StructSet"/>.
+ /// </returns>
+ ISelectResults<TResult>^ Execute( array<Object^>^ paramList);
+ /// <summary>
+ /// Get the string for this query.
+ /// </summary>
+ property String^ QueryString
+ {
+ String^ get( );
+ }
+
+ /// <summary>
+ /// Compile the given query -- NOT IMPLEMENTED.
+ /// </summary>
+ void Compile( );
+
+ /// <summary>
+ /// Check if the query is compiled -- NOT IMPLEMENTED.
+ /// </summary>
+ property bool IsCompiled
+ {
+ bool get( );
+ }
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Query<TResult>^ Create( apache::geode::client::QueryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Query<TResult>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Query( apache::geode::client::QueryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Query>(nativeptr);
+ }
+
+ ISelectResults<TResult>^ WrapResults(const apache::geode::client::SelectResultsPtr& selectResults);
+
+ native_shared_ptr<native::Query>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/QueryService.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/QueryService.cpp b/clicache/src/QueryService.cpp
new file mode 100644
index 0000000..acb38cf
--- /dev/null
+++ b/clicache/src/QueryService.cpp
@@ -0,0 +1,233 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "QueryService.hpp"
+#include "Query.hpp"
+#include "Log.hpp"
+#include "CqAttributes.hpp"
+#include "CqQuery.hpp"
+#include "CqServiceStatistics.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TResult>
+ //generic<class TResult>
+ Query<TResult>^ QueryService<TKey, TResult>::NewQuery(String^ query)
+ {
+ ManagedString mg_queryStr(query);
+ try
+ {
+ return Query<TResult>::Create(m_nativeptr->get()->newQuery(
+ mg_queryStr.CharPtr));
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ QueryService<TKey, TResult>::NewCq(String^ query, CqAttributes<TKey, TResult>^ cqAttr, bool isDurable)
+ {
+ ManagedString mg_queryStr(query);
+ try
+ {
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->newCq(
+ mg_queryStr.CharPtr, cqAttr->GetNative(), isDurable));
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ QueryService<TKey, TResult>::NewCq(String^ name, String^ query, CqAttributes<TKey, TResult>^ cqAttr, bool isDurable)
+ {
+ ManagedString mg_queryStr(query);
+ ManagedString mg_nameStr(name);
+ try
+ {
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->newCq(
+ mg_nameStr.CharPtr, mg_queryStr.CharPtr, cqAttr->GetNative(), isDurable));
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void QueryService<TKey, TResult>::CloseCqs()
+ {
+ try
+ {
+ m_nativeptr->get()->closeCqs();
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ array<CqQuery<TKey, TResult>^>^ QueryService<TKey, TResult>::GetCqs()
+ {
+ try
+ {
+ apache::geode::client::QueryService::query_container_type vrr;
+ m_nativeptr->get()->getCqs(vrr);
+ auto cqs = gcnew array<CqQuery<TKey, TResult>^>(vrr.size());
+
+ for (System::Int32 index = 0; index < vrr.size(); index++)
+ {
+ cqs[index] = CqQuery<TKey, TResult>::Create(vrr[index]);
+ }
+ return cqs;
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ QueryService<TKey, TResult>::GetCq(String^ name)
+ {
+ ManagedString mg_queryStr(name);
+ try
+ {
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->getCq(
+ mg_queryStr.CharPtr));
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void QueryService<TKey, TResult>::ExecuteCqs()
+ {
+ try
+ {
+ m_nativeptr->get()->executeCqs();
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void QueryService<TKey, TResult>::StopCqs()
+ {
+ try
+ {
+ m_nativeptr->get()->stopCqs();
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqServiceStatistics^ QueryService<TKey, TResult>::GetCqStatistics()
+ {
+ try
+ {
+ return CqServiceStatistics::Create(m_nativeptr->get()->getCqServiceStatistics());
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ System::Collections::Generic::List<String^>^ QueryService<TKey, TResult>::GetAllDurableCqsFromServer()
+ {
+ try
+ {
+ auto durableCqsArrayListPtr = m_nativeptr->get()->getAllDurableCqsFromServer();
+ auto durableCqsList = gcnew System::Collections::Generic::List<String^>();
+ for (const auto& d : *durableCqsArrayListPtr)
+ {
+ durableCqsList->Add(CacheableString::GetString(std::static_pointer_cast<apache::geode::client::CacheableString>(d)));
+ }
+ return durableCqsList;
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/QueryService.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/QueryService.hpp b/clicache/src/QueryService.hpp
new file mode 100644
index 0000000..78d29ef
--- /dev/null
+++ b/clicache/src/QueryService.hpp
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "native_shared_ptr.hpp"
+#include "begin_native.hpp"
+#include <geode/QueryService.hpp>
+#include "end_native.hpp"
+
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ ref class Query;
+
+ generic<class TKey, class TResult>
+ ref class CqQuery;
+
+ generic<class TKey, class TResult>
+ ref class CqAttributes;
+
+ ref class CqServiceStatistics;
+
+ /// <summary>
+ /// Provides a query service.
+ /// </summary>
+ generic<class TKey, class TResult>
+ public ref class QueryService sealed
+ {
+ public:
+
+ /// <summary>
+ /// Get a <c>Query</c> object to enable querying.
+ /// </summary>
+ //generic<class TResult>
+ Query<TResult>^ NewQuery( String^ query );
+ /// @nativeclient
+ /// <summary>
+ /// Get a <c>CqQuery</c> object to enable continuous querying.
+ /// </summary>
+ /// @endnativeclient
+ //generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ NewCq( String^ query, CqAttributes<TKey, TResult>^ cqAttr, bool isDurable );
+ /// @nativeclient
+ /// <summary>
+ /// Get a <c>CqQuery</c> object to enable continuous querying.
+ /// </summary>
+ /// @endnativeclient
+ //generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ NewCq( String^ name, String^ query, CqAttributes<TKey, TResult>^ cqAttr, bool isDurable );
+ /// @nativeclient
+ /// <summary>
+ /// Close all <c>CqQuery</c> on this client.
+ /// </summary>
+ /// @endnativeclient
+ void CloseCqs();
+
+ /// @nativeclient
+ /// <summary>
+ /// Get all <c>CqQuery</c> on this client.
+ /// </summary>
+ /// @endnativeclient
+ //generic<class TKey, class TResult>
+ array<CqQuery<TKey, TResult>^>^ GetCqs();
+
+ /// @nativeclient
+ /// <summary>
+ /// Get the <c>CqQuery</c> with the given name on this client.
+ /// </summary>
+ /// @endnativeclient
+ //generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ GetCq(String^ name);
+
+ /// @nativeclient
+ /// <summary>
+ /// Get the <c>CqQuery</c> with the given name on this client.
+ /// </summary>
+ /// @endnativeclient
+ void ExecuteCqs();
+
+ /// @nativeclient
+ /// <summary>
+ /// Stop all <c>CqQuery</c> on this client.
+ /// </summary>
+ /// @endnativeclient
+ void StopCqs();
+
+ /// @nativeclient
+ /// <summary>
+ /// Get <c>CqServiceStatistics</c> on this client.
+ /// </summary>
+ /// @endnativeclient
+ CqServiceStatistics^ GetCqStatistics();
+
+ /// @nativeclient
+ /// <summary>
+ /// Get all durableCq nanes from server for this client.
+ /// </summary>
+ /// @endnativeclient
+ System::Collections::Generic::List<String^>^ GetAllDurableCqsFromServer();
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static QueryService<TKey, TResult>^ Create(native::QueryServicePtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew QueryService<TKey, TResult>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline QueryService(native::QueryServicePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::QueryService>(nativeptr);
+ }
+
+ native_shared_ptr<native::QueryService>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ReflectionBasedAutoSerializer.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ReflectionBasedAutoSerializer.cpp b/clicache/src/ReflectionBasedAutoSerializer.cpp
new file mode 100755
index 0000000..436ce4b
--- /dev/null
+++ b/clicache/src/ReflectionBasedAutoSerializer.cpp
@@ -0,0 +1,565 @@
+/*
+ * 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.
+ */
+#include "ReflectionBasedAutoSerializer.hpp"
+#include "PdxIdentityFieldAttribute.hpp"
+#include "Serializable.hpp"
+#pragma warning(disable:4091)
+#include <msclr/lock.h>
+#include "ExceptionTypes.hpp"
+#include "impl/DotNetTypes.hpp"
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class FieldWrapper
+ {
+ private:
+ //static readonly Module Module = typeof(Program).Module;
+ static array<Type^>^ oneObj = gcnew array<Type^>(1) { Type::GetType("System.Object") };
+ static array<Type^>^ twoObj = gcnew array<Type^>(2) { Type::GetType("System.Object"), Type::GetType("System.Object") };
+ delegate void MySetter(Object^ t1, Object^ t2);
+ delegate Object^ MyGetter(Object^ t1);
+
+ static Type^ setterDelegateType = Type::GetType("Apache.Geode.Client.FieldWrapper+MySetter");
+ static Type^ getterDelegateType = Type::GetType("Apache.Geode.Client.FieldWrapper+MyGetter");
+
+ FieldInfo^ m_fi;
+ String^ m_fieldName;
+ bool m_isIdentityField;
+ FieldType m_fieldType;
+ int m_pdxType;
+
+ MyGetter^ m_getter;
+ MySetter^ m_setter;
+
+ static MySetter^ createFieldSetter(FieldInfo^ fieldInfo)
+ {
+ DynamicMethod^ dynam = gcnew DynamicMethod("", Internal::DotNetTypes::VoidType , twoObj, fieldInfo->DeclaringType, true);
+ ILGenerator^ il = dynam->GetILGenerator();
+
+ if (!fieldInfo->IsStatic)
+ pushInstance(il, fieldInfo->DeclaringType);
+
+ il->Emit(OpCodes::Ldarg_1);
+ unboxIfNeeded(il, fieldInfo->FieldType);
+ il->Emit(OpCodes::Stfld, fieldInfo);
+ il->Emit(OpCodes::Ret);
+
+ return (MySetter^)dynam->CreateDelegate( setterDelegateType );
+ }
+
+ static MyGetter^ createFieldGetter(FieldInfo^ fieldInfo)
+ {
+ DynamicMethod^ dynam = gcnew DynamicMethod( "", Internal::DotNetTypes::ObjectType, oneObj, fieldInfo->DeclaringType, true);
+ ILGenerator^ il = dynam->GetILGenerator();
+
+ if (!fieldInfo->IsStatic)
+ pushInstance(il, fieldInfo->DeclaringType);
+
+ il->Emit(OpCodes::Ldfld, fieldInfo);
+ boxIfNeeded(il, fieldInfo->FieldType);
+ il->Emit(OpCodes::Ret);
+
+ return (MyGetter^)dynam->CreateDelegate(getterDelegateType);
+ }
+
+ static void boxIfNeeded(ILGenerator^ il, Type^ type)
+ {
+ if (type->IsValueType)
+ il->Emit(OpCodes::Box, type);
+ }
+
+ static void pushInstance( ILGenerator^ il, Type^ type)
+ {
+ il->Emit(OpCodes::Ldarg_0);
+ if (type->IsValueType)
+ il->Emit(OpCodes::Unbox, type);
+ }
+
+ static void unboxIfNeeded( ILGenerator^ il, Type^ type)
+ {
+ if (type->IsValueType)
+ il->Emit(OpCodes::Unbox_Any, type);
+ }
+ public:
+ FieldWrapper(FieldInfo^ fi, String^ fieldName, bool isIdentityField, FieldType fieldtype)
+ {
+ m_fi = fi;
+ m_fieldName = fieldName;
+ m_isIdentityField = isIdentityField;
+ m_fieldType = fieldtype;
+
+ m_setter = createFieldSetter(fi);
+ m_getter = createFieldGetter(fi);
+ }
+
+ property bool isIdentityField
+ {
+ bool get(){return m_isIdentityField;}
+ }
+
+ property Type^ FType
+ {
+ Type^ get() {return m_fi->FieldType;}
+ }
+
+ property String^ FieldName
+ {
+ String^ get(){return m_fieldName;}
+ }
+
+ property FieldInfo^ FI
+ {
+ FieldInfo^ get(){return m_fi;}
+ }
+
+ void SetFieldValue(Object^ parent, Object^ val)
+ {
+ m_setter(parent, val);
+ }
+
+ Object^ GetFieldValue(Object^ parent)
+ {
+ return m_getter(parent);
+ }
+
+ void SerializeField(IPdxWriter^ w, Object^ value)
+ {
+ switch(m_fieldType)
+ {
+ case FieldType::BOOLEAN:
+ w->WriteBoolean(m_fieldName, (bool)value);
+ break;
+ case FieldType::BYTE:
+ w->WriteByte(m_fieldName, (SByte)value);
+ break;
+ case FieldType::CHAR:
+ w->WriteChar(m_fieldName, (Char)value);
+ break;
+ case FieldType::SHORT:
+ w->WriteShort(m_fieldName, (short)value);
+ break;
+ case FieldType::INT:
+ w->WriteInt(m_fieldName, (int)value);
+ break;
+ case FieldType::LONG:
+ w->WriteLong(m_fieldName, (Int64)value);
+ break;
+ case FieldType::FLOAT:
+ w->WriteFloat(m_fieldName, (float)value);
+ break;
+ case FieldType::DOUBLE:
+ w->WriteDouble(m_fieldName, (double)value);
+ break;
+ case FieldType::DATE:
+ w->WriteDate(m_fieldName, (DateTime)value);
+ break;
+ case FieldType::STRING:
+ w->WriteString(m_fieldName, (String^)value);
+ break;
+ case FieldType::OBJECT:
+ w->WriteObject(m_fieldName, value);
+ break;
+ case FieldType::BOOLEAN_ARRAY:
+ w->WriteBooleanArray(m_fieldName, (array<bool>^)value);
+ break;
+ case FieldType::CHAR_ARRAY:
+ w->WriteCharArray(m_fieldName, (array<Char>^)value);
+ break;
+ case FieldType::BYTE_ARRAY:
+ w->WriteByteArray(m_fieldName, (array<Byte>^)value);
+ break;
+ case FieldType::SHORT_ARRAY:
+ w->WriteShortArray(m_fieldName, (array<Int16>^)value);
+ break;
+ case FieldType::INT_ARRAY:
+ w->WriteIntArray(m_fieldName, (array<Int32>^)value);
+ break;
+ case FieldType::LONG_ARRAY:
+ w->WriteLongArray(m_fieldName, (array<System::Int64>^)value);
+ break;
+ case FieldType::FLOAT_ARRAY:
+ w->WriteFloatArray(m_fieldName, (array<float>^)value);
+ break;
+ case FieldType::DOUBLE_ARRAY:
+ w->WriteDoubleArray(m_fieldName, (array<double>^)value);
+ break;
+ case FieldType::STRING_ARRAY:
+ w->WriteStringArray(m_fieldName, (array<String^>^)value);
+ break;
+ case FieldType::OBJECT_ARRAY:
+ w->WriteObjectArray(m_fieldName, safe_cast<System::Collections::Generic::List<Object^>^>(value));
+ break;
+ case FieldType::ARRAY_OF_BYTE_ARRAYS:
+ w->WriteArrayOfByteArrays(m_fieldName, (array<array<Byte>^>^)value);
+ break;
+ default:
+ throw gcnew IllegalStateException("Not found FieldType: " + m_fieldType.ToString());
+ }
+ }
+
+ Object^ DeserializeField(IPdxReader^ r)
+ {
+ switch(m_fieldType)
+ {
+ case FieldType::BOOLEAN:
+ return r->ReadBoolean(m_fieldName);
+ break;
+ case FieldType::BYTE:
+ return r->ReadByte(m_fieldName);
+ break;
+ case FieldType::CHAR:
+ return r->ReadChar(m_fieldName);
+ break;
+ case FieldType::SHORT:
+ return r->ReadShort(m_fieldName);
+ break;
+ case FieldType::INT:
+ return r->ReadInt(m_fieldName);
+ break;
+ case FieldType::LONG:
+ return r->ReadLong(m_fieldName);
+ break;
+ case FieldType::FLOAT:
+ return r->ReadFloat(m_fieldName);
+ break;
+ case FieldType::DOUBLE:
+ return r->ReadDouble(m_fieldName);
+ break;
+ case FieldType::DATE:
+ return r->ReadDate(m_fieldName);
+ break;
+ case FieldType::STRING:
+ return r->ReadString(m_fieldName);
+ break;
+ case FieldType::OBJECT:
+ return r->ReadObject(m_fieldName);
+ break;
+ case FieldType::BOOLEAN_ARRAY:
+ return r->ReadBooleanArray(m_fieldName);
+ break;
+ case FieldType::CHAR_ARRAY:
+ return r->ReadCharArray(m_fieldName);
+ break;
+ case FieldType::BYTE_ARRAY:
+ return r->ReadByteArray(m_fieldName);
+ break;
+ case FieldType::SHORT_ARRAY:
+ return r->ReadShortArray(m_fieldName);
+ break;
+ case FieldType::INT_ARRAY:
+ return r->ReadIntArray(m_fieldName);
+ break;
+ case FieldType::LONG_ARRAY:
+ return r->ReadLongArray(m_fieldName);
+ break;
+ case FieldType::FLOAT_ARRAY:
+ return r->ReadFloatArray(m_fieldName);
+ break;
+ case FieldType::DOUBLE_ARRAY:
+ return r->ReadDoubleArray(m_fieldName);
+ break;
+ case FieldType::STRING_ARRAY:
+ return r->ReadStringArray(m_fieldName);
+ break;
+ case FieldType::OBJECT_ARRAY:
+ return r->ReadObjectArray(m_fieldName);
+ break;
+ case FieldType::ARRAY_OF_BYTE_ARRAYS:
+ return r->ReadArrayOfByteArrays(m_fieldName);
+ break;
+ default:
+ throw gcnew IllegalStateException("Not found FieldType: " + m_fieldType.ToString());
+ }
+ return nullptr;
+ }
+
+
+
+ };
+
+ ReflectionBasedAutoSerializer::ReflectionBasedAutoSerializer()
+ {
+ PdxIdentityFieldAttribute^ pif = gcnew PdxIdentityFieldAttribute();
+ PdxIdentityFieldAttributeType = pif->GetType();
+ classNameVsFieldInfoWrapper = gcnew Dictionary<String^, List<FieldWrapper^>^>();
+ }
+
+ bool ReflectionBasedAutoSerializer::ToData( Object^ o,IPdxWriter^ writer )
+ {
+ serializeFields(o, writer);
+ return true;
+ }
+
+ Object^ ReflectionBasedAutoSerializer::FromData(String^ o, IPdxReader^ reader )
+ {
+ return deserializeFields(o, reader);
+ }
+
+ void ReflectionBasedAutoSerializer::serializeFields(Object^ o,IPdxWriter^ writer )
+ {
+ Type^ ty = o->GetType();
+ // Log::Debug("ReflectionBasedAutoSerializer::serializeFields classname {0}: objectType {1}", o->GetType()->FullName,o->GetType());
+ for each(FieldWrapper^ fi in GetFields(o->GetType()))
+ {
+ // Log::Debug("ReflectionBasedAutoSerializer::serializeFields fieldName: {0}, fieldType: {1}", fi->FieldName, fi->FType);
+ // writer->WriteField(fi->Name, fi->GetValue(o), fi->FieldType);
+ // SerializeField(o, fi, writer);
+ //Object^ originalValue = fi->FI->GetValue(o);
+ Object^ originalValue = fi->GetFieldValue(o);
+ //hook which can overide by app
+ originalValue = WriteTransform(fi->FI, fi->FType, originalValue);
+
+ fi->SerializeField(writer, originalValue);
+
+ if(fi->isIdentityField)
+ {
+ // Log::Debug("ReflectionBasedAutoSerializer::serializeFields fieldName: {0} is identity field.", fi->FieldName);
+ writer->MarkIdentityField(fi->FieldName);
+ }
+ }
+
+ // serializeBaseClassFields(o, writer, ty->BaseType);
+ }
+
+
+ /*void ReflectionBasedAutoSerializer::SerializeField(Object^ o, FieldInfo^ fi, IPdxWriter^ writer)
+ {
+ writer->WriteField(fi->Name, fi->GetValue(o), fi->FieldType);
+ }
+
+ Object^ ReflectionBasedAutoSerializer::DeserializeField(Object^ o, FieldInfo^ fi, IPdxReader^ reader)
+ {
+ return reader->ReadField(fi->Name, fi->FieldType);
+ }*/
+
+ Object^ ReflectionBasedAutoSerializer::deserializeFields(String^ className, IPdxReader^ reader)
+ {
+ Object^ o = CreateObject(className);
+ //Log::Debug("ReflectionBasedAutoSerializer::deserializeFields classname {0}: objectType {1}", className,o->GetType());
+ for each(FieldWrapper^ fi in GetFields(o->GetType()))
+ {
+ //Log::Debug("1ReflectionBasedAutoSerializer::deserializeFields fieldName: {0}, fieldType: {1}", fi->FieldName, fi->FType);
+ Object^ serializeValue = fi->DeserializeField(reader);
+ serializeValue = ReadTransform( fi->FI, fi->FType, serializeValue);
+ //fi->FI->SetValue(o, serializeValue);
+ fi->SetFieldValue(o, serializeValue);
+ }
+
+ return o;
+ //deserializeBaseClassFields(o, reader, ty->BaseType);
+ }
+
+ Object^ ReflectionBasedAutoSerializer::CreateObject(String^ className)
+ {
+ return Serializable::CreateObject(className);
+ }
+
+ bool ReflectionBasedAutoSerializer::IsPdxIdentityField(FieldInfo^ fi)
+ {
+ array<Object^>^ cAttr= fi->GetCustomAttributes(PdxIdentityFieldAttributeType, true);
+ if(cAttr != nullptr && cAttr->Length > 0)
+ {
+ PdxIdentityFieldAttribute^ pifa = (PdxIdentityFieldAttribute^)(cAttr[0]);
+ return true;
+ }
+ return false;
+ }
+
+ List<FieldWrapper^>^ ReflectionBasedAutoSerializer::GetFields(Type^ domaimType)
+ {
+ List<FieldWrapper^>^ retVal = nullptr;
+
+ String^ className = domaimType->FullName;
+ System::Collections::Generic::Dictionary<String^, List<FieldWrapper^>^>^ tmp = classNameVsFieldInfoWrapper;
+ tmp->TryGetValue(className, retVal);
+ if(retVal != nullptr)
+ return retVal;
+ msclr::lock lockInstance(classNameVsFieldInfoWrapper);
+ {
+ tmp = classNameVsFieldInfoWrapper;
+ tmp->TryGetValue(className, retVal);
+ if(retVal != nullptr)
+ return retVal;
+
+ List<FieldWrapper^>^ collectFields = gcnew List<FieldWrapper^>();
+ while(domaimType != nullptr)
+ {
+ for each(FieldInfo^ fi in domaimType->GetFields(BindingFlags::Public| BindingFlags::NonPublic | BindingFlags::Instance
+ |BindingFlags::DeclaredOnly
+ ))
+ {
+ if(!fi->IsNotSerialized && !fi->IsStatic && !fi->IsLiteral && !fi->IsInitOnly)
+ {
+ //to ignore the fild
+ if(IsFieldIncluded(fi, domaimType))
+ {
+ //This are all hooks which app can implement
+
+ String^ fieldName = GetFieldName(fi, domaimType);
+ bool isIdentityField = IsIdentityField(fi, domaimType);
+ FieldType ft = GetFieldType(fi, domaimType);
+
+ FieldWrapper^ fw = gcnew FieldWrapper(fi, fieldName, isIdentityField, ft);
+
+ collectFields->Add(fw);
+ }
+ }
+ }
+ domaimType = domaimType->BaseType;
+ }
+ tmp = gcnew System::Collections::Generic::Dictionary<String^, List<FieldWrapper^>^>(classNameVsFieldInfoWrapper);
+ tmp->Add(className, collectFields);
+ classNameVsFieldInfoWrapper = tmp;
+
+ return collectFields;
+ }
+ }
+
+
+ String^ ReflectionBasedAutoSerializer::GetFieldName(FieldInfo^ fi, Type^ type)
+ {
+ return fi->Name;
+ }
+
+ bool ReflectionBasedAutoSerializer::IsIdentityField(FieldInfo^ fi, Type^ type)
+ {
+ return IsPdxIdentityField(fi);
+ }
+
+ FieldType ReflectionBasedAutoSerializer::GetFieldType(FieldInfo^ fi, Type^ type)
+ {
+ return getPdxFieldType(fi->FieldType);
+ }
+
+ bool ReflectionBasedAutoSerializer::IsFieldIncluded(FieldInfo^ fi, Type^ type)
+ {
+ return true;
+ }
+
+ Object^ ReflectionBasedAutoSerializer::WriteTransform(FieldInfo^ fi, Type^ type, Object^ originalValue)
+ {
+ return originalValue;
+ }
+
+ Object^ ReflectionBasedAutoSerializer::ReadTransform(FieldInfo^ fi, Type^ type, Object^ serializeValue)
+ {
+ return serializeValue;
+ }
+
+ FieldType ReflectionBasedAutoSerializer::getPdxFieldType( Type^ type)
+ {
+ if(type->Equals(Internal::DotNetTypes::IntType))
+ {
+ return FieldType::INT;
+ }
+ else if(type->Equals(Internal::DotNetTypes::StringType))
+ {
+ return FieldType::STRING;
+ }
+ else if(type->Equals(Internal::DotNetTypes::BooleanType))
+ {
+ return FieldType::BOOLEAN;
+ }
+ else if(type->Equals(Internal::DotNetTypes::FloatType))
+ {
+ return FieldType::FLOAT;
+ }
+ else if(type->Equals(Internal::DotNetTypes::DoubleType))
+ {
+ return FieldType::DOUBLE;
+ }
+ else if(type->Equals(Internal::DotNetTypes::CharType))
+ {
+ return FieldType::CHAR;
+ }
+ else if(type->Equals(Internal::DotNetTypes::SByteType))
+ {
+ return FieldType::BYTE;
+ }
+ else if(type->Equals(Internal::DotNetTypes::ShortType))
+ {
+ return FieldType::SHORT;
+ }
+ else if(type->Equals(Internal::DotNetTypes::LongType))
+ {
+ return FieldType::LONG;
+ }
+ else if(type->Equals(Internal::DotNetTypes::ByteArrayType))
+ {
+ return FieldType::BYTE_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::DoubleArrayType))
+ {
+ return FieldType::DOUBLE_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::FloatArrayType))
+ {
+ return FieldType::FLOAT_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::ShortArrayType))
+ {
+ return FieldType::SHORT_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::IntArrayType))
+ {
+ return FieldType::INT_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::LongArrayType))
+ {
+ return FieldType::LONG_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::BoolArrayType))
+ {
+ return FieldType::BOOLEAN_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::CharArrayType))
+ {
+ return FieldType::CHAR_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::StringArrayType))
+ {
+ return FieldType::STRING_ARRAY;
+ }
+ else if(type->Equals(Internal::DotNetTypes::DateType))
+ {
+ return FieldType::DATE;
+ }
+ else if(type->Equals(Internal::DotNetTypes::ByteArrayOfArrayType))
+ {
+ return FieldType::ARRAY_OF_BYTE_ARRAYS;
+ }
+ /*else if(type->Equals(Internal::DotNetTypes::ObjectArrayType))
+ {
+ //Giving more preference to arraylist instead of Object[] in java side
+ //return this->WriteObjectArray(fieldName, safe_cast<System::Collections::Generic::List<Object^>^>(fieldValue));
+ return FieldType::OBJECT_ARRAY;
+ }*/
+ else
+ {
+ return FieldType::OBJECT;
+ //throw gcnew IllegalStateException("WriteField unable to serialize "
+ // + fieldName + " of " + type);
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ReflectionBasedAutoSerializer.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ReflectionBasedAutoSerializer.hpp b/clicache/src/ReflectionBasedAutoSerializer.hpp
new file mode 100755
index 0000000..e32b68f
--- /dev/null
+++ b/clicache/src/ReflectionBasedAutoSerializer.hpp
@@ -0,0 +1,225 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IPdxSerializer.hpp"
+#include "PdxIdentityFieldAttribute.hpp"
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Reflection::Emit;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Enumerated type for pdx FieldType
+ /// </summary>
+ public enum class FieldType
+ {
+ BOOLEAN,
+ BYTE,
+ CHAR,
+ SHORT,
+ INT,
+ LONG,
+ FLOAT,
+ DOUBLE,
+ DATE,
+ STRING,
+ OBJECT,
+ BOOLEAN_ARRAY,
+ CHAR_ARRAY,
+ BYTE_ARRAY,
+ SHORT_ARRAY,
+ INT_ARRAY,
+ LONG_ARRAY,
+ FLOAT_ARRAY,
+ DOUBLE_ARRAY,
+ STRING_ARRAY,
+ OBJECT_ARRAY,
+ ARRAY_OF_BYTE_ARRAYS
+ };
+
+ ref class FieldWrapper;
+
+ /// <summary>
+ /// This class uses .NET reflection in conjunction with
+ /// <see cref="IPdxSerializer"/> to perform
+ /// automatic serialization of domain objects. The implication is that the domain
+ /// classes do not need to implement the <see cref="IPdxSerializable"> interface.
+ /// This implementation will serialize all relevant fields.
+ /// This will not serialize the fields which has defined attribute NonSerialized.
+ /// This will not serialize the static, literal and readonly fields.
+ ///
+ /// Use <see cref="PdxIdentityFieldAttribute"> to define member field as identity field.
+ /// Identity fields are used for hashcode creation and equals methods.
+ ///
+ /// </summary>
+ public ref class ReflectionBasedAutoSerializer : IPdxSerializer
+ {
+ public:
+
+ virtual bool ToData( Object^ o,IPdxWriter^ writer );
+
+ virtual Object^ FromData(String^ o, IPdxReader^ reader );
+
+ /// <summary>
+ /// Controls the field name that will be used in pdx for a field being auto serialized.
+ /// Override this method to customize the field names that will be generated by auto serialization.
+ /// It allows you to convert a local, language dependent name, to a more portable name.
+ /// The returned name is the one that will show up in a <see cref="IPdxInstance" /> and that
+ /// one that will need to be used to access the field when doing a query.
+ /// <para>
+ /// The default implementation returns the name obtained from <code>fi</code>.
+ /// <para>
+ /// This method is only called the first time it sees a new class. The result
+ /// will be remembered and used the next time the same class is seen.
+ /// </summary>
+ /// <param name="fi"> the field whose name is returned.</param>
+ /// <param name"type"> type the original class being serialized that owns this field.</param>
+ /// <returns> the name of the field </returns>
+
+ virtual String^ GetFieldName(FieldInfo^ fi, Type^ type);
+
+ /// <summary>
+ /// Controls what fields of a class that is auto serialized will be marked
+ /// as pdx identity fields.
+ /// Override this method to customize what fields of an auto serialized class will be
+ /// identity fields.
+ /// Identity fields are used when a <see cref="IPdxInstance" /> computes its hash code
+ /// and checks to see if it is equal to another object.
+ /// <para>
+ /// The default implementation only marks fields that match an "#identity=" pattern
+ /// as identity fields.
+ /// <para>
+ /// This method is only called the first time it sees a new class. The result
+ /// will be remembered and used the next time the same class is seen.
+ /// </summary>
+ /// <param name="fi"> the field to test to see if it is an identity field.</param>
+ /// <param name="type"> the original class being serialized that owns this field.</param>
+ /// <returns> true if the field should be marked as an identity field; false if not. </returns>
+
+ virtual bool IsIdentityField(FieldInfo^ fi, Type^ type);
+
+ /// <summary>
+ /// Controls what pdx field type will be used when auto serializing.
+ /// Override this method to customize what pdx field type will be used
+ /// for a given domain class field.
+ /// <para>
+ /// The default implementation uses type of field.
+ /// <para>
+ /// This method is only called the first time it sees a new class. The result
+ /// will be remembered and used the next time the same class is seen.
+ /// </summary>
+ /// <param name="fi"> the field whose pdx field type needs to be determined </param>
+ /// <param name="type"> the original class being serialized that owns this field.</param>
+ /// <returns> the pdx field type of the given domain class field.</returns>
+
+ virtual FieldType GetFieldType(FieldInfo^ fi, Type^ type);
+
+ /// <summary>
+ /// Controls what fields of a class will be auto serialized by this serializer.
+ /// Override this method to customize what fields of a class will be auto serialized.
+ /// The default implementation:
+ /// <list type="bullet">
+ /// <item>
+ /// <description> excludes NonSerialized fields</description>
+ /// </item>
+ /// <item>
+ /// <description> excludes static fields</description>
+ /// </item>
+ /// <item>
+ /// <description> excludes literal fields</description>
+ /// </item>
+ /// <item>
+ /// <description> excludes readonly fields </description>
+ /// </item>
+ /// </list>
+ /// All other fields are included.
+ /// This method is only called the first time it sees a new class. The result
+ /// will be remembered and used the next time the same class is seen.
+ /// </summary>
+ /// <param name="fi"> the field being considered for serialization</param>
+ /// <param name="type"> the original class being serialized that owns this field.</param>
+ /// <returns> true if the field should be serialized as a pdx field; false if it should be ignored.</returns>
+
+ virtual bool IsFieldIncluded(FieldInfo^ fi, Type^ type);
+
+ /// <summary>
+ /// Controls what field value is written during auto serialization.
+ /// Override this method to customize the data that will be written
+ /// during auto serialization.
+ /// </summary>
+ /// <param name="fi"> the field in question</param>
+ /// <param name="type"> the original class being serialized that owns this field.</param>
+ /// <param name="originalValue"> the value of the field that was read from the domain object.</param>
+ /// <returns> the actual value to write for this field. Return <code>originalValue</code>
+ /// if you decide not to transform the value. </returns>
+
+ virtual Object^ WriteTransform(FieldInfo^ fi, Type^ type, Object^ originalValue);
+
+ /// <summary>
+ /// Controls what field value is read during auto deserialization.
+ /// Override this method to customize the data that will be read
+ /// during auto deserialization.
+ /// This method will only be called if {@link #transformFieldValue}
+ /// returned true.
+ /// </summary>
+ /// <param name="fi"> the field in question </param>
+ /// <param name="type"> the original class being serialized that owns this field.
+ /// Note that this field may have been inherited from a super class by this class.</param>
+ /// <param value="serializeValue"> the value of the field that was serialized for this field.</param>
+ /// <returns> the actual value to write for this field. Return <code>serializedValue</code>
+ /// if you decide not to transform the value. </returns>
+ virtual Object^ ReadTransform(FieldInfo^ fi, Type^ type, Object^ serializeValue);
+
+ /// <summary>
+ /// Overirde this method to create default instance of <code>className</code>
+ /// Otherwise it will create instance using zer arg public constructor
+ /// </summary>
+ /// <param name="className"> name of the class to create default instance </param>
+ /// <returns> the defaulf instance </returns>
+
+ virtual Object^ CreateObject(String^ className);
+
+ ReflectionBasedAutoSerializer();
+ private:
+
+ FieldType getPdxFieldType( Type^ type);
+
+ void serializeFields(Object^ o,IPdxWriter^ writer );
+
+ Object^ deserializeFields(String^ o, IPdxReader^ reader);
+
+ bool IsPdxIdentityField(FieldInfo^ fi);
+
+ System::Collections::Generic::Dictionary<String^, List<FieldWrapper^>^>^ classNameVsFieldInfoWrapper;
+
+ List<FieldWrapper^>^ GetFields(Type^ domaimType);
+
+ static Type^ PdxIdentityFieldAttributeType = nullptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[30/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientSecurityAuthzTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientSecurityAuthzTestsN.cs b/clicache/integration-test/ThinClientSecurityAuthzTestsN.cs
new file mode 100644
index 0000000..31bcd41
--- /dev/null
+++ b/clicache/integration-test/ThinClientSecurityAuthzTestsN.cs
@@ -0,0 +1,710 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("group3")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientSecurityAuthzTests : ThinClientSecurityAuthzTestBase
+ {
+ #region Private members
+ IRegion<object, object> region;
+ IRegion<object, object> region1;
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private UnitProcess m_client3;
+ private TallyListener<object, object> m_listener;
+ private TallyWriter<object, object> m_writer;
+ private string keys = "Key";
+ private string value = "Value";
+
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ public void CreateRegion(string locators, bool caching,
+ bool listener, bool writer)
+ {
+ 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);
+
+ if (writer)
+ {
+ m_writer = new TallyWriter<object, object>();
+ }
+ else
+ {
+ m_writer = null;
+ }
+ AttributesMutator<object, object> at = region.AttributesMutator;
+ at.SetCacheWriter(m_writer);
+ }
+
+ public void DoPut()
+ {
+ region = CacheHelper.GetRegion<object, object>(RegionName);
+ region[keys] = value;
+ }
+
+ public void CheckAssert()
+ {
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer Should be invoked");
+ Assert.AreEqual(false, m_listener.IsListenerInvoked, "Listener Should not be invoked");
+ Assert.IsFalse(region.GetLocalView().ContainsKey(keys), "Key should have been found in the region");
+ }
+
+ public void DoLocalPut()
+ {
+ region1 = CacheHelper.GetRegion<object, object>(RegionName);
+ region1.GetLocalView()[m_keys[2]] = m_vals[2];
+ Assert.IsTrue(region1.GetLocalView().ContainsKey(m_keys[2]), "Key should have been found in the region");
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer Should be invoked");
+ Assert.AreEqual(true, m_listener.IsListenerInvoked, "Listener Should be invoked");
+
+ //try Update
+ try
+ {
+ Util.Log("Trying UpdateEntry");
+ m_listener.ResetListenerInvokation();
+ UpdateEntry(RegionName, m_keys[2], m_nvals[2], false);
+ Assert.Fail("Should have got NotAuthorizedException during updateEntry");
+ }
+ catch (NotAuthorizedException)
+ {
+ Util.Log("NotAuthorizedException Caught");
+ Util.Log("Success");
+ }
+ catch (Exception other)
+ {
+ Util.Log("Stack trace: {0} ", other.StackTrace);
+ Util.Log("Got exception : {0}", other.Message);
+ }
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer should be invoked");
+ Assert.AreEqual(false, m_listener.IsListenerInvoked, "Listener should not be invoked");
+ Assert.IsTrue(region1.GetLocalView().ContainsKey(m_keys[2]), "Key should have been found in the region");
+ VerifyEntry(RegionName, m_keys[2], m_vals[2]);
+ m_writer.SetWriterFailed();
+
+ //test CacheWriter
+ try
+ {
+ Util.Log("Testing CacheWriterException");
+ UpdateEntry(RegionName, m_keys[2], m_nvals[2], false);
+ Assert.Fail("Should have got NotAuthorizedException during updateEntry");
+ }
+ catch (CacheWriterException)
+ {
+ Util.Log("CacheWriterException Caught");
+ Util.Log("Success");
+ }
+
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ client.Call(CacheHelper.Close);
+ }
+ }
+ CacheHelper.Close();
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ void runAllowPutsGets()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(false))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("testAllowPutsGets: Using authinit: " + authInit);
+ Util.Log("testAllowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("testAllowPutsGets: Using accessor: " + accessor);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("AllowPutsGets: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, createCredentials);
+
+ // Start client2 with valid GET credentials
+ Properties<string, string> getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ javaProps = cGen.JavaProperties;
+ Util.Log("AllowPutsGets: For second client GET credentials: " +
+ getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, getCredentials);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 2);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGets, 2);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runDisallowPutsGets()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(false))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("DisallowPutsGets: Using authinit: " + authInit);
+ Util.Log("DisallowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("DisallowPutsGets: Using accessor: " + accessor);
+
+ // Check that we indeed can obtain valid credentials not allowed to do
+ // gets
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ Properties<string, string> createJavaProps = cGen.JavaProperties;
+ Properties<string, string> getCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ Properties<string, string> getJavaProps = cGen.JavaProperties;
+ if (getCredentials == null || getCredentials.Size == 0)
+ {
+ Util.Log("DisallowPutsGets: Unable to obtain valid credentials " +
+ "with no GET permission; skipping this combination.");
+ continue;
+ }
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials
+ createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, createCredentials);
+
+ // Start client2 with invalid GET credentials
+ getCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For second client invalid GET " +
+ "credentials: " + getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, getCredentials);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 2);
+
+ // Verify that the gets throw exception
+ m_client2.Call(DoGets, 2, false, ExpectedResult.NotAuthorizedException);
+
+ // Try to connect client2 with reader credentials
+ getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 5);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For second client valid GET " +
+ "credentials: " + getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, getCredentials);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGets, 2);
+
+ // Verify that the puts throw exception
+ m_client2.Call(DoPuts, 2, true, ExpectedResult.NotAuthorizedException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runInvalidAccessor()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(false))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("InvalidAccessor: Using authinit: " + authInit);
+ Util.Log("InvalidAccessor: Using authenticator: " + authenticator);
+
+ // Start server1 with invalid accessor
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ "com.gemstone.none", null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+
+ // Client creation should throw exceptions
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 3);
+ javaProps = cGen.JavaProperties;
+ Util.Log("InvalidAccessor: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, createCredentials,
+ ExpectedResult.OtherException);
+ Properties<string, string> getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 7);
+ javaProps = cGen.JavaProperties;
+ Util.Log("InvalidAccessor: For second client GET credentials: " +
+ getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, getCredentials,
+ ExpectedResult.OtherException);
+
+ // Now start server2 that has valid accessor
+ Util.Log("InvalidAccessor: Using accessor: " + accessor);
+ serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StopJavaServer(1);
+
+ // Client creation should be successful now
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, createCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, getCredentials);
+
+ // Now perform some put operations from client1
+ m_client1.Call(DoPuts, 4);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGets, 4);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runAllOpsWithFailover()
+ {
+ runAllOpsWithFailover(false, false);
+ }
+
+ void runAllOpsWithFailover(bool ssl, bool withPassword)
+ {
+ OperationWithAction[] allOps = {
+ // Test CREATE and verify with a GET
+ new OperationWithAction(OperationCode.Put, 3, OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 3, OpFlags.CheckNoKey
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.CheckNoKey, 4),
+
+ // OPBLOCK_END indicates end of an operation block; the above block of
+ // three operations will be first executed on server1 and then on
+ // server2 after failover
+ OperationWithAction.OpBlockEnd,
+
+ // Test GetServerKeys (KEY_SET) operation.
+ new OperationWithAction(OperationCode.GetServerKeys),
+ new OperationWithAction(OperationCode.GetServerKeys, 3, OpFlags.CheckNotAuthz, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Test UPDATE and verify with a GET
+ new OperationWithAction(OperationCode.Put, 3, OpFlags.UseNewVal
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Test DESTROY and verify with a GET and that key should not exist
+ new OperationWithAction(OperationCode.Destroy, 3, OpFlags.UseNewVal
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Destroy),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.CheckFail, 4),
+ // Repopulate the region
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseNewVal, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Check QUERY
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Query, 3,
+ OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Query),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Register interest in all keys
+ new OperationWithAction(OperationCode.RegisterInterest, 3,
+ OpFlags.UseAllKeys | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.RegisterInterest, 2,
+ OpFlags.UseAllKeys, 4),
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // Unregister interest in all keys
+ new OperationWithAction(OperationCode.UnregisterInterest, 2,
+ OpFlags.UseAllKeys | OpFlags.UseOldConn, 4),
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ /// PutAll, GetAll, ExecuteCQ and ExecuteFunction ops
+ new OperationWithAction(OperationCode.PutAll),
+ // NOTE: GetAll depends on previous PutAll so it should happen right after.
+ new OperationWithAction(OperationCode.GetAll),
+ new OperationWithAction(OperationCode.RemoveAll),
+ new OperationWithAction(OperationCode.ExecuteCQ),
+ new OperationWithAction(OperationCode.ExecuteFunction),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Register interest in all keys using list
+ new OperationWithAction(OperationCode.RegisterInterest, 3,
+ OpFlags.UseList | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.RegisterInterest, 1,
+ OpFlags.UseList, 4),
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put, 2),
+ new OperationWithAction(OperationCode.Get, 1, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // Unregister interest in all keys using list
+ new OperationWithAction(OperationCode.UnregisterInterest, 1,
+ OpFlags.UseOldConn | OpFlags.UseList, 4),
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 2, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 1, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Register interest in all keys using regular expression
+ new OperationWithAction(OperationCode.RegisterInterest, 3,
+ OpFlags.UseRegex | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.RegisterInterest, 2,
+ OpFlags.UseRegex, 4),
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // Unregister interest in all keys using regular expression
+ new OperationWithAction(OperationCode.UnregisterInterest, 2,
+ OpFlags.UseOldConn | OpFlags.UseRegex, 4),
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Do REGION_DESTROY of the sub-region and check with GET
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseSubRegion,
+ 8),
+ new OperationWithAction(OperationCode.RegionDestroy, 3,
+ OpFlags.UseSubRegion | OpFlags.CheckNotAuthz, 1),
+ new OperationWithAction(OperationCode.RegionDestroy, 1,
+ OpFlags.UseSubRegion, 1),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseSubRegion
+ | OpFlags.CheckNoKey | OpFlags.CheckException, 8),
+
+ // Do REGION_DESTROY of the region and check with GET
+ new OperationWithAction(OperationCode.RegionDestroy, 3,
+ OpFlags.CheckNotAuthz, 1),
+ new OperationWithAction(OperationCode.RegionDestroy, 1, OpFlags.None,
+ 1),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.CheckNoKey | OpFlags.CheckException, 8),
+
+ // Skip failover for region destroy since it shall fail
+ // without restarting the server
+ OperationWithAction.OpBlockNoFailover
+ };
+ if (ssl == true && withPassword == true)
+ {
+ RunOpsWithFailoverSSL(allOps, "AllOpsWithFailover", true);
+ }
+ else if(ssl == true)
+ RunOpsWithFailoverSSL(allOps, "AllOpsWithFailover", false);
+ else
+ RunOpsWithFailover(allOps, "AllOpsWithFailover");
+ }
+
+ void runThinClientWriterExceptionTest()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(false))
+ {
+ for (int i = 1; i <= 2; ++i)
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("ThinClientWriterException: Using authinit: " + authInit);
+ Util.Log("ThinClientWriterException: Using authenticator: " + authenticator);
+ Util.Log("ThinClientWriterException: Using accessor: " + accessor);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the server.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid CREATE credentials
+ Properties<string, string> createCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPuts: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClientR0, RegionName,
+ CacheHelper.Locators, authInit, createCredentials);
+
+ Util.Log("Creating region in client1 , no-ack, no-cache, with listener and writer");
+ m_client1.Call(CreateRegion,CacheHelper.Locators,
+ true, true, true);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+
+ try
+ {
+ Util.Log("Trying put Operation");
+ m_client1.Call(DoPut);
+ Util.Log(" Put Operation Successful");
+ Assert.Fail("Should have got NotAuthorizedException during put");
+ }
+ catch (NotAuthorizedException)
+ {
+ Util.Log("NotAuthorizedException Caught");
+ Util.Log("Success");
+ }
+ catch (Exception other)
+ {
+ Util.Log("Stack trace: {0} ", other.StackTrace);
+ Util.Log("Got exception : {0}",
+ other.Message);
+ }
+ m_client1.Call(CheckAssert);
+ // Do LocalPut
+ m_client1.Call(DoLocalPut);
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ }
+ }
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region Tests
+
+ [Test]
+ public void AllowPutsGets()
+ {
+ runAllowPutsGets();
+ }
+
+ [Test]
+ public void DisallowPutsGets()
+ {
+ runDisallowPutsGets();
+ }
+
+ //this test no more valid as the way we do auth now change, so it gets different exception
+ //[Test]
+ public void InvalidAccessor()
+ {
+ //runInvalidAccessor();
+ }
+
+ [Test]
+ public void AllOpsWithFailover()
+ {
+ runAllOpsWithFailover();
+ }
+
+ [Test]
+ public void AllOpsWithFailoverWithSSL()
+ {
+ // SSL CAN ONLY BE ENABLED WITH LOCATORS THUS REQUIRING POOLS.
+ runAllOpsWithFailover(true, false); // pool with locator with ssl
+ }
+
+ [Test]
+ public void AllOpsWithFailoverWithSSLWithPassword()
+ {
+ // SSL CAN ONLY BE ENABLED WITH LOCATORS THUS REQUIRING POOLS.
+ runAllOpsWithFailover(true, true); // pool with locator with ssl
+ }
+
+ [Test]
+ public void ThinClientWriterExceptionTest()
+ {
+ runThinClientWriterExceptionTest();
+ }
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientStatisticTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientStatisticTestsN.cs b/clicache/integration-test/ThinClientStatisticTestsN.cs
new file mode 100644
index 0000000..69bc5e9
--- /dev/null
+++ b/clicache/integration-test/ThinClientStatisticTestsN.cs
@@ -0,0 +1,255 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using System.Threading;
+
+ using Apache.Geode.Client;
+
+ public class TestStatisticsType
+ {
+ public StatisticsType testStatsType;
+ public int statIdIntCounter;
+ public int statIdIntGauge;
+ public int statIdLongCounter;
+ public int statIdLongGauge;
+ public int statIdDoubleCounter;
+ public int statIdDoubleGauge;
+ };
+
+ public class IncThread
+ {
+ private Statistics m_stat;
+ private TestStatisticsType m_type;
+
+ public IncThread (Statistics stat,TestStatisticsType type)
+ {
+ this.m_stat = stat;
+ this.m_type = type;
+ }
+
+ public void ThreadOperation()
+ {
+ /* Just 1000 Inc, Stop after that */
+ for ( int incIdx = 0 ; incIdx < 1000 ; incIdx++ ) {
+ m_stat.IncInt(m_type.statIdIntCounter, 1 );
+ m_stat.IncInt(m_type.statIdIntGauge, 1 );
+ m_stat.IncLong(m_type.statIdLongCounter, 1 );
+ m_stat.IncLong(m_type.statIdLongGauge, 1 );
+ m_stat.IncDouble(m_type.statIdDoubleCounter, 1.0 );
+ m_stat.IncDouble(m_type.statIdDoubleGauge, 1.0 );
+ }
+ }
+ };
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientStatisticTests : UnitTests
+ {
+ //#region Private members
+ private UnitProcess m_client1;
+ //#endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ return new ClientBase[] { m_client1 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ [Test]
+ public void StatisticsCheckTest()
+ {
+ CacheHelper.SetupJavaServers(false, "cacheserver.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CacheHelper.InitClient);
+
+ m_client1.Call(statisticsTest);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ m_client1.Call(CacheHelper.Close);
+ }
+
+ #region Functions invoked by the tests
+
+ public void Close()
+ {
+ CacheHelper.Close();
+ }
+
+ void createType(StatisticsFactory statFactory, TestStatisticsType testType)
+ {
+ StatisticDescriptor[] statDescriptorArr = new StatisticDescriptor[6];
+
+ statDescriptorArr[0] = statFactory.CreateIntCounter("IntCounter",
+ "Test Statistic Descriptor int_t Counter.","TestUnit");
+
+ statDescriptorArr[1] = statFactory.CreateIntGauge("IntGauge",
+ "Test Statistic Descriptor int_t Gauge.","TestUnit");
+
+ statDescriptorArr[2] = statFactory.CreateLongCounter("LongCounter",
+ "Test Statistic Descriptor Long Counter.","TestUnit");
+
+ statDescriptorArr[3] = statFactory.CreateLongGauge("LongGauge",
+ "Test Statistic Descriptor Long Gauge.","TestUnit");
+
+ statDescriptorArr[4] = statFactory.CreateDoubleCounter("DoubleCounter",
+ "Test Statistic Descriptor Double Counter.","TestUnit");
+
+ statDescriptorArr[5] = statFactory.CreateDoubleGauge("DoubleGauge",
+ "Test Statistic Descriptor Double Gauge.","TestUnit");
+
+ StatisticsType statsType = statFactory.CreateType("TestStatsType",
+ "Statistics for Unit Test.",statDescriptorArr, 6);
+
+ Assert.IsNotNull(statsType, "Error in creating Stats Type");
+
+ testType.testStatsType = statsType;
+ testType.statIdIntCounter = statsType.NameToId("IntCounter");
+ testType.statIdIntGauge = statsType.NameToId("IntGauge");
+ testType.statIdLongCounter = statsType.NameToId("LongCounter");
+ testType.statIdLongGauge = statsType.NameToId("LongGauge");
+ testType.statIdDoubleCounter = statsType.NameToId("DoubleCounter");
+ testType.statIdDoubleGauge = statsType.NameToId("DoubleGauge");
+
+ StatisticsType statsType1 = statFactory.CreateType("TestStatsType1",
+ "Statistics for Unit Test", statDescriptorArr, 6);
+ testType.testStatsType = statsType1;
+
+ /* Test Find */
+ Assert.IsNotNull(statFactory.FindType("TestStatsType"),"stat not found");
+ Assert.IsNotNull(statFactory.FindType("TestStatsType1"), "stat not found");
+ Assert.IsNull(statFactory.FindType("TestStatsType2"),"stat not to be found");
+ }
+
+ void testGetSetIncFunctions(Statistics stat, TestStatisticsType type )
+ {
+ /* Set a initial value = 10 */
+ stat.SetInt(type.statIdIntCounter, 10);
+ stat.SetInt(type.statIdIntGauge, 10);
+ stat.SetLong(type.statIdLongCounter, 10);
+ stat.SetLong(type.statIdLongGauge, 10);
+ stat.SetDouble(type.statIdDoubleCounter, 10.0);
+ stat.SetDouble(type.statIdDoubleGauge, 10.0);
+ Util.Log(" Setting Initial Value Complete");
+
+ /* Check Initial Value = 10*/
+ Assert.AreEqual(10, stat.GetInt(type.statIdIntCounter), " Check1 1 Failed ");
+ Assert.AreEqual(10, stat.GetInt(type.statIdIntGauge), " Check1 2 Failed ");
+ Assert.AreEqual(10, stat.GetLong(type.statIdLongCounter), " Check1 3 Failed ");
+ Assert.AreEqual(10, stat.GetLong(type.statIdLongGauge), " Check1 4 Failed ");
+ Assert.AreEqual(10.0, stat.GetDouble(type.statIdDoubleCounter), " Check1 5 Failed ");
+ Assert.AreEqual(10.0, stat.GetDouble(type.statIdDoubleGauge), " Check1 6 Failed ");
+ Util.Log(" All Set() were correct.");
+
+ /* Increment single thread for 100 times */
+ for ( int incIdx = 0 ; incIdx < 100 ; incIdx++ ) {
+ stat.IncInt(type.statIdIntCounter, 1);
+ stat.IncInt(type.statIdIntGauge, 1);
+ stat.IncLong(type.statIdLongCounter, 1);
+ stat.IncLong(type.statIdLongGauge, 1);
+ stat.IncDouble(type.statIdDoubleCounter, 1.0);
+ stat.IncDouble(type.statIdDoubleGauge, 1.0);
+ Thread.Sleep(10);
+ }
+ Util.Log(" Incremented 100 times by 1.");
+
+ /* Check Incremented Value = 110 */
+ Assert.AreEqual(110, stat.GetInt(type.statIdIntCounter), " Check2 1 Failed ");
+ Assert.AreEqual(110, stat.GetInt(type.statIdIntGauge), " Check2 2 Failed ");
+ Assert.AreEqual(110, stat.GetLong(type.statIdLongCounter), " Check2 3 Failed ");
+ Assert.AreEqual(110, stat.GetLong(type.statIdLongGauge), " Check2 4 Failed ");
+ Assert.AreEqual(110.0, stat.GetDouble(type.statIdDoubleCounter), " Check2 5 Failed ");
+ Assert.AreEqual(110.0, stat.GetDouble(type.statIdDoubleGauge), " Check2 6 Failed ");
+ Util.Log(" Single thread Inc() Passed.");
+
+ IncThread[] myThreads = new IncThread[10];
+ Thread[] thread = new Thread[10];
+
+ for (int i = 0; i < 10; i++)
+ {
+ myThreads[i] = new IncThread(stat, type);
+ thread[i] = new Thread(new ThreadStart(myThreads[i].ThreadOperation));
+ thread[i].Start();
+ }
+ Thread.Sleep(1000);
+ for (int i = 0; i < 10; i++)
+ {
+ thread[i].Join();
+ }
+
+ /* Check Final Value = 10,110 */
+ Assert.AreEqual(10110, stat.GetInt(type.statIdIntCounter), " Check2 1 Failed ");
+ Assert.AreEqual(10110, stat.GetInt(type.statIdIntGauge), " Check2 2 Failed ");
+ Assert.AreEqual(10110, stat.GetLong(type.statIdLongCounter), " Check2 3 Failed ");
+ Assert.AreEqual(10110, stat.GetLong(type.statIdLongGauge), " Check2 4 Failed ");
+ Assert.AreEqual(10110.0, stat.GetDouble(type.statIdDoubleCounter), " Check2 5 Failed ");
+ Assert.AreEqual(10110.0, stat.GetDouble(type.statIdDoubleGauge), " Check2 6 Failed ");
+ Util.Log(" Parallel Inc() Passed.");
+
+ /* Check value of Gauge type */
+ stat.SetInt(type.statIdIntGauge, 50);
+ stat.SetDouble(type.statIdDoubleGauge, 50.0);
+ stat.SetLong(type.statIdLongGauge, 50);
+
+ Assert.AreEqual(50, stat.GetInt(type.statIdIntGauge), " Check3 1 Failed");
+ Assert.AreEqual(50, stat.GetLong(type.statIdLongGauge), "Check3 2 Failed");
+ Assert.AreEqual(50.0, stat.GetDouble(type.statIdDoubleGauge), "Check3 3 Failed");
+ }
+
+ void statisticsTest()
+ {
+
+ }
+
+ #endregion
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientStringArrayTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientStringArrayTestsN.cs b/clicache/integration-test/ThinClientStringArrayTestsN.cs
new file mode 100644
index 0000000..6294bb0
--- /dev/null
+++ b/clicache/integration-test/ThinClientStringArrayTestsN.cs
@@ -0,0 +1,232 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+
+ public class ThinClientStringArrayTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+ "Portfolios3" };
+ private static string QERegionName = "Portfolios";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ m_client1.Call(InitClient);
+ m_client2.Call(InitClient);
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTest();
+ }
+
+
+ public void InitClient()
+ {
+ CacheHelper.Init();
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ignore since we run multiple incarnations of client in same process
+ }
+ }
+ public void StepOne(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+ region.CreateSubRegion(QueryRegionNames[1], regattrs);
+ }
+
+ public void StepTwo()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+ IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+ IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+
+ string[] cnm = { "C#aaa", "C#bbb", "C#ccc", "C#ddd" };
+ //CacheableStringArray cnm = CacheableStringArray.Create(sta);
+ qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets, 1, cnm);
+ qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets, 1, cnm);
+ qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets, 1, cnm);
+ }
+
+ public void StepTwoQT()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ string[] /*sta*/ cnm = { "C#aaa", "C#bbb", "C#ccc", "C#ddd" };
+ //CacheableStringArray cnm = CacheableStringArray.Create(sta);
+ qh.PopulatePortfolioData(region0, 4, 2, 2, cnm);
+ qh.PopulatePositionData(subRegion0, 4, 2);
+ }
+
+ public void StepOneQE(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ string[] /*sta*/ cnm = { "C#aaa", "C#bbb", "C#ccc", "C#ddd" };
+ //CacheableStringArray cnm = CacheableStringArray.Create(sta);
+ Portfolio p1 = new Portfolio(1, 2, cnm);
+ Portfolio p2 = new Portfolio(2, 2, cnm);
+ Portfolio p3 = new Portfolio(3, 2, cnm);
+ Portfolio p4 = new Portfolio(4, 2, cnm);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ Query<object> qry = qs.NewQuery("select * from /" + QERegionName + " p where p.ID!=3");
+ ISelectResults<object> results = qry.Execute();
+ Util.Log("Results size {0}.", results.Size);
+
+ SelectResultsIterator<object> iter = results.GetIterator();
+
+ while (iter.HasNext)
+ {
+ /*IGeodeSerializable*/ object item = iter.Next();
+ Portfolio port = item as Portfolio;
+ if (port == null)
+ {
+ Position pos = item as Position;
+ if (pos == null)
+ {
+ //CacheableString cs = item as CacheableString;
+ string cs = item as string;
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+
+ void runStringArrayTest()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwo);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepOneQE, CacheHelper.Locators);
+ Util.Log("StepOneQE complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ [Test]
+ public void StringArrayTest()
+ {
+ runStringArrayTest();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/Timeouts.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/Timeouts.xml b/clicache/integration-test/Timeouts.xml
new file mode 100644
index 0000000..458a175
--- /dev/null
+++ b/clicache/integration-test/Timeouts.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ 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.
+-->
+
+<Settings timeout="1800">
+ <ClientServerTests>
+ <BigValue timeout="2700" />
+ </ClientServerTests>
+ <PutGetTests>
+ <CheckPutGet timeout="4200" />
+ </PutGetTests>
+ <ThinClientRegionTests>
+ <CheckPutGet timeout="4200" />
+ </ThinClientRegionTests>
+ <ThinClientQueryTests>
+ <QueryTimeout timeout="4200" />
+ </ThinClientQueryTests>
+ <ThinClientDurableTests>
+ <DurableAndNonDurableBasic timeout="4200" />
+ </ThinClientDurableTests>
+ <ThinClientSecurityAuthzTests>
+ <AllOpsWithFailover timeout="4800" />
+ </ThinClientSecurityAuthzTests>
+ <ThinClientSecurityAuthzTestsMU>
+ <AllOpsWithFailover timeout="4800" />
+ </ThinClientSecurityAuthzTestsMU>
+</Settings>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/UnitTests.csproj.in
----------------------------------------------------------------------
diff --git a/clicache/integration-test/UnitTests.csproj.in b/clicache/integration-test/UnitTests.csproj.in
new file mode 100644
index 0000000..a670c9c
--- /dev/null
+++ b/clicache/integration-test/UnitTests.csproj.in
@@ -0,0 +1,627 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+-->
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <CMAKE_SOURCE_DIR>${CMAKE_SOURCE_DIR_NATIVE}</CMAKE_SOURCE_DIR>
+ <CMAKE_CURRENT_SOURCE_DIR>${CMAKE_CURRENT_SOURCE_DIR_NATIVE}</CMAKE_CURRENT_SOURCE_DIR>
+ <CMAKE_BINARY_DIR>${CMAKE_BINARY_DIR_NATIVE}</CMAKE_BINARY_DIR>
+ <CMAKE_CURRENT_BINARY_DIR>${CMAKE_CURRENT_BINARY_DIR_NATIVE}</CMAKE_CURRENT_BINARY_DIR>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x64</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CC6D226A-1DFF-31D1-89D1-D99420F6AF72}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Apache.Geode.Client.UnitTests</RootNamespace>
+ <AssemblyName>UnitTests</AssemblyName>
+ <TargetFrameworkVersion>${DOTNET_TARGET_FRAMEWORK_VERSION}</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <IntermediateOutputPath>Debug</IntermediateOutputPath>
+ <OutputPath>Debug</OutputPath>
+ <Optimize>false</Optimize>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ <NoWarn>618</NoWarn>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <IntermediateOutputPath>Release</IntermediateOutputPath>
+ <OutputPath>Release</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <NoWarn>618</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <DebugSymbols>true</DebugSymbols>
+ <Optimize>false</Optimize>
+ <IntermediateOutputPath>Debug</IntermediateOutputPath>
+ <OutputPath>Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoWarn>618</NoWarn>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <IntermediateOutputPath>Release</IntermediateOutputPath>
+ <OutputPath>Release</OutputPath>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <NoWarn>618</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>${STRONG_NAME_KEY_ENABLED}</SignAssembly>
+ <AssemblyOriginatorKeyFile>${STRONG_NAME_KEY}</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework">
+ <HintPath>${NUNIT}\bin\framework\nunit.framework.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Management" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\PortfolioPdx.cs">
+ <Link>PortfolioPdx.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\PositionPdx.cs">
+ <Link>PositionPdx.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\QueryHelper\QueryHelperN.cs">
+ <Link>QueryHelperN.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\Portfolio.cs">
+ <Link>Portfolio.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\Position.cs">
+ <Link>Position.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\SimpleCacheListener.cs">
+ <Link>SimpleCacheListener.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\AssemblyInfo.cs">
+ <Link>AssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\DataOutputTests.cs">
+ <Link>DataOutputTests.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\DefaultCacheableN.cs">
+ <Link>DefaultCacheableN.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyListener.cs">
+ <Link>TallyListener.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyResolverN.cs">
+ <Link>TallyResolverN.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyWriter.cs">
+ <Link>TallyWriter.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCallbackArgN.cs">
+ <Link>ThinClientCallbackArgN.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientDurableCqTestsN.cs">
+ <Link>ThinClientDurableCqTestsN.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientPdxTests.cs">
+ <Link>ThinClientPdxTests.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\AttributesFactoryTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\AttributesMutatorTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheHelperN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\CachelessTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\DistOpsStepsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\PutGetTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\RegionWrapperN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\SecurityTestUtilN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyListenerN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyLoaderN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\TallyWriterN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRegionStepsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRegionTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\UnitTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientRegionInterestTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientStatisticTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthTestsMUN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthzTestBaseN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthzTestsMUN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientSecurityAuthzTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientQueryTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientAppDomainQueryTests.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientAppDomainFunctionExecutionTests.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\BuiltinCacheableWrappersN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheableWrapperN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\DupListenerN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\RegionOperationN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientFunctionExecutionTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientHARegionTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientListenerWriterN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientPoolTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\DurableListenerN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientDurableTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ExpirationTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\OverflowTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\SerializationTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientConflationTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCqIRTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCqTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientStringArrayTestsN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCSTXN.cs" />
+ <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientDeltaTestN.cs" />
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\DeltaTestImpl.cs">
+ <Link>DeltaTestImpl.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\TestObject1.cs">
+ <Link>TestObject1.cs</Link>
+ </Compile>
+ <Compile Include="$(CMAKE_SOURCE_DIR)\tests\cli\NewTestObject\DeltaEx.cs">
+ <Link>DeltaEx.cs</Link>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(CMAKE_CURRENT_SOURCE_DIR)\geode.properties.mixed">
+ <Link>geode.properties.mixed</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(CMAKE_CURRENT_SOURCE_DIR)\geode.properties.nativeclient">
+ <Link>geode.properties.nativeclient</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="$(CMAKE_CURRENT_SOURCE_DIR)\system.properties">
+ <Link>system.properties</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Include="authz5_5.dtd" />
+ <None Include="cdb.pl" />
+ <None Include="runCSFunctions.sh" />
+ <None Include="runCSTests.sh" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription_forDoc.xml">
+ <Link>cacheserver_notify_subscription_forDoc.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_partitioned.xml">
+ <Link>cacheserver1_partitioned.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_TradeKey.xml">
+ <Link>cacheserver1_TradeKey.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2_partitioned.xml">
+ <Link>cacheserver2_partitioned.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2_TradeKey.xml">
+ <Link>cacheserver2_TradeKey.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver3_TradeKey.xml">
+ <Link>cacheserver3_TradeKey.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverDurableCqs.xml">
+ <Link>cacheserverDurableCqs.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_pdxinstance_hashcode.xml">
+ <Link>cacheserver_pdxinstance_hashcode.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_servergroup.xml">
+ <Link>cacheserver_servergroup.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_servergroup2.xml">
+ <Link>cacheserver_servergroup2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\client_generics_plugins.xml">
+ <Link>client_generics_plugins.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\client_pdx.xml">
+ <Link>client_pdx.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\Settings.xml">
+ <Link>Settings.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\Timeouts.xml">
+ <Link>Timeouts.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\valid_overflowAttr.xml">
+ <Link>valid_overflowAttr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver.xml">
+ <Link>cacheserver.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverPdxSerializer.xml">
+ <Link>cacheserverPdxSerializer.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheServer_pdxreadserialized.xml">
+ <Link>cacheServer_pdxreadserialized.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverPdx2.xml">
+ <Link>cacheserverPdx2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverForPdx.xml">
+ <Link>cacheserverForPdx.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverMDS1.xml">
+ <Link>cacheserverMDS1.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverMDS2.xml">
+ <Link>cacheserverMDS2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserverPdx.xml">
+ <Link>cacheserverPdx.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_expiry.xml">
+ <Link>cacheserver1_expiry.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_fpr.xml">
+ <Link>cacheserver1_fpr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_pool.xml">
+ <Link>cacheserver1_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver1_pr.xml">
+ <Link>cacheserver1_pr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2.xml">
+ <Link>cacheserver2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2_fpr.xml">
+ <Link>cacheserver2_fpr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2_pool.xml">
+ <Link>cacheserver2_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver2_pr.xml">
+ <Link>cacheserver2_pr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver3.xml">
+ <Link>cacheserver3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver3_fpr.xml">
+ <Link>cacheserver3_fpr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver3_pool.xml">
+ <Link>cacheserver3_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver3_pr.xml">
+ <Link>cacheserver3_pr.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_conflation.xml">
+ <Link>cacheserver_conflation.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_hashcode.xml">
+ <Link>cacheserver_hashcode.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_interest_notify.xml">
+ <Link>cacheserver_interest_notify.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription.xml">
+ <Link>cacheserver_notify_subscription.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription2.xml">
+ <Link>cacheserver_notify_subscription2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription3.xml">
+ <Link>cacheserver_notify_subscription3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription4.xml">
+ <Link>cacheserver_notify_subscription4.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription5.xml">
+ <Link>cacheserver_notify_subscription5.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription5N.xml">
+ <Link>cacheserver_notify_subscription5N.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_notify_subscription6.xml">
+ <Link>cacheserver_notify_subscription6.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_pool_client.xml">
+ <Link>cacheserver_pool_client.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_remoteoql.xml">
+ <Link>cacheserver_remoteoql.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_remoteoql2.xml">
+ <Link>cacheserver_remoteoql2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_remoteoqlN.xml">
+ <Link>cacheserver_remoteoqlN.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_remoteoql2N.xml">
+ <Link>cacheserver_remoteoql2N.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_with_delta.xml">
+ <Link>cacheserver_with_delta.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_with_deltaAD.xml">
+ <Link>cacheserver_with_deltaAD.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cacheserver_with_delta_test_impl.xml">
+ <Link>cacheserver_with_delta_test_impl.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheServPoolRedun1.xml">
+ <Link>CacheServPoolRedun1.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheServPoolRedun2.xml">
+ <Link>CacheServPoolRedun2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\CacheServPoolRedun3.xml">
+ <Link>CacheServPoolRedun3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cache_redundancy.xml">
+ <Link>cache_redundancy.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\client_pool.xml">
+ <Link>client_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache1.xml">
+ <Link>invalid_cache1.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache2.xml">
+ <Link>invalid_cache2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache3.xml">
+ <Link>invalid_cache3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache_pool.xml">
+ <Link>invalid_cache_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache_pool2.xml">
+ <Link>invalid_cache_pool2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache_pool3.xml">
+ <Link>invalid_cache_pool3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_cache_pool4.xml">
+ <Link>invalid_cache_pool4.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_overflowAttr1.xml">
+ <Link>invalid_overflowAttr1.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_overflowAttr2.xml">
+ <Link>invalid_overflowAttr2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\invalid_overflowAttr3.xml">
+ <Link>invalid_overflowAttr3.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\regionquery_diffconfig.xml">
+ <Link>regionquery_diffconfig.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\regionquery_diffconfig2.xml">
+ <Link>regionquery_diffconfig2.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\regionquery_diffconfigN.xml">
+ <Link>regionquery_diffconfigN.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\regionquery_diffconfig2N.xml">
+ <Link>regionquery_diffconfig2N.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\remotequery.xml">
+ <Link>remotequery.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\remotequeryN.xml">
+ <Link>remotequeryN.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\cqqueryfailover.xml">
+ <Link>cqqueryfailover.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\serverDurableClient.xml">
+ <Link>serverDurableClient.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\valid_cache.xml">
+ <Link>valid_cache.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\valid_cache_pool.xml">
+ <Link>valid_cache_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\multi_get_function_server.xml">
+ <Link>multi_get_function_server.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\func_cacheserver1_pool.xml">
+ <Link>func_cacheserver1_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\func_cacheserver2_pool.xml">
+ <Link>func_cacheserver2_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\func_cacheserver3_pool.xml">
+ <Link>func_cacheserver3_pool.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\client_server_persistent_transactions.xml">
+ <Link>client_server_persistent_transactions.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\client_server_transactions.xml">
+ <Link>client_server_transactions.xml</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\CMakeLists.txt"/>
+ <Content Include="$(CMAKE_CURRENT_SOURCE_DIR)\UnitTests.csproj.in"/>
+ <Content Include="authz-dummy.xml" />
+ <Content Include="authz-ldap.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\plugins\SQLiteCLI\SQLiteCLI.csproj">
+ <Project>{FF9597E3-A4DD-4FDE-871D-B0C66088762F}</Project>
+ <Name>SQLiteCLI</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\clicache\src\Apache.Geode.vcxproj">
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\DUnitFramework\DUnitFramework.csproj">
+ <Project>{796727E8-3A6A-46BE-A2DB-584A4774CD51}</Project>
+ <Name>DUnitFramework</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\FwkClient\FwkClient.csproj">
+ <Project>{9EFAA401-B5D1-4592-A2FF-0972C776FF6A}</Project>
+ <Name>FwkClient</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\PdxClassLibrary\PdxClassLibrary.csproj">
+ <Project>{10613802-A371-4C27-8F66-CE79BFCAC3F2}</Project>
+ <Name>PdxClassLibrary</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\PdxVersion1Lib\PdxVersion1Lib.csproj">
+ <Project>{97F9965D-6B3D-44F6-92B3-5880A3C7178E}</Project>
+ <Name>PdxVersion1Lib</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\PdxVersion2Lib\PdxVersion2Lib.csproj">
+ <Project>{5055633B-6D1C-488D-B934-1AC482C915F7}</Project>
+ <Name>PdxVersion2Lib</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\QueryHelper\QueryWrapper.vcxproj">
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
+ <Name>QueryWrapper</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(CMAKE_BINARY_DIR)\tests\cli\SecurityUtil\SecurityUtil.csproj">
+ <Project>{29CFC13C-1D6C-4FE8-B56E-A5E7BA7F849F}</Project>
+ <Name>SecurityUtil</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/UnitTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/UnitTestsN.cs b/clicache/integration-test/UnitTestsN.cs
new file mode 100644
index 0000000..2650e2a
--- /dev/null
+++ b/clicache/integration-test/UnitTestsN.cs
@@ -0,0 +1,180 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using System.IO;
+
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ /// <summary>
+ /// Setup the test parameters including logfile, timebomb and timeout settings.
+ /// Also close the cache for each client in teardown.
+ /// </summary>
+ public abstract class UnitTests : DUnitTestClass
+ {
+ protected virtual string ExtraPropertiesFile
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ protected DateTime m_startTime;
+ protected DateTime m_endTime;
+
+ protected override void SetLogging(string logFile)
+ {
+ base.SetLogging(logFile);
+ CacheHelper.SetLogging();
+ }
+
+ protected override void SetClientLogging(ClientBase[] clients, string logFile)
+ {
+ base.SetClientLogging(clients, logFile);
+ if (clients != null)
+ {
+ foreach (ClientBase client in clients)
+ {
+ client.Call(CacheHelper.SetLogging);
+ }
+ }
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ string extraPropsFile = ExtraPropertiesFile;
+ if (extraPropsFile != null)
+ {
+ CacheHelper.SetExtraPropertiesFile(extraPropsFile);
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ client.Call(CacheHelper.SetExtraPropertiesFile, extraPropsFile);
+ }
+ }
+ }
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ string coverageXMLs = string.Empty;
+ string startDir = null;
+ bool hasCoverage = "true".Equals(Environment.GetEnvironmentVariable(
+ "COVERAGE_ENABLED"));
+ try
+ {
+ CacheHelper.SetExtraPropertiesFile(null);
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ try
+ {
+ client.Call(CacheHelper.Close);
+ }
+ catch (System.Runtime.Remoting.RemotingException)
+ {
+ }
+ catch (System.Net.Sockets.SocketException)
+ {
+ }
+ if (hasCoverage)
+ {
+ coverageXMLs = coverageXMLs + " coverage-" + client.ID + ".xml";
+ startDir = client.StartDir;
+ }
+ }
+ }
+ CacheHelper.Close();
+ }
+ finally
+ {
+ base.EndTests();
+ }
+ // merge ncover output
+ if (coverageXMLs.Length > 0)
+ {
+ string mergedCoverage = "merged-coverage.xml";
+ string mergedCoverageTmp = "merged-coverage-tmp.xml";
+ System.Diagnostics.Process mergeProc;
+ if (File.Exists(mergedCoverage))
+ {
+ coverageXMLs = coverageXMLs + " " + mergedCoverage;
+ }
+ //Console.WriteLine("Current directory: " + Environment.CurrentDirectory + "; merging: " + coverageXMLs);
+ if (!Util.StartProcess("ncover.reporting.exe", coverageXMLs + " //s "
+ + mergedCoverageTmp, Util.LogFile == null, startDir,
+ true, true, true, out mergeProc))
+ {
+ Assert.Fail("FATAL: Could not start ncover.reporting");
+ }
+ if (!mergeProc.WaitForExit(UnitProcess.MaxEndWaitMillis)
+ && !mergeProc.HasExited)
+ {
+ mergeProc.Kill();
+ }
+ File.Delete(mergedCoverage);
+ File.Move(mergedCoverageTmp, mergedCoverage);
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ File.Delete("coverage-" + client.ID + ".xml");
+ }
+ }
+ }
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.EndTest();
+ base.EndTest();
+ }
+
+ public void StartTimer()
+ {
+ m_startTime = DateTime.Now;
+ }
+
+ public TimeSpan StopTimer()
+ {
+ m_endTime = DateTime.Now;
+ return (m_endTime - m_startTime);
+ }
+
+ public void LogTaskTiming(ClientBase client, string taskName, int numOps)
+ {
+ StopTimer();
+ TimeSpan elapsed = m_endTime - m_startTime;
+ Util.Log("{0}Time taken for task [{1}]: {2}ms {3}ops/sec{4}",
+ Util.MarkerString, taskName, elapsed.TotalMilliseconds,
+ (numOps * 1000) / elapsed.TotalMilliseconds, Util.MarkerString);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cache.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cache.xml b/clicache/integration-test/cache.xml
new file mode 100644
index 0000000..906ce04
--- /dev/null
+++ b/clicache/integration-test/cache.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+</client-cache>
+
[47/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/CacheHelperN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheHelperN.cs b/clicache/integration-test/CacheHelperN.cs
new file mode 100644
index 0000000..5824fd7
--- /dev/null
+++ b/clicache/integration-test/CacheHelperN.cs
@@ -0,0 +1,2460 @@
+/*
+ * 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.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using System.Management;
+
+ public class PropsStringToObject
+ {
+ public PropsStringToObject(Properties<string, object> target)
+ {
+ m_target = target;
+ }
+
+ public void Visit(string key, string val)
+ {
+ if (key == "security-signature")
+ {
+ Util.Log("VJR: Got SIG as " + val);
+ string[] stringbytes = val.Split(' ');
+ byte[] credentialbytes = new byte[stringbytes.Length - 1];
+ int position = 0;
+ foreach (string item in stringbytes)
+ {
+ Util.Log("VJR: Parsing byte " + item);
+ if (string.IsNullOrEmpty(item)) continue;
+ credentialbytes[position++] = byte.Parse(item);
+ }
+ m_target.Insert(key, credentialbytes);
+ }
+ else
+ {
+ m_target.Insert(key, val);
+ }
+ }
+
+ private Properties<string, object> m_target;
+ }
+
+ public class PutGetTestsAD : MarshalByRefObject
+ {
+ private static string m_regionName;
+ private static PutGetTests m_putGetTestInstance = new PutGetTests();
+
+ public int InitKeys(UInt32 typeId, int numKeys, int maxSize)
+ {
+ return m_putGetTestInstance.InitKeys(typeId, numKeys, maxSize);
+ }
+
+ public void InitValues(UInt32 typeId, int numValues, int maxSize)
+ {
+ m_putGetTestInstance.InitValues(typeId, numValues, maxSize);
+ }
+
+ public void DoPuts()
+ {
+ m_putGetTestInstance.DoPuts();
+ }
+
+ public void DoKeyChecksumPuts()
+ {
+ m_putGetTestInstance.DoKeyChecksumPuts();
+ }
+
+ public void DoValChecksumPuts()
+ {
+ m_putGetTestInstance.DoValChecksumPuts();
+ }
+
+ public void DoGetsVerify()
+ {
+ m_putGetTestInstance.DoGetsVerify();
+ }
+
+ public void InvalidateRegion(string regionName)
+ {
+ CacheHelper.InvalidateRegion<object, object>(regionName, true, true);
+ }
+
+ public void DoRunQuery()
+ {
+ m_putGetTestInstance.DoRunQuery();
+ }
+
+ public void SetRegion(string regionName)
+ {
+ m_regionName = regionName;
+ m_putGetTestInstance.SetRegion(regionName);
+ }
+
+ public void DoGets()
+ {
+ m_putGetTestInstance.DoGets();
+ }
+
+ public void pdxPutGet(bool caching, bool readPdxSerialized)
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>(m_regionName);
+ PdxTests.PdxType pt = new PdxTests.PdxType();
+ reg["pi"] = pt;
+
+ object pi = null;
+
+ if (caching)
+ {
+ pi = reg.GetLocalView()["pi"];
+ }
+ else
+ {
+ pi = reg["pi"];
+ }
+
+ if (readPdxSerialized)
+ {
+ int iv = (int)((IPdxInstance)pi).GetField("m_int32");
+ Assert.AreEqual(iv, pt.Int32);
+ }
+ else
+ {
+ Assert.AreEqual(pi, pt);
+ }
+ }
+
+ public void pdxGetPut(bool caching, bool readPdxSerialized)
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxType.CreateDeserializable);
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>(m_regionName);
+ PdxTests.PdxType pt = new PdxTests.PdxType();
+
+ object pi = null;
+
+ if (caching)
+ {
+ pi = reg.GetLocalView()["pi"];
+ }
+ else
+ {
+ pi = reg["pi"];
+ }
+
+ if (readPdxSerialized)
+ {
+ int iv = (int)((IPdxInstance)pi).GetField("m_int32") + 10;
+
+ IWritablePdxInstance wpi = ((IPdxInstance)pi).CreateWriter();
+
+ wpi.SetField("m_int32", iv);
+
+ reg["pi"] = wpi;
+
+ if (caching)
+ {
+ pi = reg.GetLocalView()["pi"];
+ }
+ else
+ {
+ pi = reg["pi"];
+ }
+
+ iv = (int)((IPdxInstance)pi).GetField("m_int32");
+
+ Assert.AreEqual(iv, pt.Int32 + 10);
+ }
+ else
+ {
+ Assert.AreEqual(pi, pt);
+ }
+ }
+ }
+
+ public class CacheHelperWrapper : MarshalByRefObject
+ {
+ public void CreateTCRegions_Pool_AD<TKey, TValue>(string[] regionNames,
+ string locators, string poolName, bool clientNotification, bool ssl, bool caching, bool pdxReadSerialized)
+ {
+ try
+ {
+ Console.WriteLine("creating region1 " + pdxReadSerialized);
+ CacheHelper.PdxReadSerialized = pdxReadSerialized;
+ CacheHelper.CreateTCRegion_Pool_AD<TKey, TValue>(regionNames[0], true, caching,
+ null, locators, poolName, clientNotification, ssl, false);
+ //CacheHelper.CreateTCRegion_Pool(regionNames[1], false, true,
+ //null, endpoints, locators, poolName, clientNotification, ssl, false);
+ // m_regionNames = regionNames;
+ CacheHelper.PdxReadSerialized = false;
+ Util.Log("created region " + regionNames[0]);
+ }
+ catch (AlreadyConnectedException)
+ {
+ Console.WriteLine("Got already connected exception in TEST");
+ Util.Log("Got already connected exception " + regionNames[0]);
+ }
+ }
+
+ public void CallDistrinbutedConnect()
+ {
+ try
+ {
+ //Console.WriteLine(" cakk CallDistrinbutedConnect");
+ CacheHelper.DSConnectAD();
+ }
+ catch (Exception ex)
+ {
+ //Console.WriteLine(" cakk CallDistrinbutedConnect 33");
+ Util.Log(" got AlreadyConnectedException " + ex.Message);
+ }
+ }
+
+ public void RegisterBuiltins(long dtTime)
+ {
+ CacheableHelper.RegisterBuiltinsAD(dtTime);
+ }
+
+ public void InvalidateRegion(string regionName)
+ {
+ CacheHelper.InvalidateRegion<object, object>(regionName, true, true);
+ }
+
+ public void CloseCache()
+ {
+ CacheHelper.Close();
+ }
+
+ public void SetLogFile(string logFileName)
+ {
+ Util.LogFile = logFileName;
+ }
+ }
+
+ /// <summary>
+ /// Helper class to create/destroy Distributed System, cache and regions.
+ /// This class is intentionally not thread-safe.
+ /// </summary>
+ public class CacheHelper
+ {
+ public static string TestDir
+ {
+ get
+ {
+ if (m_testDir == null)
+ {
+ m_testDir = Util.GetEnvironmentVariable("TESTSRC");
+ if (m_testDir == null)
+ {
+ return ".";
+ }
+ }
+ return m_testDir;
+ }
+ }
+
+ public static int HOST_PORT_1;
+ public static int HOST_PORT_2;
+ public static int HOST_PORT_3;
+ public static int HOST_PORT_4;
+
+ public static bool PdxIgnoreUnreadFields = false;
+ public static bool PdxReadSerialized = false;
+
+ public static int LOCATOR_PORT_1;
+ public static int LOCATOR_PORT_2;
+ public static int LOCATOR_PORT_3;
+ public static int LOCATOR_PORT_4;
+
+ #region Private static members and constants
+
+ private static DistributedSystem m_dsys = null;
+ private static bool m_doDisconnect = false;
+ private static Cache m_cache = null;
+ private static IRegionService m_cacheForMultiUser = null;
+ private static IRegion<object, object> m_currRegion = null;
+ private static string m_gfeDir = null;
+ private static string m_gfeLogLevel = null;
+ private static string m_gfeSecLogLevel = null;
+ private static string m_endpoints = null;
+ private static string m_locators = null;
+ private static string m_locatorFirst = null;
+ private static string m_locatorSecond = null;
+ private static string[] m_cacheXmls = null;
+ private static bool m_localServer = true;
+ private static string m_extraPropertiesFile = null;
+
+ private const string DefaultDSName = "dstest";
+ private const string DefaultCacheName = "cachetest";
+
+ private const string JavaServerName = "gfsh.bat";
+ private const string GeodeName = "gfsh.bat";
+ private static int JavaMcastPort = -1;
+ private const string JavaServerStartArgs =
+ "start server --J=-Xmx512m --J=-Xms128m --J=-XX:+UseConcMarkSweepGC --J=-XX:+UseParNewGC --J=-Xss256k --cache-xml-file=";
+ private const string JavaServerStopArgs = "stop server";
+ private const string LocatorStartArgs = "start locator";
+ private const string LocatorStopArgs = "stop locator";
+ private const int LocatorPort = 34755;
+ private const int MaxWaitMillis = 60000;
+ private static char PathSep = Path.DirectorySeparatorChar;
+
+ private static string m_testDir = null;
+ private static Dictionary<int, string> m_runningJavaServers =
+ new Dictionary<int, string>();
+ private static Dictionary<int, string> m_runningLocators =
+ new Dictionary<int, string>();
+ private static CacheTransactionManager m_cstxManager = null;
+ #endregion
+
+ #region Public accessors
+
+ public static IRegion<object, object> CurrentRegion
+ {
+ get
+ {
+ return m_currRegion;
+ }
+ }
+
+ public static DistributedSystem DSYS
+ {
+ get
+ {
+ return m_dsys;
+ }
+ set
+ {
+ m_dsys = value;
+ }
+ }
+ public static CacheTransactionManager CSTXManager
+ {
+ get
+ {
+ return m_cstxManager;
+ }
+ }
+ public static Cache DCache
+ {
+ get
+ {
+ return m_cache;
+ }
+ set
+ {
+ m_cache = value;
+ }
+ }
+
+ public static string Locators
+ {
+ get
+ {
+ return m_locators;
+ }
+ }
+
+ public static string LocatorSecond
+ {
+ get
+ {
+ return m_locatorSecond;
+ }
+ }
+
+ public static string LocatorFirst
+ {
+ get
+ {
+ return m_locatorFirst;
+ }
+ }
+
+ public static string ExtraPropertiesFile
+ {
+ get
+ {
+ return m_extraPropertiesFile;
+ }
+ }
+
+ /*
+ public static QueryService QueryServiceInstance
+ {
+ get
+ {
+ return m_cache.GetQueryService();
+ }
+ }
+ * */
+
+ public const string DefaultRegionName = "regiontest";
+
+ #endregion
+
+ #region Functions to initialize or close a cache and distributed system
+
+ public static void SetLogging()
+ {
+ if (Util.LogFile != null)
+ {
+ string logFile = Regex.Replace(Util.LogFile, "\\....$", string.Empty);
+ LogLevel logLevel;
+ if (Util.CurrentLogLevel != Util.DefaultLogLevel)
+ {
+ logLevel = (LogLevel)Util.CurrentLogLevel;
+ }
+ else
+ {
+ logLevel = Log.Level();
+ }
+ Log.Close();
+ Log.Init(logLevel, logFile);
+ }
+ }
+
+ public static void DSConnectAD()
+ {
+ m_dsys = DistributedSystem.Connect("DSName", null, m_cache);
+ }
+
+ private static void SetLogConfig(ref Properties<string, string> config)
+ {
+ if (Util.LogFile != null)
+ {
+ Log.Close();
+ if (config == null)
+ {
+ config = new Properties<string, string>();
+ }
+ if (Util.LogFile != null && Util.LogFile.Length > 0)
+ {
+ string logFile = Regex.Replace(Util.LogFile, "\\....$", string.Empty);
+ config.Insert("log-file", logFile);
+ }
+ if (Util.CurrentLogLevel != Util.DefaultLogLevel)
+ {
+ config.Insert("log-level", Util.CurrentLogLevel.ToString().ToLower());
+ }
+ }
+ }
+
+ private static void DSConnect(string dsName, Properties<string, string> config)
+ {
+ SetLogConfig(ref config);
+ m_dsys = DistributedSystem.Connect(dsName, config, m_cache);
+ }
+
+ public static void ConnectName(string dsName)
+ {
+ ConnectConfig(dsName, null);
+ }
+
+ public static void ConnectConfig(string dsName, Properties<string, string> config)
+ {
+ DSConnect(dsName, config);
+ }
+
+ public static void Init()
+ {
+ InitConfig(null, null);
+ }
+
+ public static void InitConfig(Properties<string, string> config)
+ {
+ InitConfig(config, null);
+ }
+
+ public static void InitConfigForDurable_Pool(string locators, int redundancyLevel,
+ string durableClientId, int durableTimeout)
+ {
+ InitConfigForDurable_Pool(locators, redundancyLevel, durableClientId, durableTimeout, 1);
+ }
+
+ public static void InitConfigForDurable_Pool(string locators, int redundancyLevel,
+ string durableClientId, int durableTimeout, int ackInterval)
+ {
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("durable-client-id", durableClientId);
+ config.Insert("durable-timeout", durableTimeout.ToString());
+ InitConfig(config, null);
+ CreatePool<object, object>("__TESTPOOL1_", locators, (string)null, redundancyLevel, true,
+ ackInterval, 300);
+ }
+
+ public static void InitConfigForDurable_Pool2(string locators, int redundancyLevel,
+ string durableClientId, int durableTimeout, int ackInterval, string poolName)
+ {
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("durable-client-id", durableClientId);
+ config.Insert("durable-timeout", durableTimeout.ToString());
+ InitConfig(config, null);
+ CreatePool<object, object>(poolName, locators, (string)null, redundancyLevel, true,
+ ackInterval, 300);
+ }
+
+ public static void InitConfigForConflation(string durableClientId, string conflation)
+ {
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("durable-client-id", durableClientId);
+ config.Insert("durable-timeout", "300");
+ config.Insert("notify-ack-interval", "1");
+ if (conflation != null && conflation.Length > 0)
+ {
+ config.Insert("conflate-events", conflation);
+ }
+ InitConfig(config, null);
+ }
+
+ static int m_heapLimit = -1;
+ static int m_delta = -1;
+ static public void SetHeapLimit(int maxheaplimit, int delta)
+ {
+ m_heapLimit = maxheaplimit;
+ m_delta = delta;
+ }
+
+ static public void UnsetHeapLimit()
+ {
+ m_heapLimit = -1;
+ m_delta = -1;
+ }
+
+ public static void InitConfigForConflation_Pool(string locators,
+ string durableClientId, string conflation)
+ {
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("durable-client-id", durableClientId);
+ config.Insert("durable-timeout", "300");
+ config.Insert("notify-ack-interval", "1");
+ if (conflation != null && conflation.Length > 0)
+ {
+ config.Insert("conflate-events", conflation);
+ }
+ InitConfig(config, null);
+ CreatePool<object, object>("__TESTPOOL1_", locators, (string)null, 0, true);
+ }
+
+ public static void InitConfig(string cacheXml)
+ {
+ InitConfig(null, cacheXml);
+ }
+
+ public static void InitConfig(Properties<string, string> config, string cacheXml)
+ {
+ //Console.WriteLine(" in InitConfig1 " + System.AppDomain.CurrentDomain.Id);
+ if (cacheXml != null)
+ {
+ string duplicateXMLFile = Util.Rand(3536776).ToString() + cacheXml;
+ createDuplicateXMLFile(cacheXml, duplicateXMLFile);
+ cacheXml = duplicateXMLFile;
+ }
+ if (config == null)
+ {
+ config = new Properties<string, string>();
+ }
+ if (m_extraPropertiesFile != null)
+ {
+ config.Load(m_extraPropertiesFile);
+ }
+
+ if (m_cache == null || m_cache.IsClosed)
+ {
+
+ try
+ {
+ CacheHelper.m_doDisconnect = false;
+ config.Insert("enable-time-statistics", "true");
+ SetLogConfig(ref config);
+
+ if (m_heapLimit != -1)
+ config.Insert("heap-lru-limit", m_heapLimit.ToString());
+ if (m_delta != -1)
+ config.Insert("heap-lru-delta", m_delta.ToString());
+ config.Insert("enable-time-statistics", "true");
+
+ CacheFactory cf = CacheFactory.CreateCacheFactory(config);
+
+ if (cacheXml != null && cacheXml.Length > 0)
+ {
+ cf = cf.Set("cache-xml-file", cacheXml);
+ }
+
+ m_cache = cf
+ .SetPdxIgnoreUnreadFields(PdxIgnoreUnreadFields)
+ .SetPdxReadSerialized(PdxReadSerialized)
+ .Create();
+
+ PdxIgnoreUnreadFields = false; //reset so next test will have default value
+ PdxReadSerialized = false;
+ }
+ catch (CacheExistsException)
+ {
+ m_cache = CacheFactory.CreateCacheFactory(config).Create();
+ }
+ }
+
+ m_dsys = m_cache.DistributedSystem;
+ m_cstxManager = m_cache.CacheTransactionManager;
+ }
+
+ public static void SetExtraPropertiesFile(string fName)
+ {
+ m_extraPropertiesFile = fName;
+ }
+
+ public static void InitClient()
+ {
+ CacheHelper.Close();
+ Properties<string, string> config = new Properties<string, string>();
+ config.Load("geode.properties");
+ CacheHelper.InitConfig(config);
+ }
+
+ public static void Close()
+ {
+ Util.Log("in cache close : " + System.Threading.Thread.GetDomainID());
+ //if (DistributedSystem.IsConnected)
+ {
+ CloseCache();
+ if (m_doDisconnect)
+ {
+ // DistributedSystem.Disconnect();
+ }
+ }
+ m_dsys = null;
+ m_cacheForMultiUser = null;
+ }
+
+
+ public static void CloseUserCache(bool keepAlive)
+ {
+ //TODO: need to look
+ m_cacheForMultiUser.Close();
+ }
+
+ public static void CloseCache()
+ {
+ Util.Log("A CloseCache " + (m_cache != null ? m_cache.IsClosed.ToString() : "cache is closed"));
+ if (m_cache != null && !m_cache.IsClosed)
+ {
+ m_cache.Close();
+ }
+ m_cache = null;
+ }
+
+ public static void CloseKeepAlive()
+ {
+ CloseCacheKeepAlive();
+ m_dsys = null;
+ }
+
+ public static void CloseCacheKeepAlive()
+ {
+ if (m_cache != null && !m_cache.IsClosed)
+ {
+ m_cache.Close(true);
+ }
+ m_cache = null;
+ }
+
+ public static void ReadyForEvents()
+ {
+ if (m_cache != null && !m_cache.IsClosed)
+ {
+ m_cache.ReadyForEvents();
+ }
+ }
+
+ #endregion
+
+ #region Functions to create or destroy a region
+
+ public static IRegion<TKey, TValue> CreateRegion<TKey, TValue>(string name, Apache.Geode.Client.RegionAttributes<TKey, TValue> attrs)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ //region = m_cache.CreateRegion(name, attrs);
+ region = m_cache.CreateRegionFactory(RegionShortcut.LOCAL).Create<TKey, TValue>(name);
+ Assert.IsNotNull(region, "IRegion<object, object> was not created.");
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+
+ public static IRegion<TKey, TValue> CreateExpirationRegion<TKey, TValue>(
+ string name, string poolname, ExpirationAction action, int entryTimeToLive)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY)
+ .SetEntryTimeToLive(action, (uint)entryTimeToLive).SetPoolName(poolname).Create<TKey, TValue>(name);
+ Assert.IsNotNull(region, "IRegion<object, object> was not created.");
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateLocalRegionWithETTL<TKey, TValue>(
+ string name, ExpirationAction action, int entryTimeToLive)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.LOCAL)
+ .SetEntryTimeToLive(action, (uint)entryTimeToLive).Create<TKey, TValue>(name);
+ Assert.IsNotNull(region, "IRegion<object, object> was not created.");
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+ public static void CreateDefaultRegion<TKey, TValue>()
+ {
+ CreatePlainRegion<TKey, TValue>(DefaultRegionName);
+ }
+
+ public static IRegion<TKey, TValue> CreatePlainRegion<TKey, TValue>(string name)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.LOCAL).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+ public static void CreateCachingRegion<TKey, TValue>(string name, bool caching)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.PROXY).SetCachingEnabled(caching).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ }
+
+ public static void CreateDistribRegion<TKey, TValue>(string name, bool ack,
+ bool caching)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetCachingEnabled(caching).SetInitialCapacity(100000).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ }
+
+ public static IRegion<TKey, TValue> CreateDistRegion<TKey, TValue>(string rootName,
+ string name, int size)
+ {
+ Init();
+ CreateCachingRegion<TKey, TValue>(rootName, true);
+ AttributesFactory<TKey, TValue> af = new AttributesFactory<TKey, TValue>();
+ af.SetLruEntriesLimit(0);
+ af.SetInitialCapacity(size);
+ Apache.Geode.Client.RegionAttributes<TKey, TValue> rattrs = af.CreateRegionAttributes();
+ IRegion<TKey, TValue> region = ((Region<TKey, TValue>)m_currRegion).CreateSubRegion(name, rattrs);
+ Assert.IsNotNull(region, "SubRegion {0} was not created.", name);
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateILRegion<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+
+ region = regionFactory.Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateSizeRegion<TKey, TValue>(string name, int size, bool ack,
+ bool caching)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetLruEntriesLimit(0).SetInitialCapacity(size)
+ .SetCachingEnabled(caching).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateLRURegion<TKey, TValue>(string name, uint size)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ region = m_cache.CreateRegionFactory(RegionShortcut.LOCAL_ENTRY_LRU)
+ .SetLruEntriesLimit(size).SetInitialCapacity((int)size)
+ .Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ return region;
+ }
+
+
+ public static IRegion<TradeKey, Object> CreateTCRegion2<TradeKey, Object>(string name, bool ack, bool caching,
+ IPartitionResolver<TradeKey, Object> resolver, string locators, bool clientNotification)
+ {
+ Init();
+ IRegion<TradeKey, Object> region = GetRegion<TradeKey, Object>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);
+
+ regionFactory.SetInitialCapacity(100000);
+ regionFactory.SetCachingEnabled(caching);
+
+ if (resolver != null)
+ {
+ Util.Log("resolver is attached {0}", resolver);
+ regionFactory.SetPartitionResolver(resolver);
+ }
+ else
+ {
+ Util.Log("resolver is null {0}", resolver);
+ }
+
+ PoolFactory poolFactory = m_cache.GetPoolFactory();
+
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ poolFactory.AddLocator(parts[0], int.Parse(parts[1]));
+ Util.Log("AddLocator parts[0] = {0} int.Parse(parts[1]) = {1} ", parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+
+ poolFactory.SetSubscriptionEnabled(clientNotification);
+ poolFactory.Create("__TESTPOOL__", CacheHelper.DCache);
+ region = regionFactory.SetPoolName("__TESTPOOL__").Create<TradeKey, Object>(name);
+
+ Assert.IsNotNull(region, "IRegion<TradeKey, Object> {0} was not created.", name);
+ Util.Log("IRegion<TradeKey, Object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription, 5, 1, 300);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, bool prSingleHop, bool threadLocal = false)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription, -1, 1, 300, false, prSingleHop, threadLocal);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, int numConnections, bool isMultiuserMode)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription, numConnections, 1, 300, isMultiuserMode);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, int numConnections)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription, numConnections, 1, 300);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, int ackInterval, int dupCheckLife)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription,
+ 5, ackInterval, dupCheckLife);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, int numConnections, int ackInterval, int dupCheckLife)
+ {
+ return CreatePool<TKey, TValue>(name, locators, serverGroup, redundancy, subscription, numConnections, ackInterval, 300, false);
+ }
+
+ public static Pool/*<TKey, TValue>*/ CreatePool<TKey, TValue>(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, int numConnections, int ackInterval, int dupCheckLife, bool isMultiuserMode, bool prSingleHop = true, bool threadLocal = false)
+ {
+ Init();
+
+ Pool/*<TKey, TValue>*/ existing = m_cache.GetPoolManager().Find(name);
+
+ if (existing == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ if (serverGroup != null)
+ {
+ fact.SetServerGroup(serverGroup);
+ }
+ fact.SetSubscriptionRedundancy(redundancy);
+ fact.SetSubscriptionEnabled(subscription);
+ fact.SetSubscriptionAckInterval(ackInterval);
+ fact.SetSubscriptionMessageTrackingTimeout(dupCheckLife);
+ fact.SetMultiuserAuthentication(isMultiuserMode);
+ fact.SetPRSingleHopEnabled(prSingleHop);
+ fact.SetThreadLocalConnections(threadLocal);
+ Util.Log("SingleHop set to {0}", prSingleHop);
+ Util.Log("ThreadLocal = {0} ", threadLocal);
+ Util.Log("numConnections set to {0}", numConnections);
+ if (numConnections >= 0)
+ {
+ fact.SetMinConnections(numConnections);
+ fact.SetMaxConnections(numConnections);
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(name, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ return pool;
+ }
+ else
+ {
+ return existing;
+ }
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification)
+ {
+ return CreateTCRegion_Pool(name, ack, caching, listener, locators, poolName,
+ clientNotification, false, false);
+ }
+
+ public static void CreateTCRegion_Pool_AD1(string name, bool ack, bool caching,
+ string locators, string poolName, bool clientNotification, bool cloningEnable)
+ {
+ CreateTCRegion_Pool_AD<object, object>(name, ack, caching, null, locators, poolName, clientNotification, false, cloningEnable);
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool_AD<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled)
+ {
+ if (ssl)
+ {
+ Properties<string, string> sysProps = new Properties<string, string>();
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ InitConfig(sysProps);
+ }
+ else
+ {
+ Properties<string, string> sysProps = new Properties<string, string>();
+ sysProps.Insert("appdomain-enabled", "true");
+
+ InitConfig(sysProps);
+ }
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ if (m_cache.GetPoolManager().Find(poolName) == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(poolName, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000).SetPoolName(poolName).SetCloningEnabled(cloningEnabled)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ region = regionFactory.Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString<TKey, TValue>(region.Attributes));
+ return region;
+ }
+
+ public static void CreateTCRegion_Pool_MDS(string name, bool ack, bool caching,
+ string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(name, true, caching,
+ null, locators, poolName, clientNotification, ssl, false);
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled)
+ {
+ if (ssl)
+ {
+ Properties<string, string> sysProps = new Properties<string, string>();
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ InitConfig(sysProps);
+ }
+ else
+ {
+ Init();
+ }
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+ Pool pl = m_cache.GetPoolManager().Find(poolName);
+ if (pl != null)
+ {
+ Util.Log("Pool is not closed " + poolName);
+ }
+ if (pl == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(poolName, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+ Util.Log(" caching enable " + caching);
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000).SetPoolName(poolName).SetCloningEnabled(cloningEnabled)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ region = regionFactory.SetPoolName(poolName).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool2<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled, bool pr)
+ {
+ if (ssl)
+ {
+ Properties<string, string> sysProps = new Properties<string, string>();
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ InitConfig(sysProps);
+ }
+ else
+ {
+ Init();
+ }
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ if (m_cache.GetPoolManager().Find(poolName) == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(poolName, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000).SetPoolName(poolName).SetCloningEnabled(cloningEnabled)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ if (pr)
+ {
+ Util.Log("setting custom partition resolver");
+ regionFactory.SetPartitionResolver(CustomPartitionResolver<object>.Create());
+ }
+ else
+ {
+ Util.Log("Resolver is null {0}", pr);
+ }
+ region = regionFactory.Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateLRUTCRegion_Pool<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, uint lru)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ if (m_cache.GetPoolManager().Find(poolName) == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(poolName, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+
+ Properties<string, string> sqLiteProps = Properties<string, string>.Create<string, string>();
+ sqLiteProps.Insert("PageSize", "65536");
+ sqLiteProps.Insert("MaxFileSize", "512000000");
+ sqLiteProps.Insert("MaxPageCount", "1073741823");
+
+ String sqlite_dir = "SqLiteRegionData" + Process.GetCurrentProcess().Id.ToString();
+ sqLiteProps.Insert("PersistenceDirectory", sqlite_dir);
+
+ RegionFactory regionFactory = m_cache
+ .CreateRegionFactory(RegionShortcut.CACHING_PROXY_ENTRY_LRU)
+ .SetDiskPolicy(DiskPolicyType.Overflows)
+ .SetInitialCapacity(100000).SetPoolName(poolName)
+ .SetCachingEnabled(caching).SetLruEntriesLimit(lru)
+ .SetPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqLiteProps);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ region = regionFactory.Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, string serverGroup)
+ {
+ Init();
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ if (m_cache.GetPoolManager().Find(poolName) == null)
+ {
+ PoolFactory/*<TKey, TValue>*/ fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (serverGroup != null)
+ {
+ fact.SetServerGroup(serverGroup);
+ }
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool/*<TKey, TValue>*/ pool = fact.Create(poolName, CacheHelper.DCache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000).SetPoolName(poolName)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ region = regionFactory.SetPoolName(poolName).SetInitialCapacity(100000).SetCachingEnabled(caching).SetCacheListener(listener).Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> CreateTCRegion_Pool1<TKey, TValue>(string name, bool ack, bool caching,
+ ICacheListener<TKey, TValue> listener, string locators, string poolName, bool clientNotification, bool ssl,
+ bool cloningEnabled, IPartitionResolver<int, TValue> pr)
+ {
+ if (ssl)
+ {
+ Properties<string, string> sysProps = new Properties<string, string>();
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ InitConfig(sysProps);
+ }
+ else
+ {
+ Init();
+ }
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(name);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", name);
+ }
+
+ if (m_cache.GetPoolManager().Find(poolName) == null)
+ {
+ PoolFactory fact = m_cache.GetPoolFactory();
+ fact.SetSubscriptionEnabled(clientNotification);
+ if (locators != null)
+ {
+ string[] list = locators.Split(',');
+ foreach (string item in list)
+ {
+ string[] parts = item.Split(':');
+ fact.AddLocator(parts[0], int.Parse(parts[1]));
+ }
+ }
+ else
+ {
+ Util.Log("No locators or servers specified for pool");
+ }
+ Pool pool = fact.Create(poolName, m_cache);
+ if (pool == null)
+ {
+ Util.Log("Pool creation failed");
+ }
+ }
+
+ RegionFactory regionFactory = m_cache.CreateRegionFactory(RegionShortcut.PROXY)
+ .SetInitialCapacity(100000).SetPoolName(poolName).SetCloningEnabled(cloningEnabled)
+ .SetCachingEnabled(caching);
+
+ if (listener != null)
+ {
+ regionFactory.SetCacheListener(listener);
+ }
+ else
+ {
+ Util.Log("Listener is null {0}", listener);
+ }
+
+ if (pr != null)
+ {
+ Util.Log("setting custom partition resolver {0} ", pr.GetName());
+ regionFactory.SetPartitionResolver(pr);
+ }
+ else
+ {
+ Util.Log("Resolver is null {0}", pr);
+ }
+ region = regionFactory.Create<TKey, TValue>(name);
+
+ Assert.IsNotNull(region, "IRegion<object, object> {0} was not created.", name);
+ m_currRegion = region as IRegion<object, object>;
+ Util.Log("IRegion<object, object> {0} has been created with attributes:{1}",
+ name, RegionAttributesToString(region.Attributes));
+ return region;
+ }
+
+ public static void DestroyRegion<TKey, TValue>(string name, bool local, bool verify)
+ {
+ IRegion<TKey, TValue> region;
+ if (verify)
+ {
+ region = GetVerifyRegion<TKey, TValue>(name);
+ }
+ else
+ {
+ region = GetRegion<TKey, TValue>(name);
+ }
+ if (region != null)
+ {
+ if (local)
+ {
+ region.GetLocalView().DestroyRegion();
+ Util.Log("Locally destroyed region {0}", name);
+ }
+ else
+ {
+ region.DestroyRegion();
+ Util.Log("Destroyed region {0}", name);
+ }
+ }
+ }
+
+ public static void DestroyAllRegions<TKey, TValue>(bool local)
+ {
+ if (m_cache != null && !m_cache.IsClosed)
+ {
+ IRegion<TKey, TValue>[] regions = /*(Region<TKey, TValue>)*/m_cache.RootRegions<TKey, TValue>();
+ if (regions != null)
+ {
+ foreach (IRegion<TKey, TValue> region in regions)
+ {
+ if (local)
+ {
+ region.GetLocalView().DestroyRegion();
+ }
+ else
+ {
+ region.DestroyRegion();
+ }
+ }
+ }
+ }
+ }
+
+ public static void InvalidateRegionNonGeneric(string name, bool local, bool verify)
+ {
+ InvalidateRegion<object, object>(name, local, verify);
+ }
+ public static void InvalidateRegion<TKey, TValue>(string name, bool local, bool verify)
+ {
+ IRegion<TKey, TValue> region;
+ if (verify)
+ {
+ region = GetVerifyRegion<TKey, TValue>(name);
+ Util.Log("InvalidateRegion: GetVerifyRegion done for {0}", name);
+ }
+ else
+ {
+ region = GetRegion<TKey, TValue>(name);
+ Util.Log("InvalidateRegion: GetRegion done for {0}", name);
+ }
+ if (region != null)
+ {
+ if (local)
+ {
+ Util.Log("Locally invaliding region {0}", name);
+ region.GetLocalView().InvalidateRegion();
+ Util.Log("Locally invalidated region {0}", name);
+ }
+ else
+ {
+ Util.Log("Invalidating region {0}", name);
+ region.InvalidateRegion();
+ Util.Log("Invalidated region {0}", name);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Functions to obtain a region
+
+ public static IRegion<TKey, TValue> GetRegion<TKey, TValue>(string path)
+ {
+ if (m_cache != null)
+ {
+ return m_cache.GetRegion<TKey, TValue>(path);
+ }
+ return null;
+ }
+
+ public static Properties<string, object> GetPkcsCredentialsForMU(Properties<string, string> credentials)
+ {
+ if (credentials == null)
+ return null;
+ Properties<string, object> target = Properties<string, object>.Create<string, object>();
+ PropsStringToObject psto = new PropsStringToObject(target);
+ credentials.ForEach(new PropertyVisitorGeneric<string, string>(psto.Visit));
+ return target;
+ }
+
+ public static IRegion<TKey, TValue> GetRegion<TKey, TValue>(string path, Properties<string, string> credentials)
+ {
+ if (m_cache != null)
+ {
+ Util.Log("GetRegion " + m_cacheForMultiUser);
+ if (m_cacheForMultiUser == null)
+ {
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(path);
+ Assert.IsNotNull(region, "IRegion<object, object> [" + path + "] not found.");
+ Assert.IsNotNull(region.Attributes.PoolName, "IRegion<object, object> is created without pool.");
+
+ Pool/*<TKey, TValue>*/ pool = m_cache.GetPoolManager().Find(region.Attributes.PoolName);
+
+ Assert.IsNotNull(pool, "Pool is null in GetVerifyRegion.");
+
+ //m_cacheForMultiUser = pool.CreateSecureUserCache(credentials);
+ m_cacheForMultiUser = m_cache.CreateAuthenticatedView(GetPkcsCredentialsForMU(credentials), pool.Name);
+
+ return m_cacheForMultiUser.GetRegion<TKey, TValue>(path);
+ }
+ else
+ return m_cacheForMultiUser.GetRegion<TKey, TValue>(path);
+ }
+ return null;
+ }
+
+ public static IRegionService getMultiuserCache(Properties<string, string> credentials)
+ {
+ if (m_cacheForMultiUser == null)
+ {
+ Pool/*<TKey, TValue>*/ pool = m_cache.GetPoolManager().Find("__TESTPOOL1_");
+
+ Assert.IsNotNull(pool, "Pool is null in getMultiuserCache.");
+ Assert.IsTrue(!pool.Destroyed);
+
+ //m_cacheForMultiUser = pool.CreateSecureUserCache(credentials);
+ m_cacheForMultiUser = m_cache.CreateAuthenticatedView(GetPkcsCredentialsForMU(credentials), pool.Name);
+
+ return m_cacheForMultiUser;
+ }
+ else
+ return m_cacheForMultiUser;
+ }
+
+ public static IRegion<TKey, TValue> GetVerifyRegion<TKey, TValue>(string path)
+ {
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(path);
+
+ Assert.IsNotNull(region, "IRegion<object, object> [" + path + "] not found.");
+ Util.Log("Found region '{0}'", path);
+ return region;
+ }
+
+ public static IRegion<TKey, TValue> GetVerifyRegion<TKey, TValue>(string path, Properties<string, string> credentials)
+ {
+ Util.Log("GetVerifyRegion " + m_cacheForMultiUser);
+ if (m_cacheForMultiUser == null)
+ {
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(path);
+ Assert.IsNotNull(region, "IRegion<object, object> [" + path + "] not found.");
+ Assert.IsNotNull(region.Attributes.PoolName, "IRegion<object, object> is created without pool.");
+
+ Pool/*<TKey, TValue>*/ pool = m_cache.GetPoolManager().Find(region.Attributes.PoolName);
+
+ Assert.IsNotNull(pool, "Pool is null in GetVerifyRegion.");
+
+ //m_cacheForMultiUser = pool.CreateSecureUserCache(credentials);
+ m_cacheForMultiUser = m_cache.CreateAuthenticatedView(GetPkcsCredentialsForMU(credentials), pool.Name);
+
+ return m_cacheForMultiUser.GetRegion<TKey, TValue>(path);
+ }
+ else
+ return m_cacheForMultiUser.GetRegion<TKey, TValue>(path);
+ }
+
+ public static void VerifyRegion<TKey, TValue>(string path)
+ {
+ GetVerifyRegion<TKey, TValue>(path);
+ }
+
+ public static void VerifyNoRegion<TKey, TValue>(string path)
+ {
+ IRegion<TKey, TValue> region = GetRegion<TKey, TValue>(path);
+ Assert.IsNull(region, "IRegion<object, object> [" + path + "] should not exist.");
+ }
+
+ #endregion
+
+ #region Functions to start/stop a java cacheserver for Thin Client regions
+
+ public static void SetupJavaServers(params string[] cacheXmls)
+ {
+ SetupJavaServers(false, cacheXmls);
+ }
+
+ public static void setPorts(int s1, int s2, int s3, int l1, int l2)
+ {
+ HOST_PORT_1 = s1;
+ HOST_PORT_2 = s1;
+ HOST_PORT_3 = s3;
+ LOCATOR_PORT_1 = l1;
+ LOCATOR_PORT_2 = l2;
+ }
+
+ public static void SetupJavaServers(bool locators, params string[] cacheXmls)
+ {
+ createRandomPorts();
+ m_cacheXmls = cacheXmls;
+ m_gfeDir = Util.GetEnvironmentVariable("GFE_DIR");
+ Assert.IsNotNull(m_gfeDir, "GFE_DIR is not set.");
+ Assert.IsNotEmpty(m_gfeDir, "GFE_DIR is not set.");
+ m_gfeLogLevel = Util.GetEnvironmentVariable("GFE_LOGLEVEL");
+ m_gfeSecLogLevel = Util.GetEnvironmentVariable("GFE_SECLOGLEVEL");
+ if (m_gfeLogLevel == null || m_gfeLogLevel.Length == 0)
+ {
+ m_gfeLogLevel = "config";
+ }
+ if (m_gfeSecLogLevel == null || m_gfeSecLogLevel.Length == 0)
+ {
+ m_gfeSecLogLevel = "config";
+ }
+
+ Match mt = Regex.Match(m_gfeDir, "^[^:]+:[0-9]+(,[^:]+:[0-9]+)*$");
+ if (mt != null && mt.Length > 0)
+ {
+ // The GFE_DIR is for a remote server; contains an end-point list
+ m_endpoints = m_gfeDir;
+ m_localServer = false;
+ }
+ else if (cacheXmls != null)
+ {
+ // Assume the GFE_DIR is for a local server
+ if (locators)
+ {
+ JavaMcastPort = 0;
+ }
+ else
+ {
+ JavaMcastPort = Util.Rand(2431, 31123);
+ }
+
+ for (int i = 0; i < cacheXmls.Length; i++)
+ {
+ string cacheXml = cacheXmls[i];
+ Assert.IsNotNull(cacheXml, "cacheXml is not set for Java cacheserver.");
+ Assert.IsNotEmpty(cacheXml, "cacheXml is not set for Java cacheserver.");
+ string duplicateFile = "";
+ // Assume the GFE_DIR is for a local server
+ if (cacheXml.IndexOf(PathSep) < 0)
+ {
+ duplicateFile = Directory.GetCurrentDirectory() + PathSep + Util.Rand(2342350).ToString() + cacheXml;
+ cacheXml = Directory.GetCurrentDirectory() + PathSep + cacheXml;
+ createDuplicateXMLFile(cacheXml, duplicateFile);
+ //:create duplicate xml files
+ cacheXmls[i] = duplicateFile;
+ }
+
+ // Find the port number from the given cache.xml
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.XmlResolver = null;
+ xmlDoc.Load(duplicateFile);
+
+ XmlNamespaceManager ns = new XmlNamespaceManager(xmlDoc.NameTable);
+ ns.AddNamespace("geode", "http://geode.apache.org/schema/cache");
+ XmlNodeList serverNodeList = xmlDoc.SelectNodes("//geode:cache-server", ns);
+
+ if (m_endpoints == null)
+ {
+ m_endpoints = System.Net.Dns.GetHostEntry("localhost").HostName + ":" + serverNodeList[0].Attributes["port"].Value;
+ }
+ else
+ {
+ m_endpoints += "," + System.Net.Dns.GetHostEntry("localhost").HostName + ":" + serverNodeList[0].Attributes["port"].Value;
+ }
+ }
+ Util.Log("JAVA server endpoints: " + m_endpoints);
+ }
+ }
+
+ public static void createRandomPorts()
+ {
+ if (HOST_PORT_1 == 0)
+ {
+ HOST_PORT_1 = Util.RandPort(10000, 64000);
+ HOST_PORT_2 = Util.RandPort(10000, 64000);
+ HOST_PORT_3 = Util.RandPort(10000, 64000);
+ HOST_PORT_4 = Util.RandPort(10000, 64000);
+ }
+
+ if (LOCATOR_PORT_1 == 0)
+ {
+ LOCATOR_PORT_1 = Util.RandPort(10000, 64000);
+ LOCATOR_PORT_2 = Util.RandPort(10000, 64000);
+ LOCATOR_PORT_3 = Util.RandPort(10000, 64000);
+ LOCATOR_PORT_4 = Util.RandPort(10000, 64000);
+ }
+ }
+
+ public static void createDuplicateXMLFile(string orignalFilename, string duplicateFilename)
+ {
+ string cachexmlstring = File.ReadAllText(orignalFilename);
+ cachexmlstring = cachexmlstring.Replace("HOST_PORT1", HOST_PORT_1.ToString());
+ cachexmlstring = cachexmlstring.Replace("HOST_PORT2", HOST_PORT_2.ToString());
+ cachexmlstring = cachexmlstring.Replace("HOST_PORT3", HOST_PORT_3.ToString());
+ cachexmlstring = cachexmlstring.Replace("HOST_PORT4", HOST_PORT_4.ToString());
+
+ cachexmlstring = cachexmlstring.Replace("LOC_PORT1", LOCATOR_PORT_1.ToString());
+ cachexmlstring = cachexmlstring.Replace("LOC_PORT2", LOCATOR_PORT_2.ToString());
+ cachexmlstring = cachexmlstring.Replace("LOC_PORT3", LOCATOR_PORT_3.ToString());
+ //cachexmlstring = cachexmlstring.Replace("LOC_PORT4", LOCATOR_PORT_4.ToString());
+
+ File.Create(duplicateFilename).Close();
+ File.WriteAllText(duplicateFilename, cachexmlstring);
+ }
+
+ public static void StartJavaLocator(int locatorNum, string startDir)
+ {
+ StartJavaLocator(locatorNum, startDir, null);
+ }
+ public static int getBaseLocatorPort()
+ {
+ return LocatorPort;
+ }
+
+ public static void StartJavaLocator(int locatorNum, string startDir,
+ string extraLocatorArgs)
+ {
+ StartJavaLocator(locatorNum, startDir, extraLocatorArgs, false);
+ }
+
+ public static void StartJavaLocator(int locatorNum, string startDir,
+ string extraLocatorArgs, bool ssl)
+ {
+ if (m_localServer)
+ {
+ Process javaProc;
+ string locatorPath = m_gfeDir + PathSep + "bin" + PathSep + GeodeName;
+ Util.Log("Starting locator {0} in directory {1}.", locatorNum, startDir);
+ string serverName = "Locator" + Util.Rand(64687687).ToString();
+ if (startDir != null)
+ {
+ startDir += serverName;
+ if (!Directory.Exists(startDir))
+ {
+ Directory.CreateDirectory(startDir);
+ }
+ try
+ {
+ TextWriter tw = new StreamWriter(Directory.GetCurrentDirectory() + "\\" + startDir + "\\geode.properties", false);
+ tw.WriteLine("locators=localhost[{0}],localhost[{1}],localhost[{2}]", LOCATOR_PORT_1, LOCATOR_PORT_2, LOCATOR_PORT_3);
+ if (ssl)
+ {
+ tw.WriteLine("ssl-enabled=true");
+ tw.WriteLine("ssl-require-authentication=true");
+ tw.WriteLine("ssl-ciphers=SSL_RSA_WITH_NULL_MD5");
+ tw.WriteLine("mcast-port=0");
+ }
+ tw.Close();
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("Locator property file creation failed: {0}: {1}", ex.GetType().Name, ex.Message);
+ }
+ startDir = " --dir=" + startDir;
+ }
+ else
+ {
+ startDir = string.Empty;
+ }
+
+ string locatorPort = " --port=" + getLocatorPort(locatorNum);
+ if (extraLocatorArgs != null)
+ {
+ extraLocatorArgs = ' ' + extraLocatorArgs + locatorPort;
+ }
+ else
+ {
+ extraLocatorArgs = locatorPort;
+ }
+
+ if (ssl)
+ {
+ string sslArgs = String.Empty;
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sslArgs += " --J=-Djavax.net.ssl.keyStore=" + keystore + "/server_keystore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.keyStorePassword=gemstone ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStore=" + keystore + "/server_truststore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStorePassword=gemstone ";
+ extraLocatorArgs += sslArgs;
+ }
+
+ string locatorArgs = LocatorStartArgs + " --name=" + serverName + startDir + extraLocatorArgs;
+
+ if (!Util.StartProcess(locatorPath, locatorArgs, false, null, true,
+ false, false, true, out javaProc))
+ {
+ Assert.Fail("Failed to run the locator: {0}.",
+ locatorPath);
+ }
+
+ StreamReader outSr = javaProc.StandardOutput;
+ // Wait for cache server to start
+ bool started = javaProc.WaitForExit(MaxWaitMillis);
+ Util.Log("Output from '{0} {1}':{2}{3}", GeodeName, locatorArgs,
+ Environment.NewLine, outSr.ReadToEnd());
+ outSr.Close();
+ if (!started)
+ {
+ javaProc.Kill();
+ }
+ Assert.IsTrue(started, "Timed out waiting for " +
+ "Locator to start.{0}Please check the locator logs.",
+ Environment.NewLine);
+ m_runningLocators[locatorNum] = startDir;
+ if (m_locators == null)
+ {
+ m_locators = "localhost:" + getLocatorPort(locatorNum);
+ }
+ else
+ {
+ m_locators += ",localhost:" + getLocatorPort(locatorNum);
+ }
+ Util.Log("JAVA locator endpoints: " + m_locators);
+ }
+ }
+
+
+
+ static int getLocatorPort(int num)
+ {
+ switch (num)
+ {
+ case 1:
+ return LOCATOR_PORT_1;
+ case 2:
+ return LOCATOR_PORT_2;
+ case 3:
+ return LOCATOR_PORT_3;
+ default:
+ return LOCATOR_PORT_1;
+ }
+ }
+
+ //this is for start locator independetly(will not see each other)
+ public static void StartJavaLocator_MDS(int locatorNum, string startDir,
+ string extraLocatorArgs, int dsId)
+ {
+ if (m_localServer)
+ {
+ Process javaProc;
+ string locatorPath = m_gfeDir + PathSep + "bin" + PathSep + GeodeName;
+ string serverName = "Locator" + Util.Rand(64687687).ToString();
+ Util.Log("Starting locator {0} in directory {1}.", locatorNum, startDir);
+ if (startDir != null)
+ {
+ startDir += serverName;
+ if (!Directory.Exists(startDir))
+ {
+ Directory.CreateDirectory(startDir);
+ }
+ try
+ {
+ TextWriter tw = new StreamWriter(Directory.GetCurrentDirectory() + "\\" + startDir + "\\geode.properties", false);
+ //tw.WriteLine("locators=localhost[{0}],localhost[{1}],localhost[{2}]", LOCATOR_PORT_1, LOCATOR_PORT_2, LOCATOR_PORT_3);
+ tw.WriteLine("distributed-system-id=" + dsId);
+ tw.WriteLine("mcast-port=0");
+ tw.Close();
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("Locator property file creation failed: {0}: {1}", ex.GetType().Name, ex.Message);
+ }
+ startDir = " --dir=" + startDir;
+ }
+ else
+ {
+ startDir = string.Empty;
+ }
+
+ if (dsId == 1)
+ m_locatorFirst = "localhost:" + getLocatorPort(locatorNum);
+ else
+ m_locatorSecond = "localhost:" + getLocatorPort(locatorNum);
+
+ string locatorPort = " --port=" + getLocatorPort(locatorNum);
+ if (extraLocatorArgs != null)
+ {
+ extraLocatorArgs = ' ' + extraLocatorArgs + locatorPort;
+ }
+ else
+ {
+ extraLocatorArgs = locatorPort;
+ }
+ string locatorArgs = LocatorStartArgs + " --name=" + serverName + startDir + extraLocatorArgs;
+
+ if (!Util.StartProcess(locatorPath, locatorArgs, false, null, true,
+ false, false, true, out javaProc))
+ {
+ Assert.Fail("Failed to run the locator: {0}.",
+ locatorPath);
+ }
+
+ StreamReader outSr = javaProc.StandardOutput;
+ // Wait for cache server to start
+ bool started = javaProc.WaitForExit(MaxWaitMillis);
+ Util.Log("Output from '{0} {1}':{2}{3}", GeodeName, locatorArgs,
+ Environment.NewLine, outSr.ReadToEnd());
+ outSr.Close();
+ if (!started)
+ {
+ javaProc.Kill();
+ }
+ Assert.IsTrue(started, "Timed out waiting for " +
+ "Locator to start.{0}Please check the locator logs.",
+ Environment.NewLine);
+ m_runningLocators[locatorNum] = startDir;
+ if (m_locators == null)
+ {
+ m_locators = "localhost[" + getLocatorPort(locatorNum) + "]";
+ }
+ else
+ {
+ m_locators += ",localhost[" + getLocatorPort(locatorNum) + "]";
+ }
+ Util.Log("JAVA locator endpoints: " + m_locators);
+ }
+ }
+
+ public static void StartJavaServerWithLocators(int serverNum, string startDir, int numLocators)
+ {
+ StartJavaServerWithLocators(serverNum, startDir, numLocators, false);
+ }
+
+ public static void StartJavaServerWithLocators(int serverNum, string startDir, int numLocators, bool ssl)
+ {
+ string extraServerArgs = "--locators=";
+ for (int locator = 0; locator < numLocators; locator++)
+ {
+ if (locator > 0)
+ {
+ extraServerArgs += ",";
+ }
+ extraServerArgs += "localhost[" + getLocatorPort(locator + 1) + "]";
+ }
+ if (ssl)
+ {
+ string sslArgs = String.Empty;
+ sslArgs += " ssl-enabled=true ssl-require-authentication=true ssl-ciphers=SSL_RSA_WITH_NULL_MD5 ";
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sslArgs += " -J=-Djavax.net.ssl.keyStore=" + keystore + "/server_keystore.jks ";
+ sslArgs += " -J=-Djavax.net.ssl.keyStorePassword=gemstone ";
+ sslArgs += " -J=-Djavax.net.ssl.trustStore=" + keystore + "/server_truststore.jks ";
+ sslArgs += " -J=-Djavax.net.ssl.trustStorePassword=gemstone ";
+ extraServerArgs += sslArgs;
+ }
+ StartJavaServer(serverNum, startDir, extraServerArgs);
+ }
+
+ //this is to start multiple DS
+ public static void StartJavaServerWithLocator_MDS(int serverNum, string startDir, int locatorNumber)
+ {
+ string extraServerArgs = "--locators=";
+ extraServerArgs += "localhost[" + getLocatorPort(locatorNumber) + "]";
+
+ StartJavaServer(serverNum, startDir, extraServerArgs);
+ }
+
+
+ public static void StartJavaServer(int serverNum, string startDir)
+ {
+ StartJavaServer(serverNum, startDir, null);
+ }
+
+ public static void StartJavaServerWithLocators(int serverNum, string startDir,
+ int numLocators, string extraServerArgs)
+ {
+ StartJavaServerWithLocators(serverNum, startDir, numLocators, extraServerArgs, false);
+ }
+
+ public static void StartJavaServerWithLocators(int serverNum, string startDir,
+ int numLocators, string extraServerArgs, bool ssl)
+ {
+ extraServerArgs += " --locators=";
+ for (int locator = 0; locator < numLocators; locator++)
+ {
+ if (locator > 0)
+ {
+ extraServerArgs += ",";
+ }
+ extraServerArgs += "localhost[" + getLocatorPort(locator + 1) + "]";
+ }
+ if (ssl)
+ {
+ string sslArgs = String.Empty;
+ sslArgs += " ssl-enabled=true ssl-require-authentication=true ssl-ciphers=SSL_RSA_WITH_NULL_MD5 ";
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sslArgs += " --J=-Djavax.net.ssl.keyStore=" + keystore + "/server_keystore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.keyStorePassword=gemstone ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStore=" + keystore + "/server_truststore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStorePassword=gemstone ";
+ extraServerArgs += sslArgs;
+ }
+ StartJavaServer(serverNum, startDir, extraServerArgs);
+ }
+
+ public static void StartJavaServer(int serverNum, string startDir,
+ string extraServerArgs)
+ {
+ if (m_localServer)
+ {
+ if (m_cacheXmls == null || serverNum > m_cacheXmls.Length)
+ {
+ Assert.Fail("SetupJavaServers called with incorrect parameters: " +
+ "could not find cache.xml for server number {0}", serverNum);
+ }
+ string cacheXml = m_cacheXmls[serverNum - 1];
+ Process javaProc;
+ string javaServerPath = m_gfeDir + PathSep + "bin" + PathSep + JavaServerName;
+ string serverName = "Server" + Util.Rand(372468723).ToString();
+ startDir += serverName;
+ int port = 0;
+ switch (serverNum)
+ {
+ case 1:
+ port = HOST_PORT_1;
+ break;
+ case 2:
+ port = HOST_PORT_2;
+ break;
+ case 3:
+ port = HOST_PORT_3;
+ break;
+ case 4:
+ port = HOST_PORT_4;
+ break;
+ default:
+ throw new InvalidOperationException();
+ }
+ Util.Log("Starting server {0} in directory {1}.", serverNum, startDir);
+ if (startDir != null)
+ {
+ if (!Directory.Exists(startDir))
+ {
+ Directory.CreateDirectory(startDir);
+ }
+ startDir = " --dir=" + startDir;
+ }
+ else
+ {
+ startDir = string.Empty;
+ }
+ if (extraServerArgs != null)
+ {
+ extraServerArgs = ' ' + extraServerArgs;
+ }
+
+ string classpath = Util.GetEnvironmentVariable("GF_CLASSPATH");
+
+ string serverArgs = JavaServerStartArgs + cacheXml + " --name=" + serverName +
+ " --server-port=" + port + " --classpath=" + classpath +
+ " --log-level=" + m_gfeLogLevel + startDir +
+ " --J=-Dsecurity-log-level=" + m_gfeSecLogLevel + extraServerArgs;
+ if (!Util.StartProcess(javaServerPath, serverArgs, false, null, true,
+ false, false, true, out javaProc))
+ {
+ Assert.Fail("Failed to run the java cacheserver executable: {0}.",
+ javaServerPath);
+ }
+
+ StreamReader outSr = javaProc.StandardOutput;
+ // Wait for cache server to start
+ bool started = javaProc.WaitForExit(MaxWaitMillis);
+ Util.Log("Output from '{0} {1}':{2}{3}", JavaServerName, serverArgs,
+ Environment.NewLine, outSr.ReadToEnd());
+ outSr.Close();
+ if (!started)
+ {
+ javaProc.Kill();
+ }
+ Assert.IsTrue(started, "Timed out waiting for " +
+ "Java cacheserver to start.{0}Please check the server logs.",
+ Environment.NewLine);
+ m_runningJavaServers[serverNum] = startDir;
+ }
+ }
+
+ public static void StopJavaLocator(int locatorNum)
+ {
+ StopJavaLocator(locatorNum, true, false);
+ }
+
+ public static void StopJavaLocator(int locatorNum, bool verifyLocator)
+ {
+ StopJavaLocator(locatorNum, verifyLocator, false);
+ }
+
+ public static void StopJavaLocator(int locatorNum, bool verifyLocator, bool ssl)
+ {
+ if (m_localServer)
+ {
+ // Assume the GFE_DIR is for a local server
+ string startDir;
+ if (m_runningLocators.TryGetValue(locatorNum, out startDir))
+ {
+ Util.Log("Stopping locator {0} in directory {1}.", locatorNum, startDir);
+ Process javaStopProc;
+ string javaLocatorPath = m_gfeDir + PathSep + "bin" + PathSep + GeodeName;
+ string sslArgs = String.Empty;
+ if (ssl)
+ {
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sslArgs += " --J=-Djavax.net.ssl.keyStore=" + keystore + "/server_keystore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.keyStorePassword=gemstone ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStore=" + keystore + "/server_truststore.jks ";
+ sslArgs += " --J=-Djavax.net.ssl.trustStorePassword=gemstone ";
+ string propdir = startDir.Replace("--dir=", string.Empty).Trim();
+ File.Copy(propdir + "/geode.properties", Directory.GetCurrentDirectory() + "/geode.properties", true);
+ }
+ if (!Util.StartProcess(javaLocatorPath, LocatorStopArgs + startDir + sslArgs,
+ false, null, true, false, false, true, out javaStopProc))
+ {
+ Assert.Fail("Failed to run the executable: {0}.",
+ javaLocatorPath);
+ }
+
+ StreamReader outSr = javaStopProc.StandardOutput;
+ // Wait for cache server to stop
+ bool stopped = javaStopProc.WaitForExit(MaxWaitMillis);
+ Util.Log("Output from '{0} stop-locator':{1}{2}", GeodeName,
+ Environment.NewLine, outSr.ReadToEnd());
+ outSr.Close();
+ if (!stopped)
+ {
+ javaStopProc.Kill();
+ }
+ if (ssl)
+ {
+ File.Delete(Directory.GetCurrentDirectory() + "/geode.properties");
+ }
+ Assert.IsTrue(stopped, "Timed out waiting for " +
+ "Java locator to stop.{0}Please check the locator logs.",
+ Environment.NewLine);
+ m_runningLocators.Remove(locatorNum);
+ Util.Log("Locator {0} in directory {1} stopped.", locatorNum,
+ startDir.Replace("--dir=", string.Empty).Trim());
+ }
+ else
+ {
+ if (verifyLocator)
+ {
+ Assert.Fail("StopJavaLocator() invoked for a non-existing locator {0}",
+ locatorNum);
+ }
+ }
+ }
+ }
+
+ public static void StopJavaServer(int serverNum)
+ {
+ StopJavaServer(serverNum, true);
+ }
+
+ public static void StopJavaServer(int serverNum, bool verifyServer)
+ {
+ if (m_localServer)
+ {
+ // Assume the GFE_DIR is for a local server
+ string startDir;
+ if (m_runningJavaServers.TryGetValue(serverNum, out startDir))
+ {
+ Util.Log("Stopping server {0} in directory {1}.", serverNum, startDir);
+ Process javaStopProc;
+ string javaServerPath = m_gfeDir + PathSep + "bin" + PathSep + JavaServerName;
+ if (!Util.StartProcess(javaServerPath, JavaServerStopArgs + startDir,
+ false, null, true, false, false, true, out javaStopProc))
+ {
+ Assert.Fail("Failed to run the java cacheserver executable: {0}.",
+ javaServerPath);
+ }
+
+ StreamReader outSr = javaStopProc.StandardOutput;
+ // Wait for cache server to stop
+ bool stopped = javaStopProc.WaitForExit(MaxWaitMillis);
+ Util.Log("Output from '{0} stop':{1}{2}", JavaServerName,
+ Environment.NewLine, outSr.ReadToEnd());
+ outSr.Close();
+ if (!stopped)
+ {
+ javaStopProc.Kill();
+ }
+ Assert.IsTrue(stopped, "Timed out waiting for " +
+ "Java cacheserver to stop.{0}Please check the server logs.",
+ Environment.NewLine);
+ m_runningJavaServers.Remove(serverNum);
+ Util.Log("Server {0} in directory {1} stopped.", serverNum,
+ startDir.Replace("--dir=", string.Empty).Trim());
+ }
+ else
+ {
+ if (verifyServer)
+ {
+ Assert.Fail("StopJavaServer() invoked for a non-existing server {0}",
+ serverNum);
+ }
+ }
+ }
+ }
+
+ public static void StopJavaServers()
+ {
+ int[] runningServers = new int[m_runningJavaServers.Count];
+ m_runningJavaServers.Keys.CopyTo(runningServers, 0);
+ foreach (int serverNum in runningServers)
+ {
+ StopJavaServer(serverNum);
+ Util.Log("Cacheserver {0} stopped.", serverNum);
+ }
+ m_runningJavaServers.Clear();
+ }
+
+ public static void StopJavaLocators()
+ {
+ int[] runningServers = new int[m_runningLocators.Count];
+ m_runningLocators.Keys.CopyTo(runningServers, 0);
+ foreach (int serverNum in runningServers)
+ {
+ StopJavaLocator(serverNum);
+ Util.Log("Locator {0} stopped.", serverNum);
+ }
+ m_runningLocators.Clear();
+ }
+
+ public static void ClearEndpoints()
+ {
+ m_endpoints = null;
+ }
+
+ public static void ClearLocators()
+ {
+ m_locators = null;
+ }
+
+
+
+ public static void KillJavaProcesses()
+ {
+ String myQuery = "select * from win32_process where Name ='java.exe' or Name = 'java.exe *32'";
+ ObjectQuery objQuery = new ObjectQuery(myQuery);
+ ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(objQuery);
+ ManagementObjectCollection processList = objSearcher.Get();
+
+ foreach (ManagementObject item in processList)
+ {
+ try
+ {
+ int processId = Convert.ToInt32(item["ProcessId"].ToString());
+ string commandline = item["CommandLine"].ToString();
+
+ Util.Log("processId:{0} name:{1}", item["ProcessId"], item["Name"]);
+ if (commandline.Contains("gemfire.jar"))
+ {
+ Util.Log("Killing geode process with id {0}", processId);
+ Process proc = Process.GetProcessById(processId);
+ proc.Kill();
+ proc.WaitForExit();
+ }
+ else
+ {
+ Util.Log("Process with id {0} is not geode process", processId);
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Error: " + e);
+ }
+ }
+
+ }
+
+ public static void EndTest()
+ {
+ Util.Log("Cache Helper EndTest.");
+ StopJavaServers();
+ StopJavaLocators();
+ ClearEndpoints();
+ ClearLocators();
+ KillJavaProcesses();
+ Util.Log("Cache Helper EndTest completed.");
+ }
+
+ #endregion
+
+ #region Utility functions
+
+ public static void ShowKeys(ICollection<Object> cKeys)
+ {
+ if (cKeys != null)
+ {
+ for (int i = 0; i < cKeys.Count; i++)
+ {
+ //TODO ATTACH List TO THE COLLECTION AND UNCOMMENT BELOW LINE
+ //Util.Log("Key [{0}] = {1}", i, cKeys[i]);
+ }
+ }
+ }
+
+ public static void ShowValues(ICollection<Object> cValues)
+ {
+ if (cValues != null)
+ {
+ for (int i = 0; i < cValues.Count; i++)
+ {
+ //TODO ATTACH List TO THE COLLECTION AND UNCOMMENT BELOW LINE
+ //Util.Log("Value [{0}] = {1}", i, cValues[i]);
+ }
+ }
+ }
+
+ public static string RegionAttributesToString<TKey, TVal>(Apache.Geode.Client.RegionAttributes<TKey, TVal> attrs)
+ {
+ string poolName = "RegionWithoutPool";
+
+ if (attrs.PoolName != null)
+ poolName = attrs.PoolName;
+
+ StringBuilder attrsSB = new StringBuilder();
+ attrsSB.Append(Environment.NewLine + "caching: " +
+ attrs.CachingEnabled);
+ attrsSB.Append(Environment.NewLine + "endpoints: " +
+ attrs.Endpoints);
+ attrsSB.Append(Environment.NewLine + "clientNotification: " +
+ attrs.ClientNotificationEnabled);
+ attrsSB.Append(Environment.NewLine + "initialCapacity: " +
+ attrs.InitialCapacity);
+ attrsSB.Append(Environment.NewLine + "loadFactor: " +
+ attrs.LoadFactor);
+ attrsSB.Append(Environment.NewLine + "concurrencyLevel: " +
+ attrs.ConcurrencyLevel);
+ attrsSB.Append(Environment.NewLine + "lruEntriesLimit: " +
+ attrs.LruEntriesLimit);
+ attrsSB.Append(Environment.NewLine + "lruEvictionAction: " +
+ attrs.LruEvictionAction);
+ attrsSB.Append(Environment.NewLine + "entryTimeToLive: " +
+ attrs.EntryTimeToLive);
+ attrsSB.Append(Environment.NewLine + "entryTimeToLiveAction: " +
+ attrs.EntryTimeToLiveAction);
+ attrsSB.Append(Environment.NewLine + "entryIdleTimeout: " +
+ attrs.EntryIdleTimeout);
+ attrsSB.Append(Environment.NewLine + "entryIdleTimeoutAction: " +
+ attrs.EntryIdleTimeoutAction);
+ attrsSB.Append(Environment.NewLine + "regionTimeToLive: " +
+ attrs.RegionTimeToLive);
+ attrsSB.Append(Environment.NewLine + "regionTimeToLiveAction: " +
+ attrs.RegionTimeToLiveAction);
+ attrsSB.Append(Environment.NewLine + "regionIdleTimeout: " +
+ attrs.RegionIdleTimeout);
+ attrsSB.Append(Environment.NewLine + "regionIdleTimeoutAction: " +
+ attrs.RegionIdleTimeoutAction);
+ attrsSB.Append(Environment.NewLine + "PoolName: " +
+ poolName);
+ attrsSB.Append(Environment.NewLine);
+ return attrsSB.ToString();
+ }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/CacheServPoolRedun1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheServPoolRedun1.xml b/clicache/integration-test/CacheServPoolRedun1.xml
new file mode 100644
index 0000000..bd43b0e
--- /dev/null
+++ b/clicache/integration-test/CacheServPoolRedun1.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1">
+ <group>ServerGroup1</group>
+ <group>ServerGroup2</group>
+ <group>ServerGroup3</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-native/blob/6cbd424f/clicache/integration-test/CacheServPoolRedun2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheServPoolRedun2.xml b/clicache/integration-test/CacheServPoolRedun2.xml
new file mode 100644
index 0000000..d21970e
--- /dev/null
+++ b/clicache/integration-test/CacheServPoolRedun2.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24681" /-->
+ <cache-server port="HOST_PORT2">
+ <group>ServerGroup1</group>
+ <group>ServerGroup2</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>
[15/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IRegionService.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IRegionService.hpp b/clicache/src/IRegionService.hpp
new file mode 100644
index 0000000..51f4049
--- /dev/null
+++ b/clicache/src/IRegionService.hpp
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+//#include "geode_includes.hpp"
+#include "QueryService.hpp"
+#include "Region.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IPdxInstanceFactory;
+ /// <summary>
+ /// A RegionService provides access to existing regions that exist
+ /// in a <see cref="Cache" />.
+ /// Regions can be obtained using <see cref="Cache.GetRegion" />
+ /// and queried using <see cref="Cache.GetQueryService/>.
+ /// </summary>
+ /// <remarks>
+ /// Caches are obtained from methods on the
+ /// <see cref="CacheFactory.Create"/> class.
+ /// <para>
+ /// When a cache will no longer be used, call <see cref="Cache.Close" />.
+ /// Once it <see cref="Cache.IsClosed" /> any attempt to use it
+ /// will cause a <c>CacheClosedException</c> to be thrown.
+ /// </para><para>
+ /// A cache can have multiple root regions, each with a different name.
+ /// </para>
+ /// </remarks>
+ public interface class IRegionService
+ {
+ public:
+
+ /// <summary>
+ /// True if this cache has been closed.
+ /// </summary>
+ /// <remarks>
+ /// After a new cache object is created, this method returns false.
+ /// After <see cref="Close" /> is called on this cache object, this method
+ /// returns true.
+ /// </remarks>
+ /// <returns>true if this cache is closed, otherwise false</returns>
+ property bool IsClosed
+ {
+ bool get( );
+ }
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// If RegionService is created from <see cref="Cache.CreateAuthenticatedView" />, then it clears user related security data.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ void Close( );
+
+ /// <summary>
+ /// Returns an existing region given the full path from root, or null
+ /// if no such region exists.
+ /// </summary>
+ /// <param name="name">the name of the region</param>
+ /// <returns>the region</returns>
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ GetRegion( String^ name );
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ Client::QueryService<TKey, TResult>^ GetQueryService();
+ /// <summary>
+ /// Returns an array of root regions in the cache. This set is a
+ /// snapshot and is not backed by the cache.
+ /// </summary>
+ /// <remarks>
+ /// It is not supported when Cache is created from Pool.
+ /// </remarks>
+ /// <returns>array of regions</returns>
+ generic<class TKey, class TValue>
+ array<IRegion<TKey, TValue>^>^ RootRegions( );
+
+ /// <summary>
+ /// Returns a factory that can create a {@link PdxInstance}.
+ /// @param className the fully qualified class name that the PdxInstance will become
+ /// when it is fully deserialized.
+ /// @return the factory
+ /// </summary>
+ IPdxInstanceFactory^ CreatePdxInstanceFactory(String^ className);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IResultCollector.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IResultCollector.hpp b/clicache/src/IResultCollector.hpp
new file mode 100644
index 0000000..3d97f27
--- /dev/null
+++ b/clicache/src/IResultCollector.hpp
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+ /*
+ generic<class TKey>
+ ref class ResultCollector;
+ */
+
+ /// <summary>
+ /// collect function execution results, can be overriden
+ /// </summary>
+ generic<class TResult>
+ public interface class IResultCollector
+ {
+ public:
+
+ /// <summary>
+ /// add result from a single function execution
+ /// </summary>
+ void AddResult(TResult rs);
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ System::Collections::Generic::ICollection<TResult>^ GetResult();
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ System::Collections::Generic::ICollection<TResult>^ GetResult(UInt32 timeout);
+
+ /// <summary>
+ ///Call back provided to caller, which is called after function execution is
+ ///complete and caller can retrieve results using getResult()
+ /// </summary>
+ //generic<class TKey>
+ void EndResults();
+
+ /// <summary>
+ ///Geode will invoke this method before re-executing function (in case of
+ /// Function Execution HA) This is to clear the previous execution results from
+ /// the result collector
+ /// @since 6.5
+ /// </summary>
+ //generic<class TKey>
+ void ClearResults(/*bool*/);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ISelectResults.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ISelectResults.hpp b/clicache/src/ISelectResults.hpp
new file mode 100644
index 0000000..68feff8
--- /dev/null
+++ b/clicache/src/ISelectResults.hpp
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/SelectResults.hpp>
+#include "end_native.hpp"
+
+
+#include "IGeodeSerializable.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ ref class SelectResultsIterator;
+
+ /// <summary>
+ /// Interface to encapsulate a select query result set.
+ /// </summary>
+ generic<class TResult>
+ public interface class ISelectResults
+ : public System::Collections::Generic::IEnumerable</*IGeodeSerializable^*/TResult>
+ {
+ public:
+
+ /// <summary>
+ /// True if this <c>ISelectResults</c> is modifiable.
+ /// </summary>
+ property bool IsModifiable
+ {
+ bool get( );
+ }
+
+ /// <summary>
+ /// The size of the <c>ISelectResults</c>.
+ /// </summary>
+ property System::Int32 Size
+ {
+ System::Int32 get( );
+ }
+
+ /// <summary>
+ /// Get an object at the given index.
+ /// </summary>
+ property /*Apache::Geode::Client::IGeodeSerializable^*/TResult GFINDEXER( size_t )
+ {
+ /*Apache::Geode::Client::IGeodeSerializable^*/TResult get( size_t index );
+ }
+
+ /// <summary>
+ /// Get an iterator for the result set.
+ /// </summary>
+ Apache::Geode::Client::SelectResultsIterator<TResult>^ GetIterator( );
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ISubscriptionService.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ISubscriptionService.hpp b/clicache/src/ISubscriptionService.hpp
new file mode 100644
index 0000000..1c91efd
--- /dev/null
+++ b/clicache/src/ISubscriptionService.hpp
@@ -0,0 +1,627 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey>
+ /// <summary>
+ /// This generic interface class provides all Register Interest API's for
+ /// geode's generic non local region (Region<TKey, TValue>).
+ /// Region<TKey, TValue> class implements all methods of this interface class.
+ /// LocalRegion<TKey, TValue> class does not implement this interface class.
+ /// </summary>
+ public interface class ISubscriptionService
+ {
+ public:
+
+ /// <summary>
+ /// Registers a collection of keys for getting updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <param name="keys">a collection of keys</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is empty.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// If already registered interest for all keys.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys);
+
+ /// <summary>
+ /// Registers a collection of keys for getting updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="keys">a collection of keys</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of the keys
+ /// that were registered on the server
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is empty.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// If already registered interest for all keys.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys, bool isDurable, bool getInitialValues);
+
+ /// <summary>
+ /// Registers a collection of keys for getting updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="keys">a collection of keys</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of the keys
+ /// that were registered on the server
+ /// </param>
+ /// <param name="receiveValues">
+ /// whether to act like notify-by-subscription is true
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is empty.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// If already registered interest for all keys.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys, bool isDurable, bool getInitialValues, bool receiveValues);
+
+ /// <summary>
+ /// Unregisters a collection of keys to stop getting updates for them.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is empty.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// If no keys were previously registered.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void UnregisterKeys(System::Collections::Generic::ICollection<TKey>^ keys);
+
+ /// <summary>
+ /// Register interest for all the keys of the region to get
+ /// updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterAllKeys();
+
+ /// <summary>
+ /// Register interest for all the keys of the region to get
+ /// updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterAllKeys(bool isDurable);
+
+ /// <summary>
+ /// Register interest for all the keys of the region to get
+ /// updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="resultKeys">
+ /// if non-null then all keys on the server are returned
+ /// </param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of all the keys
+ /// from the server
+ /// </param>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues);
+
+ /// <summary>
+ /// Register interest for all the keys of the region to get
+ /// updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="resultKeys">
+ /// if non-null then all keys on the server are returned
+ /// </param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of all the keys
+ /// from the server
+ /// </param>
+ /// <param name="receiveValues">
+ /// whether to act like notify-by-subscription is true
+ /// </param>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues,
+ bool receiveValues);
+
+ /// <summary>
+ /// get the interest list on this client
+ /// </summary>
+ System::Collections::Generic::ICollection<TKey>^ GetInterestList();
+
+ /// <summary>
+ /// get the list of interest regular expressions on this client
+ /// </summary>
+ System::Collections::Generic::ICollection<String^>^ GetInterestListRegex();
+
+ /// <summary>
+ /// Unregister interest for all the keys of the region to stop
+ /// getting updates for them.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// If not previously registered all keys.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void UnregisterAllKeys();
+
+ /// <summary>
+ /// Register interest for the keys of the region that match the
+ /// given regular expression to get updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterRegex(String^ regex);
+
+ /// <summary>
+ /// Register interest for the keys of the region that match the
+ /// given regular expression to get updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="regex">the regular expression to register</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterRegex(String^ regex, bool isDurable);
+
+ /// <summary>
+ /// Register interest for the keys of the region that match the
+ /// given regular expression to get updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="regex">the regular expression to register</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="resultKeys">
+ /// if non-null then the keys that match the regular expression
+ /// on the server are returned
+ ///</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys);
+
+ /// <summary>
+ /// Register interest for the keys of the region that match the
+ /// given regular expression to get updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="regex">the regular expression to register</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="resultKeys">
+ /// if non-null then the keys that match the regular expression
+ /// on the server are returned
+ ///</param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of the keys
+ /// that were registered on the server
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues);
+
+ /// <summary>
+ /// Register interest for the keys of the region that match the
+ /// given regular expression to get updates from the server.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// Should only be called for durable clients and with cache server version 5.5 onwards.
+ /// </summary>
+ /// <param name="regex">the regular expression to register</param>
+ /// <param name="isDurable">whether the registration should be durable</param>
+ /// <param name="resultKeys">
+ /// if non-null then the keys that match the regular expression
+ /// on the server are returned
+ ///</param>
+ /// <param name="getInitialValues">
+ /// true to populate the cache with values of the keys
+ /// that were registered on the server
+ /// </param>
+ /// <param name="receiveValues">
+ /// whether to act like notify-by-subscription is true
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues, bool receiveValues);
+
+ /// <summary>
+ /// Unregister interest for the keys of the region that match the
+ /// given regular expression to stop getting updates for them.
+ /// The regular expression must have been registered previously using
+ /// a <c>RegisterRegex</c> call.
+ /// Valid only for a Native Client region when client notification
+ /// ( <see cref="AttributesFactory.SetClientNotificationEnabled" /> ) is true.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// If the regular expression string is empty.
+ /// </exception>
+ /// <exception cref="IllegalStateException">
+ /// If this regular expression has not been registered by a previous
+ /// call to <c>RegisterRegex</c>.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="UnsupportedOperationException">
+ /// If the region is not a Native Client region or
+ /// <see cref="AttributesFactory.SetClientNotificationEnabled" /> is false.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="UnknownException">For other exceptions.</exception>
+ void UnregisterRegex(String^ regex);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ITransactionListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ITransactionListener.hpp b/clicache/src/ITransactionListener.hpp
new file mode 100644
index 0000000..a4db8cf
--- /dev/null
+++ b/clicache/src/ITransactionListener.hpp
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "geode_defs.hpp"
+#include "TransactionEvent.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An application plug-in that can be installed for getting events for
+ /// cache transactions.
+ /// </summary>
+ /// <seealso cref="CacheTransactionManager.AddListener" />
+ generic<class TKey, class TValue>
+ public interface class ITransactionListener
+ {
+ public:
+
+ /// <summary>
+ /// Called after a successful commit of a transaction.
+ /// </summary>
+ /// <param name="te">the transaction event</param>
+ /// <seealso cref="CacheTransactionManager.Commit" />
+ void AfterCommit(TransactionEvent<TKey, TValue>^ te);
+
+ /// <summary>
+ /// Called after an unsuccessful commit operation.
+ /// </summary>
+ /// <param name="te">the transaction event</param>
+ /// <seealso cref="CacheTransactionManager.Commit" />
+ void AfterFailedCommit(TransactionEvent<TKey, TValue>^ te);
+
+ /// <summary>
+ /// Called after an explicit rollback of a transaction.
+ /// </summary>
+ /// <param name="te">the transaction event</param>
+ /// <seealso cref="CacheTransactionManager.Commit" />
+ /// <seealso cref="CacheTransactionManager.Rollback" />
+ void AfterRollback(TransactionEvent<TKey, TValue>^ te);
+
+ /// <summary>
+ /// alled when the region containing this callback is closed or destroyed, when
+ /// the cache is closed, or when a callback is removed from a region
+ /// using an <code>AttributesMutator</code>.
+ /// Implementations should cleanup any external
+ /// resources such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </summary>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.Close" />
+ /// <seealso cref="Region.LocalDestroyRegion" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ITransactionWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ITransactionWriter.hpp b/clicache/src/ITransactionWriter.hpp
new file mode 100644
index 0000000..3874d0d
--- /dev/null
+++ b/clicache/src/ITransactionWriter.hpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "geode_defs.hpp"
+#include "TransactionEvent.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A callback that is allowed to veto a transaction. Only one TransactionWriter can exist
+ /// per cache, and only one TransactionWriter will be fired in the
+ /// entire distributed system for each transaction.
+ /// This writer can be used to update a backend data source before the Geode
+ /// cache is updated during commit. If the backend update fails, the implementer
+ /// can throw a {<c>TransactionWriterException</c>} to veto the transaction.
+ /// </summary>
+ /// <seealso cref="CacheTransactionManager.SetWriter" />
+ generic<class TKey, class TValue>
+ public interface class ITransactionWriter
+ {
+ public:
+ /// <summary>
+ /// Called before the transaction has finished committing, but after conflict checking.
+ /// Provides an opportunity for implementors to cause transaction abort by throwing a
+ /// TransactionWriterException
+ /// </summary>
+ /// <param name="te">the transaction event</param>
+ /// <exception cref="TransactionWriterException">
+ /// in the event that the transaction should be rolled back
+ /// </exception>
+ /// <seealso cref="CacheTransactionManager.Commit" />
+ void BeforeCommit(TransactionEvent<TKey, TValue>^ te);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IWritablePdxInstance.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IWritablePdxInstance.hpp b/clicache/src/IWritablePdxInstance.hpp
new file mode 100755
index 0000000..160ffb8
--- /dev/null
+++ b/clicache/src/IWritablePdxInstance.hpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// WritablePdxInstance is a <see cref="IPdxInstance" /> that also supports field modification
+ /// using the <see cref="SetField" />method.
+ /// To get a WritablePdxInstance call <see cref="IPdxInstance.CreateWriter" />.
+ /// </summary>
+ public interface class IWritablePdxInstance
+ {
+ public:
+ /// <summary>
+ ///Set the existing named field to the given value.
+ ///The setField method has copy-on-write semantics.
+ /// So for the modifications to be stored in the cache the WritablePdxInstance
+ ///must be put into a region after setField has been called one or more times.
+ /// </summary>
+ ///
+ ///<param name="fieldName"> name of the field whose value will be set </param>
+ ///<param name="value"> value that will be assigned to the field </param>
+ ///<exception cref="IllegalStateException"/> if the named field does not exist
+ ///or if the type of the value is not compatible with the field </exception>
+
+ void SetField(String^ fieldName, Object^ value);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/LocalRegion.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/LocalRegion.cpp b/clicache/src/LocalRegion.cpp
new file mode 100644
index 0000000..1313558
--- /dev/null
+++ b/clicache/src/LocalRegion.cpp
@@ -0,0 +1,1005 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include "geode/Region.hpp"
+#include "geode/Cache.hpp"
+#include "end_native.hpp"
+
+#include "LocalRegion.hpp"
+#include "Cache.hpp"
+#include "CacheStatistics.hpp"
+#include "AttributesMutator.hpp"
+#include "RegionEntry.hpp"
+#include "impl/AuthenticatedCache.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ TValue LocalRegion<TKey, TValue>::Get(TKey key, Object^ callbackArg)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ auto nativeptr= this->getRegionEntryValue(keyptr);
+ if (nativeptr == nullptr)
+ {
+ throw gcnew KeyNotFoundException("The given key was not present in the region");
+ }
+ TValue returnVal = Serializable::GetManagedValueGeneric<TValue>( nativeptr );
+ return returnVal;
+ }
+
+ generic<class TKey, class TValue>
+ apache::geode::client::SerializablePtr LocalRegion<TKey, TValue>::getRegionEntryValue(apache::geode::client::CacheableKeyPtr& keyptr)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ if (auto entryPtr = m_nativeptr->get()->getEntry(keyptr)) {
+ return entryPtr->getValue();
+ }
+ else {
+ return nullptr;
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Put(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localPut( keyptr, valueptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ TValue LocalRegion<TKey, TValue>::default::get(TKey key)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
+ if (nativeptr == nullptr)
+ {
+ throw gcnew KeyNotFoundException("The given key was not present in the region");
+ }
+ TValue returnVal = Serializable::GetManagedValueGeneric<TValue>( nativeptr );
+ return returnVal;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::default::set(TKey key, TValue value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localPut( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::IEnumerator<KeyValuePair<TKey,TValue>>^
+ LocalRegion<TKey, TValue>::GetEnumerator()
+ {
+ apache::geode::client::VectorOfRegionEntry vc;
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ auto toArray = gcnew array<KeyValuePair<TKey,TValue>>(static_cast<int>(vc.size()));
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ auto nativeptr = vc[ index ];
+ TKey key = Serializable::GetManagedValueGeneric<TKey> (nativeptr->getKey());
+ TValue val = Serializable::GetManagedValueGeneric<TValue> (nativeptr->getValue());
+ toArray[ index ] = KeyValuePair<TKey,TValue>(key, val);
+ }
+ return ((System::Collections::Generic::IEnumerable<KeyValuePair<TKey,TValue>>^)toArray)->GetEnumerator();
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::IEnumerator^
+ LocalRegion<TKey, TValue>::GetEnumeratorOld()
+ {
+ apache::geode::client::VectorOfRegionEntry vc;
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ auto toArray = gcnew array<Object^>(static_cast<int>(vc.size()));
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ auto nativeptr = vc[ index ];
+ TKey key = Serializable::GetManagedValueGeneric<TKey> (nativeptr->getKey());
+ TValue val = Serializable::GetManagedValueGeneric<TValue> (nativeptr->getValue());
+ toArray[ index ] = KeyValuePair<TKey,TValue>(key, val);
+ }
+ return ((System::Collections::Generic::IEnumerable<Object^>^)toArray)->GetEnumerator();
+ }
+
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2)
+ {
+ if ( val1 == nullptr && val2 == nullptr )
+ {
+ return true;
+ }
+ else if ((val1 == nullptr && val2 != nullptr) || (val1 != nullptr && val2 == nullptr))
+ {
+ return false;
+ }
+ else if( val1 != nullptr && val2 != nullptr )
+ {
+ if (val1->classId() != val2->classId() || val1->typeId() != val2->typeId())
+ {
+ return false;
+ }
+ std::unique_ptr<apache::geode::client::DataOutput> out1 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+ std::unique_ptr<apache::geode::client::DataOutput> out2 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+ val1->toData(*out1);
+ val2->toData(*out2);
+ if ( out1->getBufferLength() != out2->getBufferLength() )
+ {
+ return false;
+ }
+ else if (memcmp(out1->getBuffer(), out2->getBuffer(), out1->getBufferLength()) != 0)
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::Contains(KeyValuePair<TKey,TValue> keyValuePair)
+ {
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
+ //This means that key is not present.
+ if (nativeptr == nullptr) {
+ return false;
+ }
+ TValue value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ return ((Object^)value)->Equals(keyValuePair.Value);
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::ContainsKey(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ return m_nativeptr->get()->containsKey(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::TryGetValue(TKey key, TValue %val)
+ {
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
+ if (nativeptr == nullptr) {
+ val = TValue();
+ return false;
+ }
+ else {
+ val = Serializable::GetManagedValueGeneric<TValue>( nativeptr );
+ return true;
+ }
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<TKey>^ LocalRegion<TKey, TValue>::Keys::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::client::VectorOfCacheableKey vc;
+ try
+ {
+ m_nativeptr->get()->keys(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ auto keyarr = gcnew array<TKey>( static_cast<int>(vc.size( )) );
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ auto& nativeptr = vc[ index ];
+ keyarr[ index ] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
+ }
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<TValue>^ LocalRegion<TKey, TValue>::Values::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::client::VectorOfCacheable vc;
+ try
+ {
+ m_nativeptr->get()->values( vc );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ //List<TValue>^ collectionlist = gcnew List<TValue>(vc.size());
+ auto valarr = gcnew array<TValue>( static_cast<int>(vc.size( )) );
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ auto& nativeptr = vc[ index ];
+ valarr[ index ] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ }
+ auto collectionlist = (System::Collections::Generic::ICollection<TValue>^)valarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Add(TKey key, TValue value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localCreate( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Add(KeyValuePair<TKey, TValue> keyValuePair)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localCreate( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Add(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value, m_nativeptr->get()->getCache().get() );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localCreate( keyptr, valueptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::Remove(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->localDestroy(keyptr);
+ return true;
+ }
+ catch (apache::geode::client::EntryNotFoundException /*ex*/)
+ {
+ return false;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::Remove( TKey key, Object^ callbackArg )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->localDestroy(keyptr, callbackptr);
+ return true;
+ }
+ catch (apache::geode::client::EntryNotFoundException /*ex*/)
+ {
+ return false;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::Remove(KeyValuePair<TKey,TValue> keyValuePair)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key, m_nativeptr->get()->getCache().get() );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value, m_nativeptr->get()->getCache().get() );
+ return m_nativeptr->get()->localRemove(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::Remove(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->localRemove(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::InvalidateRegion()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ InvalidateRegion( nullptr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::InvalidateRegion(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localInvalidateRegion( callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::DestroyRegion()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ DestroyRegion( nullptr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::DestroyRegion(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localDestroyRegion( callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Invalidate(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ Invalidate(key, nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Invalidate(TKey key, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key, m_nativeptr->get()->getCache().get() );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() );
+ m_nativeptr->get()->localInvalidate( keyptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout, Object^ callbackArg)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache, Object^ callbackArg)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ Object^ callbackArg)
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ String^ LocalRegion<TKey, TValue>::Name::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ String^ LocalRegion<TKey, TValue>::FullPath::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getFullPath( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ LocalRegion<TKey, TValue>::ParentRegion::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto parentRegion = m_nativeptr->get()->getParentRegion( );
+ auto region = Region<TKey, TValue>::Create( parentRegion );
+ if (region == nullptr) {
+ return nullptr;
+ }
+ return region->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ LocalRegion<TKey, TValue>::Attributes::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(m_nativeptr->get()->getAttributes());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ AttributesMutator<TKey, TValue>^ LocalRegion<TKey, TValue>::AttributesMutator::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create(m_nativeptr->get()->getAttributesMutator());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::CacheStatistics^ LocalRegion<TKey, TValue>::Statistics::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return Apache::Geode::Client::CacheStatistics::Create(m_nativeptr->get()->getStatistics());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ LocalRegion<TKey, TValue>::GetSubRegion( String^ path )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_path(path);
+ auto nativeptr = m_nativeptr->get()->getSubregion(mg_path.CharPtr);
+ auto region = Region<TKey, TValue>::Create(nativeptr);
+ if (region == nullptr) {
+ return nullptr;
+ }
+ return region->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ LocalRegion<TKey, TValue>::CreateSubRegion( String^ subRegionName,
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ attributes)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_subregionName(subRegionName);
+ return Region<TKey, TValue>::Create(m_nativeptr->get()->createSubregion(
+ mg_subregionName.CharPtr, __nullptr))->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ LocalRegion<TKey, TValue>::SubRegions( bool recursive )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::client::VectorOfRegion vsr;
+ try
+ {
+ m_nativeptr->get()->subregions( recursive, vsr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ array<IRegion<TKey, TValue>^>^ subRegions =
+ gcnew array<IRegion<TKey, TValue>^>( static_cast<int>(vsr.size( )) );
+
+ for( System::Int32 index = 0; index < vsr.size( ); index++ )
+ {
+ auto nativeptr = vsr[ index ];
+ subRegions[ index ] = Region<TKey, TValue>::Create( nativeptr )->GetLocalView();
+ }
+ auto collection = (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
+ return collection;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ RegionEntry<TKey, TValue>^ LocalRegion<TKey, TValue>::GetEntry( TKey key )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
+ return RegionEntry<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^ LocalRegion<TKey, TValue>::GetEntries(bool recursive)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::client::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries( vc, recursive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto entryarr = gcnew array<RegionEntry<TKey, TValue>^>( static_cast<int>(vc.size( )) );
+
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ auto nativeptr = vc[ index ] ;
+ entryarr[ index ] = RegionEntry<TKey, TValue>::Create( nativeptr );
+ }
+ auto collection = (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
+ return collection;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ IRegionService^ LocalRegion<TKey, TValue>::RegionService::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto regionService = m_nativeptr->get()->getRegionService();
+ if (auto realCache = std::dynamic_pointer_cast<apache::geode::client::Cache>(regionService))
+ {
+ return Apache::Geode::Client::Cache::Create(realCache);
+ }
+ else
+ {
+ return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::ContainsValueForKey( TKey key )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->containsValueForKey(Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ int LocalRegion<TKey, TValue>::Count::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Clear()
+ {
+ Clear(nullptr);
+ }
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::Clear(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->localClear(Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg, m_nativeptr->get()->getCache().get() ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+
+ generic<class TKey, class TValue>
+ void LocalRegion<TKey, TValue>::CopyTo(array<KeyValuePair<TKey,TValue>>^ toArray,
+ int startIdx)
+ {
+ if (toArray == nullptr)
+ {
+ throw gcnew System::ArgumentNullException;
+ }
+ if (startIdx < 0)
+ {
+ throw gcnew System::ArgumentOutOfRangeException;
+ }
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::client::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ if (toArray->Rank > 1 || (vc.size() > (toArray->Length - startIdx)))
+ {
+ throw gcnew System::ArgumentException;
+ }
+
+ for( System::Int32 index = 0; index < vc.size( ); index++ )
+ {
+ apache::geode::client::RegionEntryPtr nativeptr = vc[ index ];
+ TKey key = Serializable::GetManagedValueGeneric<TKey> (nativeptr->getKey());
+ TValue val = Serializable::GetManagedValueGeneric<TValue> (nativeptr->getValue());
+ toArray[ startIdx ] = KeyValuePair<TKey,TValue>(key, val);
+ ++startIdx;
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::IsDestroyed::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ generic<class TResult>
+ ISelectResults<TResult>^ LocalRegion<TKey, TValue>::Query( String^ predicate )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ generic<class TResult>
+ ISelectResults<TResult>^ LocalRegion<TKey, TValue>::Query( String^ predicate, System::UInt32 timeout )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::ExistsValue( String^ predicate )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ bool LocalRegion<TKey, TValue>::ExistsValue( String^ predicate, System::UInt32 timeout )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ Object^ LocalRegion<TKey, TValue>::SelectValue( String^ predicate )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ Object^ LocalRegion<TKey, TValue>::SelectValue( String^ predicate, System::UInt32 timeout )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ ISubscriptionService<TKey>^ LocalRegion<TKey, TValue>::GetSubscriptionService()
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ LocalRegion<TKey, TValue>::GetLocalView()
+ {
+ throw gcnew System::NotSupportedException;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[29/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheServer_pdxreadserialized.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheServer_pdxreadserialized.xml b/clicache/integration-test/cacheServer_pdxreadserialized.xml
new file mode 100644
index 0000000..7c7ac61
--- /dev/null
+++ b/clicache/integration-test/cacheServer_pdxreadserialized.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+ <pdx read-serialized="true" />
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cache_redundancy.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cache_redundancy.xml b/clicache/integration-test/cache_redundancy.xml
new file mode 100644
index 0000000..5ab3da7
--- /dev/null
+++ b/clicache/integration-test/cache_redundancy.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0"
+ redundancy-level="1"
+ endpoints="localhost:HOST_PORT1,localhost:HOST_PORT2" >
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver.xml b/clicache/integration-test/cacheserver.xml
new file mode 100644
index 0000000..24662bc
--- /dev/null
+++ b/clicache/integration-test/cacheserver.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ <region name="CreateVerifyTestRegion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_TradeKey.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_TradeKey.xml b/clicache/integration-test/cacheserver1_TradeKey.xml
new file mode 100644
index 0000000..e9c7ef5
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_TradeKey.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- cacheserver1_TradeKey.xml
+ Configures a server to for clients at port HOST_PORT1.
+-->
+
+<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 port="HOST_PORT1"/>
+ <region name="TradeKeyRegion">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="10">
+ <partition-resolver>
+ <class-name>javaobject.TradeKeyResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ </region-attributes>
+ <entry>
+ <key>
+ <declarable>
+ <class-name>javaobject.TradeKey</class-name>
+ <parameter name="m_id">
+ <string>0</string>
+ </parameter>
+ <parameter name="m_accountid">
+ <string>0</string>
+ </parameter>
+ </declarable>
+ </key>
+ <value>
+ <string>new-trade</string>
+ </value>
+ </entry>
+ </region>
+<function-service>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_expiry.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_expiry.xml b/clicache/integration-test/cacheserver1_expiry.xml
new file mode 100644
index 0000000..46a71ff
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_expiry.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!--
+ |
+ | Configures a cache to serve caching clients at port 40404.
+-->
+<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 port="HOST_PORT1"/>
+ <region name="exampleRegion" refid="REPLICATE">
+ <region-attributes statistics-enabled="true">
+
+ <entry-idle-time>
+
+ <expiration-attributes timeout="5" action="invalidate"/>
+
+ </entry-idle-time>
+
+ </region-attributes>
+ </region>
+</cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_fpr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_fpr.xml b/clicache/integration-test/cacheserver1_fpr.xml
new file mode 100644
index 0000000..4e71ee9
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_fpr.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="R1">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver1</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P1" is-primary="true" num-buckets="15"/>
+ <fixed-partition-attributes partition-name="P6" is-primary="true" num-buckets="15"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R2">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver2</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P1" is-primary="true" num-buckets="50"/>
+ <fixed-partition-attributes partition-name="P4" is-primary="true" num-buckets="5"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R3">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="100">
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver3</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P1" is-primary="true" num-buckets="50"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_partitioned.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_partitioned.xml b/clicache/integration-test/cacheserver1_partitioned.xml
new file mode 100644
index 0000000..2cf218d
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_partitioned.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_partitioned_R1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_partitioned_R1.xml b/clicache/integration-test/cacheserver1_partitioned_R1.xml
new file mode 100644
index 0000000..e00dae1
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_partitioned_R1.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_partitioned_servergroup.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_partitioned_servergroup.xml b/clicache/integration-test/cacheserver1_partitioned_servergroup.xml
new file mode 100644
index 0000000..18b59d1
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_partitioned_servergroup.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1">
+ <group>A</group>
+ <group>AB</group>
+ <group>ABC</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_pool.xml b/clicache/integration-test/cacheserver1_pool.xml
new file mode 100644
index 0000000..09f46d0
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_pool.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1">
+ <group>ServerGroup1</group>
+ </cache-server>
+ <region name='PoolRegion1'>
+ <region-attributes scope="distributed-ack" data-policy="replicate"></region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_pr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_pr.xml b/clicache/integration-test/cacheserver1_pr.xml
new file mode 100644
index 0000000..0ef511c
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_pr.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="30">
+ <partition-resolver>
+ <class-name>javaobject.CustomPartitionResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver1_pr_putall.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver1_pr_putall.xml b/clicache/integration-test/cacheserver1_pr_putall.xml
new file mode 100644
index 0000000..e00dae1
--- /dev/null
+++ b/clicache/integration-test/cacheserver1_pr_putall.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2.xml b/clicache/integration-test/cacheserver2.xml
new file mode 100644
index 0000000..84a0c9f
--- /dev/null
+++ b/clicache/integration-test/cacheserver2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_TradeKey.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_TradeKey.xml b/clicache/integration-test/cacheserver2_TradeKey.xml
new file mode 100644
index 0000000..51427f7
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_TradeKey.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- cacheserver2_TradeKey.xml
+ Configures a server to for clients at port HOST_PORT2.
+-->
+
+<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 port="HOST_PORT2"/>
+ <region name="TradeKeyRegion">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="10">
+ <partition-resolver>
+ <class-name>javaobject.TradeKeyResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ </region-attributes>
+ <entry>
+ <key>
+ <declarable>
+ <class-name>javaobject.TradeKey</class-name>
+ <parameter name="m_id">
+ <string>0</string>
+ </parameter>
+ <parameter name="m_accountid">
+ <string>0</string>
+ </parameter>
+ </declarable>
+ </key>
+ <value>
+ <string>new-trade</string>
+ </value>
+ </entry>
+ </region>
+<function-service>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_fpr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_fpr.xml b/clicache/integration-test/cacheserver2_fpr.xml
new file mode 100644
index 0000000..03b8001
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_fpr.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="R1">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver1</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P2" is-primary="true" num-buckets="15"/>
+ <fixed-partition-attributes partition-name="P4" is-primary="true" num-buckets="15"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R2">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver2</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P2" is-primary="true" num-buckets="5"/>
+ <fixed-partition-attributes partition-name="P5" is-primary="true" num-buckets="5"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R3">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="100">
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver3</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P2" is-primary="true" num-buckets="25"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_partitioned.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_partitioned.xml b/clicache/integration-test/cacheserver2_partitioned.xml
new file mode 100644
index 0000000..e986312
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_partitioned.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_partitioned_R1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_partitioned_R1.xml b/clicache/integration-test/cacheserver2_partitioned_R1.xml
new file mode 100644
index 0000000..ad74b19
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_partitioned_R1.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_partitioned_servergroup.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_partitioned_servergroup.xml b/clicache/integration-test/cacheserver2_partitioned_servergroup.xml
new file mode 100644
index 0000000..8e17ea2
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_partitioned_servergroup.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2">
+ <group>B</group>
+ <group>BC</group>
+ <group>ABC</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_pool.xml b/clicache/integration-test/cacheserver2_pool.xml
new file mode 100644
index 0000000..c39fb34
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_pool.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24681" /-->
+ <cache-server port="HOST_PORT2">
+ <group>ServerGroup1</group>
+ </cache-server>
+ <region name='PoolRegion1'>
+ <region-attributes scope="distributed-ack" data-policy="replicate"></region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_pr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_pr.xml b/clicache/integration-test/cacheserver2_pr.xml
new file mode 100644
index 0000000..0796994
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_pr.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="30">
+ <partition-resolver>
+ <class-name>javaobject.CustomPartitionResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver2_pr_putall.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver2_pr_putall.xml b/clicache/integration-test/cacheserver2_pr_putall.xml
new file mode 100644
index 0000000..ad74b19
--- /dev/null
+++ b/clicache/integration-test/cacheserver2_pr_putall.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3.xml b/clicache/integration-test/cacheserver3.xml
new file mode 100644
index 0000000..9e47f0d
--- /dev/null
+++ b/clicache/integration-test/cacheserver3.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT3"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_TradeKey.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_TradeKey.xml b/clicache/integration-test/cacheserver3_TradeKey.xml
new file mode 100644
index 0000000..7577344
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_TradeKey.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- cacheserver2_TradeKey.xml
+ Configures a server to for clients at port HOST_PORT3.
+-->
+
+<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 port="HOST_PORT3"/>
+ <region name="TradeKeyRegion">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="10">
+ <partition-resolver>
+ <class-name>javaobject.TradeKeyResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ </region-attributes>
+ <entry>
+ <key>
+ <declarable>
+ <class-name>javaobject.TradeKey</class-name>
+ <parameter name="m_id">
+ <string>0</string>
+ </parameter>
+ <parameter name="m_accountid">
+ <string>0</string>
+ </parameter>
+ </declarable>
+ </key>
+ <value>
+ <string>new-trade</string>
+ </value>
+ </entry>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_fpr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_fpr.xml b/clicache/integration-test/cacheserver3_fpr.xml
new file mode 100644
index 0000000..1ccfe92
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_fpr.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3"/>
+
+ <region name="R1">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver1</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P3" is-primary="true" num-buckets="15"/>
+ <fixed-partition-attributes partition-name="P5" is-primary="true" num-buckets="15"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R2">
+ <region-attributes data-policy="partition">
+ <partition-attributes>
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver2</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P3" is-primary="true" num-buckets="5"/>
+ <fixed-partition-attributes partition-name="P6" is-primary="true" num-buckets="5"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+ <region name="R3">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="100">
+ <partition-resolver>
+ <class-name>javaobject.CustomFixedPartitionResolver3</class-name>
+ </partition-resolver>
+ <fixed-partition-attributes partition-name="P3" is-primary="true" num-buckets="25"/>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_partitioned.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_partitioned.xml b/clicache/integration-test/cacheserver3_partitioned.xml
new file mode 100644
index 0000000..79b4cf9
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_partitioned.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_partitioned_servergroup.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_partitioned_servergroup.xml b/clicache/integration-test/cacheserver3_partitioned_servergroup.xml
new file mode 100644
index 0000000..2b8ac4d
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_partitioned_servergroup.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3">
+ <group>C</group>
+ <group>AC</group>
+ <group>ABC</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_pool.xml b/clicache/integration-test/cacheserver3_pool.xml
new file mode 100644
index 0000000..4a62701
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_pool.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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"/>
+ <region name="PoolRegion1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="PoolRegion2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_pr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_pr.xml b/clicache/integration-test/cacheserver3_pr.xml
new file mode 100644
index 0000000..a1c2b5f
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_pr.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="30">
+ <partition-resolver>
+ <class-name>javaobject.CustomPartitionResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes total-num-buckets="30" colocated-with="DistRegionAck">
+ <partition-resolver>
+ <class-name>javaobject.CustomPartitionResolver</class-name>
+ </partition-resolver>
+ </partition-attributes>
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver3_pr_putall.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver3_pr_putall.xml b/clicache/integration-test/cacheserver3_pr_putall.xml
new file mode 100644
index 0000000..274dfa5
--- /dev/null
+++ b/clicache/integration-test/cacheserver3_pr_putall.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver4.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver4.xml b/clicache/integration-test/cacheserver4.xml
new file mode 100644
index 0000000..90f5be5
--- /dev/null
+++ b/clicache/integration-test/cacheserver4.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck4">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck5">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck6">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver4_pr_putall.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver4_pr_putall.xml b/clicache/integration-test/cacheserver4_pr_putall.xml
new file mode 100644
index 0000000..56e1197
--- /dev/null
+++ b/clicache/integration-test/cacheserver4_pr_putall.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT4"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <partition-attributes redundant-copies="1"/>
+ <!--cache-loader>
+ <class-name>javaobject.CacheLoaderForSingleHop</class-name>
+ </cache-loader-->
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverDurableCqs.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverDurableCqs.xml b/clicache/integration-test/cacheserverDurableCqs.xml
new file mode 100644
index 0000000..fc9b3e2
--- /dev/null
+++ b/clicache/integration-test/cacheserverDurableCqs.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<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 port="HOST_PORT1"/>
+ <region name="ListDurableCqs">
+ <region-attributes scope="distributed-ack" data-policy="replicate" />
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverForPdx.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverForPdx.xml b/clicache/integration-test/cacheserverForPdx.xml
new file mode 100644
index 0000000..f652cc0
--- /dev/null
+++ b/clicache/integration-test/cacheserverForPdx.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverForPdxWithAuto.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverForPdxWithAuto.xml b/clicache/integration-test/cacheserverForPdxWithAuto.xml
new file mode 100644
index 0000000..1e1b22e
--- /dev/null
+++ b/clicache/integration-test/cacheserverForPdxWithAuto.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListenerWithAuto</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListenerWithAuto</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.SimpleCacheListenerWithAuto</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverMDS1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverMDS1.xml b/clicache/integration-test/cacheserverMDS1.xml
new file mode 100644
index 0000000..6f43946
--- /dev/null
+++ b/clicache/integration-test/cacheserverMDS1.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverMDS2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverMDS2.xml b/clicache/integration-test/cacheserverMDS2.xml
new file mode 100644
index 0000000..9763229
--- /dev/null
+++ b/clicache/integration-test/cacheserverMDS2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverPdx.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverPdx.xml b/clicache/integration-test/cacheserverPdx.xml
new file mode 100644
index 0000000..c280ae9
--- /dev/null
+++ b/clicache/integration-test/cacheserverPdx.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+ <pdx read-serialized="true" />
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxCacheListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverPdx2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverPdx2.xml b/clicache/integration-test/cacheserverPdx2.xml
new file mode 100644
index 0000000..3c3bd69
--- /dev/null
+++ b/clicache/integration-test/cacheserverPdx2.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+ <pdx read-serialized="true" />
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ </region-attributes>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ </region-attributes>
+ </region>
+ <function-service>
+
+ <function>
+ <class-name>javaobject.ComparePdxTypes</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.IterateRegion</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserverPdxSerializer.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserverPdxSerializer.xml b/clicache/integration-test/cacheserverPdxSerializer.xml
new file mode 100644
index 0000000..e3a43f1
--- /dev/null
+++ b/clicache/integration-test/cacheserverPdxSerializer.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+ <pdx read-serialized="true" />
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
[42/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyListener.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyListener.cs b/clicache/integration-test/TallyListener.cs
new file mode 100644
index 0000000..62a6df0
--- /dev/null
+++ b/clicache/integration-test/TallyListener.cs
@@ -0,0 +1,300 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+
+ class TallyListener : Apache.Geode.Client.CacheListenerAdapter<Object, Object>
+ {
+ #region Private members
+
+ private int m_creates = 0;
+ private int m_updates = 0;
+ private int m_invalidates = 0;
+ private int m_destroys = 0;
+ private int m_clears = 0;
+ private Apache.Geode.Client.ICacheableKey m_lastKey = null;
+ private Apache.Geode.Client.IGeodeSerializable m_lastValue = null;
+ private Apache.Geode.Client.IGeodeSerializable m_callbackArg = null;
+ private bool m_ignoreTimeout = false;
+ private bool m_quiet = false;
+ private bool isListenerInvoke = false;
+ private bool isCallbackCalled = false;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Creates
+ {
+ get
+ {
+ return m_creates;
+ }
+ }
+
+ public int Clears
+ {
+ get
+ {
+ return m_clears;
+ }
+ }
+
+ public int Updates
+ {
+ get
+ {
+ return m_updates;
+ }
+ }
+
+ public int Invalidates
+ {
+ get
+ {
+ return m_invalidates;
+ }
+ }
+
+ public int Destroys
+ {
+ get
+ {
+ return m_destroys;
+ }
+ }
+
+ public Apache.Geode.Client.IGeodeSerializable LastKey
+ {
+ get
+ {
+ return m_lastKey;
+ }
+ }
+
+ public bool IsListenerInvoked
+ {
+ get
+ {
+ return isListenerInvoke;
+ }
+ }
+
+ public bool IsCallBackArgCalled
+ {
+ get
+ {
+ return isCallbackCalled;
+ }
+ }
+
+ public Apache.Geode.Client.IGeodeSerializable LastValue
+ {
+ get
+ {
+ return m_lastValue;
+ }
+ }
+
+ public bool IgnoreTimeout
+ {
+ set
+ {
+ m_ignoreTimeout = value;
+ }
+ }
+
+ public bool Quiet
+ {
+ set
+ {
+ m_quiet = value;
+ }
+ }
+
+ public void SetCallBackArg(Apache.Geode.Client.IGeodeSerializable callbackArg)
+ {
+ m_callbackArg = callbackArg;
+ }
+
+
+ #endregion
+
+ public void CheckcallbackArg(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ if (!isListenerInvoke)
+ isListenerInvoke = true;
+ if (m_callbackArg != null)
+ {
+ Apache.Geode.Client.IGeodeSerializable callbkArg = (Apache.Geode.Client.IGeodeSerializable)ev.CallbackArgument;
+ if (m_callbackArg.Equals(callbkArg))
+ isCallbackCalled = true;
+ }
+ }
+
+
+ public void ResetListenerInvokation()
+ {
+ isListenerInvoke = false;
+ isCallbackCalled = false;
+ }
+ public int ExpectCreates(int expected)
+ {
+ int tries = 0;
+ while ((m_creates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_creates;
+ }
+
+ public int ExpectUpdates(int expected)
+ {
+ int tries = 0;
+ while ((m_updates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_updates;
+ }
+
+ public int ExpectedInvalidates(int expected)
+ {
+ int tries = 0;
+ while ((m_invalidates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_invalidates;
+ }
+
+ public int ExpectedDestroys(int expected)
+ {
+ int tries = 0;
+ while ((m_destroys < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_destroys;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyListener state: (updates = {0}, creates = {1}, invalidates = {2}, destroys = {3})",
+ Updates,Creates, Invalidates, Destroys);
+ }
+
+ #region Logging functions that check for m_quiet
+
+ private void WriteLog(string message)
+ {
+ if (!m_quiet)
+ {
+ Util.Log(message);
+ }
+ }
+
+ private void WriteLog(string format, params object[] args)
+ {
+ if (!m_quiet)
+ {
+ Util.Log(format, args);
+ }
+ }
+
+ public static TallyListener Create()
+ {
+ return new TallyListener();
+ }
+
+ #endregion
+
+ #region ICacheListener Members
+
+ public override void AfterCreate(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_creates++;
+ m_lastKey = (Apache.Geode.Client.ICacheableKey)ev.Key;
+ m_lastValue = (Apache.Geode.Client.IGeodeSerializable)ev.NewValue;
+ CheckcallbackArg(ev);
+
+ string keyString = m_lastKey.ToString();
+ WriteLog("TallyListener create - key = \"{0}\", value = \"{1}\"",
+ keyString, m_lastValue.ToString());
+
+ if ((!m_ignoreTimeout) && (keyString.IndexOf("timeout") >= 0))
+ {
+ WriteLog("TallyListener: Sleeping 10 seconds to force a timeout.");
+ Thread.Sleep(10000); // this should give the client cause to timeout...
+ WriteLog("TallyListener: done sleeping..");
+ }
+ }
+
+ public override void AfterUpdate(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_updates++;
+ m_lastKey = (Apache.Geode.Client.ICacheableKey)ev.Key;
+ m_lastValue = (Apache.Geode.Client.IGeodeSerializable)ev.NewValue;
+ CheckcallbackArg(ev);
+
+ string keyString = m_lastKey.ToString();
+ WriteLog("TallyListener update - key = \"{0}\", value = \"{1}\"",
+ keyString, m_lastValue.ToString());
+
+ if ((!m_ignoreTimeout) && (keyString.IndexOf("timeout") >= 0))
+ {
+ WriteLog("TallyListener: Sleeping 10 seconds to force a timeout.");
+ Thread.Sleep(10000); // this should give the client cause to timeout...
+ WriteLog("TallyListener: done sleeping..");
+ }
+ }
+ public override void AfterDestroy(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_destroys++;
+ CheckcallbackArg(ev);
+ }
+ public override void AfterInvalidate(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_invalidates++;
+ CheckcallbackArg(ev);
+ }
+
+ public override void AfterRegionDestroy(Apache.Geode.Client.RegionEvent<Object, Object> ev) { }
+
+ public override void AfterRegionClear(Apache.Geode.Client.RegionEvent<Object, Object> ev)
+ {
+ m_clears++;
+ }
+
+ public override void AfterRegionInvalidate(Apache.Geode.Client.RegionEvent<Object, Object> ev) { }
+
+ public override void AfterRegionLive(Apache.Geode.Client.RegionEvent<Object, Object> ev) { }
+
+ public override void Close(Apache.Geode.Client.IRegion<Object, Object> region) { }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyListenerN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyListenerN.cs b/clicache/integration-test/TallyListenerN.cs
new file mode 100644
index 0000000..3bad24e
--- /dev/null
+++ b/clicache/integration-test/TallyListenerN.cs
@@ -0,0 +1,333 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ class TallyListener<TKey, TVal> : CacheListenerAdapter<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_creates = 0;
+ private int m_updates = 0;
+ private int m_invalidates = 0;
+ private int m_destroys = 0;
+ private int m_clears = 0;
+ private TKey m_lastKey = default(TKey);
+ private TVal m_lastValue = default(TVal);
+ private object m_callbackArg = null;
+ private bool m_ignoreTimeout = false;
+ private bool m_quiet = false;
+ private bool isListenerInvoke = false;
+ private bool isCallbackCalled = false;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Creates
+ {
+ get
+ {
+ return m_creates;
+ }
+ }
+
+ public int Clears
+ {
+ get
+ {
+ return m_clears;
+ }
+ }
+
+ public int Updates
+ {
+ get
+ {
+ return m_updates;
+ }
+ }
+
+ public int Invalidates
+ {
+ get
+ {
+ return m_invalidates;
+ }
+ }
+
+ public int Destroys
+ {
+ get
+ {
+ return m_destroys;
+ }
+ }
+
+ public TKey LastKey
+ {
+ get
+ {
+ return m_lastKey;
+ }
+ }
+
+ public bool IsListenerInvoked
+ {
+ get
+ {
+ return isListenerInvoke;
+ }
+ }
+
+ public bool IsCallBackArgCalled
+ {
+ get
+ {
+ return isCallbackCalled;
+ }
+ }
+
+ public TVal LastValue
+ {
+ get
+ {
+ return m_lastValue;
+ }
+ }
+
+ public bool IgnoreTimeout
+ {
+ set
+ {
+ m_ignoreTimeout = value;
+ }
+ }
+
+ public bool Quiet
+ {
+ set
+ {
+ m_quiet = value;
+ }
+ }
+
+ public void SetCallBackArg(object callbackArg)
+ {
+ m_callbackArg = callbackArg;
+ }
+
+
+ #endregion
+
+ public void CheckcallbackArg<TKey1, TVal1>(EntryEvent<TKey1, TVal1> ev)
+ {
+ Util.Log("TallyListenerN: Checking callback arg for EntryEvent " +
+ "key:{0} oldval: {1} newval:{2} cbArg:{3} for region:{4} and remoteOrigin:{5}",
+ ev.Key, ev.NewValue, ev.OldValue, ev.CallbackArgument, ev.Region.Name, ev.RemoteOrigin);
+
+ if (!isListenerInvoke)
+ isListenerInvoke = true;
+ /*
+ if (m_callbackArg != null)
+ {
+ IGeodeSerializable callbkArg1 = ev.CallbackArgument as IGeodeSerializable;
+ IGeodeSerializable callbkArg2 = m_callbackArg as IGeodeSerializable;
+ if (callbkArg2 != null && callbkArg2.Equals(callbkArg1))
+ {
+ isCallbackCalled = true;
+ }
+ string callbkArg3 = ev.CallbackArgument as string;
+ string callbkArg4 = m_callbackArg as string;
+ if (callbkArg3 != null && callbkArg3.Equals(callbkArg4))
+ {
+ isCallbackCalled = true;
+ }
+ }
+ */
+ if (m_callbackArg != null && m_callbackArg.Equals(ev.CallbackArgument))
+ {
+ isCallbackCalled = true;
+ }
+ }
+
+
+ public void ResetListenerInvokation()
+ {
+ isListenerInvoke = false;
+ isCallbackCalled = false;
+ }
+ public int ExpectCreates(int expected)
+ {
+ int tries = 0;
+ while ((m_creates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_creates;
+ }
+
+ public int ExpectUpdates(int expected)
+ {
+ int tries = 0;
+ while ((m_updates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_updates;
+ }
+
+ public int ExpectedInvalidates(int expected)
+ {
+ int tries = 0;
+ while ((m_invalidates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_invalidates;
+ }
+
+ public int ExpectedDestroys(int expected)
+ {
+ int tries = 0;
+ while ((m_destroys < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_destroys;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyListener state: (updates = {0}, creates = {1}, invalidates = {2}, destroys = {3})",
+ Updates,Creates, Invalidates, Destroys);
+ }
+
+ #region Logging functions that check for m_quiet
+
+ private void WriteLog(string message)
+ {
+ if (!m_quiet)
+ {
+ Util.Log(message);
+ }
+ }
+
+ private void WriteLog(string format, params object[] args)
+ {
+ if (!m_quiet)
+ {
+ Util.Log(format, args);
+ }
+ }
+
+ public static TallyListener<TKey, TVal> Create()
+ {
+ return new TallyListener<TKey, TVal>();
+ }
+
+ #endregion
+
+ #region ICacheListener Members
+
+ public override void AfterCreate(EntryEvent<TKey, TVal> ev)
+ {
+ m_creates++;
+ m_lastKey = (TKey)ev.Key;
+ m_lastValue = ev.NewValue;
+ CheckcallbackArg(ev);
+
+ string keyString = m_lastKey.ToString();
+ if (m_lastValue != null)
+ WriteLog("TallyListener create - key = \"{0}\", value = \"{1}\"",
+ keyString, m_lastValue.ToString());
+ else
+ WriteLog("TallyListener create - key = \"{0}\", value = \"null\"",
+ keyString);
+
+ if ((!m_ignoreTimeout) && (keyString.IndexOf("timeout") >= 0))
+ {
+ WriteLog("TallyListener: Sleeping 10 seconds to force a timeout.");
+ Thread.Sleep(10000); // this should give the client cause to timeout...
+ WriteLog("TallyListener: done sleeping..");
+ }
+ }
+
+ public override void AfterUpdate(EntryEvent<TKey, TVal> ev)
+ {
+ m_updates++;
+ m_lastKey = (TKey)ev.Key;
+ m_lastValue = ev.NewValue;
+ CheckcallbackArg(ev);
+
+ string keyString = m_lastKey.ToString();
+ if (m_lastValue != null)
+ WriteLog("TallyListener update - key = \"{0}\", value = \"{1}\"",
+ keyString, m_lastValue.ToString());
+ else
+ WriteLog("TallyListener update - key = \"{0}\", value = \"null\"",
+ keyString);
+
+ if ((!m_ignoreTimeout) && (keyString.IndexOf("timeout") >= 0))
+ {
+ WriteLog("TallyListener: Sleeping 10 seconds to force a timeout.");
+ Thread.Sleep(10000); // this should give the client cause to timeout...
+ WriteLog("TallyListener: done sleeping..");
+ }
+ }
+ public override void AfterDestroy(EntryEvent<TKey, TVal> ev)
+ {
+ WriteLog("TallyListener destroy - key = \"{0}\"",
+ ((TKey)ev.Key).ToString());
+ m_destroys++;
+ CheckcallbackArg(ev);
+ }
+ public override void AfterInvalidate(EntryEvent<TKey, TVal> ev)
+ {
+ WriteLog("TallyListener invalidate - key = \"{0}\"",
+ ((TKey)ev.Key).ToString());
+ m_invalidates++;
+ CheckcallbackArg(ev);
+ }
+
+ public override void AfterRegionDestroy(RegionEvent<TKey, TVal> ev) { }
+
+ public override void AfterRegionClear(RegionEvent<TKey, TVal> ev)
+ {
+ m_clears++;
+ }
+
+ public override void AfterRegionInvalidate(RegionEvent<TKey, TVal> ev) { }
+
+ public override void AfterRegionLive(RegionEvent<TKey, TVal> ev) { }
+
+ public override void Close(IRegion<TKey, TVal> region) { }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyLoaderN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyLoaderN.cs b/clicache/integration-test/TallyLoaderN.cs
new file mode 100644
index 0000000..64db895
--- /dev/null
+++ b/clicache/integration-test/TallyLoaderN.cs
@@ -0,0 +1,104 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+
+ using Apache.Geode.Client;
+ using Apache.Geode.Client;
+
+ class TallyLoader<TKey, TVal> : ICacheLoader<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_loads = 0;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Loads
+ {
+ get
+ {
+ return m_loads;
+ }
+ }
+
+ #endregion
+
+ public int ExpectLoads(int expected)
+ {
+ int tries = 0;
+ while ((m_loads < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_loads;
+ }
+
+ public void Reset()
+ {
+ m_loads = 0;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyLoader state: (loads = {0})", Loads);
+ }
+
+ public static TallyLoader<TKey, TVal> Create()
+ {
+ return new TallyLoader<TKey, TVal>();
+ }
+
+ public virtual int GetLoadCount()
+ {
+ return m_loads;
+ }
+
+ #region ICacheLoader<TKey, TVal> Members
+
+ public virtual TVal Load(IRegion<TKey, TVal> region, TKey key, object helper)
+ {
+ m_loads++;
+ Util.Log("TallyLoader Load: (m_loads = {0}) TYPEOF key={1} val={2} for region {3}",
+ m_loads, typeof(TKey), typeof(TVal), region.Name);
+ if (typeof(TVal) == typeof(string))
+ {
+ return (TVal) (object) m_loads.ToString();
+ }
+ if (typeof(TVal) == typeof(int))
+ {
+ return (TVal)(object) m_loads;
+ }
+ return default(TVal);
+ }
+
+ public virtual void Close(IRegion<TKey, TVal> region)
+ {
+ Util.Log("TallyLoader<TKey, TVal>::Close");
+ }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyResolverN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyResolverN.cs b/clicache/integration-test/TallyResolverN.cs
new file mode 100755
index 0000000..a37c3a0
--- /dev/null
+++ b/clicache/integration-test/TallyResolverN.cs
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+
+ using Apache.Geode.Client;
+ using Apache.Geode.Client;
+
+ class TallyResolver<TKey, TVal> : IPartitionResolver<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_loads = 0;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Loads
+ {
+ get
+ {
+ return m_loads;
+ }
+ }
+
+ #endregion
+
+ public int ExpectLoads(int expected)
+ {
+ int tries = 0;
+ while ((m_loads < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_loads;
+ }
+
+ public void Reset()
+ {
+ m_loads = 0;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyResolver state: (loads = {0})", Loads);
+ }
+
+ public static TallyResolver<TKey, TVal> Create()
+ {
+ return new TallyResolver<TKey, TVal>();
+ }
+
+ public virtual int GetLoadCount()
+ {
+ return m_loads;
+ }
+
+ #region IPartitionResolver<TKey, TVal> Members
+
+ public virtual Object GetRoutingObject(EntryEvent<TKey, TVal> ev)
+ {
+ m_loads++;
+ Util.Log("TallyResolver Load: (m_loads = {0}) TYPEOF key={1} val={2} for region {3}",
+ m_loads, typeof(TKey), typeof(TVal), ev.Region.Name);
+ return ev.Key;
+ }
+
+ public virtual string GetName()
+ {
+ Util.Log("TallyResolver<TKey, TVal>::GetName");
+ return "TallyResolver";
+ }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyWriter.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyWriter.cs b/clicache/integration-test/TallyWriter.cs
new file mode 100644
index 0000000..8ef6db0
--- /dev/null
+++ b/clicache/integration-test/TallyWriter.cs
@@ -0,0 +1,222 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+
+ class TallyWriter : Apache.Geode.Client.CacheWriterAdapter<Object, Object>
+ {
+ #region Private members
+
+ private int m_creates = 0;
+ private int m_updates = 0;
+ private int m_invalidates = 0;
+ private int m_destroys = 0;
+ private Apache.Geode.Client.IGeodeSerializable m_callbackArg = null;
+ private int m_clears = 0;
+ private Apache.Geode.Client.IGeodeSerializable m_lastKey = null;
+ private Apache.Geode.Client.IGeodeSerializable m_lastValue = null;
+ private bool isWriterFailed = false;
+ private bool isWriterInvoke = false;
+ private bool isCallbackCalled = false;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Creates
+ {
+ get
+ {
+ return m_creates;
+ }
+ }
+ public int Clears
+ {
+ get
+ {
+ return m_clears;
+ }
+ }
+
+ public int Updates
+ {
+ get
+ {
+ return m_updates;
+ }
+ }
+
+ public int Invalidates
+ {
+ get
+ {
+ return m_invalidates;
+ }
+ }
+
+ public int Destroys
+ {
+ get
+ {
+ return m_destroys;
+ }
+ }
+
+
+ public Apache.Geode.Client.IGeodeSerializable LastKey
+ {
+ get
+ {
+ return m_lastKey;
+ }
+ }
+
+ public Apache.Geode.Client.IGeodeSerializable CallbackArgument
+ {
+ get
+ {
+ return m_callbackArg;
+ }
+ }
+
+
+ public Apache.Geode.Client.IGeodeSerializable LastValue
+ {
+ get
+ {
+ return m_lastValue;
+ }
+ }
+
+ public void SetWriterFailed( )
+ {
+ isWriterFailed = true;
+ }
+
+ public void SetCallBackArg( Apache.Geode.Client.IGeodeSerializable callbackArg )
+ {
+ m_callbackArg = callbackArg;
+ }
+
+ public void ResetWriterInvokation()
+ {
+ isWriterInvoke = false;
+ isCallbackCalled = false;
+ }
+
+ public bool IsWriterInvoked
+ {
+ get
+ {
+ return isWriterInvoke;
+ }
+ }
+ public bool IsCallBackArgCalled
+ {
+ get
+ {
+ return isCallbackCalled;
+ }
+ }
+ #endregion
+
+ public int ExpectCreates(int expected)
+ {
+ int tries = 0;
+ while ((m_creates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_creates;
+ }
+
+ public int ExpectUpdates(int expected)
+ {
+ int tries = 0;
+ while ((m_updates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_updates;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyWriter state: (updates = {0}, creates = {1}, invalidates = {2}, destroys = {3})",
+ Updates, Creates, Invalidates, Destroys);
+ }
+
+ public void CheckcallbackArg(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+
+ if(!isWriterInvoke)
+ isWriterInvoke = true;
+ if (m_callbackArg != null)
+ {
+ Apache.Geode.Client.IGeodeSerializable callbkArg = (Apache.Geode.Client.IGeodeSerializable)ev.CallbackArgument;
+ if (m_callbackArg.Equals(callbkArg))
+ isCallbackCalled = true;
+ }
+ }
+
+ public static TallyWriter Create()
+ {
+ return new TallyWriter();
+ }
+
+ #region ICacheWriter Members
+
+ public override bool BeforeCreate(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_creates++;
+ Util.Log("TallyWriter::BeforeCreate");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+
+ public override bool BeforeDestroy(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_destroys++;
+ Util.Log("TallyWriter::BeforeDestroy");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+
+ public override bool BeforeRegionClear(Apache.Geode.Client.RegionEvent<Object, Object> ev)
+ {
+ m_clears++;
+ Util.Log("TallyWriter::BeforeRegionClear");
+ return true;
+ }
+
+ public override bool BeforeUpdate(Apache.Geode.Client.EntryEvent<Object, Object> ev)
+ {
+ m_updates++;
+ Util.Log("TallyWriter::BeforeUpdate");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/TallyWriterN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/TallyWriterN.cs b/clicache/integration-test/TallyWriterN.cs
new file mode 100644
index 0000000..1f3aaa2
--- /dev/null
+++ b/clicache/integration-test/TallyWriterN.cs
@@ -0,0 +1,240 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ class TallyWriter<TKey, TVal> : CacheWriterAdapter<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_creates = 0;
+ private int m_updates = 0;
+ private int m_invalidates = 0;
+ private int m_destroys = 0;
+ private Object m_callbackArg = null;
+ private int m_clears = 0;
+ private Object m_lastKey = null;
+ private Object m_lastValue = null;
+ private bool isWriterFailed = false;
+ private bool isWriterInvoke = false;
+ private bool isCallbackCalled = false;
+
+ #endregion
+
+ #region Public accessors
+
+ public int Creates
+ {
+ get
+ {
+ return m_creates;
+ }
+ }
+ public int Clears
+ {
+ get
+ {
+ return m_clears;
+ }
+ }
+
+ public int Updates
+ {
+ get
+ {
+ return m_updates;
+ }
+ }
+
+ public int Invalidates
+ {
+ get
+ {
+ return m_invalidates;
+ }
+ }
+
+ public int Destroys
+ {
+ get
+ {
+ return m_destroys;
+ }
+ }
+
+
+ public Object LastKey
+ {
+ get
+ {
+ return m_lastKey;
+ }
+ }
+
+ public Object CallbackArgument
+ {
+ get
+ {
+ return m_callbackArg;
+ }
+ }
+
+
+ public Object LastValue
+ {
+ get
+ {
+ return m_lastValue;
+ }
+ }
+
+ public void SetWriterFailed( )
+ {
+ isWriterFailed = true;
+ }
+
+ public void SetCallBackArg( object callbackArg )
+ {
+ m_callbackArg = callbackArg;
+ }
+
+ public void ResetWriterInvokation()
+ {
+ isWriterInvoke = false;
+ isCallbackCalled = false;
+ }
+
+ public bool IsWriterInvoked
+ {
+ get
+ {
+ return isWriterInvoke;
+ }
+ }
+ public bool IsCallBackArgCalled
+ {
+ get
+ {
+ return isCallbackCalled;
+ }
+ }
+ #endregion
+
+ public int ExpectCreates(int expected)
+ {
+ int tries = 0;
+ while ((m_creates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_creates;
+ }
+
+ public int ExpectUpdates(int expected)
+ {
+ int tries = 0;
+ while ((m_updates < expected) && (tries < 200))
+ {
+ Thread.Sleep(100);
+ tries++;
+ }
+ return m_updates;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("TallyWriter state: (updates = {0}, creates = {1}, invalidates = {2}, destroys = {3})",
+ Updates, Creates, Invalidates, Destroys);
+ }
+
+ public void CheckcallbackArg<TKey1, TVal1>(EntryEvent<TKey1, TVal1> ev)
+ {
+ Util.Log("TallyWriterN: Checking callback arg for EntryEvent " +
+ "key:{0} oldval: {1} newval:{2} cbArg:{3} for region:{4} and remoteOrigin:{5}",
+ ev.Key, ev.NewValue, ev.OldValue, ev.CallbackArgument, ev.Region.Name, ev.RemoteOrigin);
+
+ if(!isWriterInvoke)
+ isWriterInvoke = true;
+ /*
+ if (m_callbackArg != null)
+ {
+ IGeodeSerializable callbkArg1 = ev.CallbackArgument as IGeodeSerializable;
+ IGeodeSerializable callbkArg2 = m_callbackArg as IGeodeSerializable;
+ if (callbkArg1 != null && callbkArg1.Equals(callbkArg2))
+ {
+ isCallbackCalled = true;
+ }
+ string callbkArg3 = ev.CallbackArgument as string;
+ string callbkArg4 = m_callbackArg as string;
+ if (callbkArg3 != null && callbkArg3.Equals(callbkArg4))
+ {
+ isCallbackCalled = true;
+ }
+ }
+ * */
+ if (m_callbackArg != null && m_callbackArg.Equals(ev.CallbackArgument))
+ {
+ isCallbackCalled = true;
+ }
+ }
+
+ public static TallyWriter<TKey, TVal> Create()
+ {
+ return new TallyWriter<TKey, TVal>();
+ }
+
+ #region ICacheWriter Members
+
+ public override bool BeforeCreate(EntryEvent<TKey, TVal> ev)
+ {
+ m_creates++;
+ Util.Log("TallyWriter::BeforeCreate");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+
+ public override bool BeforeDestroy(EntryEvent<TKey, TVal> ev)
+ {
+ m_destroys++;
+ Util.Log("TallyWriter::BeforeDestroy");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+
+ public override bool BeforeRegionClear(RegionEvent<TKey, TVal> ev)
+ {
+ m_clears++;
+ Util.Log("TallyWriter::BeforeRegionClear");
+ return true;
+ }
+
+ public override bool BeforeUpdate(EntryEvent<TKey, TVal> ev)
+ {
+ m_updates++;
+ Util.Log("TallyWriter::BeforeUpdate");
+ CheckcallbackArg(ev);
+ return !isWriterFailed;
+ }
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs b/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
new file mode 100644
index 0000000..0d9129c
--- /dev/null
+++ b/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
@@ -0,0 +1,282 @@
+//=========================================================================
+// 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.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ public class MyAppDomainResultCollector<TResult> : IResultCollector<TResult>
+ {
+ #region Private members
+ private bool m_resultReady = false;
+ ICollection<TResult> m_results = null;
+ private int m_addResultCount = 0;
+ private int m_getResultCount = 0;
+ private int m_endResultCount = 0;
+ #endregion
+ public int GetAddResultCount()
+ {
+ return m_addResultCount;
+ }
+ public int GetGetResultCount()
+ {
+ return m_getResultCount;
+ }
+ public int GetEndResultCount()
+ {
+ return m_endResultCount;
+ }
+ public MyAppDomainResultCollector()
+ {
+ m_results = new List<TResult>();
+ }
+ public void AddResult(TResult result)
+ {
+ Util.Log("MyAppDomainResultCollector " + result + " : " + result.GetType());
+ m_addResultCount++;
+ m_results.Add(result);
+ }
+ public ICollection<TResult> GetResult()
+ {
+ return GetResult(50);
+ }
+
+ public ICollection<TResult> GetResult(UInt32 timeout)
+ {
+ m_getResultCount++;
+ if (m_resultReady == true)
+ {
+ return m_results;
+ }
+ else
+ {
+ for (int i = 0; i < timeout; i++)
+ {
+ Thread.Sleep(1000);
+ if (m_resultReady == true)
+ {
+ return m_results;
+ }
+
+ }
+ throw new FunctionExecutionException(
+ "Result is not ready, endResults callback is called before invoking getResult() method");
+
+ }
+ }
+ public void EndResults()
+ {
+ m_endResultCount++;
+ m_resultReady = true;
+ }
+ public void ClearResults(/*bool unused*/)
+ {
+ m_results.Clear();
+ m_addResultCount = 0;
+ m_getResultCount = 0;
+ m_endResultCount = 0;
+ }
+ }
+
+
+ [TestFixture]
+ [Category("group3")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientAppDomainFunctionExecutionTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private static string[] FunctionExecutionRegionNames = { "partition_region", "partition_region1" };
+ private static string poolName = "__TEST_POOL1__";
+ private static string serverGroup = "ServerGroup1";
+ private static string QERegionName = "partition_region";
+ private static string OnServerHAExceptionFunction = "OnServerHAExceptionFunction";
+ private static string OnServerHAShutdownFunction = "OnServerHAShutdownFunction";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ return new ClientBase[] { };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ Util.Log("InitTests: AppDomain: " + AppDomain.CurrentDomain.Id);
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("appdomain-enabled", "true");
+ CacheHelper.InitConfig(config);
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ Util.Log("EndTest: AppDomain: " + AppDomain.CurrentDomain.Id);
+ try
+ {
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ public void createRegionAndAttachPool(string regionName, string poolName)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, null, poolName, false, serverGroup);
+ }
+ public void createPool(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, bool prSingleHop, bool threadLocal = false)
+ {
+ CacheHelper.CreatePool<object, object>(name, locators, serverGroup, redundancy, subscription, prSingleHop, threadLocal);
+ }
+
+ public void OnServerHAStepOne()
+ {
+
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 34; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ object[] routingObj = new object[17];
+
+ ArrayList args1 = new ArrayList();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ for (int i = 0; i < routingObj.Length; i++)
+ {
+ Console.WriteLine("routingObj[{0}]={1}.", i, (string)routingObj[i]);
+ args1.Add(routingObj[i]);
+ }
+
+ Boolean getResult = true;
+ //test data independant function execution with result onServer
+ Pool/*<TKey, TValue>*/ pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ Apache.Geode.Client.Execution<object> exc = FunctionService<object>.OnServer(pool);
+ Assert.IsTrue(exc != null, "onServer Returned NULL");
+
+ IResultCollector<object> rc = exc.WithArgs<ArrayList>(args1).Execute(OnServerHAExceptionFunction, 15);
+
+ ICollection<object> executeFunctionResult = rc.GetResult();
+
+ List<object> resultList = new List<object>();
+
+ Console.WriteLine("executeFunctionResult.Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ Assert.IsTrue(((string)resultList[i]) != null, "onServer Returned NULL");
+ }
+
+ rc = exc.WithArgs<ArrayList>(args1).Execute(OnServerHAShutdownFunction, 15);
+
+ ICollection<object> executeFunctionResult1 = rc.GetResult();
+
+ List<object> resultList1 = new List<object>();
+
+ foreach (List<object> item in executeFunctionResult1)
+ {
+ foreach (object item2 in item)
+ {
+ resultList1.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList1.Count);
+
+ Console.WriteLine("resultList1.Count = {0}", resultList1.Count);
+
+ Assert.IsTrue(resultList1.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList1.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList1[i]);
+ Assert.IsTrue(((string)resultList1[i]) != null, "onServer Returned NULL");
+ }
+
+ // Bring down the region
+ //region.LocalDestroyRegion();
+ }
+
+ [Test]
+ public void OnServerHAExecuteFunction()
+ {
+ Util.Log("OnServerHAExecuteFunction: AppDomain: " + AppDomain.CurrentDomain.Id);
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ createPool(poolName, CacheHelper.Locators, serverGroup, 1, true, true, /*threadLocal*/true);
+ createRegionAndAttachPool(QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ OnServerHAStepOne();
+
+ Close();
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientAppDomainQueryTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientAppDomainQueryTests.cs b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
new file mode 100644
index 0000000..90aabf7
--- /dev/null
+++ b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
@@ -0,0 +1,280 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.Client;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.DUnitFramework;
+ using NUnit.Framework;
+ using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+ using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+ using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ internal class ThinClientAppDomainQueryTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+
+ private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+ "Portfolios3" };
+
+ private static string QERegionName = "Portfolios";
+ private static string endpoint1;
+ private static string endpoint2;
+
+ #endregion Private members
+
+ protected override ClientBase[] GetClients()
+ {
+ return new ClientBase[] { };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ Properties<string, string> config = new Properties<string, string>();
+ config.Insert("appdomain-enabled", "true");
+ CacheHelper.InitConfig(config);
+ }
+
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTest();
+ }
+
+ #region Functions invoked by the tests
+
+ public void InitClient()
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+ }
+
+ public void CreateCache(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+ region.CreateSubRegion(QueryRegionNames[1], regattrs);
+ }
+
+ public void PopulateRegions()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+ IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+ IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+
+ qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+
+ public void VerifyQueries()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ if (qryIdx == 2 || qryIdx == 3 || qryIdx == 4)
+ {
+ Util.Log("Skipping query index {0} for Pdx because it is function type.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}. Query string {1}", qryIdx, qrystr.Query);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ ISelectResults<object> results = query.Execute();
+
+ int expectedRowCount = qh.IsExpectedRowsConstantRS(qryIdx) ?
+ QueryStatics.ResultSetRowCounts[qryIdx] : QueryStatics.ResultSetRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+ if (!qh.VerifyRS(results, expectedRowCount))
+ {
+ ErrorOccurred = true;
+ Util.Log("Query verify failed for query index {0}.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ ResultSet<object> rs = results as ResultSet<object>;
+
+ foreach (object item in rs)
+ {
+ PortfolioPdx port = item as PortfolioPdx;
+ if (port == null)
+ {
+ PositionPdx pos = item as PositionPdx;
+ if (pos == null)
+ {
+ string cs = item.ToString();
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.secId, pos.getSharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ }
+
+ public void VerifyUnsupporteQueries()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+ {
+ if (qrystr.Category != QueryCategory.Unsupported)
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ try
+ {
+ ISelectResults<object> results = query.Execute();
+
+ Util.Log("Query exception did not occur for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (GeodeException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ #endregion Functions invoked by the tests
+
+ [Test]
+ public void RemoteQueryRS()
+ {
+ Util.Log("DoRemoteQueryRS: AppDomain: " + AppDomain.CurrentDomain.Id);
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CreateCache(CacheHelper.Locators);
+ Util.Log("CreateCache complete.");
+
+ PopulateRegions();
+ Util.Log("PopulateRegions complete.");
+
+ VerifyQueries();
+ Util.Log("VerifyQueries complete.");
+
+ VerifyUnsupporteQueries();
+ Util.Log("VerifyUnsupporteQueries complete.");
+
+ Close();
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientCSTXN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientCSTXN.cs b/clicache/integration-test/ThinClientCSTXN.cs
new file mode 100644
index 0000000..211a52c
--- /dev/null
+++ b/clicache/integration-test/ThinClientCSTXN.cs
@@ -0,0 +1,827 @@
+/*
+ * 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 System.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Apache.Geode.Client.UnitTests;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+ using Apache.Geode.Client.Tests;
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+ class CSTXListener<TKey, TVal> : TransactionListenerAdapter<TKey, TVal>
+ {
+ public CSTXListener(string cacheName)
+ {
+ m_cacheName = cacheName;
+ }
+ public override void AfterCommit(TransactionEvent<TKey, TVal> te)
+ {
+ if (te.Cache.Name != m_cacheName)
+ incorrectCacheName = true;
+
+ afterCommitEvents++;
+ afterCommitKeyEvents += te.Events.Length;
+ }
+
+ public override void AfterFailedCommit(TransactionEvent<TKey, TVal> te)
+ {
+ if (te.Cache.Name != m_cacheName)
+ incorrectCacheName = true;
+
+ afterFailedCommitEvents++;
+ afterFailedCommitKeyEvents += te.Events.Length;
+ }
+
+ public override void AfterRollback(TransactionEvent<TKey, TVal> te)
+ {
+ if (te.Cache.Name != m_cacheName)
+ incorrectCacheName = true;
+
+ afterRollbackEvents++;
+ afterRollbackKeyEvents += te.Events.Length;
+ }
+
+ public override void Close()
+ {
+ closeEvent++;
+ }
+
+ public void ShowTallies()
+ {
+ Util.Log("CSTXListener state: (afterCommitEvents = {0}, afterRollbackEvents = {1}, afterFailedCommitEvents = {2}, afterCommitRegionEvents = {3}, afterRollbackRegionEvents = {4}, afterFailedCommitRegionEvents = {5}, closeEvent = {6})",
+ afterCommitEvents, afterRollbackEvents, afterFailedCommitEvents, afterCommitKeyEvents, afterRollbackKeyEvents, afterFailedCommitKeyEvents, closeEvent);
+ }
+
+ public int AfterCommitEvents { get { return afterCommitEvents; } }
+ public int AfterRollbackEvents { get { return afterRollbackEvents; } }
+ public int AfterFailedCommitEvents { get { return afterFailedCommitEvents; } }
+ public int AfterCommitKeyEvents { get { return afterCommitKeyEvents; } }
+ public int AfterRollbackKeyEvents { get { return afterRollbackKeyEvents; } }
+ public int AfterFailedCommitKeyEvents { get { return afterFailedCommitKeyEvents; } }
+ public int CloseEvent { get { return closeEvent; } }
+ public bool IncorrectCacheName { get { return incorrectCacheName; } }
+
+ private int afterCommitEvents = 0;
+
+ private int afterRollbackEvents = 0;
+ private int afterFailedCommitEvents = 0;
+
+ private int afterCommitKeyEvents = 0;
+ private int afterRollbackKeyEvents = 0;
+ private int afterFailedCommitKeyEvents = 0;
+ private int closeEvent = 0;
+
+ private string m_cacheName = null;
+
+ private bool incorrectCacheName = false;
+
+
+ }
+ class CSTXWriter<TKey, TVal> : TransactionWriterAdapter<TKey, TVal>
+ {
+ public CSTXWriter(string cacheName, string instanceName)
+ {
+ m_instanceName = instanceName;
+ m_cacheName = cacheName;
+ }
+
+ public override void BeforeCommit(TransactionEvent<TKey, TVal> te)
+ {
+ if (te.Cache.Name != m_cacheName)
+ incorrectCacheName = true;
+
+ beforeCommitEvents++;
+ beforeCommitKeyEvents += te.Events.Length;
+ }
+ public int BeforeCommitEvents { get { return beforeCommitEvents; } }
+ public int BeforeCommitKeyEvents { get { return beforeCommitKeyEvents; } }
+ public string InstanceName { get { return m_instanceName; } }
+ public bool IncorrectCacheName { get { return incorrectCacheName; } }
+ public void ShowTallies()
+ {
+ Util.Log("CSTXWriter state: (beforeCommitEvents = {0}, beforeCommitRegionEvents = {1}, instanceName = {2})",
+ beforeCommitEvents, beforeCommitKeyEvents, m_instanceName);
+ }
+ private int beforeCommitEvents = 0;
+ private int beforeCommitKeyEvents = 0;
+ private string m_cacheName = null;
+ private string m_instanceName;
+
+ private bool incorrectCacheName = false;
+
+ }
+ */
+ #endregion
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ public class ThinClientCSTX : ThinClientRegionSteps
+ {
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*private CSTXWriter<object, object> m_writer1;
+ private CSTXWriter<object, object> m_writer2;
+ private CSTXListener<object, object> m_listener1;
+ private CSTXListener<object, object> m_listener2;*/
+ #endregion
+
+ RegionOperation o_region1;
+ RegionOperation o_region2;
+ private TallyListener<object, object> m_listener;
+ private static string[] cstxRegions = new string[] { "cstx1", "cstx2", "cstx3" };
+ private UnitProcess m_client1;
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ return new ClientBase[] { m_client1 };
+ }
+
+ public void CreateRegion(string regionName, string locators, bool listener)
+ {
+ if (listener)
+ m_listener = new TallyListener<object, object>();
+ else
+ m_listener = null;
+
+ Region region = null;
+ region = CacheHelper.CreateTCRegion_Pool<object, object>(regionName, false, false,
+ m_listener, locators, "__TESTPOOL1_", false);
+
+ }
+
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+ public void ValidateCSTXListenerWriter()
+ {
+ Util.Log("tallies for listener 1");
+ m_listener1.ShowTallies();
+ Util.Log("tallies for writer 1");
+ m_writer1.ShowTallies();
+ Util.Log("tallies for listener 2");
+ m_listener2.ShowTallies();
+ Util.Log("tallies for writer 2");
+ m_writer2.ShowTallies();
+
+ // listener 1
+ Assert.AreEqual(4, m_listener1.AfterCommitEvents, "Should be 4");
+ Assert.AreEqual(14, m_listener1.AfterCommitKeyEvents, "Should be 14");
+ Assert.AreEqual(0, m_listener1.AfterFailedCommitEvents, "Should be 0");
+ Assert.AreEqual(0, m_listener1.AfterFailedCommitKeyEvents, "Should be 0");
+ Assert.AreEqual(2, m_listener1.AfterRollbackEvents, "Should be 2");
+ Assert.AreEqual(6, m_listener1.AfterRollbackKeyEvents, "Should be 6");
+ Assert.AreEqual(1, m_listener1.CloseEvent, "Should be 1");
+ Assert.AreEqual(false, m_listener1.IncorrectCacheName, "Incorrect cache name in the events");
+
+ // listener 2
+ Assert.AreEqual(2, m_listener2.AfterCommitEvents, "Should be 2");
+ Assert.AreEqual(6, m_listener2.AfterCommitKeyEvents, "Should be 6");
+ Assert.AreEqual(0, m_listener2.AfterFailedCommitEvents, "Should be 0");
+ Assert.AreEqual(0, m_listener2.AfterFailedCommitKeyEvents, "Should be 0");
+ Assert.AreEqual(2, m_listener2.AfterRollbackEvents, "Should be 2");
+ Assert.AreEqual(6, m_listener2.AfterRollbackKeyEvents, "Should be 6");
+ Assert.AreEqual(1, m_listener2.CloseEvent, "Should be 1");
+ Assert.AreEqual(false, m_listener2.IncorrectCacheName, "Incorrect cache name in the events");
+
+ // writer 1
+ Assert.AreEqual(3, m_writer1.BeforeCommitEvents, "Should be 3");
+ Assert.AreEqual(10, m_writer1.BeforeCommitKeyEvents, "Should be 10");
+ Assert.AreEqual(false, m_writer1.IncorrectCacheName, "Incorrect cache name in the events");
+
+ // writer 2
+ Assert.AreEqual(1, m_writer2.BeforeCommitEvents, "Should be 1");
+ Assert.AreEqual(4, m_writer2.BeforeCommitKeyEvents, "Should be 4");
+ Assert.AreEqual(false, m_writer2.IncorrectCacheName, "Incorrect cache name in the events");
+ }
+ */
+ #endregion
+ public void ValidateListener()
+ {
+ o_region1 = new RegionOperation(cstxRegions[2]);
+ CacheHelper.CSTXManager.Begin();
+ o_region1.Region.Put("key3", "value1", null);
+ o_region1.Region.Put("key4", "value2", null);
+ o_region1.Region.Remove("key4");
+ CacheHelper.CSTXManager.Commit();
+ // server is conflating the events on the same key hence only 1 create
+ Assert.AreEqual(1, m_listener.Creates, "Should be 1 creates");
+ Assert.AreEqual(1, m_listener.Destroys, "Should be 1 destroys");
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.Region.Put("key1", "value1", null);
+ o_region1.Region.Put("key2", "value2", null);
+ o_region1.Region.Invalidate("key1");
+ o_region1.Region.Invalidate("key3");
+ CacheHelper.CSTXManager.Commit();
+
+ // server is conflating the events on the same key hence only 1 invalidate
+ Assert.AreEqual(3, m_listener.Creates, "Should be 3 creates");
+ Assert.AreEqual(1, m_listener.Invalidates, "Should be 1 invalidates");
+
+ }
+ public void SuspendResumeRollback()
+ {
+ o_region1 = new RegionOperation(cstxRegions[0]);
+ o_region2 = new RegionOperation(cstxRegions[1]);
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(1, null);
+
+ o_region2.PutOp(1, null);
+
+
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(CacheHelper.CSTXManager.TransactionId), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(CacheHelper.CSTXManager.TransactionId), true, "Transaction should exist");
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be two values in the region before commit");
+ Assert.AreEqual(2, o_region2.Region.Keys.Count, "There should be two values in the region before commit");
+
+ TransactionId tid = CacheHelper.CSTXManager.Suspend();
+
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), true, "Transaction should be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), true, "Transaction should exist");
+ Assert.AreEqual(0, o_region1.Region.Keys.Count, "There should be 0 values in the region after suspend");
+ Assert.AreEqual(0, o_region2.Region.Keys.Count, "There should be 0 values in the region after suspend");
+
+
+ CacheHelper.CSTXManager.Resume(tid);
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), true, "Transaction should exist");
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be two values in the region before commit");
+ Assert.AreEqual(2, o_region2.Region.Keys.Count, "There should be two values in the region before commit");
+
+ o_region2.PutOp(2, null);
+
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be four values in the region before commit");
+ Assert.AreEqual(4, o_region2.Region.Keys.Count, "There should be four values in the region before commit");
+
+ CacheHelper.CSTXManager.Rollback();
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), false, "Transaction should NOT exist");
+ Assert.AreEqual(CacheHelper.CSTXManager.TryResume(tid), false, "Transaction should not be resumed");
+ Assert.AreEqual(CacheHelper.CSTXManager.TryResume(tid, 3000), false, "Transaction should not be resumed");
+ Assert.AreEqual(0, o_region1.Region.Keys.Count, "There should be 0 values in the region after rollback");
+ Assert.AreEqual(0, o_region2.Region.Keys.Count, "There should be 0 values in the region after rollback");
+ bool resumeEx = false;
+ try
+ {
+ CacheHelper.CSTXManager.Resume(tid);
+ }
+ catch (IllegalStateException)
+ {
+ resumeEx = true;
+ }
+ Assert.AreEqual(resumeEx, true, "The transaction should not be resumed");
+
+ }
+
+ public void SuspendResumeInThread()
+ {
+ AutoResetEvent txEvent = new AutoResetEvent(false);
+ AutoResetEvent txIdUpdated = new AutoResetEvent(false);
+ SuspendTransactionThread susObj = new SuspendTransactionThread(false, txEvent, txIdUpdated);
+ Thread susThread = new Thread(new ThreadStart(susObj.ThreadStart));
+ susThread.Start();
+ txIdUpdated.WaitOne();
+
+ ResumeTransactionThread resObj = new ResumeTransactionThread(susObj.Tid, false, false, txEvent);
+ Thread resThread = new Thread(new ThreadStart(resObj.ThreadStart));
+ resThread.Start();
+
+ susThread.Join();
+ resThread.Join();
+ Assert.AreEqual(resObj.IsFailed, false, resObj.Error);
+
+ susObj = new SuspendTransactionThread(false, txEvent, txIdUpdated);
+ susThread = new Thread(new ThreadStart(susObj.ThreadStart));
+ susThread.Start();
+ txIdUpdated.WaitOne();
+
+ resObj = new ResumeTransactionThread(susObj.Tid, true, false, txEvent);
+ resThread = new Thread(new ThreadStart(resObj.ThreadStart));
+ resThread.Start();
+
+ susThread.Join();
+ resThread.Join();
+ Assert.AreEqual(resObj.IsFailed, false, resObj.Error);
+
+
+ susObj = new SuspendTransactionThread(true, txEvent, txIdUpdated);
+ susThread = new Thread(new ThreadStart(susObj.ThreadStart));
+ susThread.Start();
+ txIdUpdated.WaitOne();
+
+ resObj = new ResumeTransactionThread(susObj.Tid, false, true, txEvent);
+ resThread = new Thread(new ThreadStart(resObj.ThreadStart));
+ resThread.Start();
+
+ susThread.Join();
+ resThread.Join();
+ Assert.AreEqual(resObj.IsFailed, false, resObj.Error);
+
+
+ susObj = new SuspendTransactionThread(true, txEvent, txIdUpdated);
+ susThread = new Thread(new ThreadStart(susObj.ThreadStart));
+ susThread.Start();
+
+ txIdUpdated.WaitOne();
+ resObj = new ResumeTransactionThread(susObj.Tid, true, true, txEvent);
+ resThread = new Thread(new ThreadStart(resObj.ThreadStart));
+ resThread.Start();
+
+ susThread.Join();
+ resThread.Join();
+ Assert.AreEqual(resObj.IsFailed, false, resObj.Error);
+
+ }
+ public void SuspendResumeCommit()
+ {
+ o_region1 = new RegionOperation(cstxRegions[0]);
+ o_region2 = new RegionOperation(cstxRegions[1]);
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(1, null);
+
+ o_region2.PutOp(1, null);
+
+
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(CacheHelper.CSTXManager.TransactionId), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(CacheHelper.CSTXManager.TransactionId), true, "Transaction should exist");
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be two values in the region before commit");
+ Assert.AreEqual(2, o_region2.Region.Keys.Count, "There should be two values in the region before commit");
+
+ TransactionId tid = CacheHelper.CSTXManager.Suspend();
+
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), true, "Transaction should be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), true, "Transaction should exist");
+ Assert.AreEqual(0, o_region1.Region.Keys.Count, "There should be 0 values in the region after suspend");
+ Assert.AreEqual(0, o_region2.Region.Keys.Count, "There should be 0 values in the region after suspend");
+
+
+ CacheHelper.CSTXManager.Resume(tid);
+ Assert.AreEqual(CacheHelper.CSTXManager.TryResume(tid), false, "The transaction should not have been resumed again.");
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), true, "Transaction should exist");
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be two values in the region before commit");
+ Assert.AreEqual(2, o_region2.Region.Keys.Count, "There should be two values in the region before commit");
+
+ o_region2.PutOp(2, null);
+
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be four values in the region before commit");
+ Assert.AreEqual(4, o_region2.Region.Keys.Count, "There should be four values in the region before commit");
+
+ CacheHelper.CSTXManager.Commit();
+ Assert.AreEqual(CacheHelper.CSTXManager.IsSuspended(tid), false, "Transaction should not be suspended");
+ Assert.AreEqual(CacheHelper.CSTXManager.Exists(tid), false, "Transaction should NOT exist");
+ Assert.AreEqual(CacheHelper.CSTXManager.TryResume(tid), false, "Transaction should not be resumed");
+ Assert.AreEqual(CacheHelper.CSTXManager.TryResume(tid, 3000), false, "Transaction should not be resumed");
+ Assert.AreEqual(2, o_region1.Region.Keys.Count, "There should be four values in the region after commit");
+ Assert.AreEqual(4, o_region2.Region.Keys.Count, "There should be four values in the region after commit");
+ o_region1.DestroyOpWithPdxValue(1, null);
+ o_region2.DestroyOpWithPdxValue(2, null);
+ bool resumeEx = false;
+ try
+ {
+ CacheHelper.CSTXManager.Resume(tid);
+ }
+ catch (IllegalStateException)
+ {
+ resumeEx = true;
+ }
+ Assert.AreEqual(resumeEx, true, "The transaction should not be resumed");
+ Assert.AreEqual(CacheHelper.CSTXManager.Suspend(), null, "The transaction should not be suspended");
+ }
+
+ public void CallOp()
+ {
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+ m_writer1 = new CSTXWriter<object, object>(CacheHelper.DCache.Name, "cstxWriter1");
+ m_writer2 = new CSTXWriter<object, object>(CacheHelper.DCache.Name, "cstxWriter2");
+ m_listener1 = new CSTXListener<object, object>(CacheHelper.DCache.Name);
+ m_listener2 = new CSTXListener<object, object>(CacheHelper.DCache.Name);
+
+ CacheHelper.CSTXManager.AddListener<object, object>(m_listener1);
+ CacheHelper.CSTXManager.AddListener<object, object>(m_listener2);
+ CacheHelper.CSTXManager.SetWriter<object, object>(m_writer1);
+
+ // test two listener one writer for commit on two regions
+ Util.Log(" test two listener one writer for commit on two regions");
+ */
+ #endregion
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1 = new RegionOperation(cstxRegions[0]);
+ o_region1.PutOp(2, null);
+
+ o_region2 = new RegionOperation(cstxRegions[1]);
+ o_region2.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Commit();
+ //two pdx put as well
+ Assert.AreEqual(2 + 2, o_region1.Region.Keys.Count, "Commit didn't put two values in the region");
+ Assert.AreEqual(2 + 2, o_region2.Region.Keys.Count, "Commit didn't put two values in the region");
+
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+ Util.Log(" test two listener one writer for commit on two regions - complete");
+ //////////////////////////////////
+
+ // region test two listener one writer for commit on one region
+ Util.Log(" region test two listener one writer for commit on one region");
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Commit();
+ Util.Log(" region test two listener one writer for commit on one region - complete");
+ //////////////////////////////////
+ // test two listener one writer for rollback on two regions
+ Util.Log(" test two listener one writer for rollback on two regions");
+ */
+ #endregion
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(2, null);
+
+ o_region2.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Rollback();
+ //two pdx put as well
+ Assert.AreEqual(2 + 2, o_region1.Region.Keys.Count, "Region has incorrect number of objects");
+ Assert.AreEqual(2 + 2, o_region2.Region.Keys.Count, "Region has incorrect number of objects");
+ o_region1.DestroyOpWithPdxValue(2, null);
+ o_region2.DestroyOpWithPdxValue(2, null);
+
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+
+ Util.Log(" test two listener one writer for rollback on two regions - complete");
+ //////////////////////////////////
+
+ // test two listener one writer for rollback on on region
+ Util.Log(" test two listener one writer for rollback on on region");
+ CacheHelper.CSTXManager.Begin();
+
+ o_region2.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Rollback();
+ Util.Log(" test two listener one writer for rollback on on region - complete");
+ //////////////////////////////////
+
+ // test remove listener
+ Util.Log(" test remove listener");
+ CacheHelper.CSTXManager.RemoveListener<object, object>(m_listener2);
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(2, null);
+
+ o_region2.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Commit();
+ Util.Log(" test remove listener - complete" );
+ //////////////////////////////////
+
+ // test GetWriter
+ Util.Log("test GetWriter");
+ CSTXWriter<object, object> writer = (CSTXWriter<object, object>)CacheHelper.CSTXManager.GetWriter<object, object>();
+ Assert.AreEqual(writer.InstanceName, m_writer1.InstanceName, "GetWriter is not returning the object set by SetWriter");
+ Util.Log("test GetWriter - complete");
+ //////////////////////////////////
+
+ // set a different writer
+ Util.Log("set a different writer");
+ CacheHelper.CSTXManager.SetWriter<object, object>(m_writer2);
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1.PutOp(2, null);
+
+ o_region2.PutOp(2, null);
+
+ CacheHelper.CSTXManager.Commit();
+ Util.Log("set a different writer - complete");
+ //////////////////////////////////
+ */
+ #endregion
+ }
+
+ void runThinClientCSTXTest()
+ {
+ CacheHelper.SetupJavaServers(true, "client_server_transactions.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CacheHelper.InitClient);
+ Util.Log("Creating two regions in client1");
+ m_client1.Call(CreateRegion, cstxRegions[0], CacheHelper.Locators, false);
+ m_client1.Call(CreateRegion, cstxRegions[1], CacheHelper.Locators, false);
+ m_client1.Call(CreateRegion, cstxRegions[2], CacheHelper.Locators, true);
+
+ m_client1.Call(CallOp);
+ m_client1.Call(SuspendResumeCommit);
+ m_client1.Call(SuspendResumeRollback);
+ m_client1.Call(SuspendResumeInThread);
+
+
+ m_client1.Call(ValidateListener);
+
+ #region CSTX_COMMENTED - transaction listener and writer are disabled for now
+ /*
+ m_client1.Call(ValidateCSTXListenerWriter);
+ */
+ #endregion
+
+ m_client1.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ void runThinClientPersistentTXTest()
+ {
+ CacheHelper.SetupJavaServers(true, "client_server_persistent_transactions.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, "--J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true");
+
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CacheHelper.InitClient);
+ Util.Log("Creating two regions in client1");
+ m_client1.Call(CreateRegion, cstxRegions[0], CacheHelper.Locators, false);
+
+ m_client1.Call(initializePdxSerializer);
+ m_client1.Call(doPutGetWithPdxSerializer);
+
+ m_client1.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ base.EndTest();
+ }
+
+ //Successful
+ [Test]
+ public void ThinClientCSTXTest()
+ {
+ runThinClientCSTXTest();
+ }
+
+ [Test]
+ public void ThinClientPersistentTXTest()
+ {
+ runThinClientPersistentTXTest();
+ }
+
+ public class SuspendTransactionThread
+ {
+ public SuspendTransactionThread(bool sleep, AutoResetEvent txevent, AutoResetEvent txIdUpdated)
+ {
+ m_sleep = sleep;
+ m_txevent = txevent;
+ m_txIdUpdated = txIdUpdated;
+ }
+ public void ThreadStart()
+ {
+ RegionOperation o_region1 = new RegionOperation(cstxRegions[0]);
+ RegionOperation o_region2 = new RegionOperation(cstxRegions[1]);
+ CacheHelper.CSTXManager.Begin();
+
+ o_region1.PutOp(1, null);
+ o_region2.PutOp(1, null);
+
+ m_tid = CacheHelper.CSTXManager.TransactionId;
+ m_txIdUpdated.Set();
+
+ if (m_sleep)
+ {
+ m_txevent.WaitOne();
+ Thread.Sleep(5000);
+ }
+
+ m_tid = CacheHelper.CSTXManager.Suspend();
+ }
+
+ public TransactionId Tid
+ {
+ get
+ {
+ return m_tid;
+ }
+ }
+
+ private TransactionId m_tid = null;
+ private bool m_sleep = false;
+ private AutoResetEvent m_txevent = null;
+ AutoResetEvent m_txIdUpdated = null;
+ }
+
+ public class ResumeTransactionThread
+ {
+ public ResumeTransactionThread(TransactionId tid, bool isCommit, bool tryResumeWithSleep, AutoResetEvent txevent)
+ {
+ m_tryResumeWithSleep = tryResumeWithSleep;
+ m_txevent = txevent;
+ m_tid = tid;
+ m_isCommit = isCommit;
+ }
+
+ public void ThreadStart()
+ {
+ RegionOperation o_region1 = new RegionOperation(cstxRegions[0]);
+ RegionOperation o_region2 = new RegionOperation(cstxRegions[1]);
+ if (m_tryResumeWithSleep)
+ {
+ if (AssertCheckFail(CacheHelper.CSTXManager.IsSuspended(m_tid) == false, "Transaction should not be suspended"))
+ return;
+ }
+ else
+ {
+ if (AssertCheckFail(CacheHelper.CSTXManager.IsSuspended(m_tid) == true, "Transaction should be suspended"))
+ return;
+ }
+ if (AssertCheckFail(CacheHelper.CSTXManager.Exists(m_tid) == true, "Transaction should exist"))
+ return;
+ if (AssertCheckFail(0 == o_region1.Region.Keys.Count, "There should be 0 values in the region after suspend"))
+ return;
+ if (AssertCheckFail(0 == o_region2.Region.Keys.Count, "There should be 0 values in the region after suspend"))
+ return;
+
+ if (m_tryResumeWithSleep)
+ {
+ m_txevent.Set();
+ CacheHelper.CSTXManager.TryResume(m_tid, 30000);
+ }
+ else
+ CacheHelper.CSTXManager.Resume(m_tid);
+
+ if (AssertCheckFail(CacheHelper.CSTXManager.IsSuspended(m_tid) == false, "Transaction should not be suspended"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.Exists(m_tid) == true, "Transaction should exist"))
+ return;
+ if (AssertCheckFail(o_region1.Region.Keys.Count == 2, "There should be two values in the region after suspend"))
+ return;
+ if (AssertCheckFail(o_region2.Region.Keys.Count == 2, "There should be two values in the region after suspend"))
+ return;
+
+ o_region2.PutOp(2, null);
+
+ if (m_isCommit)
+ {
+ CacheHelper.CSTXManager.Commit();
+ if (AssertCheckFail(CacheHelper.CSTXManager.IsSuspended(m_tid) == false, "Transaction should not be suspended"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.Exists(m_tid) == false, "Transaction should NOT exist"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.TryResume(m_tid) == false, "Transaction should not be resumed"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.TryResume(m_tid, 3000) == false, "Transaction should not be resumed"))
+ return;
+ if (AssertCheckFail(2 == o_region1.Region.Keys.Count, "There should be four values in the region after commit"))
+ return;
+ if (AssertCheckFail(4 == o_region2.Region.Keys.Count, "There should be four values in the region after commit"))
+ return;
+ o_region1.DestroyOpWithPdxValue(1, null);
+ o_region2.DestroyOpWithPdxValue(2, null);
+ }
+ else
+ {
+ CacheHelper.CSTXManager.Rollback();
+ if (AssertCheckFail(CacheHelper.CSTXManager.IsSuspended(m_tid) == false, "Transaction should not be suspended"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.Exists(m_tid) == false, "Transaction should NOT exist"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.TryResume(m_tid) == false, "Transaction should not be resumed"))
+ return;
+ if (AssertCheckFail(CacheHelper.CSTXManager.TryResume(m_tid, 3000) == false, "Transaction should not be resumed"))
+ return;
+ if (AssertCheckFail(0 == o_region1.Region.Keys.Count, "There should be 0 values in the region after rollback"))
+ return;
+ if (AssertCheckFail(0 == o_region2.Region.Keys.Count, "There should be 0 values in the region after rollback"))
+ return;
+ }
+
+ }
+
+ public bool AssertCheckFail(bool cond, String error)
+ {
+ if (!cond)
+ {
+ m_isFailed = true;
+ m_error = error;
+ return true;
+ }
+ return false;
+ }
+
+ public TransactionId Tid
+ {
+ get { return m_tid; }
+ }
+ public bool IsFailed
+ {
+ get { return m_isFailed; }
+ }
+ public String Error
+ {
+ get { return m_error; }
+ }
+
+ private TransactionId m_tid = null;
+ private bool m_tryResumeWithSleep = false;
+ private bool m_isFailed = false;
+ private String m_error;
+ private bool m_isCommit = false;
+ private AutoResetEvent m_txevent = null;
+
+ }
+
+ public void initializePdxSerializer()
+ {
+ Serializable.RegisterPdxSerializer(new PdxSerializer());
+ }
+
+ public void doPutGetWithPdxSerializer()
+ {
+ CacheHelper.CSTXManager.Begin();
+ o_region1 = new RegionOperation(cstxRegions[0]);
+ for (int i = 0; i < 10; i++)
+ {
+ o_region1.Region[i] = i + 1;
+ object ret = o_region1.Region[i];
+ o_region1.Region[i + 10] = i + 10;
+ ret = o_region1.Region[i + 10];
+ o_region1.Region[i + 20] = i + 20;
+ ret = o_region1.Region[i + 20];
+ }
+ CacheHelper.CSTXManager.Commit();
+ Util.Log("Region keys count after commit for non-pdx keys = {0} ", o_region1.Region.Keys.Count);
+ Assert.AreEqual(30, o_region1.Region.Keys.Count, "Commit didn't put two values in the region");
+
+ CacheHelper.CSTXManager.Begin();
+ o_region1 = new RegionOperation(cstxRegions[0]);
+ for (int i = 100; i < 110; i++)
+ {
+ object put = new SerializePdx1(true);
+ o_region1.Region[i] = put;
+ put = new SerializePdx2(true);
+ o_region1.Region[i + 10] = put;
+ put = new SerializePdx3(true, i % 2);
+ o_region1.Region[i + 20] = put;
+ }
+ CacheHelper.CSTXManager.Commit();
+
+ for (int i = 100; i < 110; i++)
+ {
+ object put = new SerializePdx1(true);
+ object ret = o_region1.Region[i];
+ Assert.AreEqual(put, ret);
+ put = new SerializePdx2(true);
+ ret = o_region1.Region[i + 10];
+ Assert.AreEqual(put, ret);
+ put = new SerializePdx3(true, i % 2);
+ ret = o_region1.Region[i + 20];
+ Assert.AreEqual(put, ret);
+ }
+ Util.Log("Region keys count after pdx-keys commit = {0} ", o_region1.Region.Keys.Count);
+ Assert.AreEqual(60, o_region1.Region.Keys.Count, "Commit didn't put two values in the region");
+ }
+ }
+}
[12/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Region.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
new file mode 100644
index 0000000..17e9a62
--- /dev/null
+++ b/clicache/src/Region.cpp
@@ -0,0 +1,1538 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include "geode/Region.hpp"
+#include "geode/Cache.hpp"
+#include "end_native.hpp"
+
+#include "Region.hpp"
+#include "Cache.hpp"
+#include "CacheStatistics.hpp"
+#include "RegionAttributes.hpp"
+#include "AttributesMutator.hpp"
+#include "RegionEntry.hpp"
+#include "ISelectResults.hpp"
+#include "IGeodeSerializable.hpp"
+#include "ResultSet.hpp"
+#include "StructSet.hpp"
+#include "impl/AuthenticatedCache.hpp"
+#include "impl/SafeConvert.hpp"
+#include "LocalRegion.hpp"
+#include "Pool.hpp"
+#include "PoolManager.hpp"
+#include "SystemProperties.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ using namespace System;
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TValue>
+ TValue Region<TKey, TValue>::Get(TKey key, Object^ callbackArg)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ GC::KeepAlive(m_nativeptr);
+ auto nativeptr = this->get(keyptr, callbackptr);
+ if (nativeptr == nullptr)
+ {
+ throw gcnew KeyNotFoundException("The given key was not present in the region.");
+ }
+ TValue returnVal = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ return returnVal;
+ }
+
+ generic<class TKey, class TValue>
+ native::SerializablePtr Region<TKey, TValue>::get(native::CacheableKeyPtr& keyptr, native::SerializablePtr& callbackptr)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ return m_nativeptr->get()->get(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ native::SerializablePtr Region<TKey, TValue>::get(native::CacheableKeyPtr& keyptr)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ return m_nativeptr->get()->get(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::isPoolInMultiuserMode()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ auto rAttributes = this->Attributes;
+ auto poolName = rAttributes->PoolName;
+ if (poolName != nullptr) {
+ auto poolManager = gcnew PoolManager(m_nativeptr->get()->getCache()->getPoolManager());
+ auto pool = poolManager->Find(poolName);
+ if (pool != nullptr && !pool->Destroyed) {
+ return pool->MultiuserAuthentication;
+ }
+ }
+ return false;
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Put(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->put(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ TValue Region<TKey, TValue>::default::get(TKey key)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ GC::KeepAlive(m_nativeptr);
+ auto nativeptr = this->get(keyptr);
+ if (nativeptr == nullptr)
+ {
+ throw gcnew KeyNotFoundException("The given key was not present in the region.");
+ }
+ TValue returnVal = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ return returnVal;
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::default::set(TKey key, TValue value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->put(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::IEnumerator<KeyValuePair<TKey, TValue>>^
+ Region<TKey, TValue>::GetEnumerator()
+ {
+ native::VectorOfRegionEntry vc;
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ auto toArray = gcnew array<KeyValuePair<TKey, TValue>>(static_cast<int>(vc.size()));
+
+ for (System::Int32 index = 0; index < toArray->Length; index++)
+ {
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ toArray[index] = KeyValuePair<TKey, TValue>(key, val);
+ }
+ return ((System::Collections::Generic::IEnumerable<KeyValuePair<TKey, TValue>>^)toArray)->GetEnumerator();
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::IEnumerator^
+ Region<TKey, TValue>::GetEnumeratorOld()
+ {
+ native::VectorOfRegionEntry vc;
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ auto toArray = gcnew array<Object^>(static_cast<int>(vc.size()));
+
+ for (System::Int32 index = 0; index < toArray->Length; index++)
+ {
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ toArray[index] = KeyValuePair<TKey, TValue>(key, val);
+ }
+ return ((System::Collections::Generic::IEnumerable<Object^>^)toArray)->GetEnumerator();
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::AreValuesEqual(native::CacheablePtr& val1, native::CacheablePtr& val2)
+ {
+ if (val1 == nullptr && val2 == nullptr)
+ {
+ return true;
+ }
+ else if ((val1 == nullptr && val2 != nullptr) || (val1 != nullptr && val2 == nullptr))
+ {
+ return false;
+ }
+ else if (val1 != nullptr && val2 != nullptr)
+ {
+ if (val1->classId() != val2->classId() || val1->typeId() != val2->typeId())
+ {
+ return false;
+ }
+ std::unique_ptr<native::DataOutput> out1 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+ std::unique_ptr<native::DataOutput> out2 = m_nativeptr->get_shared_ptr()->getCache()->createDataOutput();
+ val1->toData(*out1);
+ val2->toData(*out2);
+
+ GC::KeepAlive(m_nativeptr);
+ if (out1->getBufferLength() != out2->getBufferLength())
+ {
+ return false;
+ }
+ else if (memcmp(out1->getBuffer(), out2->getBuffer(), out1->getBufferLength()) != 0)
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::Contains(KeyValuePair<TKey, TValue> keyValuePair)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
+ GC::KeepAlive(m_nativeptr);
+ auto nativeptr = this->get(keyptr);
+ //This means that key is not present.
+ if (nativeptr == nullptr) {
+ return false;
+ }
+ auto value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ return ((Object^)value)->Equals(keyValuePair.Value);
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::ContainsKey(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->containsKeyOnServer(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::TryGetValue(TKey key, TValue %val)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ GC::KeepAlive(m_nativeptr);
+ auto nativeptr = this->get(keyptr);
+ if (nativeptr == nullptr) {
+ val = TValue();
+ return false;
+ }
+ else {
+ val = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ return true;
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<TKey>^ Region<TKey, TValue>::Keys::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vc;
+ try
+ {
+ m_nativeptr->get()->serverKeys(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto keyarr = gcnew array<TKey>(static_cast<int>(vc.size()));
+ for (System::Int32 index = 0; index < keyarr->Length; index++)
+ {
+ auto& nativeptr = vc[index];
+ keyarr[index] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
+ }
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<TValue>^ Region<TKey, TValue>::Values::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheable vc;
+ try
+ {
+ m_nativeptr->get()->values(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto valarr = gcnew array<TValue>(vc.size());
+ for (System::Int32 index = 0; index < vc.size(); index++)
+ {
+ auto& nativeptr = vc[index];
+ valarr[index] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ }
+ auto collectionlist = (System::Collections::Generic::ICollection<TValue>^)valarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Add(TKey key, TValue value)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->create(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Add(KeyValuePair<TKey, TValue> keyValuePair)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->create(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Add(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->create(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::Remove(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->removeEx(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::Remove(TKey key, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->removeEx(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::Remove(KeyValuePair<TKey, TValue> keyValuePair)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->remove(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::Remove(TKey key, TValue value, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ GC::KeepAlive(m_nativeptr);
+ return m_nativeptr->get()->remove(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::InvalidateRegion()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ InvalidateRegion(nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::InvalidateRegion(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->invalidateRegion(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::DestroyRegion()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ DestroyRegion(nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::DestroyRegion(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->destroyRegion(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Invalidate(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ Invalidate(key, nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Invalidate(TKey key, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->invalidate(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ return PutAll(map, DEFAULT_RESPONSE_TIMEOUT);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::HashMapOfCacheable nativeMap;
+ for each (KeyValuePair<TKey, TValue> keyValPair in map)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value, m_nativeptr->get()->getCache().get());
+ nativeMap.emplace(keyptr, valueptr);
+ }
+ try
+ {
+ m_nativeptr->get()->putAll(nativeMap, timeout);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout, Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::HashMapOfCacheable nativeMap;
+ for each (KeyValuePair<TKey, TValue> keyValPair in map)
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key, m_nativeptr->get()->getCache().get());
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value, m_nativeptr->get()->getCache().get());
+ nativeMap.emplace(keyptr, valueptr);
+ }
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ try
+ {
+ m_nativeptr->get()->putAll(nativeMap, timeout, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ GetAll(keys, values, exceptions, false);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache)
+ {
+ if (keys != nullptr) {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vecKeys;
+
+ for each(TKey item in keys)
+ {
+ vecKeys.push_back(
+ Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ }
+
+ native::HashMapOfCacheablePtr valuesPtr;
+ if (values != nullptr) {
+ valuesPtr = std::make_shared<native::HashMapOfCacheable>();
+ }
+ native::HashMapOfExceptionPtr exceptionsPtr;
+ if (exceptions != nullptr) {
+ exceptionsPtr = std::make_shared<native::HashMapOfException>();
+ }
+ try
+ {
+ m_nativeptr->get()->getAll(vecKeys, valuesPtr, exceptionsPtr, addToLocalCache);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ if (values != nullptr) {
+ for (const auto& iter : *valuesPtr) {
+ TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first);
+ TValue val = Serializable::GetManagedValueGeneric<TValue>(iter.second);
+ values->Add(key, val);
+ }
+ }
+ if (exceptions != nullptr) {
+ for (const auto& iter : *exceptionsPtr) {
+ TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first);
+ System::Exception^ ex = GeodeException::Get(*(iter.second));
+ exceptions->Add(key, ex);
+ }
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ else {
+ throw gcnew IllegalArgumentException("GetAll: null keys provided");
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache, Object^ callbackArg)
+ {
+ if (keys != nullptr) {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vecKeys;
+
+ for each(TKey item in keys)
+ {
+ vecKeys.push_back(
+ Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ }
+
+ native::HashMapOfCacheablePtr valuesPtr;
+ if (values != nullptr) {
+ valuesPtr = std::make_shared<native::HashMapOfCacheable>();
+ }
+ native::HashMapOfExceptionPtr exceptionsPtr;
+ if (exceptions != nullptr) {
+ exceptionsPtr = std::make_shared<native::HashMapOfException>();
+ }
+
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+
+ try
+ {
+ m_nativeptr->get()->getAll(vecKeys, valuesPtr, exceptionsPtr, addToLocalCache, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ if (values != nullptr) {
+ for (const auto& iter : *valuesPtr) {
+ TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first);
+ TValue val = Serializable::GetManagedValueGeneric<TValue>(iter.second);
+ values->Add(key, val);
+ }
+ }
+ if (exceptions != nullptr) {
+ for (const auto& iter : *exceptionsPtr) {
+ TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first);
+ System::Exception^ ex = GeodeException::Get(*(iter.second));
+ exceptions->Add(key, ex);
+ }
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ else {
+ throw gcnew IllegalArgumentException("GetAll: null keys provided");
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ RemoveAll(keys, nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vecKeys;
+ for each(TKey item in keys)
+ vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+
+ try
+ {
+ m_nativeptr->get()->removeAll(vecKeys, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+ generic<class TKey, class TValue>
+ String^ Region<TKey, TValue>::Name::get()
+ {
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getName());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ String^ Region<TKey, TValue>::FullPath::get()
+ {
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getFullPath());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ Region<TKey, TValue>::ParentRegion::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto parentRegion = m_nativeptr->get()->getParentRegion();
+ return Region::Create(parentRegion);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ Region<TKey, TValue>::Attributes::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->getAttributes();
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ AttributesMutator<TKey, TValue>^ Region<TKey, TValue>::AttributesMutator::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto am = m_nativeptr->get()->getAttributesMutator();
+ return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create( am );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::CacheStatistics^ Region<TKey, TValue>::Statistics::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->getStatistics();
+ return Apache::Geode::Client::CacheStatistics::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ Region<TKey, TValue>::GetSubRegion(String^ path)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_path(path);
+ try
+ {
+ auto subRegion = m_nativeptr->get()->getSubregion(mg_path.CharPtr);
+ return Region::Create(subRegion);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ Region<TKey, TValue>::CreateSubRegion(String^ subRegionName,
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ attributes)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_subregionName(subRegionName);
+ auto p_attrs = attributes->GetNative();
+ return Region::Create(m_nativeptr->get()->createSubregion(mg_subregionName.CharPtr, p_attrs));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ Region<TKey, TValue>::SubRegions(bool recursive)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfRegion vsr;
+ try
+ {
+ m_nativeptr->get()->subregions(recursive, vsr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto subRegions =
+ gcnew array<IRegion<TKey, TValue>^>(static_cast<int>(vsr.size()));
+
+ for (System::Int32 index = 0; index < subRegions->Length; index++)
+ {
+ auto subRegion = vsr[index];
+ subRegions[index] = Region<TKey, TValue>::Create(subRegion);
+ }
+ auto collection = (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
+ return collection;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ RegionEntry<TKey, TValue>^ Region<TKey, TValue>::GetEntry(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
+ return RegionEntry<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^ Region<TKey, TValue>::GetEntries(bool recursive)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries(vc, recursive);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto entryarr = gcnew array<RegionEntry<TKey, TValue>^>(static_cast<int>(vc.size()));
+
+ for (System::Int32 index = 0; index < entryarr->Length; index++)
+ {
+ auto& nativeptr = vc[index];
+ entryarr[index] = RegionEntry<TKey, TValue>::Create(nativeptr);
+ }
+ auto collection = (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
+
+ return collection;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ IRegionService^ Region<TKey, TValue>::RegionService::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto regionService = m_nativeptr->get()->getRegionService();
+ if (auto realCache = std::dynamic_pointer_cast<native::Cache>(regionService))
+ {
+ return Apache::Geode::Client::Cache::Create(realCache);
+ }
+ else
+ {
+ return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::ContainsValueForKey(TKey key)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key, m_nativeptr->get()->getCache().get());
+ return m_nativeptr->get()->containsValueForKey(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ int Region<TKey, TValue>::Count::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ return m_nativeptr->get()->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Clear()
+ {
+ Clear(nullptr);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::Clear(Object^ callbackArg)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, m_nativeptr->get()->getCache().get());
+ m_nativeptr->get()->clear(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::CopyTo(array<KeyValuePair<TKey, TValue>>^ toArray,
+ int startIdx)
+ {
+ if (toArray == nullptr)
+ {
+ throw gcnew System::ArgumentNullException;
+ }
+ if (startIdx < 0)
+ {
+ throw gcnew System::ArgumentOutOfRangeException;
+ }
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ if (toArray->Rank > 1 || (vc.size() > (toArray->Length - startIdx)))
+ {
+ throw gcnew System::ArgumentException;
+ }
+
+ for (System::Int32 index = 0; index < vc.size(); index++)
+ {
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ toArray[startIdx] = KeyValuePair<TKey, TValue>(key, val);
+ ++startIdx;
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::IsDestroyed::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys)
+ {
+ RegisterKeys(keys, false, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys, bool isDurable, bool getInitialValues)
+ {
+ RegisterKeys(keys, isDurable, getInitialValues, true);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys,
+ bool isDurable,
+ bool getInitialValues,
+ bool receiveValues)
+ {
+ if (keys != nullptr)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vecKeys;
+
+ for each(TKey item in keys)
+ {
+ vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ }
+ try
+ {
+ m_nativeptr->get()->registerKeys(vecKeys, isDurable, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::UnregisterKeys(System::Collections::Generic::ICollection<TKey>^ keys)
+ {
+ if (keys != nullptr)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vecKeys;
+
+ for each(TKey item in keys)
+ {
+ vecKeys.push_back(
+ Serializable::GetUnmanagedValueGeneric<TKey>(item, m_nativeptr->get()->getCache().get()));
+ }
+
+ try
+ {
+ m_nativeptr->get()->unregisterKeys(vecKeys);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterAllKeys()
+ {
+ RegisterAllKeys(false, nullptr, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterAllKeys(bool isDurable)
+ {
+ RegisterAllKeys(isDurable, nullptr, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues)
+ {
+ RegisterAllKeys(isDurable, resultKeys, getInitialValues, true);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues,
+ bool receiveValues)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ if (resultKeys != nullptr) {
+ auto mg_keys = std::make_shared<native::VectorOfCacheableKey>();
+
+ try
+ {
+ m_nativeptr->get()->registerAllKeys(isDurable, mg_keys, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ for (System::Int32 index = 0; index < mg_keys->size(); ++index) {
+ resultKeys->Add(Serializable::GetManagedValueGeneric<TKey>(
+ mg_keys->operator[](index)));
+ }
+ }
+ else {
+ try
+ {
+ m_nativeptr->get()->registerAllKeys(isDurable, nullptr, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<TKey>^ Region<TKey, TValue>::GetInterestList()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableKey vc;
+ try
+ {
+ m_nativeptr->get()->getInterestList(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto keyarr = gcnew array<TKey>(static_cast<int>(vc.size()));
+ for (System::Int32 index = 0; index < keyarr->Length; index++)
+ {
+ auto& nativeptr = vc[index];
+ keyarr[index] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
+ }
+
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ System::Collections::Generic::ICollection<String^>^ Region<TKey, TValue>::GetInterestListRegex()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ native::VectorOfCacheableString vc;
+ try
+ {
+ m_nativeptr->get()->getInterestListRegex(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto strarr = gcnew array<String^>(static_cast<int>(vc.size()));
+ for (System::Int32 index = 0; index < strarr->Length; index++)
+ {
+ strarr[index] = ManagedString::Get(vc[index]->asChar());
+ //collectionlist[ index ] = Serializable::GetManagedValue<TValue>(nativeptr);
+ }
+ auto collectionlist = (System::Collections::Generic::ICollection<String^>^)strarr;
+ return collectionlist;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::UnregisterAllKeys()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->unregisterAllKeys();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterRegex(String^ regex)
+ {
+ RegisterRegex(regex, false, nullptr, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterRegex(String^ regex, bool isDurable)
+ {
+ RegisterRegex(regex, isDurable, nullptr, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys)
+ {
+ RegisterRegex(regex, isDurable, resultKeys, false);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues)
+ {
+ RegisterRegex(regex, isDurable, resultKeys, getInitialValues, true);
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues, bool receiveValues)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_regex(regex);
+ if (resultKeys != nullptr) {
+ auto mg_keys = std::make_shared<native::VectorOfCacheableKey>();
+ m_nativeptr->get()->registerRegex(mg_regex.CharPtr, isDurable,
+ mg_keys, getInitialValues, receiveValues);
+
+ for (System::Int32 index = 0; index < mg_keys->size(); ++index) {
+ resultKeys->Add(Serializable::GetManagedValueGeneric<TKey>(
+ mg_keys->operator[](index)));
+ }
+ }
+ else {
+ m_nativeptr->get()->registerRegex(mg_regex.CharPtr, isDurable,
+ nullptr, getInitialValues, receiveValues);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void Region<TKey, TValue>::UnregisterRegex(String^ regex)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_regex(regex);
+ try
+ {
+ m_nativeptr->get()->unregisterRegex(mg_regex.CharPtr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ generic<class TResult>
+ ISelectResults<TResult>^ Region<TKey, TValue>::Query(String^ predicate)
+ {
+ return Query<TResult>( predicate, DEFAULT_QUERY_RESPONSE_TIMEOUT );
+ }
+
+ generic<class TKey, class TValue>
+ generic<class TResult>
+ ISelectResults<TResult>^ Region<TKey, TValue>::Query(String^ predicate, System::UInt32 timeout)
+ {
+ ManagedString mg_predicate(predicate);
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto selectResults = m_nativeptr->get()->query(mg_predicate.CharPtr, timeout);
+ if (auto resultptr = std::dynamic_pointer_cast<native::ResultSet>(selectResults))
+ {
+ return ResultSet<TResult>::Create(resultptr);
+ }
+ else if (auto structptr = std::dynamic_pointer_cast<native::StructSet>(selectResults))
+ {
+ return StructSet<TResult>::Create(structptr);
+ }
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::ExistsValue(String^ predicate)
+ {
+ return ExistsValue(predicate, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+
+ generic<class TKey, class TValue>
+ bool Region<TKey, TValue>::ExistsValue(String^ predicate, System::UInt32 timeout)
+ {
+ ManagedString mg_predicate(predicate);
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->existsValue(mg_predicate.CharPtr, timeout);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ Object^ Region<TKey, TValue>::SelectValue(String^ predicate)
+ {
+ return SelectValue(predicate, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+
+ generic<class TKey, class TValue>
+ Object^ Region<TKey, TValue>::SelectValue(String^ predicate, System::UInt32 timeout)
+ {
+ ManagedString mg_predicate(predicate);
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->selectValue(mg_predicate.CharPtr, timeout);
+ return Serializable::GetManagedValueGeneric<Object^>(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+
+ }
+
+ generic<class TKey, class TValue>
+ ISubscriptionService<TKey>^ Region<TKey, TValue>::GetSubscriptionService()
+ {
+ return (ISubscriptionService<TKey>^) this;
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ Region<TKey, TValue>::GetLocalView()
+ {
+ return gcnew LocalRegion<TKey, TValue>(GetNative());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Region.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Region.hpp b/clicache/src/Region.hpp
new file mode 100644
index 0000000..9aa7c27
--- /dev/null
+++ b/clicache/src/Region.hpp
@@ -0,0 +1,307 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+
+#include "IRegion.hpp"
+#include "ISubscriptionService.hpp"
+#include "native_shared_ptr.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TValue>
+ public ref class Region :
+ public IRegion<TKey, TValue>,
+ public ISubscriptionService<TKey>
+ {
+ public:
+
+ virtual property TValue default[TKey]
+ {
+ TValue get(TKey key);
+ void set(TKey key, TValue value);
+ }
+
+ virtual System::Collections::Generic::IEnumerator<KeyValuePair<TKey,TValue>>^ GetEnumerator();
+
+ virtual System::Collections::IEnumerator^ GetEnumeratorOld() =
+ System::Collections::IEnumerable::GetEnumerator;
+
+ virtual bool ContainsKey(TKey key);
+
+ virtual void Add(TKey key, TValue val);
+
+ virtual void Add(KeyValuePair<TKey, TValue> keyValuePair);
+
+ virtual void Add(TKey key, TValue value, Object^ callbackArg);
+
+ virtual bool Remove(TKey key);
+
+ virtual bool Remove( TKey key, Object^ callbackArg );
+
+ virtual bool Remove(KeyValuePair<TKey,TValue> keyValuePair);
+
+ virtual bool Remove(TKey key, TValue value, Object^ callbackArg );
+
+ virtual bool Contains(KeyValuePair<TKey,TValue> keyValuePair);
+
+ virtual void Clear();
+
+ virtual void Clear(Object^ callbackArg);
+
+ virtual void CopyTo(array<KeyValuePair<TKey,TValue>>^ toArray, int startIdx);
+
+ virtual bool TryGetValue(TKey key, TValue %val);
+
+ virtual property int Count
+ {
+ int get();
+ }
+
+ virtual property bool IsReadOnly
+ {
+ bool get() {throw gcnew System::NotImplementedException;/*return false;*/}
+ }
+
+ virtual property System::Collections::Generic::ICollection<TKey>^ Keys
+ {
+ System::Collections::Generic::ICollection<TKey>^ get();
+ }
+
+ virtual property System::Collections::Generic::ICollection<TValue>^ Values
+ {
+ System::Collections::Generic::ICollection<TValue>^ get();
+ }
+
+ virtual void Put(TKey key, TValue value, Object^ callbackArg);
+
+ virtual TValue Get(TKey key, Object^ callbackArg);
+
+ virtual void InvalidateRegion();
+
+ virtual void InvalidateRegion(Object^ callbackArg);
+
+ virtual void DestroyRegion();
+
+ virtual void DestroyRegion(Object^ callbackArg);
+
+ virtual void Invalidate(TKey key);
+
+ virtual void Invalidate(TKey key, Object^ callbackArg);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout, Object^ callbackArg);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache, Object^ callbackArg);
+
+ virtual void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys);
+ virtual void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ Object^ callbackArg);
+
+ virtual property String^ Name
+ {
+ String^ get();
+ }
+
+ virtual property String^ FullPath
+ {
+ String^ get();
+ }
+
+ virtual property IRegion<TKey, TValue>^ ParentRegion
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ virtual property RegionAttributes<TKey, TValue>^ Attributes
+ {
+ RegionAttributes<TKey, TValue>^ get();
+ }
+
+ virtual property AttributesMutator<TKey, TValue>^ AttributesMutator
+ {
+ Apache::Geode::Client::AttributesMutator<TKey, TValue>^ get();
+ }
+
+ virtual property Apache::Geode::Client::CacheStatistics^ Statistics
+ {
+ Apache::Geode::Client::CacheStatistics^ get();
+ }
+
+ virtual IRegion<TKey, TValue>^ GetSubRegion( String^ path );
+
+ virtual IRegion<TKey, TValue>^ CreateSubRegion( String^ subRegionName,
+ RegionAttributes<TKey, TValue>^ attributes );
+
+ virtual System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ SubRegions( bool recursive );
+
+ virtual Client::RegionEntry<TKey, TValue>^ GetEntry( TKey key );
+
+ virtual System::Collections::Generic::ICollection<Client::RegionEntry<TKey, TValue>^>^ GetEntries(bool recursive);
+
+ virtual property Client::IRegionService^ RegionService
+ {
+ Client::IRegionService^ get( );
+ }
+
+ virtual bool ContainsValueForKey( TKey key );
+
+ //Additional Region properties and methods
+ virtual property bool IsDestroyed
+ {
+ bool get();
+ }
+ virtual Apache::Geode::Client::ISubscriptionService<TKey>^ GetSubscriptionService();
+
+ virtual IRegion<TKey, TValue>^ GetLocalView();
+
+ virtual void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys );
+
+ virtual void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys, bool isDurable, bool getInitialValues);
+
+ virtual void RegisterKeys(System::Collections::Generic::ICollection<TKey>^ keys,
+ bool isDurable,
+ bool getInitialValues,
+ bool receiveValues);
+
+ virtual void UnregisterKeys(System::Collections::Generic::ICollection<TKey>^ keys);
+
+ virtual void RegisterAllKeys( );
+
+ virtual void RegisterAllKeys( bool isDurable );
+
+ virtual void RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues);
+
+ virtual void RegisterAllKeys(bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys,
+ bool getInitialValues,
+ bool receiveValues);
+
+ virtual System::Collections::Generic::ICollection<TKey>^ GetInterestList();
+
+ virtual System::Collections::Generic::ICollection<String^>^ GetInterestListRegex();
+
+ virtual void UnregisterAllKeys( );
+
+ virtual void RegisterRegex(String^ regex );
+
+ virtual void RegisterRegex( String^ regex, bool isDurable );
+
+ virtual void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys);
+
+ virtual void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues);
+
+ virtual void RegisterRegex(String^ regex, bool isDurable,
+ System::Collections::Generic::ICollection<TKey>^ resultKeys, bool getInitialValues, bool receiveValues);
+
+ virtual void UnregisterRegex( String^ regex );
+
+ generic<class TResult>
+ virtual ISelectResults<TResult>^ Query( String^ predicate );
+
+ generic<class TResult>
+ virtual ISelectResults<TResult>^ Query( String^ predicate, System::UInt32 timeout );
+
+ virtual bool ExistsValue( String^ predicate );
+
+ virtual bool ExistsValue( String^ predicate, System::UInt32 timeout );
+
+ virtual Object^ SelectValue( String^ predicate );
+
+ virtual Object^ SelectValue( String^ predicate, System::UInt32 timeout );
+
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ //generic<class TKey, class TValue>
+ inline static IRegion<TKey, TValue>^
+ Create( native::RegionPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Region<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::Region> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Region( native::RegionPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Region>(nativeptr);
+ }
+
+ inline apache::geode::client::SerializablePtr get(apache::geode::client::CacheableKeyPtr& key, apache::geode::client::SerializablePtr& callbackArg);
+ inline apache::geode::client::SerializablePtr get(apache::geode::client::CacheableKeyPtr& key);
+ bool AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2);
+ bool isPoolInMultiuserMode();
+
+ native_shared_ptr<native::Region>^ m_nativeptr;
+
+ };
+
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionAttributes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionAttributes.cpp b/clicache/src/RegionAttributes.cpp
new file mode 100644
index 0000000..7bc639a
--- /dev/null
+++ b/clicache/src/RegionAttributes.cpp
@@ -0,0 +1,605 @@
+/*
+ * 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.
+ */
+
+#include "RegionAttributes.hpp"
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+#include "impl/PartitionResolver.hpp"
+#include "Properties.hpp"
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "CacheListenerAdapter.hpp"
+#include "CacheWriterAdapter.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic <class TKey, class TValue>
+ void Client::RegionAttributes<TKey, TValue>::ToData(
+ Apache::Geode::Client::DataOutput^ output )
+ {
+ auto nativeOutput = output->GetNative();
+ if (nativeOutput != nullptr)
+ {
+ try
+ {
+ m_nativeptr->get()->toData(*nativeOutput);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ generic <class TKey, class TValue>
+ Apache::Geode::Client::IGeodeSerializable^ Client::RegionAttributes<TKey, TValue>::FromData(
+ Apache::Geode::Client::DataInput^ input )
+ {
+ auto nativeInput = input->GetNative();
+ if (nativeInput != nullptr)
+ {
+ try
+ {
+ auto temp = static_cast<native::RegionAttributes*>(m_nativeptr->get()->fromData(*nativeInput));
+ if (temp != m_nativeptr->get())
+ {
+ m_nativeptr->get_shared_ptr().reset(temp);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ ICacheLoader<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheLoader::get()
+ {
+ try
+ {
+ auto loaderptr = m_nativeptr->get()->getCacheLoader();
+ if (auto mg_loader = std::dynamic_pointer_cast<native::ManagedCacheLoaderGeneric>(loaderptr))
+ {
+ return (ICacheLoader<TKey, TValue>^) mg_loader->userptr();
+ }
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ICacheWriter<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheWriter::get()
+ {
+ try
+ {
+ auto writerptr = m_nativeptr->get()->getCacheWriter();
+ if (auto mg_writer = std::dynamic_pointer_cast<native::ManagedCacheWriterGeneric>(writerptr))
+ {
+ return (ICacheWriter<TKey, TValue>^)mg_writer->userptr();
+ }
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ICacheListener<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheListener::get()
+ {
+ try
+ {
+ auto listenerptr = m_nativeptr->get()->getCacheListener();
+ if (auto mg_listener = std::dynamic_pointer_cast<native::ManagedCacheListenerGeneric>(listenerptr))
+ {
+ return (ICacheListener<TKey, TValue>^)mg_listener->userptr();
+ }
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ IPartitionResolver<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::PartitionResolver::get()
+ {
+ try
+ {
+ auto resolverptr = m_nativeptr->get()->getPartitionResolver();
+ if (auto mg_resolver = std::dynamic_pointer_cast<native::ManagedPartitionResolverGeneric>(resolverptr))
+ {
+ return (IPartitionResolver<TKey, TValue>^)mg_resolver->userptr();
+ }
+
+ if (auto mg_fixedResolver = std::dynamic_pointer_cast<native::ManagedFixedPartitionResolverGeneric>(resolverptr))
+ {
+ return (IPartitionResolver<TKey, TValue>^)mg_fixedResolver->userptr();
+ }
+
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::RegionTimeToLive::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getRegionTimeToLive( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ExpirationAction Client::RegionAttributes<TKey, TValue>::RegionTimeToLiveAction::get()
+ {
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getRegionTimeToLiveAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::RegionIdleTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getRegionIdleTimeout( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ExpirationAction Client::RegionAttributes<TKey, TValue>::RegionIdleTimeoutAction::get()
+ {
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getRegionIdleTimeoutAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::EntryTimeToLive::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getEntryTimeToLive( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ExpirationAction Client::RegionAttributes<TKey, TValue>::EntryTimeToLiveAction::get()
+ {
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getEntryTimeToLiveAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::EntryIdleTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getEntryIdleTimeout( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ExpirationAction Client::RegionAttributes<TKey, TValue>::EntryIdleTimeoutAction::get()
+ {
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getEntryIdleTimeoutAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ bool Client::RegionAttributes<TKey, TValue>::CachingEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getCachingEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ bool Client::RegionAttributes<TKey, TValue>::CloningEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getCloningEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::InitialCapacity::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getInitialCapacity( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ Single Client::RegionAttributes<TKey, TValue>::LoadFactor::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getLoadFactor( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::Int32 Client::RegionAttributes<TKey, TValue>::ConcurrencyLevel::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getConcurrencyLevel( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ System::UInt32 Client::RegionAttributes<TKey, TValue>::LruEntriesLimit::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getLruEntriesLimit( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ DiskPolicyType Client::RegionAttributes<TKey, TValue>::DiskPolicy::get()
+ {
+ try
+ {
+ return static_cast<DiskPolicyType>( m_nativeptr->get()->getDiskPolicy( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ ExpirationAction Client::RegionAttributes<TKey, TValue>::LruEvictionAction::get()
+ {
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getLruEvictionAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheLoaderLibrary::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheLoaderLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheLoaderFactory::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheLoaderFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheListenerLibrary::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheListenerLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::PartitionResolverLibrary::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPartitionResolverLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::PartitionResolverFactory::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPartitionResolverFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheListenerFactory::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheListenerFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheWriterLibrary::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheWriterLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::CacheWriterFactory::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheWriterFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ bool Client::RegionAttributes<TKey, TValue>::Equals(Client::RegionAttributes<TKey, TValue>^ other)
+ {
+ auto otherPtr = other->GetNative();
+ try
+ {
+ if (GetNative() != __nullptr && otherPtr != __nullptr) {
+ return m_nativeptr->get()->operator==(*otherPtr);
+ }
+ return (GetNative() == otherPtr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ bool Client::RegionAttributes<TKey, TValue>::Equals(Object^ other)
+ {
+ return Equals(dynamic_cast<Client::RegionAttributes<TKey, TValue>^>(other));
+ }
+
+ generic <class TKey, class TValue>
+ void Client::RegionAttributes<TKey, TValue>::ValidateSerializableAttributes()
+ {
+ try
+ {
+ m_nativeptr->get()->validateSerializableAttributes( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::Endpoints::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getEndpoints( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::PoolName::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPoolName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ Boolean Client::RegionAttributes<TKey, TValue>::ClientNotificationEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getClientNotificationEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::PersistenceLibrary::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPersistenceLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ String^ Client::RegionAttributes<TKey, TValue>::PersistenceFactory::get()
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPersistenceFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ generic <class TKey, class TValue>
+ bool Client::RegionAttributes<TKey, TValue>::ConcurrencyChecksEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getConcurrencyChecksEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic <class TKey, class TValue>
+ Properties<String^, String^>^Client::RegionAttributes<TKey, TValue>::PersistenceProperties::get()
+ {
+ try
+ {
+ return Properties<String^, String^>::Create(m_nativeptr->get()->getPersistenceProperties());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[23/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableHashSet.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableHashSet.hpp b/clicache/src/CacheableHashSet.hpp
new file mode 100644
index 0000000..581d4a8
--- /dev/null
+++ b/clicache/src/CacheableHashSet.hpp
@@ -0,0 +1,683 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
+#include "Serializable.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/PdxInstanceImpl.hpp"
+#include "native_shared_ptr.hpp"
+#include "native_unique_ptr.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+#pragma managed
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ template <System::UInt32 TYPEID, typename HSTYPE>
+ public ref class CacheableHashSetType
+ : public Serializable, public ICollection<Object^>
+ {
+ public:
+
+ virtual void ToData(DataOutput^ output) override
+ {
+ output->WriteArrayLen(this->Count);
+
+ auto set = static_cast<HSTYPE*>(m_nativeptr->get());
+ for (const auto& iter : *set) {
+ auto key = Serializable::GetManagedValueGeneric<Object^>(iter);
+ output->WriteObject(key);
+ }
+
+ GC::KeepAlive(this);
+ }
+
+ virtual IGeodeSerializable^ FromData(DataInput^ input) override
+ {
+ int len = input->ReadArrayLen();
+ if (len > 0)
+ {
+ for (int i = 0; i < len; i++)
+ {
+ Object^ key = (input->ReadObject());
+ this->Add(key);
+ }
+ }
+ return this;
+ }
+
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get() override
+ {
+ System::UInt32 size = 0;
+ for each (Object^ key in this) {
+ if (key != nullptr)
+ //size += key->ObjectSize;
+ //TODO:: how should we do this now
+ size += 1;
+ }
+ return size;
+ }
+ }
+
+ virtual int GetHashCode() override
+ {
+ IEnumerator<Object^>^ ie = GetEnumerator();
+
+ int h = 0;
+ while (ie->MoveNext() == true)
+ {
+ h = h + PdxInstanceImpl::deepArrayHashCode(ie->Current);
+ }
+ return h;
+ }
+
+ virtual bool Equals(Object^ other)override
+ {
+ if (other == nullptr)
+ return false;
+
+ CacheableHashSetType^ otherCHST = dynamic_cast<CacheableHashSetType^>(other);
+
+ if (otherCHST == nullptr)
+ return false;
+
+ if (Count != otherCHST->Count)
+ return false;
+
+ IEnumerator<Object^>^ ie = GetEnumerator();
+
+ while (ie->MoveNext() == true)
+ {
+ if (otherCHST->Contains(ie->Current))
+ return true;
+ else
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Enumerator for <c>CacheableHashSet</c> class.
+ /// </summary>
+ ref class Enumerator sealed
+ : public IEnumerator<Object^>
+ {
+ public:
+ // Region: IEnumerator<ICacheableKey^> Members
+
+ /// <summary>
+ /// Gets the element in the collection at the current
+ /// position of the enumerator.
+ /// </summary>
+ /// <returns>
+ /// The element in the collection at the current position
+ /// of the enumerator.
+ /// </returns>
+ property Object^ Current
+ {
+ virtual Object^ get() =
+ IEnumerator<Object^>::Current::get
+ {
+ if (!m_started) {
+ throw gcnew System::InvalidOperationException(
+ "Call MoveNext first.");
+ }
+ auto ret = Serializable::GetManagedValueGeneric<Object^>(*(*(m_nativeptr->get())));
+ GC::KeepAlive(this);
+ return ret;
+ }
+ }
+
+ // End Region: IEnumerator<ICacheableKey^> Members
+
+ // Region: IEnumerator Members
+
+ /// <summary>
+ /// Advances the enumerator to the next element of the collection.
+ /// </summary>
+ /// <returns>
+ /// true if the enumerator was successfully advanced to the next
+ /// element; false if the enumerator has passed the end of
+ /// the collection.
+ /// </returns>
+ virtual bool MoveNext()
+ {
+ auto nptr = m_nativeptr->get();
+ bool isEnd = static_cast<HSTYPE*>(m_set->m_nativeptr->get())->end() == *nptr;
+ if (!m_started) {
+ m_started = true;
+ }
+ else {
+ if (!isEnd) {
+ (*nptr)++;
+ isEnd = static_cast<HSTYPE*>(m_set->m_nativeptr->get())->end() == *nptr;
+ }
+ }
+ GC::KeepAlive(this);
+ return !isEnd;
+ }
+
+ /// <summary>
+ /// Sets the enumerator to its initial position, which is before
+ /// the first element in the collection.
+ /// </summary>
+ virtual void Reset()
+ {
+ try
+ {
+ m_nativeptr = gcnew native_unique_ptr<typename HSTYPE::iterator>(
+ std::make_unique<typename HSTYPE::iterator>(
+ static_cast<HSTYPE*>(m_set->m_nativeptr->get())->begin()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ m_started = false;
+ }
+
+ !Enumerator() {}
+ ~Enumerator() {}
+
+ // End Region: IEnumerator Members
+
+ internal:
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Enumerator(CacheableHashSetType<TYPEID, HSTYPE>^ set)
+ : m_set(set) {
+ Reset();
+ }
+
+ private:
+ // Region: IEnumerator Members
+
+ /// <summary>
+ /// Gets the current element in the collection.
+ /// </summary>
+ /// <returns>
+ /// The current element in the collection.
+ /// </returns>
+ /// <exception cref="System.InvalidOperationException">
+ /// The enumerator is positioned before the first element of
+ /// the collection or after the last element.
+ /// </exception>
+ property Object^ ICurrent
+ {
+ virtual Object^ get() sealed =
+ System::Collections::IEnumerator::Current::get
+ {
+ return Current;
+ }
+ }
+
+ // End Region: IEnumerator Members
+
+ bool m_started;
+
+ CacheableHashSetType<TYPEID, HSTYPE>^ m_set;
+
+ native_unique_ptr<typename HSTYPE::iterator>^ m_nativeptr;
+ };
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return TYPEID;
+ }
+ }
+
+ /// <summary>
+ /// Get the largest possible size of the <c>CacheableHashSet</c>.
+ /// </summary>
+ property System::Int32 MaxSize
+ {
+ inline System::Int32 get()
+ {
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->max_size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ /// <summary>
+ /// True if the <c>CacheableHashSet</c>'s size is 0.
+ /// </summary>
+ property bool IsEmpty
+ {
+ inline bool get()
+ {
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->empty();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get the number of buckets used by the HashSet.
+ /// </summary>
+ property System::Int32 BucketCount
+ {
+ inline System::Int32 get()
+ {
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->bucket_count();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Increases the bucket count to at least <c>size</c> elements.
+ /// </summary>
+ /// <param name="size">The new size of the HashSet.</param>
+ virtual void Resize(System::Int32 size) sealed
+ {
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->reserve(size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Swap the contents of this <c>CacheableHashSet</c>
+ /// with the given one.
+ /// </summary>
+ /// <param name="other">
+ /// The other CacheableHashSet to use for swapping.
+ /// </param>
+ virtual void Swap(CacheableHashSetType<TYPEID, HSTYPE>^ other) sealed
+ {
+ try
+ {
+ if (other != nullptr) {
+ static_cast<HSTYPE*>(m_nativeptr->get())->swap(
+ *static_cast<HSTYPE*>(other->m_nativeptr->get()));
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(other->m_nativeptr);
+ }
+ }
+
+ // Region: ICollection<ICacheableKey^> Members
+
+ /// <summary>
+ /// Adds an item to the <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <param name="item">
+ /// The object to add to the collection.
+ /// </param>
+ virtual void Add(Object^ item)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->insert(Serializable::GetUnmanagedValueGeneric(item, nullptr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ /// <summary>
+ /// Removes all items from the <c>CacheableHashSet</c>.
+ /// </summary>
+ virtual void Clear()
+ {
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->clear();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the <c>CacheableHashSet</c> contains
+ /// a specific value.
+ /// </summary>
+ /// <param name="item">
+ /// The object to locate in the <c>CacheableHashSet</c>.
+ /// </param>
+ /// <returns>
+ /// true if item is found in the <c>CacheableHashSet</c>;
+ /// otherwise false.
+ /// </returns>
+ virtual bool Contains(Object^ item)
+ {
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->find(Serializable::GetUnmanagedValueGeneric(item, nullptr)) != static_cast<HSTYPE*>(m_nativeptr->get())->end();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the <c>CacheableHashSet</c> to an
+ /// <c>System.Array</c>, starting at a particular
+ /// <c>System.Array</c> index.
+ /// </summary>
+ /// <param name="array">
+ /// The one-dimensional System.Array that is the destination of the
+ /// elements copied from <c>CacheableHashSet</c>. The
+ /// <c>System.Array</c> must have zero-based indexing.
+ /// </param>
+ /// <param name="arrayIndex">
+ /// The zero-based index in array at which copying begins.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// arrayIndex is less than 0 or array is null.
+ /// </exception>
+ /// <exception cref="OutOfRangeException">
+ /// arrayIndex is equal to or greater than the length of array.
+ /// -or-The number of elements in the source <c>CacheableHashSet</c>
+ /// is greater than the available space from arrayIndex to the end
+ /// of the destination array.
+ /// </exception>
+ virtual void CopyTo(array<Object^>^ array, System::Int32 arrayIndex)
+ {
+ if (array == nullptr || arrayIndex < 0) {
+ throw gcnew IllegalArgumentException("CacheableHashSet.CopyTo():"
+ " array is null or array index is less than zero");
+ }
+
+ auto set = static_cast<HSTYPE*>(m_nativeptr->get());
+ System::Int32 index = arrayIndex;
+
+ if (arrayIndex >= array->Length ||
+ array->Length < (arrayIndex + (System::Int32)set->size())) {
+ throw gcnew OutOfRangeException("CacheableHashSet.CopyTo():"
+ " array index is beyond the HashSet or length of given "
+ "array is less than that required to copy all the "
+ "elements from HashSet");
+ }
+ for (const auto& iter : *set) {
+ array[index++] = Serializable::GetManagedValueGeneric<Object^>(iter);
+ }
+
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ /// <summary>
+ /// Gets the number of elements contained in the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ virtual property System::Int32 Count
+ {
+ virtual System::Int32 get()
+ {
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Removes the first occurrence of a specific object from the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <param name="item">
+ /// The object to remove from the <c>CacheableHashSet</c>.
+ /// </param>
+ /// <returns>
+ /// true if item was successfully removed from the
+ /// <c>CacheableHashSet</c>; otherwise, false. This method also
+ /// returns false if item is not found in the original
+ /// <c>CacheableHashSet</c>.
+ /// </returns>
+ virtual bool Remove(Object^ item)
+ {
+ try
+ {
+ return (static_cast<HSTYPE*>(m_nativeptr->get())->erase(Serializable::GetUnmanagedValueGeneric(item, nullptr)) > 0);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the collection is read-only.
+ /// </summary>
+ /// <returns>
+ /// always false for <c>CacheableHashSet</c>
+ /// </returns>
+ virtual property bool IsReadOnly
+ {
+ virtual bool get()
+ {
+ return false;
+ }
+ }
+
+ // End Region: ICollection<ICacheableKey^> Members
+
+ // Region: IEnumerable<ICacheableKey^> Members
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the
+ /// <c>CacheableHashSet</c>.
+ /// </summary>
+ /// <returns>
+ /// A <c>System.Collections.Generic.IEnumerator</c> that
+ /// can be used to iterate through the <c>CacheableHashSet</c>.
+ /// </returns>
+ virtual IEnumerator<Object^>^ GetEnumerator()
+ {
+ return gcnew Enumerator(this);
+ }
+
+ // End Region: IEnumerable<ICacheableKey^> Members
+
+ internal:
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj)
+ {
+ return (obj != NULL ?
+ gcnew CacheableHashSetType<TYPEID, HSTYPE>(obj) : nullptr);
+ }
+
+ private:
+ // Region: IEnumerable Members
+
+ /// <summary>
+ /// Returns an enumerator that iterates through a collection.
+ /// </summary>
+ /// <returns>
+ /// An <c>System.Collections.IEnumerator</c> object that can be used
+ /// to iterate through the collection.
+ /// </returns>
+ virtual System::Collections::IEnumerator^ GetIEnumerator() sealed =
+ System::Collections::IEnumerable::GetEnumerator
+ {
+ return GetEnumerator();
+ }
+
+ // End Region: IEnumerable Members
+
+ protected:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableHashSetType<TYPEID, HSTYPE>(apache::geode::client::SerializablePtr nativeptr)
+ : Serializable(nativeptr) { }
+
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashSetType<TYPEID, HSTYPE>()
+ : Serializable(std::shared_ptr<HSTYPE>(static_cast<HSTYPE*>(HSTYPE::createDeserializable())))
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="size">The initial size of the HashSet.</param>
+ inline CacheableHashSetType<TYPEID, HSTYPE>(System::Int32 size)
+ : Serializable(HSTYPE::create(size))
+ { }
+ };
+ }
+
+#define _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(m, HSTYPE) \
+ public ref class m : public Internal::CacheableHashSetType<Apache::Geode::Client::GeodeClassIds::m, HSTYPE> \
+ { \
+ public: \
+ /** <summary>
+ * Allocates a new empty instance.
+ * </summary>
+ */ \
+ inline m() \
+ : Internal::CacheableHashSetType<Apache::Geode::Client::GeodeClassIds::m, HSTYPE>() {} \
+ \
+ /** <summary>
+ * Allocates a new instance with the given size.
+ * </summary>
+ * <param name="size">the intial size of the new instance</param>
+ */ \
+ inline m(System::Int32 size) \
+ : Internal::CacheableHashSetType<Apache::Geode::Client::GeodeClassIds::m, HSTYPE>(size) {} \
+ \
+ /** <summary>
+ * Static function to create a new empty instance.
+ * </summary>
+ */ \
+ inline static m^ Create() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ /** <summary>
+ * Static function to create a new instance with the given size.
+ * </summary>
+ */ \
+ inline static m^ Create(System::Int32 size) \
+ { \
+ return gcnew m(size); \
+ } \
+ \
+ /* <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGeodeSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj) \
+ { \
+ return gcnew m(obj); \
+ } \
+ \
+ private: \
+ inline m(apache::geode::client::SerializablePtr nativeptr) \
+ : Internal::CacheableHashSetType<Apache::Geode::Client::GeodeClassIds::m, HSTYPE>(nativeptr) { } \
+ };
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(CacheableHashSet,
+ apache::geode::client::CacheableHashSet);
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> hash set wrapper that can serve as
+ /// a distributable object for caching. This is provided for compability
+ /// with java side though is functionally identical to
+ /// <c>CacheableHashSet</c> i.e. does not provide the linked semantics of
+ /// java <c>LinkedHashSet</c>.
+ /// </summary>
+ _GFCLI_CACHEABLEHASHSET_DEF_GENERIC(CacheableLinkedHashSet,
+ apache::geode::client::CacheableLinkedHashSet);
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableHashTable.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableHashTable.hpp b/clicache/src/CacheableHashTable.hpp
new file mode 100644
index 0000000..a2c6c7e
--- /dev/null
+++ b/clicache/src/CacheableHashTable.hpp
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CacheableHashMap.hpp"
+#include "DataInput.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> to <c>IGeodeSerializable</c> hash table
+ /// that can serve as a distributable object for caching. This class
+ /// extends .NET generic <c>Dictionary</c> class.
+ /// </summary>
+ ref class CacheableHashTable
+ : public CacheableHashMap
+ {
+ public:
+
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashTable()
+ : CacheableHashMap()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given dictionary.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary whose elements are copied to this HashTable.
+ /// </param>
+ inline CacheableHashTable(Object^ dictionary)
+ : CacheableHashMap(dictionary)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the HashTable.
+ /// </param>
+ inline CacheableHashTable(System::Int32 capacity)
+ : CacheableHashMap(capacity)
+ { }
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return GeodeClassIds::CacheableHashTable;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableHashTable();
+ }
+
+ virtual IGeodeSerializable^ FromData(DataInput^ input) override
+ {
+ m_dictionary = input->ReadHashtable();
+ return this;
+ }
+ internal:
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ Create(Object^ hashtable)
+ {
+ return gcnew CacheableHashTable(hashtable);
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableIdentityHashMap.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableIdentityHashMap.hpp b/clicache/src/CacheableIdentityHashMap.hpp
new file mode 100644
index 0000000..6407c53
--- /dev/null
+++ b/clicache/src/CacheableIdentityHashMap.hpp
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CacheableHashMap.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> to <c>IGeodeSerializable</c> hash map
+ /// that can serve as a distributable object for caching. This class
+ /// extends .NET generic <c>Dictionary</c> class. This class is meant
+ /// as a means to interoperate with java server side
+ /// <c>IdentityHashMap</c> class objects but is intentionally not
+ /// intended to provide <c>java.util.IdentityHashMap</c> semantics.
+ /// </summary>
+ ref class CacheableIdentityHashMap
+ : public CacheableHashMap
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableIdentityHashMap()
+ : CacheableHashMap()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given dictionary.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary whose elements are copied to this HashMap.
+ /// </param>
+ inline CacheableIdentityHashMap(Object^ dictionary)
+ : CacheableHashMap(dictionary)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the HashMap.
+ /// </param>
+ inline CacheableIdentityHashMap(System::Int32 capacity)
+ : CacheableHashMap(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create()
+ {
+ return gcnew CacheableIdentityHashMap();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given dictionary.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create(
+ Object^ dictionary)
+ {
+ return gcnew CacheableIdentityHashMap(dictionary);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableIdentityHashMap^ Create(System::Int32 capacity)
+ {
+ return gcnew CacheableIdentityHashMap(capacity);
+ }
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return GeodeClassIds::CacheableIdentityHashMap;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableIdentityHashMap();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableKey.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableKey.cpp b/clicache/src/CacheableKey.cpp
new file mode 100644
index 0000000..5fc03fa
--- /dev/null
+++ b/clicache/src/CacheableKey.cpp
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "CacheableKey.hpp"
+#include "CacheableString.hpp"
+#include "CacheableBuiltins.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ // generic<class TKey>
+ System::Int32 CacheableKey::GetHashCode()
+ {
+ try
+ {
+ return static_cast<native::CacheableKey*>(m_nativeptr->get())->hashcode();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ // generic<class TKey>
+ bool CacheableKey::Equals(Client::ICacheableKey^ other)
+ {
+ if (other == nullptr || other->ClassId != ClassId) {
+ return false;
+ }
+ try
+ {
+ return static_cast<native::CacheableKey*>(m_nativeptr->get())->operator==(
+ *static_cast<native::CacheableKey*>(
+ ((Client::CacheableKey^)other)->m_nativeptr->get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(((Client::CacheableKey^)other)->m_nativeptr);
+ }
+ }
+
+ //generic<class TKey>
+ bool CacheableKey::Equals(Object^ obj)
+ {
+ return Equals(dynamic_cast<CacheableKey^>(obj));
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Byte value)
+ {
+ return (CacheableKey^) CacheableByte::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (bool value)
+ {
+ return (CacheableKey^) CacheableBoolean::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Char value)
+ {
+ return (CacheableKey^) CacheableCharacter::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Double value)
+ {
+ return (CacheableKey^) CacheableDouble::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (Single value)
+ {
+ return (CacheableKey^) CacheableFloat::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (System::Int16 value)
+ {
+ return (CacheableKey^) CacheableInt16::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey^ (System::Int32 value)
+ {
+ return (CacheableKey^) CacheableInt32::Create(value);
+ }
+
+ // generic<class TKey>
+ CacheableKey::operator CacheableKey^ (System::Int64 value)
+ {
+ return (CacheableKey^) CacheableInt64::Create(value);
+ }
+
+ //generic<class TKey>
+ CacheableKey::operator CacheableKey ^ (String^ value)
+ {
+ return dynamic_cast<CacheableKey^>(CacheableString::Create(value));
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableKey.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableKey.hpp b/clicache/src/CacheableKey.hpp
new file mode 100644
index 0000000..39bf3e5
--- /dev/null
+++ b/clicache/src/CacheableKey.hpp
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include "end_native.hpp"
+
+#include "Serializable.hpp"
+#include "ICacheableKey.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// This class wraps the native C++ <c>apache::geode::client::Serializable</c> objects
+ /// as managed <see cref="../../IGeodeSerializable" /> objects.
+ /// </summary>
+ public ref class CacheableKey
+ : public Serializable, public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// It gets the hash code by calling the <c>hashcode()</c> function
+ /// of the underlying <c>apache::geode::client::CacheableKey</c> object.
+ /// </summary>
+ virtual System::Int32 GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object. It invokes the '=='
+ /// operator of the underlying <c>apache::geode::client::CacheableKey</c> object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator if the underlying object is a
+ /// <c>apache::geode::client::CacheableKey</c>, else returns
+ /// <c>System.Object.Equals()</c>
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // Static conversion functions from primitive types.
+
+ /// <summary>
+ /// Implicit conversion operator from a boolean
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (bool value);
+
+ /// <summary>
+ /// Implicit conversion operator from a byte
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Byte value);
+
+ /// <summary>
+ /// Implicit conversion operator from a double
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Double value);
+
+ /// <summary>
+ /// Implicit conversion operator from a float
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Single value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 16-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (System::Int16 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a character
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (Char value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 32-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (System::Int32 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a 64-bit integer
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (System::Int64 value);
+
+ /// <summary>
+ /// Implicit conversion operator from a string
+ /// to a <c>CacheableKey</c>.
+ /// </summary>
+ static operator CacheableKey^ (String^ value);
+
+ internal:
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline CacheableKey()
+ : Client::Serializable() { }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableKey(apache::geode::client::SerializablePtr nativeptr)
+ : Client::Serializable(nativeptr) { }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableLinkedList.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableLinkedList.hpp b/clicache/src/CacheableLinkedList.hpp
new file mode 100644
index 0000000..0da310c
--- /dev/null
+++ b/clicache/src/CacheableLinkedList.hpp
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CacheableVector.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>IGeodeSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching. This class extends .NET generic
+ /// <c>List</c> class.
+ /// </summary>
+ ref class CacheableLinkedList
+ : public IGeodeSerializable
+ {
+ System::Collections::Generic::LinkedList<Object^>^ m_linkedList;
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableLinkedList(System::Collections::Generic::LinkedList<Object^>^ list)
+ {
+ m_linkedList = list;
+ }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableLinkedList^ Create()
+ {
+ return gcnew CacheableLinkedList(gcnew System::Collections::Generic::LinkedList<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableLinkedList^ Create(System::Collections::Generic::LinkedList<Object^>^ list)
+ {
+ return gcnew CacheableLinkedList(list);
+ }
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableLinkedList;
+ }
+ }
+
+ // Region: IGeodeSerializable Members
+
+ virtual void ToData(DataOutput^ output)
+ {
+ if (m_linkedList != nullptr)
+ {
+ output->WriteArrayLen(m_linkedList->Count);
+ for each (Object^ obj in m_linkedList) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+ }
+ else
+ output->WriteByte(0xFF);
+ }
+
+ virtual IGeodeSerializable^ FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ for (int i = 0; i < len; i++)
+ {
+ m_linkedList->AddLast(input->ReadObject());
+ }
+ return this;
+ }
+
+ /*System::UInt32 ObjectSize::get()
+ {
+ //TODO::
+ System::UInt32 size = static_cast<System::UInt32> (sizeof(CacheableVector^));
+ for each (IGeodeSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }
+ return m_linkedList->Count;
+ }*/
+
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get()
+ {
+ return m_linkedList->Count;
+ }
+ }
+
+ virtual property System::Collections::Generic::LinkedList<Object^>^ Value
+ {
+ virtual System::Collections::Generic::LinkedList<Object^>^ get()
+ {
+ return m_linkedList;
+ }
+ }
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableLinkedList(gcnew System::Collections::Generic::LinkedList<Object^>());
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObject.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObject.cpp b/clicache/src/CacheableObject.cpp
new file mode 100644
index 0000000..3bb18d2
--- /dev/null
+++ b/clicache/src/CacheableObject.cpp
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+
+//#include "geode_includes.hpp"
+#include "CacheableObject.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+#include "impl/GeodeNullStream.hpp"
+#include "impl/GeodeDataInputStream.hpp"
+#include "impl/GeodeDataOutputStream.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Runtime::Serialization::Formatters::Binary;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void CacheableObject::ToData(DataOutput^ output)
+ {
+ if(m_obj != nullptr)
+ {
+ output->AdvanceCursor(4); // placeholder for object size bytes needed while reading back.
+
+ GeodeDataOutputStream dos(output);
+ BinaryFormatter bf;
+ System::Int64 checkpoint = dos.Length;
+ bf.Serialize(%dos, m_obj);
+ m_objectSize = (System::UInt32) (dos.Length - checkpoint);
+
+ output->RewindCursor(m_objectSize + 4);
+ output->WriteInt32(m_objectSize);
+ output->AdvanceCursor(m_objectSize);
+ }
+ }
+
+ IGeodeSerializable^ CacheableObject::FromData(DataInput^ input)
+ {
+ int maxSize = input->ReadInt32();
+ GeodeDataInputStream dis(input, maxSize);
+ System::UInt32 checkpoint = dis.BytesRead;
+ BinaryFormatter bf;
+ m_obj = bf.Deserialize(%dis);
+ m_objectSize = dis.BytesRead - checkpoint;
+ return this;
+ }
+
+ System::UInt32 CacheableObject::ObjectSize::get()
+ {
+ if (m_objectSize == 0) {
+ GeodeNullStream ns;
+ BinaryFormatter bf;
+ bf.Serialize(%ns, m_obj);
+
+ m_objectSize = (System::UInt32)sizeof(CacheableObject^) + (System::UInt32)ns.Length;
+ }
+ return m_objectSize;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObject.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObject.hpp b/clicache/src/CacheableObject.hpp
new file mode 100644
index 0000000..3b9ff2f
--- /dev/null
+++ b/clicache/src/CacheableObject.hpp
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An mutable generic <see cref="System.Object" /> wrapper that can
+ /// serve as a distributable value for caching.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This class can serialize any class which has either the
+ /// [Serializable] attribute set or implements
+ /// <see cref="System.Runtime.Serialization.ISerializable" /> interface.
+ /// However, for better efficiency the latter should be avoided and the
+ /// user should implement <see cref="../../IGeodeSerializable" /> instead.
+ /// </para><para>
+ /// The user must keep in mind that the rules that apply to runtime
+ /// serialization would be the rules that apply to this class. For
+ /// the serialization will be carried out by serializing all the
+ /// members (public/private/protected) of the class. Each of the
+ /// contained classes should also have either the [Serializable]
+ /// attribute set or implement <c>ISerializable</c> interface.
+ /// </para>
+ /// </remarks>
+ public ref class CacheableObject
+ : public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given object.
+ /// </summary>
+ /// <remarks>
+ /// If the given object is null then this method returns null.
+ /// </remarks>
+ inline static CacheableObject^ Create(Object^ value)
+ {
+ return (value != nullptr ? gcnew CacheableObject(value) :
+ nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this <see cref="System.Object" /> using
+ /// <see cref="System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the <see cref="System.Object" /> using
+ /// <see cref="System.Runtime.Serialization.Formatters.Binary.BinaryFormatter" /> class.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableManagedObject;
+ }
+ }
+
+ /// <summary>
+ /// Gets the object value.
+ /// </summary>
+ /// <remarks>
+ /// The user can modify the object and the changes shall be reflected
+ /// immediately in the local cache. For this change to be propagate to
+ /// other members of the distributed system, the object needs to be
+ /// put into the cache.
+ /// </remarks>
+ property Object^ Value
+ {
+ inline Object^ get()
+ {
+ return m_obj;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return (m_obj == nullptr ? nullptr : m_obj->ToString());
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObject(nullptr);
+ }
+
+ internal:
+ /// <summary>
+ /// Allocates a new instance from the given object.
+ /// </summary>
+ inline CacheableObject(Object^ value)
+ : m_obj(value), m_objectSize(0) { }
+
+
+
+ private:
+ Object^ m_obj;
+ System::UInt32 m_objectSize;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObjectArray.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObjectArray.cpp b/clicache/src/CacheableObjectArray.cpp
new file mode 100644
index 0000000..ac615fd
--- /dev/null
+++ b/clicache/src/CacheableObjectArray.cpp
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+#include "CacheableObjectArray.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // Region: IGeodeSerializable Members
+
+ void CacheableObjectArray::ToData(DataOutput^ output)
+ {
+ output->WriteArrayLen((System::Int32)Count);
+ output->WriteByte((int8_t)apache::geode::client::GeodeTypeIdsImpl::Class);
+ output->WriteByte((int8_t)apache::geode::client::GeodeTypeIds::CacheableASCIIString);
+ output->WriteUTF("java.lang.Object");
+
+ for each (Object^ obj in this) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+ }
+
+ IGeodeSerializable^ CacheableObjectArray::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if (len >= 0) {
+ //int8_t typeCode;
+ input->ReadByte(); // ignore CLASS typeid
+ input->ReadByte(); // ignore string typeid
+ unsigned short classLen;
+ classLen = input->ReadInt16();
+ input->AdvanceCursor(classLen);
+ //nativeInput.readInt(&classLen);
+ //nativeInput.advanceCursor(classLen);
+ }
+ for (System::Int32 index = 0; index < len; ++index) {
+ Add(input->ReadObject());
+ }
+ return this;
+ /*_GF_MG_EXCEPTION_TRY
+
+ apache::geode::client::DataInput& nativeInput = *(input->_NativePtr);
+ System::Int32 len;
+ nativeInput.readArrayLen(&len);
+ if (len >= 0) {
+ int8_t typeCode;
+ nativeInput.read(&typeCode); // ignore CLASS typeid
+ nativeInput.read(&typeCode); // ignore string typeid
+ System::UInt16 classLen;
+ nativeInput.readInt(&classLen);
+ nativeInput.advanceCursor(classLen);
+ }
+ apache::geode::client::CacheablePtr value;
+ for (System::Int32 index = 0; index < len; ++index) {
+ nativeInput.readObject(value);
+ Add(SafeUMSerializableConvert(value.get()));
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL
+ return this;*/
+ }
+
+ System::UInt32 CacheableObjectArray::ObjectSize::get()
+ {
+ /* System::UInt32 size = static_cast<System::UInt32> (sizeof(CacheableObjectArray^));
+ for each (IGeodeSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return Count;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObjectArray.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObjectArray.hpp b/clicache/src/CacheableObjectArray.hpp
new file mode 100644
index 0000000..2a88330
--- /dev/null
+++ b/clicache/src/CacheableObjectArray.hpp
@@ -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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "GeodeClassIds.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>IGeodeSerializable</c> object array wrapper that can serve
+ /// as a distributable object for caching. Though this class provides
+ /// compatibility with java Object[] serialization, it provides the
+ /// semantics of .NET generic <c>List</c> class.
+ /// </summary>
+ public ref class CacheableObjectArray
+ : public List<Object^>, public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableObjectArray()
+ : List<Object^>()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given collection.
+ /// </summary>
+ /// <param name="collection">
+ /// The collection whose elements are copied to this list.
+ /// </param>
+ inline CacheableObjectArray(IEnumerable<Object^>^ collection)
+ : List<Object^>(collection)
+ { }
+
+ /// <summary>
+ /// Allocates a new empty instance with given initial size.
+ /// </summary>
+ /// <param name="capacity">
+ /// The initial capacity of the vector.
+ /// </param>
+ inline CacheableObjectArray(System::Int32 capacity)
+ : List<Object^>(capacity)
+ { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableObjectArray^ Create()
+ {
+ return gcnew CacheableObjectArray();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given collection.
+ /// </summary>
+ inline static CacheableObjectArray^ Create(
+ IEnumerable<Object^>^ collection)
+ {
+ return gcnew CacheableObjectArray(collection);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance with given initial size.
+ /// </summary>
+ inline static CacheableObjectArray^ Create(System::Int32 capacity)
+ {
+ return gcnew CacheableObjectArray(capacity);
+ }
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableObjectArray;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObjectArray();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObjectXml.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObjectXml.cpp b/clicache/src/CacheableObjectXml.cpp
new file mode 100644
index 0000000..5899a20
--- /dev/null
+++ b/clicache/src/CacheableObjectXml.cpp
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "CacheableObjectXml.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+#include "Log.hpp"
+#include "impl/GeodeNullStream.hpp"
+#include "impl/GeodeDataInputStream.hpp"
+#include "impl/GeodeDataOutputStream.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace System::Xml::Serialization;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void CacheableObjectXml::ToData(DataOutput^ output)
+ {
+ if (m_obj == nullptr) {
+ output->WriteByte((Byte)1);
+ }
+ else
+ {
+ output->WriteByte((Byte)0);
+ Type^ objType = m_obj->GetType();
+
+ output->WriteUTF(objType->AssemblyQualifiedName);
+
+ output->AdvanceCursor(4); // placeholder for object size bytes needed while reading back.
+
+ XmlSerializer xs(objType);
+ GeodeDataOutputStream dos(output);
+ System::Int64 checkpoint = dos.Length;
+ xs.Serialize(%dos, m_obj);
+ m_objectSize = (System::UInt32) (dos.Length - checkpoint);
+
+ output->RewindCursor(m_objectSize + 4);
+ output->WriteInt32(m_objectSize);
+ output->AdvanceCursor(m_objectSize);
+ }
+ }
+
+ IGeodeSerializable^ CacheableObjectXml::FromData(DataInput^ input)
+ {
+ Byte isNull = input->ReadByte();
+ if (isNull) {
+ m_obj = nullptr;
+ }
+ else {
+ String^ typeName = input->ReadUTF();
+ Type^ objType = Type::GetType(typeName);
+ if (objType == nullptr)
+ {
+ Log::Error("CacheableObjectXml.FromData(): Cannot find type '" +
+ typeName + "'.");
+ m_obj = nullptr;
+ }
+ else {
+ int maxSize = input->ReadInt32();
+ GeodeDataInputStream dis(input, maxSize);
+ XmlSerializer xs(objType);
+ System::UInt32 checkpoint = dis.BytesRead;
+ m_obj = xs.Deserialize(%dis);
+ m_objectSize = dis.BytesRead - checkpoint;
+ }
+ }
+ return this;
+ }
+
+ System::UInt32 CacheableObjectXml::ObjectSize::get()
+ {
+ if (m_objectSize == 0) {
+ if (m_obj != nullptr) {
+ Type^ objType = m_obj->GetType();
+ XmlSerializer xs(objType);
+ GeodeNullStream ns;
+ xs.Serialize(%ns, m_obj);
+
+ m_objectSize = (System::UInt32)sizeof(CacheableObjectXml^) + (System::UInt32)ns.Length;
+ }
+ }
+ return m_objectSize;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableObjectXml.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableObjectXml.hpp b/clicache/src/CacheableObjectXml.hpp
new file mode 100644
index 0000000..fdd1753
--- /dev/null
+++ b/clicache/src/CacheableObjectXml.hpp
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable generic <see cref="System.Object" /> wrapper that can
+ /// serve as a distributable value for caching.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This class can contain any object and uses the
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> to
+ /// serialize and deserialize the object. So the user must use the
+ /// <c>XmlSerializer</c> attributes to control the serialization/deserialization
+ /// of the object (or implement the <see cref="System.Xml.Serialization.IXmlSerializable" />)
+ /// to change the serialization/deserialization. However, the latter should
+ /// be avoided for efficiency reasons and the user should implement
+ /// <see cref="../../IGeodeSerializable" /> instead.
+ /// </para><para>
+ /// The user must keep in mind that the rules that apply to <c>XmlSerializer</c>
+ /// would be the rules that apply to this class. For instance the user
+ /// cannot pass objects of class implementing or containing
+ /// <see cref="System.Collections.IDictionary" /> class, must use
+ /// <see cref="System.Xml.Serialization.XmlIncludeAttribute" /> to
+ /// mark user-defined types etc.
+ /// </para>
+ /// </remarks>
+ public ref class CacheableObjectXml
+ : public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given object.
+ /// </summary>
+ /// <remarks>
+ /// If the given object is null then this method returns null.
+ /// </remarks>
+ inline static CacheableObjectXml^ Create(Object^ value)
+ {
+ return (value != nullptr ? gcnew CacheableObjectXml(value) :
+ nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this <see cref="System.Object" /> using
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> class.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes the <see cref="System.Object" /> using
+ /// <see cref="System.Xml.Serialization.XmlSerializer" /> class.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableManagedObjectXml;
+ }
+ }
+
+ /// <summary>
+ /// Gets the object value.
+ /// </summary>
+ /// <remarks>
+ /// The user can modify the object and the changes shall be reflected
+ /// immediately in the local cache. For this change to be propagate to
+ /// other members of the distributed system, the object needs to be
+ /// put into the cache.
+ /// </remarks>
+ property Object^ Value
+ {
+ inline Object^ get()
+ {
+ return m_obj;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return (m_obj == nullptr ? nullptr : m_obj->ToString());
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableObjectXml(nullptr);
+ }
+
+ internal:
+ /// <summary>
+ /// Allocates a new instance from the given object.
+ /// </summary>
+ inline CacheableObjectXml(Object^ value)
+ : m_obj(value), m_objectSize(0) { }
+
+ private:
+ Object^ m_obj;
+ System::UInt32 m_objectSize;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableStack.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableStack.cpp b/clicache/src/CacheableStack.cpp
new file mode 100644
index 0000000..6b5d1c8
--- /dev/null
+++ b/clicache/src/CacheableStack.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+
+
+#include "CacheableStack.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+#include "impl/SafeConvert.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // Region: IGeodeSerializable Members
+
+ void CacheableStack::ToData(DataOutput^ output)
+ {
+ if (m_stack != nullptr)
+ {
+ output->WriteArrayLen((System::Int32)m_stack->Count);
+ for each (Object^ obj in m_stack) {
+ output->WriteObject(obj);
+ }
+ }
+ else
+ {
+ output->WriteByte(0xFF);
+ }
+ }
+
+ IGeodeSerializable^ CacheableStack::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if (len > 0)
+ {
+ System::Collections::Generic::Stack<Object^>^ stack = safe_cast<System::Collections::Generic::Stack<Object^>^>(m_stack);
+ for (int i = 0; i < len; i++)
+ {
+ (stack)->Push(input->ReadObject());
+ // Push(input->ReadObject());
+ }
+ }
+ return this;
+ }
+
+ System::UInt32 CacheableStack::ClassId::get()
+ {
+ return GeodeClassIds::CacheableStack;
+ }
+
+ System::UInt32 CacheableStack::ObjectSize::get()
+ {
+ //TODO:
+ /*System::UInt32 size = static_cast<System::UInt32> (sizeof(CacheableStack^));
+ for each (IGeodeSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return m_stack->Count;
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+} //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableStack.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableStack.hpp b/clicache/src/CacheableStack.hpp
new file mode 100644
index 0000000..fbebf6a
--- /dev/null
+++ b/clicache/src/CacheableStack.hpp
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>IGeodeSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ ref class CacheableStack
+ : public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableStack(System::Collections::ICollection^ stack)
+ {
+ m_stack = stack;
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableStack^ Create()
+ {
+ return gcnew CacheableStack(gcnew System::Collections::Generic::Stack<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableStack^ Create(System::Collections::ICollection^ stack)
+ {
+ return gcnew CacheableStack(stack);
+ }
+
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get();
+ }
+
+ virtual property System::Collections::ICollection^ Value
+ {
+ virtual System::Collections::ICollection^ get()
+ {
+ return m_stack;
+ }
+ }
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableStack(gcnew System::Collections::Generic::Stack<Object^>());
+ }
+
+ private:
+ System::Collections::ICollection^ m_stack;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[39/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs b/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
new file mode 100644
index 0000000..2fcb1ba
--- /dev/null
+++ b/clicache/integration-test/ThinClientFunctionExecutionTestsN.cs
@@ -0,0 +1,1843 @@
+/*
+ * 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.Collections.Generic;
+using System.Collections;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ public class MyResultCollector<TResult> : Client.IResultCollector<TResult>
+ {
+ #region Private members
+ private bool m_resultReady = false;
+ ICollection<TResult> m_results = null;
+ private int m_addResultCount = 0;
+ private int m_getResultCount = 0;
+ private int m_endResultCount = 0;
+ #endregion
+ public int GetAddResultCount()
+ {
+ return m_addResultCount;
+ }
+ public int GetGetResultCount()
+ {
+ return m_getResultCount;
+ }
+ public int GetEndResultCount()
+ {
+ return m_endResultCount;
+ }
+ public MyResultCollector()
+ {
+ m_results = new List<TResult>();
+ }
+ public void AddResult(TResult result)
+ {
+ Util.Log(" in MyResultCollector " + result + " : " + result.GetType());
+ m_addResultCount++;
+ m_results.Add(result);
+ }
+ public ICollection<TResult> GetResult()
+ {
+ return GetResult(50);
+ }
+
+ public ICollection<TResult> GetResult(UInt32 timeout)
+ {
+ m_getResultCount++;
+ if (m_resultReady == true)
+ {
+ return m_results;
+ }
+ else
+ {
+ for (int i = 0; i < timeout; i++)
+ {
+ Thread.Sleep(1000);
+ if (m_resultReady == true)
+ {
+ return m_results;
+ }
+
+ }
+ throw new FunctionExecutionException(
+ "Result is not ready, endResults callback is called before invoking getResult() method");
+
+ }
+ }
+ public void EndResults()
+ {
+ m_endResultCount++;
+ m_resultReady = true;
+ }
+ public void ClearResults(/*bool unused*/)
+ {
+ m_results.Clear();
+ m_addResultCount = 0;
+ m_getResultCount = 0;
+ m_endResultCount = 0;
+ }
+ }
+
+
+ [TestFixture]
+ [Category("group3")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientFunctionExecutionTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private static string[] FunctionExecutionRegionNames = { "partition_region", "partition_region1" };
+ private static string poolName = "__TEST_POOL1__";
+ private static string serverGroup = "ServerGroup1";
+ private static string QERegionName = "partition_region";
+ private static string getFuncName = "MultiGetFunction";
+ private static string getFuncIName = "MultiGetFunctionI";
+ private static string OnServerHAExceptionFunction = "OnServerHAExceptionFunction";
+ private static string OnServerHAShutdownFunction = "OnServerHAShutdownFunction";
+ private static string RegionOperationsHAFunction = "RegionOperationsHAFunction";
+ private static string RegionOperationsHAFunctionPrSHOP = "RegionOperationsHAFunctionPrSHOP";
+ private static string exFuncNameSendException = "executeFunction_SendException";
+ private static string FEOnRegionPrSHOP = "FEOnRegionPrSHOP";
+ private static string FEOnRegionPrSHOP_OptimizeForWrite = "FEOnRegionPrSHOP_OptimizeForWrite";
+ private static string putFuncName = "MultiPutFunction";
+ private static string putFuncIName = "MultiPutFunctionI";
+ private static string FuncTimeOutName = "FunctionExecutionTimeOut";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ public void InitClient()
+ {
+ CacheHelper.Init();
+ }
+
+ public void createRegionAndAttachPool(string regionName, string poolName)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, null, poolName, false, serverGroup);
+ }
+ public void createPool(string name, string locators, string serverGroup,
+ int redundancy, bool subscription, bool prSingleHop, bool threadLocal = false)
+ {
+ CacheHelper.CreatePool<object, object>(name, locators, serverGroup, redundancy, subscription, prSingleHop, threadLocal);
+ }
+
+ //public void StepOne(string endpoints)
+ //{
+
+ // CacheHelper.CreateTCRegion(QERegionName, true, true,
+ // null, endpoints, true);
+
+ // Region region = CacheHelper.GetVerifyRegion(QERegionName);
+ // for (int i = 0; i < 34; i++)
+ // {
+ // region["KEY--" + i] = "VALUE--" + i;
+ // }
+
+ // string[] routingObj = new string[17];
+ // int j = 0;
+ // for (int i = 0; i < 34; i++)
+ // {
+ // if (i % 2 == 0) continue;
+ // routingObj[j] = "KEY--" + i;
+ // j++;
+ // }
+ // Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ // bool args = true;
+ // Boolean getResult = true;
+ // //test data dependant function execution
+ // // test get function with result
+ // Execution<object> exc = FunctionService<object>.OnRegion<object, object> (region);
+ // IResultCollector<object> rc = exc.WithArgs<bool>(args).WithFilter<string>(routingObj).Execute(
+ //getFuncName, getResult);
+ // ICollection<object> executeFunctionResult = rc.GetResult();
+ // List<object> resultList = new List<object>();
+ // //resultList.Clear();
+
+ // foreach (List<object> item in executeFunctionResult)
+ // {
+
+ // foreach (object item2 in item)
+ // {
+ // resultList.Add(item2);
+ // }
+ // }
+ // Util.Log("on region: result count= {0}.", resultList.Count);
+ // Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ // for (int i = 0; i < resultList.Count; i++)
+ // {
+ // Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ // }
+ // // Bring down the region
+ // region.GetLocalView().DestroyRegion();
+ //}
+
+ public void PoolStepOne(string locators)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 230; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ Object[] routingObj = new Object[17];
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ object args = true;
+ //test data dependant function execution
+ // test get function with result
+
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+ Client.IResultCollector<object> rc = exc.WithArgs<object>(args).WithFilter<object>(routingObj).Execute(getFuncName);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ List<object> resultList = new List<object>();
+ //resultList.Clear();
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 34, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ }
+
+ //---------------------Test for function execution with sendException------------------------//
+ for (int i = 1; i <= 230; i++) {
+ region["execKey-" + i] = i;
+ }
+ Util.Log("Put on region complete for execKeys");
+
+ List<Object> arrList = new List<Object>(20);
+ for (int i = 100; i < 120; i++) {
+ arrList.Add("execKey-" + i);
+ }
+
+ Object[] filter = new Object[20];
+ j = 0;
+ for (int i = 100; i < 120; i++) {
+ filter[j] = "execKey-" + i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+ args = true;
+
+ exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ rc = exc.WithArgs<object>(args).WithFilter<object>(filter).Execute(exFuncNameSendException);
+
+ executeFunctionResult = rc.GetResult();
+
+ Assert.IsTrue(executeFunctionResult.Count == 1, "executeFunctionResult count check failed");
+
+ foreach (UserFunctionExecutionException item in executeFunctionResult) {
+ Util.Log("Item returned for bool arguement is {0} ", item.Message);
+ }
+
+ Util.Log("Executing exFuncNameSendException on region for execKeys for bool arguement done.");
+
+ rc = exc.WithArgs<object>(arrList).WithFilter<object>(filter).Execute(exFuncNameSendException);
+ executeFunctionResult = rc.GetResult();
+
+ Util.Log("exFuncNameSendException for arrList result->size() = {0} ", executeFunctionResult.Count);
+
+ Assert.IsTrue(executeFunctionResult.Count == arrList.Count + 1, "region get: resultList count is not as arrList count + exception");
+
+ foreach (object item in executeFunctionResult) {
+ Util.Log("Items returned for arrList arguement is {0} ", item);
+ }
+
+ Util.Log("Executing exFuncNameSendException on region for execKeys for arrList arguement done.");
+
+ MyResultCollector<object> myRC1 = new MyResultCollector<object>();
+ rc = exc.WithArgs<object>(args).WithCollector(myRC1).Execute(exFuncNameSendException);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC1.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC1.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC1.GetEndResultCount());
+ Assert.IsTrue(myRC1.GetAddResultCount() == 1, "add result count check failed");
+ Assert.IsTrue(myRC1.GetGetResultCount() == 1, "get result count check failed");
+ Assert.IsTrue(myRC1.GetEndResultCount() == 1, "end result count check failed");
+ Util.Log("on Region with collector: result count= {0}.", executeFunctionResult.Count);
+ Assert.IsTrue(executeFunctionResult.Count == 1, "result count check failed");
+ foreach (object item in executeFunctionResult) {
+ Util.Log("on Region with collector: get:result {0}", (item as UserFunctionExecutionException).Message);
+ }
+
+ //---------------------Test for function execution with sendException Done-----------------------//
+
+ Pool/*<object, object>*/ pl = CacheHelper.DCache.GetPoolManager().Find(poolName);
+ //test date independant fucntion execution on one server
+ // test get function with result
+
+ exc = Client.FunctionService<object>.OnServer(pl);
+ ArrayList args1 = new ArrayList();
+ for (int i = 0; i < routingObj.Length; i++)
+ {
+ Util.Log("routingObj[{0}]={1}.", i, (string)routingObj[i]);
+ args1.Add(routingObj[i]);
+ }
+ rc = exc.WithArgs<ArrayList>(args1).Execute(getFuncIName);
+ executeFunctionResult = rc.GetResult();
+
+ resultList.Clear();
+ foreach (List<object> item in executeFunctionResult)
+ {
+
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+ Util.Log("on one server: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on one server: get:result[{0}]={1}.", i, (string)resultList[i]);
+ }
+
+ //test data independant fucntion execution on all servers
+ // test get function with result
+
+ exc = Client.FunctionService<object>.OnServers(pl);
+ rc = exc.WithArgs<ArrayList>(args1).Execute(getFuncIName);
+ executeFunctionResult = rc.GetResult();
+ resultList.Clear();
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+ Util.Log("on all servers: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 34, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on all servers: get:result[{0}]={1}.", i, (string)resultList[i]);
+ }
+ //TODO::enable it once the StringArray conversion is fixed.
+ //test withCollector
+ MyResultCollector<object> myRC = new MyResultCollector<object>();
+ rc = exc.WithArgs<ArrayList>(args1).WithCollector(myRC).Execute(getFuncIName);
+ //executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC.GetEndResultCount());
+ Util.Log("on all servers with collector: result count= {0}.", executeFunctionResult.Count);
+ Assert.IsTrue(myRC.GetResult().Count == 2, "result count check failed");
+
+ IList res = (IList)myRC.GetResult();
+
+ foreach (object o in res)
+ {
+ IList resList = (IList)o;
+ Util.Log("results " + resList.Count);
+
+ Assert.AreEqual(17, resList.Count);
+ }
+
+ MyResultCollector<object> myRC2 = new MyResultCollector<object>();
+ rc = exc.WithArgs<object>(args).WithCollector(myRC2).Execute(exFuncNameSendException);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC2.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC2.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC2.GetEndResultCount());
+ Assert.IsTrue(myRC2.GetAddResultCount() == 2, "add result count check failed");
+ Assert.IsTrue(myRC2.GetGetResultCount() == 1, "get result count check failed");
+ Assert.IsTrue(myRC2.GetEndResultCount() == 1, "end result count check failed");
+ Util.Log("on Region with collector: result count= {0}.", executeFunctionResult.Count);
+ Assert.IsTrue(executeFunctionResult.Count == 2, "result count check failed");
+ foreach (object item in executeFunctionResult) {
+ Util.Log("on Region with collector: get:result {0}", (item as UserFunctionExecutionException).Message);
+ }
+
+ }
+
+ public void genericFEResultIntTest(string locators)
+ {
+ IRegion<int, int> region = CacheHelper.GetVerifyRegion<int, int>(QERegionName);
+ Pool pl = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ for (int n = 0; n < 34; n++)
+ {
+ region[n] = n;
+ }
+
+ ICollection<int> routingObj = new List<int>();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj.Add(i);
+ j++;
+ }
+ Console.WriteLine("routingObj count= {0}.", routingObj.Count);
+
+ int args1 = 0;
+
+ MyResultCollector<int> myRC = new MyResultCollector<int>();
+ Apache.Geode.Client.Execution<int> exc = Client.FunctionService<int>.OnServers/*OnRegion<string, string>*/(pl/*region*/);
+ Client.IResultCollector<int> rc = exc.WithArgs<int>(args1).WithCollector(myRC).Execute("SingleStrGetFunction");
+
+ Util.Log("add result count= {0}.", myRC.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC.GetEndResultCount());
+
+ Assert.IsTrue(myRC.GetResult().Count == 2, "result count check failed");
+
+ ICollection<int> res = myRC.GetResult();
+ Assert.AreEqual(2, res.Count);
+
+ foreach (int o in res)
+ {
+ Util.Log("results " + o);
+ }
+
+ }
+
+ public void genericFEResultStringTest(string locators)
+ {
+ IRegion<string, string> region = CacheHelper.GetVerifyRegion<string, string>(QERegionName);
+ Pool pl = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ for (int n = 0; n < 34; n++)
+ {
+ region["KEY--" + n] = "VALUE--" + n;
+ }
+
+ ICollection<string> routingObj = new List<string>();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj.Add("KEY--" + i);
+ j++;
+ }
+ Console.WriteLine("routingObj count= {0}.", routingObj.Count);
+
+ ArrayList args1 = new ArrayList();
+
+ int count = 0;
+ foreach (string str in routingObj)
+ {
+ Util.Log("string at index {0} = {1}.", count, str);
+ args1.Add(str);
+ count++;
+ }
+
+ MyResultCollector<string> myRC = new MyResultCollector<string>();
+ Apache.Geode.Client.Execution<string> exc = Client.FunctionService<string>.OnServers/*OnRegion<string, string>*/(pl/*region*/);
+ Client.IResultCollector<string> rc = exc.WithArgs<ArrayList>(args1).WithCollector(myRC).Execute("SingleStrGetFunction");
+
+ Util.Log("add result count= {0}.", myRC.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC.GetEndResultCount());
+
+ Assert.IsTrue(myRC.GetResult().Count == 2, "result count check failed");
+
+ ICollection<string> res = myRC.GetResult();
+ Assert.AreEqual(2, res.Count);
+ foreach (string o in res)
+ {
+ Util.Log("results " + o);
+ }
+
+ }
+
+ public void genericFEResultDCStringTest(string locators)
+ {
+ IRegion<string, string> region = CacheHelper.GetVerifyRegion<string, string>(QERegionName);
+ Pool pl = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ for (int n = 0; n < 34; n++)
+ {
+ region["KEY--" + n] = "VALUE--" + n;
+ }
+
+ ICollection<string> routingObj = new List<string>();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj.Add("KEY--" + i);
+ j++;
+ }
+ Console.WriteLine("routingObj count= {0}.", routingObj.Count);
+
+ ArrayList args1 = new ArrayList();
+
+ int count = 0;
+ foreach (string str in routingObj)
+ {
+ Util.Log("string at index {0} = {1}.", count, str);
+ args1.Add(str);
+ count++;
+ }
+
+ Apache.Geode.Client.Execution<string> exc = Client.FunctionService<string>.OnServers/*OnRegion<string, string>*/(pl/*region*/);
+ Client.IResultCollector<string> rc = exc.WithArgs<ArrayList>(args1).Execute("SingleStrGetFunction");
+
+ Assert.IsTrue(rc.GetResult().Count == 2, "result count check failed");
+
+ ICollection<string> res = rc.GetResult();
+ Assert.AreEqual(2, res.Count);
+ foreach (string o in res)
+ {
+ Util.Log("results " + o);
+ }
+
+ }
+
+ public void genericFEResultDCPdxTest(string locators)
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ IRegion<string, IPdxSerializable> region = CacheHelper.GetVerifyRegion<string, IPdxSerializable>(QERegionName);
+ Pool pl = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ for (int n = 0; n < 34; n++)
+ {
+ region["KEY--pdx" + n] = new PdxTests.PdxTypes8();
+ }
+
+ ICollection<string> routingObj = new List<string>();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj.Add("KEY--pdx" + i);
+ j++;
+ }
+ Console.WriteLine("routingObj count= {0}.", routingObj.Count);
+
+ ArrayList args1 = new ArrayList();
+
+ int count = 0;
+ foreach (string str in routingObj)
+ {
+ Util.Log("string at index {0} = {1}.", count, str);
+ args1.Add(str);
+ count++;
+ }
+
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnServers/*OnRegion<string, string>*/(pl/*region*/);
+ Client.IResultCollector<object> rc = exc.WithArgs<ArrayList>(args1).Execute("PdxFunctionTest");
+
+ Assert.IsTrue(rc.GetResult().Count == 2, "result count check failed");
+
+ ICollection<object> res = rc.GetResult();
+ Assert.AreEqual(2, res.Count);
+ foreach (ICollection o in res)
+ {
+ Util.Log("results " + o);
+ Assert.IsTrue(o.Count == 1);
+ foreach (IPdxSerializable ip in o)
+ {
+ Assert.IsNotNull(ip);
+ }
+ }
+
+ }
+
+ public void HAStepOne()
+ {
+
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 226; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ object[] routingObj = new object[17];
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ bool args = true;
+ //test data dependant function execution
+ // test get function with result
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+ Client.IResultCollector<object> rc = exc.WithArgs<bool>(args).WithFilter<object>(routingObj).Execute(getFuncName);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ List<object> resultList = new List<object>();
+ //resultList.Clear();
+
+ Util.Log("executeFunctionResult Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 34, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ }
+
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+
+ public void OnRegionHA()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 230; i++)
+ {
+ region[i] = "VALUE--" + i;
+ }
+
+ Object[] routingObj = new Object[17];
+ ArrayList args1 = new ArrayList();
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ for (int i = 0; i < routingObj.Length; i++)
+ {
+ Util.Log("routingObj[{0}]={1}.", i, (int)routingObj[i]);
+ args1.Add(routingObj[i]);
+ }
+
+ //test data independant function execution with result OnRegion
+
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ Assert.IsTrue(exc != null, "onRegion Returned NULL");
+
+ Client.IResultCollector<object> rc = exc.WithArgs<ArrayList>(args1).Execute(RegionOperationsHAFunctionPrSHOP, 15);
+
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ List<Object> resultList = new List<Object>();
+ Console.WriteLine("executeFunctionResult.Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ Assert.IsTrue((string)resultList[i] != null, "onRegion Returned NULL");
+ }
+ }
+
+
+ public void OnRegionHAStepOne()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 226; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ Object[] routingObj = new Object[17];
+ ArrayList args1 = new ArrayList();
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ for (int i = 0; i < routingObj.Length; i++)
+ {
+ Console.WriteLine("routingObj[{0}]={1}.", i, (string)routingObj[i]);
+ args1.Add(routingObj[i]);
+ }
+
+ //test data independant function execution with result onServer
+
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ Assert.IsTrue(exc != null, "onRegion Returned NULL");
+
+ Client.IResultCollector<object> rc = exc.WithArgs<ArrayList>(args1).Execute(RegionOperationsHAFunction, 15);
+
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ List<Object> resultList = new List<Object>();
+ Console.WriteLine("executeFunctionResult.Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ Assert.IsTrue((string)resultList[i] != null, "onServer Returned NULL");
+ }
+
+ ///////////////OnRegion with Single filter Key ////////////////
+
+ Object[] filter = new Object[1];
+ filter[0] = "KEY--" + 10;
+ rc = exc.WithArgs<ArrayList>(args1).WithFilter<Object>(filter).Execute(RegionOperationsHAFunction, 15);
+
+ executeFunctionResult = rc.GetResult();
+ resultList = new List<Object>();
+ Console.WriteLine("executeFunctionResult.Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ Assert.IsTrue((string)resultList[i] != null, "onServer Returned NULL");
+ }
+
+ ///////////////OnRegion with Single filter Key Done////////////////
+ }
+
+
+ public void OnRegionPrSHOPSingleFilterKey()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+
+ for (int i = 0; i < 230; i++)
+ {
+ region[i] = "VALUE--" + i;
+ }
+ Util.Log("Put on region complete ");
+ ///////////////////// OnRegion with single filter key /////////////////////////////
+ Object[] filter = new Object[1];
+ for (int i = 0; i < 230; i++)
+ {
+ filter[0] = i;
+ Util.Log("filter count= {0}.", filter.Length);
+
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+ IResultCollector<object> rc = exc.WithFilter<object>(filter).Execute(FEOnRegionPrSHOP);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionPrSHOPSingleFilterKey for filter executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(1, executeFunctionResult.Count, "executeFunctionResult count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP done");
+
+ rc = exc.WithFilter<object>(filter).Execute(FEOnRegionPrSHOP_OptimizeForWrite);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionPrSHOPSingleFilterKey for FEOnRegionPrSHOP_OptimizeForWrite executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(1, executeFunctionResult.Count, "executeFunctionResult.Count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP_OptimizeForWrite:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP_OptimizeForWrite item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP_OptimizeForWrite done");
+ }
+ ///////////////////// OnRegion with single filter key done/////////////////////////////
+ }
+
+ public void FEOnRegionTx()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ CacheTransactionManager csTx = CacheHelper.CSTXManager;
+ csTx.Begin();
+ Util.Log("Transaction begun.");
+
+ for (int i = 0; i < 230; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+ Util.Log("Put on region complete ");
+
+ int j = 0;
+ Object[] filter = new Object[20];
+ for (int i = 0; i < 20; i++)
+ {
+ filter[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ IResultCollector<object> rc = exc.WithFilter<object>(filter).Execute(putFuncName);
+
+ Util.Log("Executing ExecuteFunctionOnRegion on region for execKeys for arrList arguement done.");
+
+ csTx.Commit();
+ Util.Log("Transaction commited");
+
+ for (int i = 0; i < filter.Length; i++)
+ {
+ String str = (String)filter[i];
+ String val = (String)region[str];
+ Util.Log("Filter Key = {0}, get Value = {1} ", str, val);
+ if (!str.Equals(val))
+ Assert.Fail("Value after function execution and transaction is incorrect");
+ }
+ }
+
+ public void ExecuteFEOnRegionMultiFilterKeyStepOne()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+
+ for (int k = 0; k < 210; k++)
+ {
+ int j = 0;
+ Object[] filter = new Object[20];
+ for (int i = k; i < k + 20; i++)
+ {
+ filter[j] = i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+ object args = true;
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ IResultCollector<object> rc = exc.WithFilter<object>(filter).Execute(getFuncName);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+
+ Util.Log("ExecuteFEOnRegionMultiFilterKeyStepOne for filter executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+
+ List<object> resultList = new List<object>();
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.AreEqual(40, resultList.Count, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:= {0}.", resultList[i]);
+ }
+
+ Util.Log("Executing ExecuteFEOnRegionMultiFilterKeyStepOne on region for execKeys for arrList arguement done.");
+
+ MyResultCollector<object> myRC1 = new MyResultCollector<object>();
+ rc = exc.WithFilter<object>(filter).WithCollector(myRC1).Execute(getFuncName);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC1.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC1.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC1.GetEndResultCount());
+ Assert.AreEqual(4, myRC1.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, myRC1.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, myRC1.GetEndResultCount(), "end result count check failed");
+ Util.Log("on Region with collector: result count= {0}.", executeFunctionResult.Count);
+
+ resultList.Clear();
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count with custom ResultCollector = {0}.", resultList.Count);
+ Assert.AreEqual(40, resultList.Count, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:= {0}.", resultList[i]);
+ }
+ }
+ }
+
+ public void ExecuteFETimeOut()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 230; i++)
+ {
+ region[i] = "VALUE--" + i;
+ }
+
+ object args = 5000 * 1000;
+
+ for (int k = 0; k < 210; k++)
+ {
+ int j = 0;
+ Object[] filter = new Object[20];
+ for (int i = k; i < k + 20; i++)
+ {
+ filter[j] = i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+ IResultCollector<object> rc = exc.WithArgs<Object>(args).WithFilter<object>(filter).Execute(FuncTimeOutName, 5000);
+ ICollection<object> FunctionResult = rc.GetResult();
+ Util.Log("ExecuteFETimeOut onRegion FunctionResult.Count = {0} ", FunctionResult.Count);
+ foreach (Boolean item in FunctionResult)
+ {
+ Util.Log("on region:ExecuteFETimeOut:= {0}.", item);
+ Assert.AreEqual(true, item, "ExecuteFETimeOut item not true");
+ break;
+ }
+ Util.Log("ExecuteFETimeOut onRegion Done");
+ }
+
+ Pool pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
+ Execution<object> excs = Client.FunctionService<object>.OnServer(pool);
+ IResultCollector<object> rcs = excs.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000);
+ ICollection<object> ServerFunctionResult = rcs.GetResult();
+ Util.Log("ExecuteFETimeOut onServer FunctionResult.Count = {0} ", ServerFunctionResult.Count);
+ foreach (Boolean item in ServerFunctionResult)
+ {
+ Util.Log("on server:ExecuteFETimeOut:= {0}.", item);
+ Assert.AreEqual(true, item, "ExecuteFETimeOut item not true");
+ }
+ Util.Log("ExecuteFETimeOut onServer Done");
+
+
+ Execution<object> excss = Client.FunctionService<object>.OnServers(pool);
+ IResultCollector<object> rcss = excss.WithArgs<Object>(args).Execute(FuncTimeOutName, 5000);
+ ICollection<object> ServerFunctionResults = rcss.GetResult();
+ Util.Log("ExecuteFETimeOut onServer FunctionResult.Count = {0} ", ServerFunctionResults.Count);
+ foreach (Boolean item in ServerFunctionResults)
+ {
+ Util.Log("on servers:ExecuteFETimeOut:= {0}.", item);
+ Assert.AreEqual(true, item, "ExecuteFETimeOut item not true");
+ }
+ Util.Log("ExecuteFETimeOut onServers Done");
+ }
+
+ public void ExecuteFEOnRegionMultiFilterKeyStepTwo()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+
+ for (int i = 0; i < 230; i++)
+ {
+ region[i] = "VALUE--" + i;
+ }
+ Util.Log("Put on region complete ");
+
+ for (int k = 0; k < 210; k++)
+ {
+ int j = 0;
+ Object[] filter = new Object[20];
+ for (int i = k; i < k + 20; i++)
+ {
+ filter[j] = i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+ object args = true;
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ IResultCollector<object> rc = exc.WithFilter<object>(filter).Execute(getFuncName);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+
+ Util.Log("ExecuteFEOnRegionMultiFilterKeyStepTwo for filter executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+
+ List<object> resultList = new List<object>();
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.AreEqual(40, resultList.Count, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:= {0}.", resultList[i]);
+ }
+
+ Util.Log("Executing ExecuteFEOnRegionMultiFilterKeyStepTwo on region for execKeys for arrList arguement done.");
+
+ MyResultCollector<object> myRC1 = new MyResultCollector<object>();
+ rc = exc.WithFilter<object>(filter).WithCollector(myRC1).Execute(getFuncName);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC1.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC1.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC1.GetEndResultCount());
+ Assert.AreEqual(4, myRC1.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, myRC1.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, myRC1.GetEndResultCount(), "end result count check failed");
+ Util.Log("on Region with collector: result count= {0}.", executeFunctionResult.Count);
+
+ resultList.Clear();
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count with custom ResultCollector = {0}.", resultList.Count);
+ Assert.AreEqual(40, resultList.Count, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:= {0}.", resultList[i]);
+ }
+ }
+ }
+
+ public void OnRegionMultiFilterKeyPrSHOP()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ region.GetSubscriptionService().RegisterAllKeys();
+ for (int i = 0; i < 230; i++)
+ {
+ region[i] = "VALUE--" + i;
+ }
+ Util.Log("Put on region complete ");
+
+ for (int k = 0; k < 210; k++)
+ {
+ Object[] filter = new Object[20];
+ int j = 0;
+ for (int i = k; i < k + 20; i++)
+ {
+ filter[j] = i;
+ j++;
+ }
+ Util.Log("filter count= {0}.", filter.Length);
+
+ object args = true;
+
+ Execution<object> exc = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ IResultCollector<object> rc = exc.WithFilter<object>(filter).Execute(FEOnRegionPrSHOP);
+ ICollection<object> executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for filter executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(2, executeFunctionResult.Count, "executeFunctionResult count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:OnRegionMultiFilterKeyPrSHOP:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP item not true");
+ }
+ Util.Log("OnRegionMultiFilterKeyPrSHOP done");
+
+ rc = exc.WithFilter<object>(filter).Execute(FEOnRegionPrSHOP_OptimizeForWrite);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for FEOnRegionPrSHOP_OptimizeForWrite executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(3, executeFunctionResult.Count, "executeFunctionResult.Count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP_OptimizeForWrite:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP_OptimizeForWrite item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP_OptimizeForWrite done");
+
+ MyResultCollector<object> myRC1 = new MyResultCollector<object>();
+ rc = exc.WithFilter<object>(filter).WithCollector(myRC1).Execute(FEOnRegionPrSHOP);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC1.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC1.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC1.GetEndResultCount());
+ Assert.AreEqual(2, myRC1.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, myRC1.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, myRC1.GetEndResultCount(), "end result count check failed");
+ executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for filter executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(2, executeFunctionResult.Count, "executeFunctionResult count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP with ResultCollector done");
+
+ MyResultCollector<object> myRC2 = new MyResultCollector<object>();
+ rc = exc.WithFilter<object>(filter).WithCollector(myRC2).Execute(FEOnRegionPrSHOP_OptimizeForWrite);
+ executeFunctionResult = rc.GetResult();
+ Util.Log("add result count= {0}.", myRC2.GetAddResultCount());
+ Util.Log("get result count= {0}.", myRC2.GetGetResultCount());
+ Util.Log("end result count= {0}.", myRC2.GetEndResultCount());
+ Assert.AreEqual(3, myRC2.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, myRC2.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, myRC2.GetEndResultCount(), "end result count check failed");
+ executeFunctionResult = rc.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for FEOnRegionPrSHOP_OptimizeForWrite executeFunctionResult.Count = {0} ", executeFunctionResult.Count);
+ Assert.AreEqual(3, executeFunctionResult.Count, "executeFunctionResult.Count check failed");
+ foreach (Boolean item in executeFunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP_OptimizeForWrite:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP_OptimizeForWrite item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP_OptimizeForWrite with ResultCollector done");
+ }
+
+ Execution<object> exe = Client.FunctionService<object>.OnRegion<object, object>(region);
+
+ //w/o filter
+ IResultCollector<object> collector = exe.Execute(FEOnRegionPrSHOP);
+ ICollection<Object> FunctionResult = collector.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for filter FunctionResult.Count = {0} ", FunctionResult.Count);
+ Assert.AreEqual(2, FunctionResult.Count, "FunctionResult count check failed");
+ foreach (Boolean item in FunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP item not true");
+ }
+ collector.ClearResults();
+ Util.Log("FEOnRegionPrSHOP without filter done");
+
+ // w/o filter
+ MyResultCollector<object> rC = new MyResultCollector<object>();
+ IResultCollector<Object> Rcollector = exe.WithCollector(rC).Execute(FEOnRegionPrSHOP);
+ FunctionResult = Rcollector.GetResult();
+ Util.Log("add result count= {0}.", rC.GetAddResultCount());
+ Util.Log("get result count= {0}.", rC.GetGetResultCount());
+ Util.Log("end result count= {0}.", rC.GetEndResultCount());
+ Assert.AreEqual(2, rC.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, rC.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, rC.GetEndResultCount(), "end result count check failed");
+ FunctionResult = Rcollector.GetResult();
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for filter FunctionResult.Count = {0} ", FunctionResult.Count);
+ Assert.AreEqual(2, FunctionResult.Count, "executeFunctionResult count check failed");
+ foreach (Boolean item in FunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP with ResultCollector without filter done");
+
+ //w/o filter
+ collector.ClearResults();
+ collector = exe.Execute(FEOnRegionPrSHOP_OptimizeForWrite);
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for FEOnRegionPrSHOP_OptimizeForWrite executeFunctionResult.Count = {0} ", collector.GetResult().Count);
+ Assert.AreEqual(3, collector.GetResult().Count, "executeFunctionResult.Count check failed");
+ foreach (Boolean item in collector.GetResult())
+ {
+ Util.Log("on region:FEOnRegionPrSHOP_OptimizeForWrite:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP_OptimizeForWrite item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP_OptimizeForWrite done w/o filter");
+
+ //w/o filter
+ MyResultCollector<object> rC2 = new MyResultCollector<object>();
+ Rcollector = exe.WithCollector(rC2).Execute(FEOnRegionPrSHOP_OptimizeForWrite);
+ FunctionResult = Rcollector.GetResult();
+ Util.Log("add result count= {0}.", rC2.GetAddResultCount());
+ Util.Log("get result count= {0}.", rC2.GetGetResultCount());
+ Util.Log("end result count= {0}.", rC2.GetEndResultCount());
+ Assert.AreEqual(3, rC2.GetAddResultCount(), "add result count check failed");
+ Assert.AreEqual(1, rC2.GetGetResultCount(), "get result count check failed");
+ Assert.AreEqual(1, rC2.GetEndResultCount(), "end result count check failed");
+ Util.Log("OnRegionMultiFilterKeyPrSHOP for FEOnRegionPrSHOP_OptimizeForWrite FunctionResult.Count = {0} ", FunctionResult.Count);
+ Assert.AreEqual(3, FunctionResult.Count, "executeFunctionResult.Count check failed");
+ foreach (Boolean item in FunctionResult)
+ {
+ Util.Log("on region:FEOnRegionPrSHOP_OptimizeForWrite:= {0}.", item);
+ Assert.AreEqual(true, item, "FEOnRegionPrSHOP_OptimizeForWrite item not true");
+ }
+ Util.Log("FEOnRegionPrSHOP_OptimizeForWrite with ResultCollector w/o filter done");
+
+ for (int i = 0; i < 500; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+ Util.Log("Put on region complete ");
+
+ Object[] fil = new Object[500];
+ int x = 0;
+ for (int i = 0; i < 500; i++)
+ {
+ fil[x] = "KEY--" + i;
+ x++;
+ }
+ Util.Log("filter count= {0}.", fil.Length);
+
+ // Fire N Forget with filter keys
+ exe = Client.FunctionService<object>.OnRegion<object, object>(region);
+ exe.WithFilter<object>(fil).Execute(putFuncName);
+ Util.Log("Executing ExecuteFunctionOnRegion on region for execKeys for arrList arguement done.");
+ Thread.Sleep(4000); //wait for results to be updated
+
+ for (int i = 0; i < fil.Length; i++)
+ {
+ String str = (String)fil[i];
+ String val = (String)region[str];
+ Util.Log("Filter Key = {0}, get Value = {1} ", str, val);
+ if (!str.Equals(val))
+ Assert.Fail("Value after function execution is incorrect");
+ }
+
+ // Fire N Forget without filter keys
+ ArrayList args1 = new ArrayList();
+ for (int i = 10; i < 200; i++)
+ {
+ args1.Add("KEY--" + i);
+ }
+ exe = Client.FunctionService<object>.OnRegion<object, object>(region);
+ exe.WithArgs<ArrayList>(args1).Execute(putFuncIName);
+ Util.Log("Executing ExecuteFunctionOnRegion on region for execKeys for arrList arguement done.");
+ Thread.Sleep(4000); ////wait for results to be updated
+
+ for (int i = 0; i < args1.Count; i++)
+ {
+ String str = (String)args1[i];
+ String val = (String)region[str];
+ Util.Log("Arg Key = {0}, get Value = {1} ", str, val);
+ if (!str.Equals(val))
+ Assert.Fail("Value after function execution is incorrect");
+ }
+ }
+
+ public void OnServerHAStepOne()
+ {
+
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ for (int i = 0; i < 34; i++)
+ {
+ region["KEY--" + i] = "VALUE--" + i;
+ }
+
+ object[] routingObj = new object[17];
+
+ ArrayList args1 = new ArrayList();
+
+ int j = 0;
+ for (int i = 0; i < 34; i++)
+ {
+ if (i % 2 == 0) continue;
+ routingObj[j] = "KEY--" + i;
+ j++;
+ }
+ Util.Log("routingObj count= {0}.", routingObj.Length);
+
+ for (int i = 0; i < routingObj.Length; i++)
+ {
+ Console.WriteLine("routingObj[{0}]={1}.", i, (string)routingObj[i]);
+ args1.Add(routingObj[i]);
+ }
+
+ //test data independant function execution with result onServer
+ Pool/*<TKey, TValue>*/ pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ Apache.Geode.Client.Execution<object> exc = Client.FunctionService<object>.OnServer(pool);
+ Assert.IsTrue(exc != null, "onServer Returned NULL");
+
+ Client.IResultCollector<object> rc = exc.WithArgs<ArrayList>(args1).Execute(OnServerHAExceptionFunction, 15);
+
+ ICollection<object> executeFunctionResult = rc.GetResult();
+
+ List<object> resultList = new List<object>();
+
+ Console.WriteLine("executeFunctionResult.Length = {0}", executeFunctionResult.Count);
+
+ foreach (List<object> item in executeFunctionResult)
+ {
+ foreach (object item2 in item)
+ {
+ resultList.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList.Count);
+ Assert.IsTrue(resultList.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList[i]);
+ Assert.IsTrue(((string)resultList[i]) != null, "onServer Returned NULL");
+ }
+
+ rc = exc.WithArgs<ArrayList>(args1).Execute(OnServerHAShutdownFunction, 15);
+
+ ICollection<object> executeFunctionResult1 = rc.GetResult();
+
+ List<object> resultList1 = new List<object>();
+
+ foreach (List<object> item in executeFunctionResult1)
+ {
+ foreach (object item2 in item)
+ {
+ resultList1.Add(item2);
+ }
+ }
+
+ Util.Log("on region: result count= {0}.", resultList1.Count);
+
+ Console.WriteLine("resultList1.Count = {0}", resultList1.Count);
+
+ Assert.IsTrue(resultList1.Count == 17, "result count check failed");
+ for (int i = 0; i < resultList1.Count; i++)
+ {
+ Util.Log("on region:get:result[{0}]={1}.", i, (string)resultList1[i]);
+ Assert.IsTrue(((string)resultList1[i]) != null, "onServer Returned NULL");
+ }
+
+ // Bring down the region
+ //region.LocalDestroyRegion();
+ }
+
+ void runOnServerHAExecuteFunction()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, true, /*threadLocal*/true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(OnServerHAStepOne);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFEOnRegionPrSHOPSingleFilterKey()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, true, true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(OnRegionPrSHOPSingleFilterKey);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runOnRegionHAExecuteFunction()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, /*singleHop*/false, /*threadLocal*/false);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(OnRegionHAStepOne);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runOnRegionHAExecuteFunctionPrSHOP()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, /*singleHop*/true, /*threadLocal*/true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(OnRegionHA);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runExecuteFunctionOnRegionMultiFilterKey(bool singleHop)
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, singleHop, /*threadLocal*/false);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(ExecuteFEOnRegionMultiFilterKeyStepOne);
+ m_client1.Call(ExecuteFEOnRegionMultiFilterKeyStepTwo);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runExecuteFunctionTimeOut(bool singleHop)
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, singleHop, /*threadLocal*/false);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(ExecuteFETimeOut);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFEOnRegionTx(bool singleHop)
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, singleHop, /*threadLocal*/true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(FEOnRegionTx);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFEOnRegionPrSHOPMultiFilterKey(bool singleHop)
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, singleHop, /*threadLocal*/true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+ Util.Log("Client 1 (pool locator) regions created");
+
+ m_client1.Call(OnRegionMultiFilterKeyPrSHOP);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ [Test]
+ public void PoolExecuteFunctionTest()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 0, true, /*singleHop*/false, /*threadLocal*/false);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+
+ m_client1.Call(PoolStepOne, CacheHelper.Locators);
+ m_client1.Call(genericFEResultIntTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultStringTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultDCStringTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultDCPdxTest, CacheHelper.Locators);
+
+ Util.Log("PoolStepOne complete.");
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ }
+
+ [Test]
+ public void PoolExecuteFunctionTestPrSHOP()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 0, true, /*singleHop*/true, /*threadLocal*/true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+
+ m_client1.Call(PoolStepOne, CacheHelper.Locators);
+ m_client1.Call(genericFEResultIntTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultStringTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultDCStringTest, CacheHelper.Locators);
+ m_client1.Call(genericFEResultDCPdxTest, CacheHelper.Locators);
+
+ Util.Log("PoolStepOne complete.");
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ }
+
+ [Test]
+ public void HAExecuteFunctionTest()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, /*singleHop*/false, /*threadLocal*/false);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+
+ m_client1.Call(HAStepOne);
+ Util.Log("HAStepOne complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ }
+
+ [Test]
+ public void HAExecuteFunctionTestPrSHOP()
+ {
+ CacheHelper.SetupJavaServers(true, "func_cacheserver1_pool.xml",
+ "func_cacheserver2_pool.xml", "func_cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+ m_client1.Call(createPool, poolName, CacheHelper.Locators, serverGroup, 1, true, /*singleHop*/true, true);
+ m_client1.Call(createRegionAndAttachPool, QERegionName, poolName);
+
+ m_client1.Call(HAStepOne);
+ Util.Log("HAStepOne complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ }
+
+ [Test]
+ public void OnServerHAExecuteFunctionTest()
+ {
+ runOnServerHAExecuteFunction();
+ }
+
+ [Test]
+ public void OnRegionHAExecuteFunctionTest()
+ {
+ runOnRegionHAExecuteFunction();
+ }
+
+ [Test]
+ public void TestFEOnRegionPrSHOPSingleFilterKey()
+ {
+ runFEOnRegionPrSHOPSingleFilterKey();
+ }
+
+ [Test]
+ public void OnRegionHAExecuteFunctionTestPrSHOP()
+ {
+ runOnRegionHAExecuteFunctionPrSHOP();
+ }
+
+ [Test]
+ public void ExecuteFunctionOnRegionMultiFilterKey()
+ {
+ runExecuteFunctionOnRegionMultiFilterKey(false);
+ runExecuteFunctionOnRegionMultiFilterKey(true);
+ }
+
+ [Test]
+ public void ExecuteFunctionTimeOut()
+ {
+ runExecuteFunctionTimeOut(false);
+ runExecuteFunctionTimeOut(true);
+ }
+
+ [Test]
+ public void TestFEOnRegionPrSHOPMultiFilterKey()
+ {
+ runFEOnRegionPrSHOPMultiFilterKey(true);
+ }
+
+ [Test]
+ public void TestFEOnRegionTransaction()
+ {
+ runFEOnRegionTx(true);
+ runFEOnRegionTx(false);
+ }
+ }
+}
[18/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheWriter.hpp b/clicache/src/ICacheWriter.hpp
new file mode 100644
index 0000000..ea02933
--- /dev/null
+++ b/clicache/src/ICacheWriter.hpp
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IRegion.hpp"
+//#include "Region.hpp"
+
+#include "EntryEvent.hpp"
+#include "RegionEvent.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Defines methods that are called <b>before</b> entry modification,
+ /// such as writing the value to a database.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A distributed region will typically have a single cache writer.
+ /// If the application is designed such that all or most updates to
+ /// a region occur on a node, the cache writer for the region should
+ /// be installed at that node.
+ /// </para><para>
+ /// A cache writer is defined in the <see cref="RegionAttributes" />.
+ /// </para><para>
+ /// Cache writer invocations are initiated by the node where the entry or
+ /// region modification occurs.
+ /// </para><para>
+ /// Before a region is updated via a put, create, or destroy operation,
+ /// Geode will call an <c>ICacheWriter</c> that is installed anywhere in any
+ /// participating cache for that region, preferring a local <c>ICacheWriter</c>
+ /// if there is one. Usually there will be only one <c>ICacheWriter</c> in
+ /// the distributed system. If there are multiple <c>ICacheWriter</c>s
+ /// available in the distributed system, the Geode
+ /// implementation always prefers one that is stored locally, or else picks one
+ /// arbitrarily. In any case, only one <c>ICacheWriter</c> will be invoked.
+ /// </para><para>
+ /// The typical use for a <c>ICacheWriter</c> is to update a database.
+ /// Application writers should implement these methods to execute
+ /// application-specific behavior before the cache is modified.
+ /// </para>
+ /// <para>
+ /// Note that cache writer callbacks are synchronous callbacks and have the ability
+ /// to veto the cache update. Since cache writer invocations require communications
+ /// over the network, (especially if they are not co-located on the nodes where the
+ /// change occurs) the use of cache writers presents a performance penalty.
+ /// </para><para>
+ /// The <c>ICacheWriter</c> is capable of aborting the update to the cache by throwing
+ /// a <c>CacheWriterException</c>. This exception or any runtime exception
+ /// thrown by the <c>ICacheWriter</c> will abort the operation, and the
+ /// exception will be propagated to the initiator of the operation, regardless
+ /// of whether the initiator is in the same process as the <c>ICacheWriter</c>.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheWriter" />
+ /// <seealso cref="RegionAttributes.CacheWriter" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheListener" />
+ generic <class TKey, class TValue>
+ public interface class ICacheWriter
+ {
+ public:
+
+ /// <summary>
+ /// Called before an entry is updated. The entry update is initiated by a
+ /// <c>Put</c> or a <c>Get</c> that causes the loader to update an existing entry.
+ /// </summary>
+ /// <remarks>
+ /// The entry previously existed in the cache where the operation was
+ /// initiated, although the old value may have been null. The entry being
+ /// updated may or may not exist in the local cache where the CacheWriter is
+ /// installed.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with updating the entry
+ /// </param>
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ bool BeforeUpdate(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called before an entry is created. Entry creation is initiated by a
+ /// <c>Create</c>, a <c>Put</c>, or a <c>Get</c>.
+ /// </summary>
+ /// <remarks>
+ /// The <c>CacheWriter</c> can determine whether this value comes from a
+ /// <c>Get</c> or not from <c>Load</c>. The entry being
+ /// created may already exist in the local cache where this <c>CacheWriter</c>
+ /// is installed, but it does not yet exist in the cache where the operation was initiated.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with creating the entry
+ /// </param>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ bool BeforeCreate(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called before an entry is destroyed.
+ /// </summary>
+ /// <remarks>
+ /// The entry being destroyed may or may
+ /// not exist in the local cache where the CacheWriter is installed. This method
+ /// is <em>not</em> called as a result of expiration or
+ /// <see cref="Region.LocalDestroyRegion" />.
+ /// </remarks>
+ /// <param name="ev">
+ /// event object associated with destroying the entry
+ /// </param>
+ /// <seealso cref="Region.Destroy" />
+ bool BeforeDestroy(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called before this region is cleared.
+ /// </summary>
+ bool BeforeRegionClear(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called before this region is destroyed.
+ /// </summary>
+ /// <param name="ev">
+ /// event object associated with destroying the region
+ /// </param>
+ /// <seealso cref="Region.DestroyRegion" />
+ bool BeforeRegionDestroy(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Implementations should clean up any external
+ /// resources, such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// </para><para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <param name="region">region to close</param>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close(IRegion<TKey, TValue>^ region);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheableKey.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheableKey.hpp b/clicache/src/ICacheableKey.hpp
new file mode 100644
index 0000000..3ca9514
--- /dev/null
+++ b/clicache/src/ICacheableKey.hpp
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// This interface class is the superclass of all user objects
+ /// in the cache that can be used as a key.
+ /// </summary>
+ /// <remarks>
+ /// If an implementation is required to act as a key in the cache, then
+ /// it must implement this interface and preferably override
+ /// <c>System.Object.ToString</c> to obtain proper string representation.
+ /// Note that this interface requires that the class overrides
+ /// <c>Object.GetHashCode</c>. Though this is not enforced, the default
+ /// implementation in <c>System.Object</c> is almost certainly incorrect
+ /// and will not work correctly.
+ /// </remarks>
+ public interface class ICacheableKey
+ : public IGeodeSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Get the hash code for this object. This is used in the internal
+ /// hash tables and so must have a nice distribution pattern.
+ /// </summary>
+ /// <returns>
+ /// The hashcode for this object.
+ /// </returns>
+ System::Int32 GetHashCode( );
+
+ /// <summary>
+ /// Returns true if this <c>ICacheableKey</c> matches the other.
+ /// </summary>
+ bool Equals( ICacheableKey^ other );
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICqAttributes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICqAttributes.hpp b/clicache/src/ICqAttributes.hpp
new file mode 100644
index 0000000..b401b56
--- /dev/null
+++ b/clicache/src/ICqAttributes.hpp
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class CqListener;
+
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Listener change notifications are invoked <c>after</c>
+ /// the change has occured.
+ /// </summary>
+ /// <remarks>
+ /// Listeners receive notifications when entries in a region change or changes occur to the
+ /// region attributes themselves.
+ /// <para>
+ /// A cache listener is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ /// The methods on a <c>ICacheListener</c>
+ /// are invoked asynchronously. Multiple events can cause concurrent invocation
+ /// of <c>ICacheListener</c> methods. If event A occurs before event B,
+ /// there is no guarantee that their corresponding <c>ICacheListener</c>
+ /// method invocations will occur in the same order. Any exceptions thrown by
+ /// the listener are caught by Geode and logged.
+ ///
+ /// Listeners are user callbacks that
+ /// are invoked by Geode. It is important to ensure that minimal work is done in the
+ /// listener before returning control back to Geode. For example, a listener
+ /// implementation may choose to hand off the event to a thread pool that then processes
+ /// the event on its thread rather than the listener thread
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributes.CacheListener" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheWriter" />
+ public interface class ICqListener
+ {
+ public:
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <param name="ev">
+ /// Denotes the event object associated with the entry creation.
+ /// </param>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ void OnEvent(CqEvent^ ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry.
+ /// </param>
+ /// <seealso cref="Region.Put" />
+ void OnError(CqEvent^ ev);
+
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources,
+ /// such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICqEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICqEvent.hpp b/clicache/src/ICqEvent.hpp
new file mode 100644
index 0000000..2f1bff0
--- /dev/null
+++ b/clicache/src/ICqEvent.hpp
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+#include "ICacheableKey.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+
+
+ generic<class TKey, class TResult>
+ ref class CqQuery;
+
+ interface class ICacheableKey;
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Listener change notifications are invoked <c>after</c>
+ /// the change has occured.
+ /// </summary>
+ /// <remarks>
+ /// Listeners receive notifications when entries in a region change or changes occur to the
+ /// region attributes themselves.
+ /// <para>
+ /// A cache listener is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ /// The methods on a <c>ICacheListener</c>
+ /// are invoked asynchronously. Multiple events can cause concurrent invocation
+ /// of <c>ICacheListener</c> methods. If event A occurs before event B,
+ /// there is no guarantee that their corresponding <c>ICacheListener</c>
+ /// method invocations will occur in the same order. Any exceptions thrown by
+ /// the listener are caught by Geode and logged.
+ ///
+ /// Listeners are user callbacks that
+ /// are invoked by Geode. It is important to ensure that minimal work is done in the
+ /// listener before returning control back to Geode. For example, a listener
+ /// implementation may choose to hand off the event to a thread pool that then processes
+ /// the event on its thread rather than the listener thread
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributes.CacheListener" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheWriter" />
+ generic<class TKey, class TResult>
+ public interface class ICqEvent
+ {
+ public:
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ CqQuery<TKey, TResult>^ getCq();
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <seealso cref="Region.Put" />
+ CqOperationType getBaseOperation();
+
+ CqOperationType getQueryOperation();
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources,
+ /// such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ TKey /*Generic::ICacheableKey^*/ getKey();
+
+ TResult /*Object^*/ getNewValue();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICqListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICqListener.hpp b/clicache/src/ICqListener.hpp
new file mode 100644
index 0000000..fbdaebc
--- /dev/null
+++ b/clicache/src/ICqListener.hpp
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CqEvent.hpp"
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TResult>
+ ref class CqEvent;
+
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// Listener change notifications are invoked <c>after</c>
+ /// the change has occured.
+ /// </summary>
+ /// <remarks>
+ /// Listeners receive notifications when entries in a region change or changes occur to the
+ /// region attributes themselves.
+ /// <para>
+ /// A cache listener is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ /// The methods on a <c>ICacheListener</c>
+ /// are invoked asynchronously. Multiple events can cause concurrent invocation
+ /// of <c>ICacheListener</c> methods. If event A occurs before event B,
+ /// there is no guarantee that their corresponding <c>ICacheListener</c>
+ /// method invocations will occur in the same order. Any exceptions thrown by
+ /// the listener are caught by Geode and logged.
+ ///
+ /// Listeners are user callbacks that
+ /// are invoked by Geode. It is important to ensure that minimal work is done in the
+ /// listener before returning control back to Geode. For example, a listener
+ /// implementation may choose to hand off the event to a thread pool that then processes
+ /// the event on its thread rather than the listener thread
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributes.CacheListener" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheWriter" />
+ //generic<class TKey, class TValue>
+ generic<class TKey, class TResult>
+ public interface class ICqListener
+ {
+ public:
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <param name="ev">
+ /// Denotes the event object associated with the entry creation.
+ /// </param>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ void OnEvent(CqEvent<TKey, TResult>^ ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry.
+ /// </param>
+ /// <seealso cref="Region.Put" />
+ //generic<class TKey, class TValue>
+ void OnError(CqEvent<TKey, TResult>^ ev);
+
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources,
+ /// such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICqResults.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICqResults.hpp b/clicache/src/ICqResults.hpp
new file mode 100644
index 0000000..f8d737f
--- /dev/null
+++ b/clicache/src/ICqResults.hpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/SelectResults.hpp>
+#include "end_native.hpp"
+
+
+#include "ISelectResults.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ ref class SelectResultsIterator;
+
+ /// <summary>
+ /// Interface to encapsulate a select query result set.
+ /// </summary>
+ generic<class TResult>
+ public interface class ICqResults
+ : public ISelectResults<TResult>
+ {
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICqStatusListener.hpp b/clicache/src/ICqStatusListener.hpp
new file mode 100644
index 0000000..b623a68
--- /dev/null
+++ b/clicache/src/ICqStatusListener.hpp
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ICqListener.hpp"
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Extension of CqListener. Adds two new methods to CqListener, one that
+ /// is called when the cq is connected and one that is called when
+ /// the cq is disconnected.
+ /// </summary>
+
+ generic<class TKey, class TResult>
+ public interface class ICqStatusListener : public ICqListener<TKey, TResult>
+ {
+ public:
+
+ /// <summary>
+ /// Called when the cq loses connection with all servers.
+ /// </summary>
+ virtual void OnCqDisconnected();
+
+ /// <summary>
+ /// Called when the cq establishes a connection with a server
+ /// </summary>
+ virtual void OnCqConnected();
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IFixedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IFixedPartitionResolver.hpp b/clicache/src/IFixedPartitionResolver.hpp
new file mode 100644
index 0000000..18962ee
--- /dev/null
+++ b/clicache/src/IFixedPartitionResolver.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IPartitionResolver.hpp"
+
+//using System::Collections::Generics;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+ /// <summary>
+ /// Implementers of interface <code>FixedPartitionResolver</code> helps to
+ /// achieve explicit mapping of a "user defined" partition to a data member node.
+ /// </summary>
+ /// <remarks>
+ /// <p>
+ /// Geode uses the partition name returned by
+ /// {@link FixedPartitionResolver#getPartitionName(EntryEvent, CacheableHashSet)}
+ /// to determine on which member the data is being managed. Say, for example, you want to
+ /// partition all Trades according to quarters. You can implement
+ /// FixedPartitionResolver to get the name of the quarter based on the date given
+ /// as part of {@link EntryEvent}.
+ /// </p>
+ ///
+ /// public class QuarterPartitionResolver implements FixedPartitionResolver{<br>
+ ///     public String getPartitionName(EntryOperation opDetails, CacheableHashSet
+ /// allAvailablePartitions) {<br>
+ ///     Date date = sdf.parse((String)opDetails.getKey());<br>
+ ///     Calendar cal = Calendar.getInstance();<br>
+ ///     cal.setTime(date);<br>
+ ///     int month = cal.get(Calendar.MONTH);<br>
+ ///     if (month == 0 || month == 1 || month == 2) {<br>
+ ///       return "Quarter1";<br>
+ ///     }<br>
+ ///     else if (month == 3 || month == 4 || month == 5) {<br>
+ ///       return "Quarter2";<br>
+ ///     }<br>
+ ///     else if (month == 6 || month == 7 || month == 8) {<br>
+ ///       return "Quarter3";<br>
+ ///     }<br>
+ ///     else if (month == 9 || month == 10 || month == 11) {<br>
+ ///       return "Quarter4";<br>
+ ///     }<br>
+ ///     else {<br>
+ ///       return "Invalid Quarter";<br>
+ ///     }<br>
+ ///   }<br>
+ ///
+ /// @see PartitionResolver
+ ///
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetPartitionResolver" />
+ /// <seealso cref="RegionAttributes.PartitionResolver" />
+ generic<class TKey, class TValue>
+ public interface class IFixedPartitionResolver : public IPartitionResolver<TKey, TValue>
+ {
+ public:
+
+ /// <summary>
+ /// This method is used to get the name of the partition for the given entry
+ /// operation.
+ /// </summary>
+ /// <param name="opDetails">
+ /// the details of the entry event e.g. {@link Region#get(Object)}
+ /// </param>
+ /// <return> partition-name associated with node which allows mapping of given
+ /// data to user defined partition
+ /// </return>
+ String^ GetPartitionName(EntryEvent<TKey, TValue>^ opDetails);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IGeodeCache.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IGeodeCache.hpp b/clicache/src/IGeodeCache.hpp
new file mode 100644
index 0000000..69bf539
--- /dev/null
+++ b/clicache/src/IGeodeCache.hpp
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IRegionService.hpp"
+#include "DistributedSystem.hpp"
+#include "CacheTransactionManager.hpp"
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// GeodeCache represents the singleton cache that must be created
+ /// in order to connect to Geode server.
+ /// </summary>
+ /// <remarks>
+ /// Caches are obtained from Crest methods on the
+ /// <see cref="CacheFactory.Create"/> class.
+ /// <para>
+ /// When a cache is created a <see cref="DistributedSystem" />
+ /// must be specified.
+ /// </para><para>
+ /// When a cache will no longer be used, call <see cref="Cache.Close" />.
+ /// Once it <see cref="Cache.IsClosed" /> any attempt to use it
+ /// will cause a <c>CacheClosedException</c> to be thrown.
+ /// </para><para>
+ /// A cache can have multiple root regions, each with a different name.
+ /// </para>
+ /// </remarks>
+ public interface class IGeodeCache : IRegionService
+ {
+ public:
+
+ /// <summary>
+ /// Returns the name of this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ /// <returns>the string name of this cache</returns>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Initializes the cache from an XML file.
+ /// </summary>
+ /// <param name="cacheXml">pathname of a <c>cache.xml</c> file</param>
+ void InitializeDeclarativeCache(String^ cacheXml);
+
+ /// <summary>
+ /// Returns the distributed system used to
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ property DistributedSystem^ DistributedSystem
+ {
+ Apache::Geode::Client::DistributedSystem^ get();
+ }
+
+ /// <summary>
+ /// Returns the cache transaction manager of
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ property Apache::Geode::Client::CacheTransactionManager^ CacheTransactionManager
+ {
+ Apache::Geode::Client::CacheTransactionManager^ get();
+ }
+
+ ///<summary>
+ /// Returns whether Cache saves unread fields for Pdx types.
+ ///</summary>
+ bool GetPdxIgnoreUnreadFields();
+
+ ///<summary>
+ /// Returns whether { @link PdxInstance} is preferred for PDX types instead of .NET object.
+ ///</summary>
+ bool GetPdxReadSerialized();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IGeodeDelta.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IGeodeDelta.hpp b/clicache/src/IGeodeDelta.hpp
new file mode 100644
index 0000000..25832a3
--- /dev/null
+++ b/clicache/src/IGeodeDelta.hpp
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+#pragma once
+
+#include "geode_defs.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class DataOutput;
+ ref class DataInput;
+ ref class Serializable;
+
+ /// <summary>
+ /// This interface is used for delta propagation.
+ /// To use delta propagation, an application class must implement interfaces <c>IGeodeDelta</c> as well as <c>IGeodeSerializable</c>.
+ /// The <c>IGeodeDelta</c> interface methods <c>HasDelta( ), ToDelta( )</c> and <c>FromDelta( )</c> must be implemented by the class, as these methods are used by Geode
+ /// to detect the presence of delta in an object, to serialize the delta, and to apply a serialized delta to an existing object
+ /// of the class.
+ /// If a customized cloning method is required, the class must also implement the interface <c>System.ICloneable</c>.
+ /// To use cloning in delta propagation for a region, the region attribute for cloning must be enabled.
+ /// </summary>
+ public interface class IGeodeDelta
+ {
+ public:
+
+ /// <summary>
+ /// Writes out delta information to out in a user-defined format. This is
+ /// invoked on an application object after Geode determines the presence
+ /// of delta in it by calling <c>HasDelta()</c> on the object.
+ /// </summary>
+ /// <exception cref="GeodeIOException">
+ /// </exception>
+ void ToDelta(DataOutput^ out);
+
+ /// <summary>
+ /// Reads in delta information to this object in a user-defined format. This is
+ /// invoked on an existing application object after Geode determines the
+ /// presence of delta in <c>DataInput</c> instance.
+ /// </summary>
+ /// <exception cref="InvalidDeltaException">
+ /// if the delta in the <c>DataInput</c> instance cannot be applied
+ /// to this instance (possible causes may include mismatch of Delta version or logic error).
+ /// </exception>
+ /// <exception cref="GeodeIOException">
+ /// </exception>
+ void FromDelta(DataInput^ in);
+
+ /// <summary>
+ /// <c>HasDelta( )</c> is invoked by Geode during <c>Region.Put( ICacheableKey, IGeodeSerializable )</c> to determine if the object contains a delta.
+ /// If <c>HasDelta( )</c> returns true, the delta in the object is serialized by invoking <c>ToDelta( DataOutput )</c>.
+ /// If <c>HasDelta( )</c> returns false, the object is serialized by invoking <c>IGeodeSerializable.ToData( DataOutput )</c>.
+ /// </summary>
+ bool HasDelta();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IGeodeSerializable.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IGeodeSerializable.hpp b/clicache/src/IGeodeSerializable.hpp
new file mode 100644
index 0000000..c21946f
--- /dev/null
+++ b/clicache/src/IGeodeSerializable.hpp
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/geode_types.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class DataOutput;
+ ref class DataInput;
+ ref class Serializable;
+
+ /// <summary>
+ /// This interface class is the superclass of all user objects
+ /// in the cache that can be serialized.
+ /// </summary>
+ public interface class IGeodeSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ void ToData( DataOutput^ output );
+
+ //bool HasDelta();
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ IGeodeSerializable^ FromData( DataInput^ input );
+
+ /// <summary>
+ /// Get the size of this object in bytes.
+ /// This is only needed if you use the HeapLRU feature.
+ /// </summary>
+ /// <remarks>
+ /// Note that you can simply return zero if you are not using the HeapLRU feature.
+ /// </remarks>
+ /// <returns>the size of this object in bytes.</returns>
+ property System::UInt32 ObjectSize
+ {
+ System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <remarks>
+ /// The classId must be unique within an application suite
+ /// and in the range 0 to ((2^31)-1) both inclusive. An application can
+ /// thus define upto 2^31 custom <c>IGeodeSerializable</c> classes.
+ /// Returning a value greater than ((2^31)-1) may result in undefined
+ /// behaviour.
+ /// </remarks>
+ /// <returns>the classId</returns>
+ property System::UInt32 ClassId
+ {
+ System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// </summary>
+ String^ ToString( );
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPartitionResolver.hpp b/clicache/src/IPartitionResolver.hpp
new file mode 100644
index 0000000..ae3127f
--- /dev/null
+++ b/clicache/src/IPartitionResolver.hpp
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+//#include "ICacheableKey.hpp"
+
+#include "EntryEvent.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+
+
+ /// <summary>
+ /// Implementers of interface <code>PartitionResolver</code> enable custom
+ /// partitioning on the <code>PartitionedRegion</code>.
+ /// </summary>
+ /// <remarks>
+ /// 1. The Key class or callback arg can implement PartitionResolver interface to
+ /// enable custom partitioning OR
+ /// 2. Configure your own PartitionResolver class in partition attributes (For
+ /// instance when the Key is a primitive type or String) Implement the
+ /// appropriate equals - For all implementations, you need to be sure to code the
+ /// class equals method so it properly verifies equality for the
+ /// PartitionResolver implementation. This might mean verifying that class names
+ /// are the same or that the returned routing objects are the same etc.. When you
+ /// initiate the partitioned region on multiple nodes, Geode uses the equals
+ /// method to ensure you are using the same PartitionResolver implementation for
+ /// all of the nodes for the region.
+ /// Geode uses the routing object's hashCode to determine where the data is
+ /// being managed. Say, for example, you want to colocate all Trades by month and
+ /// year.The key is implemented by TradeKey class which also implements the
+ /// PartitionResolver interface.
+ /// public class TradeKey implements PartitionResolver {<br>
+ ///     private String tradeID;<br>
+ ///     private Month month ;<br>
+ ///     private Year year ;<br>
+ ///
+ ///     public TradingKey(){ } <br>
+ ///     public TradingKey(Month month, Year year){<br>
+ ///         this.month = month;<br>
+ ///         this.year = year;<br>
+ ///     } <br>
+ ///     public Serializable getRoutingObject(EntryOperation key){<br>
+ ///         return this.month + this.year;<br>
+ ///     }<br> }<br>
+ ///
+ /// In the example above, all trade entries with the same month and year are
+ /// guaranteed to be colocated.
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetPartitionResolver" />
+ /// <seealso cref="RegionAttributes.PartitionResolver" />
+ generic<class TKey, class TValue>
+ public interface class IPartitionResolver
+ {
+ public:
+
+ /// <summary>
+ /// Returns the name of the PartitionResolver.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// <returns>
+ /// the name of the PartitionResolver
+ /// </returns>
+ /// </remarks>
+ String^ GetName();
+
+ /// <summary>
+ /// return object associated with entry event which allows the Partitioned Region to store associated data together.
+ /// </summary>
+ /// <remarks>
+ /// throws RuntimeException - any exception thrown will terminate the operation and the exception will be passed to the
+ /// calling thread.
+ /// </remarks>
+ /// <param name="key">
+ /// key the detail of the entry event.
+ /// </param>
+
+ Object^ GetRoutingObject(EntryEvent<TKey, TValue>^ key);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxInstance.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxInstance.hpp b/clicache/src/IPdxInstance.hpp
new file mode 100755
index 0000000..dee3cd0
--- /dev/null
+++ b/clicache/src/IPdxInstance.hpp
@@ -0,0 +1,185 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "IWritablePdxInstance.hpp"
+using namespace System;
+using namespace System::Collections::Generic;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ ///PdxInstance provides run time access to the fields of a PDX without
+ ///deserializing the PDX. Preventing deserialization saves time
+ ///and memory and does not require the domain class.
+ ///This interface is implemented by NativeClient. The PdxInstance implementation
+ ///is a light weight wrapper that simply refers to the raw bytes of the PDX
+ ///that are kept in the cache.
+ ///Applications can choose to access PdxInstances instead of .NET objects by
+ ///configuring the Cache to prefer PDX instances during deserialization.
+ ///This can be done in <c>cache.xml</c> by setting the attribute <c>read-serialized</c>
+ ///to true on the <c>pdx</c> element. Or it can be done programmatically using
+ ///the <see cref="CacheFactory.SetPdxReadSerialized" />
+ ///method. Once this preference is configured, then any time deserialization of a
+ ///PDX is done it will deserialize into a PdxInstance.
+ ///PdxInstance are immutable. If you want to change one call
+ ///<see cref="IPdxInstance.CreateWriter"/>.
+ ///
+ /// </summary>
+ public interface class IPdxInstance : IDisposable
+ {
+ public:
+ /// <summary>
+ ///Return the full name of the class that this pdx instance represents.
+ /// </summary>
+ ///<returns> the name of the class that this pdx instance represents.</returns>
+ String^ GetClassName();
+ /// <summary>
+ ///Deserializes and returns the domain object that this instance represents.
+ /// </summary>
+ ///<returns> the deserialized domain object.</returns>
+ Object^ GetObject();
+
+ /// <summary>
+ ///Checks if the named field exists and returns the result.
+ ///This can be useful when writing code that handles more than one version of
+ ///a PDX class.
+ /// </summary>
+ ///<param> fieldName the name of the field to check</param>
+ ///<returns> <code>true</code> if the named field exists; otherwise <code>false</code></returns>
+
+ bool HasField(String^ fieldName);
+
+ /// <summary>
+ ///Return an list of the field names on this PdxInstance.
+ /// </summary>
+ ///<returns> an list of the field names on this PdxInstance</returns>
+ IList<String^>^ GetFieldNames();
+
+ /// <summary>
+ ///Checks if the named field was <see cref="IPdxWriter.MarkIdentityField" /> marked as an identity field.
+ ///Note that if no fields have been marked then all the fields are used as identity fields even though
+ ///this method will return <code>false</code> since none of them have been marked.
+ /// </summary>
+ ///<param name="fieldName"> the name of the field to check</param>
+ ///<returns> <code>true</code> if the named field exists and was marked as an identify field; otherwise <code>false</code></returns>
+
+ bool IsIdentityField(String^ fieldName);
+
+ /// <summary>
+ ///Reads the named field and returns its value. If the field does
+ ///not exist <code>null</code> is returned.
+ ///A <code>null</code> result indicates that the field does not exist
+ ///or that it exists and its value is currently <code>null</code>.
+ ///The <see cref="HasField" /> method can be used to figure out
+ ///which if these two cases is true.
+ ///If an Object[] is deserialized by this call then that array's component
+ ///type will be <code>Object</code> instead of the original class that
+ ///the array had when it was serialized. This is done so that PdxInstance objects
+ ///can be added to the array.
+ /// </summary>
+ ///
+ ///<param name="fieldName"> name of the field to read</param>
+ ///
+ ///
+ ///<returns> If this instance has the named field then the field's value is returned,
+ ///otherwise <code>null</code> is returned.</returns>
+
+ Object^ GetField(String^ fieldName);
+
+ /// <summary>
+ ///Returns true if the given object is equals to this instance.
+ ///If <code>other</code> is not a PdxInstance then it is not equal to this instance.
+ ///NOTE: Even if <code>other</code> is the result of calling <see cref="GetObject" /> it will not
+ ///be equal to this instance.
+ ///Otherwise equality of two PdxInstances is determined as follows:
+ /// <list type="bullet">
+ /// <item>
+ ///<description>The domain class name must be equal for both PdxInstances</description>
+ /// </item>
+ /// <item>
+ ///<description>Each identity field must be equal.</description>
+ /// </item>
+ /// </list>
+ ///If one of the instances does not have a field that the other one does then equals will assume it
+ ///has the field with a default value.
+ ///If a PdxInstance has marked identity fields using <see cref="IPdxWriter.MarkIdentityField" />
+ ///then only the marked identity fields are its identity fields.
+ ///Otherwise all its fields are identity fields.
+ ///An identity field is equal if all the following are true:
+ /// <list type="bullet">
+ /// <item>
+ ///<description>The field name is equal.</description>
+ /// </item>
+ /// <item>
+ ///<description>The field type is equal.</description>
+ /// </item>
+ /// <item>
+ ///<description>The field value is equal.</description>
+ /// </item>
+ /// </list>
+ ///If a field's type is <code>OBJECT</code> then its value must be deserialized to determine if it is equals. If the deserialized object is an array then all the array element is used to determine equality. Otherwise <see cref="Object.Equals" /> is used.
+ ///If a field's type is <code>OBJECT[]</code> then its value must be deserialized and all the array element is used to determine equality.
+ ///For all other field types then the value does not need to be deserialized. Instead the serialized raw bytes are compared and used to determine equality.
+ ///Note that any fields that have objects that do not override <see cref="Object.Equals" /> will cause equals to return false when you might have expected it to return true.
+ /// </summary>
+ ///<param name="other"> the other instance to compare to this.</param>
+ ///<returns> <code>true</code> if this instance is equal to <code>other</code>.</returns>
+
+ bool Equals(Object^ other);
+
+ /// <summary>
+ ///Generates a hashCode based on the identity fields of
+ ///this PdxInstance.
+ ///If a PdxInstance has marked identity fields using <see cref="IPdxWriter.MarkIdentityField" />
+ ///then only the marked identity fields are its identity fields.
+ ///Otherwise all its fields are identity fields.
+ ///
+ ///If an identity field is of type <code>OBJECT</code> then it is deserialized. If the deserialized object is an array then all the array element is used. Otherwise <see cref="Object.GetHashCode" /> is used.
+ ///If an identity field is of type <code>OBJECT[]</code> this it is deserialized and all the array element is used.
+ ///Otherwise the field is not deserialized and the raw bytes of its value are used to compute the hash code.
+ /// </summary>
+ int GetHashCode();
+
+ /// <summary>
+ ///Prints out all of the identity fields of this PdxInstance.
+ ///If a PdxInstance has marked identity fields using <see cref="IPdxWriter.MarkIdentityField" />
+ ///then only the marked identity fields are its identity fields.
+ ///Otherwise all its fields are identity fields.
+ /// </summary>
+ String^ ToString();
+
+ /// <summary>
+ ///Creates and returns a <see cref="IWritablePdxInstance"/> whose initial
+ ///values are those of this PdxInstance.
+ ///This call returns a copy of the current field values so modifications
+ ///made to the returned value will not modify this PdxInstance.
+ /// </summary>
+ ///
+ ///<returns> a <see cref="IWritablePdxInstance"/></returns>
+
+ IWritablePdxInstance^ CreateWriter();
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxInstanceFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxInstanceFactory.hpp b/clicache/src/IPdxInstanceFactory.hpp
new file mode 100644
index 0000000..64f9d18
--- /dev/null
+++ b/clicache/src/IPdxInstanceFactory.hpp
@@ -0,0 +1,346 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "IPdxInstance.hpp"
+using namespace System;
+using namespace System::Collections::Generic;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// PdxInstanceFactory gives you a way to create PdxInstances.
+ /// Call the write methods to populate the field data and then call <see cref="Create"/>
+ /// to produce an actual instance that contains the data.
+ /// To create a factory call <see cref="IRegionService.CreatePdxInstanceFactory"/>.
+ /// A factory can only create a single instance. To create multiple instances create
+ /// multiple factories or use <see cref="IPdxInstance.CreateWriter" /> to create subsequent instances.
+ ///
+ /// </summary>
+ public interface class IPdxInstanceFactory
+ {
+ public:
+ /// <summary>
+ /// Create a <see cref="IPdxInstance" /> . The instance
+ /// will contain any data written to this factory
+ /// using the write methods.
+ /// </summary>
+ /// <returns> the created instance</returns>
+ /// <exception cref="IllegalStateException"/> if called more than once </exception>
+
+ IPdxInstance^ Create();
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>char</code>.
+ /// <para>Java char is mapped to .NET System.Char.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteChar(String^ fieldName, Char value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>boolean</code>.
+ /// <para>Java boolean is mapped to .NET System.Boolean.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteBoolean(String^ fieldName, Boolean value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>sbyte</code>.
+ /// <para>Java byte is mapped to .NET System.SByte.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteByte(String^ fieldName, SByte value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>short</code>.
+ /// <para>Java short is mapped to .NET System.Int16.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteShort(String^ fieldName, Int16 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>int</code>.
+ /// <para>Java int is mapped to .NET System.Int32.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteInt(String^ fieldName, Int32 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>long</code>.
+ /// <para>Java long is mapped to .NET System.Int64.</para>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ /// </summary>
+ IPdxInstanceFactory^ WriteLong(String^ fieldName, Int64 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>float</code>.
+ /// <para>Java float is mapped to .NET System.Single(float).</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteFloat(String^ fieldName, float value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>double</code>.
+ /// <para>Java double is mapped to .NET System.Double.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteDouble(String^ fieldName, double value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Date</code>.
+ /// <para>Java Date is mapped to .NET System.DateTime.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteDate(String^ fieldName, System::DateTime value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>String</code>.
+ /// <para>Java String is mapped to .NET System.String.</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteString(String^ fieldName, String^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Object</code>.
+ ///
+ /// It is best to use one of the other writeXXX methods if your field type
+ /// will always be XXX. This method allows the field value to be anything
+ /// that is an instance of Object. This gives you more flexibility but more
+ /// space is used to store the serialized field.
+ /// </summary>
+ ///
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteObject(String^ fieldName, Object^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>boolean[]</code>.
+ /// <para>Java boolean[] is mapped to .NET System.Boolean[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteBooleanArray(String^ fieldName, array<Boolean>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>char[]</code>.
+ /// <para>Java char[] is mapped to .NET System.Char[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteCharArray(String^ fieldName, array<Char>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>byte[]</code>.
+ /// <para>Java byte[] is mapped to .NET System.Byte[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteByteArray(String^ fieldName, array<Byte>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>short[]</code>.
+ /// <para>Java short[] is mapped to .NET System.Int16[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteShortArray(String^ fieldName, array<Int16>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>int[]</code>.
+ /// <para>Java int[] is mapped to .NET System.Int32[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteIntArray(String^ fieldName, array<Int32>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>long[]</code>.
+ /// <para>Java long[] is mapped to .NET System.Int64[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteLongArray(String^ fieldName, array<Int64>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>float[]</code>.
+ /// <para>Java float[] is mapped to .NET System.Single[] or float[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ /// </summary>
+ IPdxInstanceFactory^ WriteFloatArray(String^ fieldName, array<float>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>double[]</code>.
+ /// <para>Java double[] is mapped to .NET System.Double[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteDoubleArray(String^ fieldName, array<double>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>String[]</code>.
+ /// <para>Java String[] is mapped to .NET System.String[].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteStringArray(String^ fieldName, array<String^>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Object[]</code>.
+ /// Java Object[] is mapped to .NET System.Collections.Generic.List<Object>.
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteObjectArray(String^ fieldName, System::Collections::Generic::List<Object^>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>byte[][]</code>.
+ /// <para>Java byte[][] is mapped to .NET System.Byte[][].</para>
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <param name="value"> the value of the field to write</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+ IPdxInstanceFactory^ WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value and type to the serialized form.
+ /// This method uses the <code>fieldType</code> to determine which writeXXX method it should call.
+ /// If it can not find a specific match to a writeXXX method it will call <see cref="WriteObject" />.
+ /// This method may serialize objects that are not portable to non-java languages.
+ /// <para>The fieldTypes maps to a specific method.</para>
+ /// <param name="fieldName"> the name of the field to write</param>
+ /// <summary>
+ /// @param fieldValue the value of the field to write; this parameter's class must extend the <code>fieldType</code>
+ /// @param fieldType the type of the field to write
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has already been written</exception>
+
+ IPdxInstanceFactory^ WriteField(String^ fieldName, Object^ fieldValue, Type^ fieldType);
+
+ /// <summary>
+ /// Indicate that the named field should be included in hashCode and equals checks
+ /// of this object on a server that is accessing <see cref="IPdxInstance" />
+ /// or when a client executes a query on a server.
+ ///
+ /// The fields that are marked as identity fields are used to generate the hashCode and
+ /// equals methods of {@link PdxInstance}. Because of this, the identity fields should themselves
+ /// either be primitives, or implement hashCode and equals.
+ ///
+ /// If no fields are set as identity fields, then all fields will be used in hashCode and equals
+ /// checks.
+ ///
+ /// The identity fields should make marked after they are written using a write/// method.
+ /// </summary>
+ /// <param name="fieldName"> the name of the field to mark as an identity field.</param>
+ /// <returns> this PdxInstanceFactory</returns>
+ /// <exception cref="IllegalStateException"/> if the named field has not already been written.</exception>
+
+ IPdxInstanceFactory^ MarkIdentityField(String^ fieldName);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[11/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionAttributes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionAttributes.hpp b/clicache/src/RegionAttributes.hpp
new file mode 100644
index 0000000..da47fc3
--- /dev/null
+++ b/clicache/src/RegionAttributes.hpp
@@ -0,0 +1,511 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionAttributes.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "IGeodeSerializable.hpp"
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+#include "GeodeClassIds.hpp"
+
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "Properties.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Defines attributes for configuring a region.
+ /// </summary>
+ /// <remarks>
+ /// These are
+ /// <c>ICacheListener</c>, <c>ICacheLoader</c>, <c>ICacheWriter</c>,
+ /// scope, mirroring, and expiration attributes
+ /// for the region itself; expiration attributes for the region entries;
+ /// and whether statistics are enabled for the region and its entries.
+ ///
+ /// To create an instance of this interface, use
+ /// <see cref="AttributesFactory.CreateRegionAttributes" />.
+ ///
+ /// For compatibility rules and default values, see <see cref="AttributesFactory" />.
+ /// <para>
+ /// Note that the <c>RegionAttributes</c> are not distributed with the region.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="AttributesFactory" />
+ /// <seealso cref="AttributesMutator" />
+ /// <seealso cref="Region.Attributes" />
+ generic <class TKey, class TValue>
+ public ref class RegionAttributes sealed
+ : public IGeodeSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Gets the cache loader for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheLoader</c> or null if none
+ /// </returns>
+ property Apache::Geode::Client::ICacheLoader<TKey, TValue>^ CacheLoader
+ {
+ Apache::Geode::Client::ICacheLoader<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the cache writer for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheWriter</c> or null if none
+ /// </returns>
+ property ICacheWriter<TKey, TValue>^ CacheWriter
+ {
+ ICacheWriter<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the cache listener for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>ICacheListener</c> or null if none
+ /// </returns>
+ property ICacheListener<TKey, TValue>^ CacheListener
+ {
+ ICacheListener<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the partition resolver for the region.
+ /// </summary>
+ /// <returns>
+ /// region's <c>IPartitionResolver</c> or null if none
+ /// </returns>
+ property IPartitionResolver<TKey, TValue>^ PartitionResolver
+ {
+ IPartitionResolver<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> value for the region as a whole.
+ /// </summary>
+ /// <returns>the timeToLive duration for this region, in seconds</returns>
+ property System::Int32 RegionTimeToLive
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> expiration action for the region as a whole.
+ /// </summary>
+ /// <returns>the timeToLive action for this region</returns>
+ property ExpirationAction RegionTimeToLiveAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> value for the region as a whole.
+ /// </summary>
+ /// <returns>the IdleTimeout duration for this region, in seconds</returns>
+ property System::Int32 RegionIdleTimeout
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> expiration action for the region as a whole.
+ /// </summary>
+ /// <returns>the idleTimeout action for this region</returns>
+ property ExpirationAction RegionIdleTimeoutAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> value for entries in this region.
+ /// </summary>
+ /// <returns>the timeToLive duration for entries in this region, in seconds</returns>
+ property System::Int32 EntryTimeToLive
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>timeToLive</c> expiration action for entries in this region.
+ /// </summary>
+ /// <returns>the timeToLive action for entries in this region</returns>
+ property ExpirationAction EntryTimeToLiveAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> value for entries in this region.
+ /// </summary>
+ /// <returns>the idleTimeout duration for entries in this region, in seconds</returns>
+ property System::Int32 EntryIdleTimeout
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Gets the <c>idleTimeout</c> expiration action for entries in this region.
+ /// </summary>
+ /// <returns>the idleTimeout action for entries in this region</returns>
+ property ExpirationAction EntryIdleTimeoutAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// If true, this region will store data in the current process.
+ /// </summary>
+ /// <returns>true if caching is enabled</returns>
+ property bool CachingEnabled
+ {
+ bool get();
+ }
+
+
+ // MAP ATTRIBUTES
+
+ /// <summary>
+ /// Returns the initial capacity of the entry's local cache.
+ /// </summary>
+ /// <returns>the initial capacity</returns>
+ property System::Int32 InitialCapacity
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the load factor of the entry's local cache.
+ /// </summary>
+ /// <returns>the load factor</returns>
+ property Single LoadFactor
+ {
+ Single get();
+ }
+
+ /// <summary>
+ /// Returns the concurrency level of the entry's local cache.
+ /// </summary>
+ /// <returns>the concurrency level</returns>
+ /// <seealso cref="AttributesFactory" />
+ property System::Int32 ConcurrencyLevel
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum number of entries this cache will hold before
+ /// using LRU eviction.
+ /// </summary>
+ /// <returns>the maximum LRU size, or 0 for no limit</returns>
+ property System::UInt32 LruEntriesLimit
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the disk policy type of the region.
+ /// </summary>
+ /// <returns>the disk policy type, default is null</returns>
+ property DiskPolicyType DiskPolicy
+ {
+ DiskPolicyType get();
+ }
+
+ /// <summary>
+ /// Returns the ExpirationAction used for LRU Eviction, default is LOCAL_DESTROY.
+ /// </summary>
+ /// <returns>the LRU eviction action</returns>
+ property ExpirationAction LruEvictionAction
+ {
+ ExpirationAction get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheLoader library path</returns>
+ property String^ CacheLoaderLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Rreturns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheLoader factory function name</returns>
+ property String^ CacheLoaderFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheListener library path</returns>
+ property String^ CacheListenerLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the PartitionResolver library path</returns>
+ property String^ PartitionResolverLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheListener factory function name</returns>
+ property String^ CacheListenerFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the PartitionResolver factory function name</returns>
+ property String^ PartitionResolverFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the CacheWriter library path</returns>
+ property String^ CacheWriterLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the loader will be created on a cache server.
+ /// </summary>
+ /// <returns>the CacheWriter factory function name</returns>
+ property String^ CacheWriterFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if all the attributes are equal to those of <c>other</c>.
+ /// </summary>
+ /// <param name="other">attribute object to compare</param>
+ /// <returns>true if equal</returns>
+ bool Equals(RegionAttributes<TKey, TValue>^ other);
+
+ /// <summary>
+ /// True if all the attributes are equal to those of <c>other</c>.
+ /// </summary>
+ /// <param name="other">attribute object to compare</param>
+ /// <returns>true if equal</returns>
+ virtual bool Equals(Object^ other) override;
+
+ /// <summary>
+ /// Throws IllegalStateException if the attributes are not suited for serialization
+ /// such as those that have a cache callback (listener, loader, or writer) set
+ /// directly instead of providing the library path and factory function.
+ /// </summary>
+ /// <exception cref="IllegalStateException">if the attributes cannot be serialized</exception>
+ void ValidateSerializableAttributes();
+
+ /// <summary>
+ /// This method returns the list of endpoints (servername:portnumber) separated by commas.
+ /// </summary>
+ /// <returns>list of endpoints</returns>
+ property String^ Endpoints
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// This method returns the name of the attached pool.
+ /// </summary>
+ /// <returns>pool name</returns>
+ property String^ PoolName
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if client notification is enabled.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool ClientNotificationEnabled
+ {
+ bool get();
+ }
+ /// <summary>
+ /// True if cloning is enabled for in case of delta.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+
+ property bool CloningEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the path of the library from which
+ /// the factory function will be invoked on a cache server.
+ /// </summary>
+ /// <returns>the PersistenceManager library path</returns>
+ property String^ PersistenceLibrary
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the symbol name of the factory function from which
+ /// the persistence manager will be created on a cache server.
+ /// </summary>
+ /// <returns>the PersistenceManager factory function name</returns>
+ property String^ PersistenceFactory
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the properties set for persistence.
+ /// </summary>
+ /// <returns>properties for the PersistenceManager</returns>
+ property Properties<String^, String^>^ PersistenceProperties
+ {
+ Properties<String^, String^>^ get();
+ }
+
+ /// <summary>
+ /// Returns the concurrency check enabled flag of the region
+ /// </summary>
+ /// <returns>the concurrency check enabled flag</returns>
+ /// <seealso cref="AttributesFactory" />
+ property bool ConcurrencyChecksEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Serializes this Properties object.
+ /// </summary>
+ /// <param name="output">the DataOutput stream to use for serialization</param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes this Properties object.
+ /// </summary>
+ /// <param name="input">the DataInput stream to use for reading data</param>
+ /// <returns>the deserialized Properties object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get()
+ {
+ return 0; //don't care
+ }
+ }
+
+ /// <summary>
+ /// Returns the classId of this class for serialization.
+ /// </summary>
+ /// <returns>classId of the Properties class</returns>
+ /// <seealso cref="../../IGeodeSerializable.ClassId" />
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::RegionAttributes;
+ }
+ }
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static RegionAttributes<TKey, TValue>^ Create(native::RegionAttributesPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionAttributes<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionAttributes> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionAttributes<TKey, TValue>(native::RegionAttributesPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionAttributes>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionAttributes>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEntry.cpp b/clicache/src/RegionEntry.cpp
new file mode 100644
index 0000000..95b5b57
--- /dev/null
+++ b/clicache/src/RegionEntry.cpp
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "RegionEntry.hpp"
+#include "Region.hpp"
+#include "CacheStatistics.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ TKey RegionEntry<TKey, TValue>::Key::get( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TKey>(m_nativeptr->get()->getKey());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ TValue RegionEntry<TKey, TValue>::Value::get( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TValue>(m_nativeptr->get()->getValue());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ RegionEntry<TKey, TValue>::Region::get( )
+ {
+ try
+ {
+ return Apache::Geode::Client::Region<TKey, TValue>::Create(m_nativeptr->get()->getRegion());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::CacheStatistics^ RegionEntry<TKey, TValue>::Statistics::get( )
+ {
+ apache::geode::client::CacheStatisticsPtr nativeptr;
+ try
+ {
+ m_nativeptr->get()->getStatistics( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return Apache::Geode::Client::CacheStatistics::Create( nativeptr);
+ }
+
+ generic<class TKey, class TValue>
+ bool RegionEntry<TKey, TValue>::IsDestroyed::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isDestroyed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEntry.hpp b/clicache/src/RegionEntry.hpp
new file mode 100644
index 0000000..85c933f
--- /dev/null
+++ b/clicache/src/RegionEntry.hpp
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionEntry.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+//#include "ICacheableKey.hpp"
+#include "IRegion.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ //ref class Region;
+ ref class CacheStatistics;
+
+ /// <summary>
+ /// An object in a region that represents an <em>entry</em>, that is, a key-value pair.
+ /// </summary>
+ /// <remarks>
+ /// This object's operations are not distributed, do not acquire any locks, and do not affect
+ /// <c>CacheStatistics</c>.
+ ///
+ /// Unless otherwise noted, all of these methods throw a
+ /// <c>CacheClosedException</c> if the cache is closed at the time of
+ /// invocation, or an <c>EntryDestroyedException</c> if the entry has been
+ /// destroyed.
+ ///
+ /// Call <see cref="IsDestroyed" /> to see if an entry has already been destroyed.
+ /// </remarks>
+ generic<class TKey, class TValue>
+ public ref class RegionEntry sealed
+ {
+ public:
+
+ /// <summary>
+ /// Returns the key for this entry.
+ /// </summary>
+ /// <returns>the key for this entry</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property TKey Key
+ {
+ TKey get( );
+ }
+
+ /// <summary>
+ /// Returns the value of this entry in the local cache. Does not invoke
+ /// an <c>ICacheLoader</c>, does not do a netSearch, netLoad, etc.
+ /// </summary>
+ /// <returns>
+ /// the value, or null if this entry is invalid -- see <see cref="IsDestroyed" />
+ /// </returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property TValue Value
+ {
+ TValue get( );
+ }
+
+ /// <summary>
+ /// Returns the region that contains this entry.
+ /// </summary>
+ /// <returns>the region that contains this entry</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ /// <exception cref="EntryDestroyedException">
+ /// if the entry has been destroyed
+ /// </exception>
+ property IRegion<TKey, TValue>^ Region
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the statistics for this entry.
+ /// </summary>
+ /// <returns>the CacheStatistics for this entry</returns>
+ /// <exception cref="StatisticsDisabledException">
+ /// if statistics have been disabled for this region
+ /// </exception>
+ property Apache::Geode::Client::CacheStatistics^ Statistics
+ {
+ Apache::Geode::Client::CacheStatistics^ get( );
+ }
+
+ ///// <summary>
+ ///// Returns the user attribute for this entry in the local cache.
+ ///// </summary>
+ ///// <returns>the user attribute for this entry</returns>
+ ////Object^ GetUserAttribute( );
+
+ ///// <summary>
+ ///// Sets the user attribute for this entry. Does not distribute the user
+ ///// attribute to other caches.
+ ///// </summary>
+ ///// <param name="uptr">a pointer to the user attribute for this entry</param>
+ ///// <returns>
+ ///// the previous user attribute or null if no user attributes have been
+ ///// set for this entry
+ ///// </returns>
+ ////void SetUserAttribute( Object^ uptr );
+
+ /// <summary>
+ /// True if this entry has been destroyed.
+ /// </summary>
+ /// <remarks>
+ /// Does not throw a <c>EntryDestroyedException</c> if this entry
+ /// has been destroyed.
+ /// </remarks>
+ /// <returns>true if this entry has been destroyed</returns>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed at the time of invocation
+ /// </exception>
+ property bool IsDestroyed
+ {
+ bool get( );
+ }
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Client::RegionEntry<TKey, TValue>^ Create( native::RegionEntryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionEntry<TKey, TValue>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionEntry( native::RegionEntryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionEntry>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionEntry>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEvent.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEvent.cpp b/clicache/src/RegionEvent.cpp
new file mode 100644
index 0000000..3ee64d2
--- /dev/null
+++ b/clicache/src/RegionEvent.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+#include "RegionEvent.hpp"
+#include "Region.hpp"
+#include "IGeodeSerializable.hpp"
+#include "impl/SafeConvert.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ RegionEvent<TKey, TValue>::Region::get( )
+ {
+ auto regionptr = m_nativeptr->getRegion( );
+ return Client::Region<TKey, TValue>::Create( regionptr );
+ }
+
+ generic<class TKey, class TValue>
+ Object^ RegionEvent<TKey, TValue>::CallbackArgument::get()
+ {
+ apache::geode::client::UserDataPtr& valptr(m_nativeptr->getCallbackArgument());
+ return Serializable::GetManagedValueGeneric<Object^>( valptr );
+ }
+
+ generic<class TKey, class TValue>
+ bool RegionEvent<TKey, TValue>::RemoteOrigin::get( )
+ {
+ return m_nativeptr->remoteOrigin( );
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionEvent.hpp b/clicache/src/RegionEvent.hpp
new file mode 100644
index 0000000..7554c13
--- /dev/null
+++ b/clicache/src/RegionEvent.hpp
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionEvent.hpp>
+#include "end_native.hpp"
+
+#include "IGeodeSerializable.hpp"
+#include "IRegion.hpp"
+#include "Region.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ //ref class Region;
+
+ /// <summary>
+ /// This class encapsulates events that occur for a region.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class RegionEvent sealed
+ {
+ public:
+
+ /// <summary>
+ /// Return the region this event occurred in.
+ /// </summary>
+ property IRegion<TKey, TValue>^ Region
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the callbackArgument passed to the method that generated
+ /// this event. See the <see cref="Region" /> interface methods
+ /// that take a callbackArgument parameter.
+ /// </summary>
+ property Object^ CallbackArgument
+ {
+ Object^ get();
+ }
+
+ /// <summary>
+ /// Returns true if the event originated in a remote process.
+ /// </summary>
+ property bool RemoteOrigin
+ {
+ bool get( );
+ }
+
+
+ internal:
+
+ const native::RegionEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Apache::Geode::Client::RegionEvent<TKey, TValue>( const native::RegionEvent* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ private:
+ const native::RegionEvent* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionFactory.cpp b/clicache/src/RegionFactory.cpp
new file mode 100644
index 0000000..f662a7c
--- /dev/null
+++ b/clicache/src/RegionFactory.cpp
@@ -0,0 +1,481 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "RegionFactory.hpp"
+#include "RegionAttributes.hpp"
+#include "impl/SafeConvert.hpp"
+
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+#include "impl/PartitionResolver.hpp"
+#include "impl/FixedPartitionResolver.hpp"
+#include "impl/FixedPartitionResolver.hpp"
+#include "impl/PersistenceManagerProxy.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ RegionFactory^ RegionFactory::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCacheListener( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheListener( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // EXPIRATION ATTRIBUTES
+
+ RegionFactory^ RegionFactory::SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryIdleTimeout( static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionIdleTimeout(static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // PERSISTENCE
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager,
+ Properties<String^, String^>^ config)
+ {
+ native::PersistenceManagerPtr persistenceManagerptr;
+ if ( persistenceManager != nullptr ) {
+ PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
+ clg->SetPersistenceManager(persistenceManager);
+ persistenceManagerptr = std::shared_ptr<native::ManagedPersistenceManagerGeneric>(new native::ManagedPersistenceManagerGeneric(persistenceManager));
+ ((native::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( persistenceManagerptr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager )
+ {
+ return SetPersistenceManager(persistenceManager, nullptr);
+ }
+
+ RegionFactory^ RegionFactory::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ SetPersistenceManager( libPath, factoryFunctionName, nullptr );
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName, /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config )
+ {
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetPoolName( String^ poolName )
+ {
+ ManagedString mg_poolName( poolName );
+
+ try
+ {
+ m_nativeptr->get()->setPoolName( mg_poolName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ // MAP ATTRIBUTES
+
+ RegionFactory^ RegionFactory::SetInitialCapacity( System::Int32 initialCapacity )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setInitialCapacity( initialCapacity );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetLoadFactor( Single loadFactor )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setLoadFactor( loadFactor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetConcurrencyLevel( System::Int32 concurrencyLevel )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setConcurrencyLevel( concurrencyLevel );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ RegionFactory::SetLruEntriesLimit( System::UInt32 entriesLimit )
+ {
+ try
+ {
+ m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetDiskPolicy( DiskPolicyType diskPolicy )
+ {
+ try
+ {
+ m_nativeptr->get()->setDiskPolicy(static_cast<native::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCachingEnabled( bool cachingEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCachingEnabled( cachingEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetCloningEnabled( bool cloningEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCloningEnabled( cloningEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ RegionFactory^ RegionFactory::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+ // NEW GENERIC APIs:
+
+ generic <class TKey, class TValue>
+ IRegion<TKey,TValue>^ RegionFactory::Create(String^ regionName)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ ManagedString mg_name( regionName );
+ auto nativeptr = m_nativeptr->get()->create( mg_name.CharPtr );
+ return Client::Region<TKey,TValue>::Create( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheLoader( Client::ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ native::CacheLoaderPtr loaderptr;
+ if ( cacheLoader != nullptr ) {
+ CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>(new native::ManagedCacheLoaderGeneric(cacheLoader));
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheWriter( Client::ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ native::CacheWriterPtr writerptr;
+ if ( cacheWriter != nullptr ) {
+ CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>(new native::ManagedCacheWriterGeneric(cacheWriter));
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetCacheListener( Client::ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ native::CacheListenerPtr listenerptr;
+ if ( cacheListener != nullptr ) {
+ CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>(new native::ManagedCacheListenerGeneric(cacheListener));
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ /*
+ listenerptr = new native::ManagedCacheListenerGeneric(
+ (Client::ICacheListener<Object^, Object^>^)cacheListener);
+ */
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+
+ generic <class TKey, class TValue>
+ RegionFactory^ RegionFactory::SetPartitionResolver(Client::IPartitionResolver<TKey, TValue>^ partitionresolver)
+ {
+ native::PartitionResolverPtr resolverptr;
+ if (partitionresolver != nullptr) {
+ Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
+ if (resolver != nullptr) {
+ FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(resolver);
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(resolver));
+ ((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ else {
+ PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver(resolverptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionFactory.hpp b/clicache/src/RegionFactory.hpp
new file mode 100644
index 0000000..6e781db
--- /dev/null
+++ b/clicache/src/RegionFactory.hpp
@@ -0,0 +1,458 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/AttributesFactory.hpp>
+#include <geode/RegionFactory.hpp>
+#include "end_native.hpp"
+
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+#include "RegionShortcut.hpp"
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "IPersistenceManager.hpp"
+#include "IRegion.hpp"
+#include "Properties.hpp"
+#include "Region.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// This interface provides for the configuration and creation of instances of Region.
+ /// </summary>
+ public ref class RegionFactory sealed
+ {
+ public:
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the loader of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheLoader</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheLoader</c> for a managed library.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the writer of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheWriter</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheWriter</c> for a managed library.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the listener of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheListener</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheListener</c> for a managed library.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetCacheListener( String^ libPath, String^ factoryFunctionName );
+
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the partition resolver of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>PartitionResolver</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>IPartitionResolver</c> for a managed library.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for entries in this region.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for entries in this region.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive );
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for the region as a whole.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for the region as a whole.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive );
+
+
+ // PERSISTENCE
+
+ /// <summary>
+ /// Sets the persistence manager for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// a user-defined persistence manager, or null for no persistence manager
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager );
+
+ /// <summary>
+ /// Sets the persistence manager for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// a user-defined persistence manager, or null for no persistence manager
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager,
+ Properties<String^, String^>^ config);
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
+ /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config );
+
+ /// <summary>
+ /// Set the pool name for a Thin Client region.
+ /// </summary>
+ /// <remarks>
+ /// The pool with the name specified must be already created.
+ /// </remarks>
+ /// <param name="poolName">
+ /// The name of the pool to attach to this region.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetPoolName( String^ poolName );
+
+ // MAP ATTRIBUTES
+
+ /// <summary>
+ /// Sets the entry initial capacity for the <c>RegionAttributes</c>
+ /// being created. This value is used in initializing the map that
+ /// holds the entries.
+ /// </summary>
+ /// <param name="initialCapacity">the initial capacity of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if initialCapacity is nonpositive
+ /// </exception>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetInitialCapacity( System::Int32 initialCapacity );
+
+ /// <summary>
+ /// Sets the entry load factor for the next <c>RegionAttributes</c>
+ /// created. This value is
+ /// used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="loadFactor">the load factor of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if loadFactor is nonpositive
+ /// </exception>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetLoadFactor( Single loadFactor );
+
+ /// <summary>
+ /// Sets the concurrency level of the next <c>RegionAttributes</c>
+ /// created. This value is used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="concurrencyLevel">
+ /// the concurrency level of the entry map
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if concurrencyLevel is nonpositive
+ /// </exception>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetConcurrencyLevel( System::Int32 concurrencyLevel );
+
+ /// <summary>
+ /// Sets a limit on the number of entries that will be held in the cache.
+ /// If a new entry is added while at the limit, the cache will evict the
+ /// least recently used entry.
+ /// </summary>
+ /// <param name="entriesLimit">
+ /// The limit of the number of entries before eviction starts.
+ /// Defaults to 0, meaning no LRU actions will used.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetLruEntriesLimit( System::UInt32 entriesLimit );
+
+ /// <summary>
+ /// Sets the disk policy type for the next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="diskPolicy">
+ /// the disk policy to use for the region
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetDiskPolicy( DiskPolicyType diskPolicy );
+
+ /// <summary>
+ /// Set caching enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then no data is stored in the local process,
+ /// but events and distributions will still occur, and the region
+ /// can still be used to put and remove, etc...
+ /// </para><para>
+ /// The default if not set is 'true', 'false' is illegal for regions
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cachingEnabled">
+ /// if true, cache data for this region in this process.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetCachingEnabled( bool cachingEnabled );
+ /// <summary>
+ /// Set cloning enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then there is no cloning will take place in case of delta.
+ /// Delta will be applied on the old value which will change old value in-place.
+ /// </para><para>
+ /// The default if not set is 'false'
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cloningEnabled">
+ /// if true, clone old value before applying delta so that in-place change would not occour..
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetCloningEnabled( bool cloningEnabled );
+
+ /// <summary>
+ /// Sets concurrency checks enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then the version checks will not occur.
+ /// </para><para>
+ /// The default if not set is 'true'
+ /// </para>
+ /// </remarks>
+ /// <param name="concurrencyChecksEnabled">
+ /// if true, version checks for region entries will occur.
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ RegionFactory^ SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
+ // NEW GENERIC APIs:
+
+ /// <summary>
+ /// Creates a region with the given name.
+ /// The region is just created locally. It is not created on the server
+ /// to which this client is connected with.
+ /// </summary>
+ /// <remarks>
+ /// If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance.
+ /// Get instance of region from <see cref="Cache.CreateAuthenticatedView" to do the operation on Cache.
+ /// </remarks>
+ /// <param name="name">the name of the region to create</param>
+ /// <returns>new region</returns>
+ /// <exception cref="RegionExistsException">
+ /// if a region with the same name is already in this cache
+ /// </exception>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is closed
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if the memory allocation failed
+ /// </exception>
+ /// <exception cref="RegionCreationFailedException">
+ /// if the call fails due to incomplete mirror initialization
+ /// </exception>
+ /// <exception cref="InitFailedException">
+ /// if the optional PersistenceManager fails to initialize
+ /// </exception>
+ /// <exception cref="UnknownException">otherwise</exception>
+ generic <class TKey, class TValue>
+ IRegion<TKey, TValue>^ Create(String^ regionName);
+
+ /// <summary>
+ /// Sets the cache loader for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheLoader">
+ /// a user-defined cache loader, or null for no cache loader
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+
+ /// <summary>
+ /// Sets the cache writer for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheWriter">
+ /// user-defined cache writer, or null for no cache writer
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+
+ /// <summary>
+ /// Sets the CacheListener for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheListener">
+ /// user-defined cache listener, or null for no cache listener
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+
+ /// <summary>
+ /// Sets the PartitionResolver for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="partitionresolver">
+ /// user-defined partition resolver, or null for no partition resolver
+ /// </param>
+ /// <returns>the instance of RegionFactory</returns>
+ generic <class TKey, class TValue>
+ RegionFactory^ SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static RegionFactory^ Create(native::RegionFactoryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionFactory( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionFactory> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline RegionFactory(native::RegionFactoryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionFactory>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionFactory>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/RegionShortcut.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/RegionShortcut.hpp b/clicache/src/RegionShortcut.hpp
new file mode 100644
index 0000000..1373aaa
--- /dev/null
+++ b/clicache/src/RegionShortcut.hpp
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+using namespace System;
+//using namespace System::Runtime::InteropServices;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Each enum represents a predefined <see cref="RegionAttributes" /> in a <see cref="Cache" />.
+ /// These enum values can be used to create regions using a <see cref="RegionFactory" />
+ /// obtained by calling <see cref="Cache.CreateRegionFactory(RegionShortcut) />.
+ /// <p>Another way to use predefined region attributes is in cache.xml by setting
+ /// the refid attribute on a region element or region-attributes element to the
+ /// string of each value.
+ /// </summary>
+ public enum class RegionShortcut {
+
+ /// <summary>
+ /// A PROXY region has no local state and forwards all operations to a server.
+ /// </summary>
+ PROXY,
+
+ /// <summary>
+ /// A CACHING_PROXY region has local state but can also send operations to a server.
+ /// If the local state is not found then the operation is sent to the server
+ /// and the local state is updated to contain the server result.
+ /// </summary>
+ CACHING_PROXY,
+
+ /// <summary>
+ /// A CACHING_PROXY_ENTRY_LRU region has local state but can also send operations to a server.
+ /// If the local state is not found then the operation is sent to the server
+ /// and the local state is updated to contain the server result.
+ /// It will also destroy entries once it detects that the number of enteries crossing default limit of #100000.
+ /// </summary>
+ CACHING_PROXY_ENTRY_LRU,
+
+ /// <summary>
+ /// A LOCAL region only has local state and never sends operations to a server.
+ /// </summary>
+ LOCAL,
+
+ /// <summary>
+ /// A LOCAL_ENTRY_LRU region only has local state and never sends operations to a server.
+ /// It will also destroy entries once it detects once it detects that the number of enteries crossing default limit of #100000.
+ /// </summary>
+ LOCAL_ENTRY_LRU
+ } ;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultCollector.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultCollector.cpp b/clicache/src/ResultCollector.cpp
new file mode 100644
index 0000000..595bd9c
--- /dev/null
+++ b/clicache/src/ResultCollector.cpp
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+
+//#include "geode_includes.hpp"
+#include "ResultCollector.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ void ResultCollector<TResult>::AddResult( TResult rs )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ auto result = std::shared_ptr<native::Cacheable>(SafeGenericMSerializableConvert((IGeodeSerializable^)rs, nullptr));
+ m_nativeptr->get()->addResult(result);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::ICollection<TResult>^ ResultCollector<TResult>::GetResult()
+ {
+ return GetResult( DEFAULT_QUERY_RESPONSE_TIMEOUT );
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::ICollection<TResult>^ ResultCollector<TResult>::GetResult(UInt32 timeout)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ auto results = m_nativeptr->get()->getResult(timeout);
+ auto rs = gcnew array<TResult>(results->size());
+ for (System::Int32 index = 0; index < results->size(); index++)
+ {
+ auto nativeptr = results->operator[](index);
+ rs[index] = Serializable::GetManagedValueGeneric<TResult>(nativeptr);
+ }
+ auto collectionlist = (ICollection<TResult>^)rs;
+ return collectionlist;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ void ResultCollector<TResult>::EndResults()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->endResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ void ResultCollector<TResult>::ClearResults(/*bool*/)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->clearResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultCollector.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultCollector.hpp b/clicache/src/ResultCollector.hpp
new file mode 100644
index 0000000..f75ffdc
--- /dev/null
+++ b/clicache/src/ResultCollector.hpp
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IResultCollector.hpp"
+#include "begin_native.hpp"
+#include <geode/ResultCollector.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ interface class IResultCollector;
+
+ /// <summary>
+ /// collect function execution results, default collector
+ /// </summary>
+ generic<class TResult>
+ public ref class ResultCollector
+ : public IResultCollector<TResult>
+ {
+ public:
+
+ /// <summary>
+ /// add result from a single function execution
+ /// </summary>
+ virtual void AddResult( TResult rs );
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ virtual System::Collections::Generic::ICollection<TResult>^ GetResult();
+
+ /// <summary>
+ /// get result
+ /// </summary>
+ virtual System::Collections::Generic::ICollection<TResult>^ GetResult(UInt32 timeout);
+
+ /// <summary>
+ ///Call back provided to caller, which is called after function execution is
+ ///complete and caller can retrieve results using getResult()
+ /// </summary>
+ //generic<class TKey>
+ virtual void EndResults();
+
+ //generic<class TKey>
+ virtual void ClearResults();
+
+ internal:
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline ResultCollector( native::ResultCollectorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::ResultCollector>(nativeptr);
+ }
+
+ native_shared_ptr<native::ResultCollector>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultSet.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultSet.cpp b/clicache/src/ResultSet.cpp
new file mode 100644
index 0000000..8e512cc
--- /dev/null
+++ b/clicache/src/ResultSet.cpp
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "ResultSet.hpp"
+#include "SelectResultsIterator.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ bool ResultSet<TResult>::IsModifiable::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isModifiable( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Int32 ResultSet<TResult>::Size::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->size( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ TResult ResultSet<TResult>::default::get( size_t index )
+ {
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ SelectResultsIterator<TResult>^ ResultSet<TResult>::GetIterator()
+ {
+ try
+ {
+ return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(
+ m_nativeptr->get()->getIterator()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::IEnumerator<TResult>^ ResultSet<TResult>::GetEnumerator( )
+ {
+ return GetIterator( );
+ }
+
+ generic<class TResult>
+ System::Collections::IEnumerator^ ResultSet<TResult>::GetIEnumerator()
+ {
+ return GetIterator();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ResultSet.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ResultSet.hpp b/clicache/src/ResultSet.hpp
new file mode 100644
index 0000000..bc64ede
--- /dev/null
+++ b/clicache/src/ResultSet.hpp
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/ResultSet.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "ISelectResults.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ generic<class TResult>
+ ref class SelectResultsIterator;
+ /// <summary>
+ /// Encapsulates a query result set.
+ /// It specifies the interface for the resultset obtained from the
+ /// Geode cache server
+ /// </summary>
+ generic<class TResult>
+ public ref class ResultSet sealed
+ : public ISelectResults<TResult>
+ {
+ public:
+
+ /// <summary>
+ /// True if this <c>ResultSet</c> is modifiable.
+ /// </summary>
+ virtual property bool IsModifiable
+ {
+ virtual bool get();
+ }
+
+ /// <summary>
+ /// The size of the <c>ResultSet</c>.
+ /// </summary>
+ virtual property System::Int32 Size
+ {
+ virtual System::Int32 get();
+ }
+
+ /// <summary>
+ /// Get an object at the given index.
+ /// </summary>
+ virtual property /*IGeodeSerializable^*/TResult GFINDEXER(size_t)
+ {
+ virtual /*IGeodeSerializable^*/TResult get(size_t index);
+ }
+
+ /// <summary>
+ /// Get an iterator for the result set.
+ /// </summary>
+ virtual SelectResultsIterator<TResult>^ GetIterator();
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection.
+ /// </summary>
+ /// <returns>
+ /// A <c>System.Collections.Generic.IEnumerator</c> that
+ /// can be used to iterate through the <c>ResultSet</c>.
+ /// </returns>
+ virtual System::Collections::Generic::IEnumerator</*IGeodeSerializable^*/TResult>^
+ GetEnumerator();
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static ResultSet<TResult>^ Create(native::ResultSetPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew ResultSet<TResult>( nativeptr );
+ }
+
+
+ private:
+
+ virtual System::Collections::IEnumerator^ GetIEnumerator() sealed
+ = System::Collections::IEnumerable::GetEnumerator;
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline ResultSet(native::ResultSetPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::ResultSet>(nativeptr);
+ }
+
+ native_shared_ptr<native::ResultSet>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[06/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CqStatusListenerProxy.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CqStatusListenerProxy.hpp b/clicache/src/impl/CqStatusListenerProxy.hpp
new file mode 100644
index 0000000..4ddcb2f
--- /dev/null
+++ b/clicache/src/impl/CqStatusListenerProxy.hpp
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+#pragma once
+
+#include "../ICqStatusListener.hpp"
+#include "SafeConvert.hpp"
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TResult>
+ public ref class CqStatusListenerGeneric : Apache::Geode::Client::ICqStatusListener<Object^, Object^>
+ {
+ private:
+
+ ICqStatusListener<TKey, TResult>^ m_listener;
+
+ public:
+
+ virtual void AddCqListener(ICqListener<TKey, TResult>^ listener)
+ {
+ m_listener = dynamic_cast<ICqStatusListener<TKey, TResult>^>(listener);
+ }
+
+ virtual void OnEvent(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
+ {
+ //TODO:split---Done
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
+ m_listener->OnEvent(%gevent);
+ }
+
+ virtual void OnError( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
+ {
+ //TODO::split--Done
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
+ m_listener->OnError(%gevent);
+ }
+
+ virtual void Close()
+ {
+ m_listener->Close();
+ }
+
+ virtual void OnCqDisconnected()
+ {
+ m_listener->OnCqDisconnected();
+ }
+
+ virtual void OnCqConnected()
+ {
+ m_listener->OnCqConnected();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/DelegateWrapper.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/DelegateWrapper.hpp b/clicache/src/impl/DelegateWrapper.hpp
new file mode 100644
index 0000000..68da9f9
--- /dev/null
+++ b/clicache/src/impl/DelegateWrapper.hpp
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "begin_native.hpp"
+#include "CacheImpl.hpp"
+#include "CacheRegionHelper.hpp"
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+#include "../geode_defs.hpp"
+#include "../Serializable.hpp"
+#include "ManagedCacheableKey.hpp"
+#include "SafeConvert.hpp"
+#include "../Log.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+ /// <summary>
+ /// Template class to wrap a managed <see cref="TypeFactoryMethod" />
+ /// delegate that returns an <see cref="IGeodeSerializable" /> object. It contains
+ /// a method that converts the managed object gotten by invoking the
+ /// delegate to the native <c>apache::geode::client::Serializable</c> object
+ /// (using the provided wrapper class constructor).
+ /// </summary>
+ /// <remarks>
+ /// This class is to enable interopibility between the managed and unmanaged
+ /// worlds when registering types.
+ /// In the managed world a user would register a managed type by providing
+ /// a factory delegate returning an object of that type. However, the
+ /// native implementation requires a factory function that returns an
+ /// object implementing <c>apache::geode::client::Serializable</c>. Normally this would not
+ /// be possible since we require to dynamically generate a new function
+ /// for a given delegate.
+ ///
+ /// Fortunately in the managed world the delegates contain an implicit
+ /// 'this' pointer. Thus we can have a universal delegate that contains
+ /// the given managed delegate (in the 'this' pointer) and returns the
+ /// native <c>apache::geode::client::Serializable</c> object. Additionally marshalling
+ /// services provide <c>Marshal.GetFunctionPointerForDelegate</c> which gives
+ /// a function pointer for a delegate which completes the conversion.
+ /// </remarks>
+ ref class DelegateWrapperGeneric
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to wrap the given managed delegate.
+ /// </summary>
+ inline DelegateWrapperGeneric( TypeFactoryMethodGeneric^ typeDelegate, Cache^ cache )
+ : m_delegate( typeDelegate ), m_cache(cache) { }
+
+ /// <summary>
+ /// Returns the native <c>apache::geode::client::Serializable</c> object by invoking the
+ /// managed delegate provided in the constructor.
+ /// </summary>
+ /// <returns>
+ /// Native <c>apache::geode::client::Serializable</c> object after invoking the managed
+ /// delegate and wrapping inside a <c>ManagedCacheableKey</c> object.
+ /// </returns>
+ apache::geode::client::Serializable* NativeDelegateGeneric( )
+ {
+ IGeodeSerializable^ tempObj = m_delegate( );
+ IGeodeDelta^ tempDelta =
+ dynamic_cast<IGeodeDelta^>(tempObj);
+ if( tempDelta != nullptr )
+ {
+ if(!SafeConvertClassGeneric::isAppDomainEnabled)
+ return new apache::geode::client::ManagedCacheableDeltaGeneric( tempDelta );
+ else
+ return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( tempDelta, false );
+ }
+ else if(!SafeConvertClassGeneric::isAppDomainEnabled)
+ return new apache::geode::client::ManagedCacheableKeyGeneric( tempObj, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
+ else
+ return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tempObj, false);
+ }
+
+
+ private:
+
+ TypeFactoryMethodGeneric^ m_delegate;
+
+ Cache^ m_cache;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/DotNetTypes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/DotNetTypes.hpp b/clicache/src/impl/DotNetTypes.hpp
new file mode 100755
index 0000000..61265e8
--- /dev/null
+++ b/clicache/src/impl/DotNetTypes.hpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ public ref class DotNetTypes sealed
+ {
+ public:
+ static Type^ IntType = Int32::typeid;
+ static Type^ StringType = String::typeid;
+ static Type^ BooleanType = Boolean::typeid;
+ static Type^ FloatType = float::typeid;
+ static Type^ DoubleType = Double::typeid;
+ static Type^ CharType = Char::typeid;
+ static Type^ SByteType = SByte::typeid;
+ static Type^ ShortType = Int16::typeid;
+ static Type^ LongType = Int64::typeid;
+ static Type^ ByteArrayType = Type::GetType("System.Byte[]");
+ static Type^ DoubleArrayType = Type::GetType("System.Double[]");
+ static Type^ FloatArrayType = Type::GetType("System.Single[]");
+ static Type^ ShortArrayType = Type::GetType("System.Int16[]");
+ static Type^ IntArrayType = Type::GetType("System.Int32[]");
+ static Type^ LongArrayType = Type::GetType("System.Int64[]");
+ static Type^ BoolArrayType = Type::GetType("System.Boolean[]");
+ static Type^ CharArrayType = Type::GetType("System.Char[]");
+ static Type^ StringArrayType = Type::GetType("System.String[]");
+ static Type^ DateType = Type::GetType("System.DateTime");
+ static Type^ ByteArrayOfArrayType = Type::GetType("System.Byte[][]");
+ static Type^ ObjectArrayType = Type::GetType("System.Collections.Generic.List`1[System.Object]");
+
+ static Type^ VoidType = Type::GetType("System.Void");
+ static Type^ ObjectType = Type::GetType("System.Object");
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/EnumInfo.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/EnumInfo.cpp b/clicache/src/impl/EnumInfo.cpp
new file mode 100755
index 0000000..feacdc8
--- /dev/null
+++ b/clicache/src/impl/EnumInfo.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "EnumInfo.hpp"
+#include "../DataOutput.hpp"
+#include "../DataInput.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ void EnumInfo::ToData( DataOutput^ output )
+ {
+ output->WriteString(_enumClassName);
+ output->WriteString(_enumName);
+ output->WriteInt32(_hashcode);
+ }
+
+ IGeodeSerializable^ EnumInfo::FromData( DataInput^ input )
+ {
+ _enumClassName = input->ReadString();
+ _enumName = input->ReadString();
+ _hashcode = input->ReadInt32();
+ return this;
+ }
+
+ Object^ EnumInfo::GetEnum()
+ {
+ String^ tmp = Serializable::GetLocalTypeName(_enumClassName);
+ Type^ t = Serializable::GetType(tmp);
+ Object^ obj = Enum::Parse(t, _enumName);
+
+ return obj;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/EnumInfo.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/EnumInfo.hpp b/clicache/src/impl/EnumInfo.hpp
new file mode 100755
index 0000000..4ee4797
--- /dev/null
+++ b/clicache/src/impl/EnumInfo.hpp
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "../IGeodeSerializable.hpp"
+#include "../GeodeClassIds.hpp"
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ public ref class EnumInfo : public IGeodeSerializable
+ {
+ private:
+ String^ _enumClassName;
+ String^ _enumName;
+ Int32 _hashcode;
+ public:
+
+ EnumInfo()
+ {
+ _hashcode = -1;
+ }
+
+ EnumInfo(String^ enumClassName, String^ enumName, int hashcode)
+ {
+ _enumClassName = enumClassName;
+ _enumName = enumName;
+ _hashcode = hashcode;
+ }
+
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew EnumInfo();
+ }
+ virtual void ToData(DataOutput^ output);
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+ virtual property System::UInt32 ObjectSize
+ {
+ System::UInt32 get(){ return 0; }
+ }
+ virtual property System::UInt32 ClassId
+ {
+ System::UInt32 get(){ return GeodeClassIds::EnumInfo; }
+ }
+ virtual String^ ToString() override
+ {
+ return "EnumInfo";
+ }
+
+ virtual int GetHashCode()override
+ {
+ if (_hashcode != -1)
+ return _hashcode;
+
+ return ((_enumClassName != nullptr ? _enumClassName->GetHashCode() : 0)
+ + (_enumName != nullptr ? _enumName->GetHashCode() : 0));
+ }
+
+ virtual bool Equals(Object^ obj)override
+ {
+ if (obj != nullptr)
+ {
+ EnumInfo^ other = dynamic_cast<EnumInfo^>(obj);
+ if (other != nullptr)
+ {
+ return _enumClassName == other->_enumClassName
+ && _enumName == other->_enumName
+ && _hashcode == other->_hashcode;
+ }
+ return false;
+ }
+ return false;
+ }
+
+ Object^ GetEnum();
+
+ };
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/FixedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/FixedPartitionResolver.hpp b/clicache/src/impl/FixedPartitionResolver.hpp
new file mode 100644
index 0000000..38a3fa3
--- /dev/null
+++ b/clicache/src/impl/FixedPartitionResolver.hpp
@@ -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.
+ */
+#pragma once
+#include "../IFixedPartitionResolver.hpp"
+#include "../Region.hpp"
+#include "ManagedString.hpp"
+#include "SafeConvert.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Threading;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ public interface class IFixedPartitionResolverProxy
+ {
+ public:
+ apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev);
+ const char * getName();
+ const char* getPartitionName(const apache::geode::client::EntryEvent& opDetails);
+ };
+
+ generic<class TKey, class TValue>
+ public ref class FixedPartitionResolverGeneric : IFixedPartitionResolverProxy
+ {
+ private:
+
+ IPartitionResolver<TKey, TValue>^ m_resolver;
+ IFixedPartitionResolver<TKey, TValue>^ m_fixedResolver;
+ Dictionary<String^, ManagedString^> ^m_strList;
+ public:
+
+ void SetPartitionResolver(IPartitionResolver<TKey, TValue>^ resolver)
+ {
+ m_resolver = resolver;
+ m_fixedResolver = dynamic_cast<IFixedPartitionResolver<TKey, TValue>^>(resolver);
+ m_strList = gcnew Dictionary<String^, ManagedString^>();
+ }
+
+ virtual apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev)
+ {
+ EntryEvent<TKey, TValue> gevent(&ev);
+ Object^ groutingobject = m_resolver->GetRoutingObject(%gevent);
+ return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject, nullptr);
+ }
+
+ virtual const char * getName()
+ {
+ ManagedString mg_name(m_resolver->GetName());
+ return mg_name.CharPtr;
+ }
+
+ virtual const char* getPartitionName(const apache::geode::client::EntryEvent& opDetails)
+ {
+ if (m_fixedResolver == nullptr)
+ {
+ throw apache::geode::client::IllegalStateException("GetPartitionName() called on non fixed partition resolver.");
+ }
+
+ EntryEvent<TKey, TValue> gevent(&opDetails);
+ String^ str = m_fixedResolver->GetPartitionName(%gevent);
+ ManagedString ^mnStr = nullptr;
+ try
+ {
+ Monitor::Enter( m_strList );
+ if(!m_strList->TryGetValue(str,mnStr))
+ {
+ mnStr= gcnew ManagedString(str);
+ m_strList->Add(str,mnStr);
+ }
+ }
+ finally
+ {
+ Monitor::Exit( m_strList );
+ }
+
+ return mnStr->CharPtr;
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/GeodeDataInputStream.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/GeodeDataInputStream.hpp b/clicache/src/impl/GeodeDataInputStream.hpp
new file mode 100644
index 0000000..8f3bb77
--- /dev/null
+++ b/clicache/src/impl/GeodeDataInputStream.hpp
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include "../DataInput.hpp"
+#include "../ExceptionTypes.hpp"
+
+using namespace System;
+using namespace System::IO;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class GeodeDataInputStream : public Stream
+ {
+ public:
+
+ GeodeDataInputStream(DataInput^ input)
+ {
+ m_buffer = input;
+ m_maxSize = input->BytesRemaining;
+ }
+
+ GeodeDataInputStream(DataInput^ input, int maxSize)
+ {
+ m_buffer = input;
+ m_maxSize = maxSize;
+ m_buffer->AdvanceUMCursor();
+ m_buffer->SetBuffer();
+ }
+
+ virtual property bool CanSeek { bool get() override { return false; } }
+ virtual property bool CanRead { bool get() override { return true; } }
+ virtual property bool CanWrite { bool get() override { return false; } }
+
+ virtual void Close() override { Stream::Close(); }
+
+ virtual property System::Int64 Length
+ {
+ System::Int64 get() override
+ {
+ //return (System::Int64) m_buffer->BytesRead + m_buffer->BytesRemaining;
+ return (System::Int64) m_maxSize;
+ }
+ }
+
+ virtual property System::Int64 Position
+ {
+ System::Int64 get() override
+ {
+ return (System::Int64) m_position;
+ }
+
+ void set(System::Int64 value) override
+ {
+ m_position = (int) value;
+ }
+ }
+
+ virtual System::Int64 Seek(System::Int64 offset, SeekOrigin origin) override
+ {
+ throw gcnew System::NotSupportedException("Seek not supported by GeodeDataInputStream");
+ }
+
+ virtual void SetLength(System::Int64 value) override { /* do nothing */ }
+
+ virtual void Write(array<Byte> ^ buffer, int offset, int count) override
+ {
+ throw gcnew System::NotSupportedException("Write not supported by GeodeDataInputStream");
+ }
+
+ virtual void WriteByte(unsigned char value) override
+ {
+ throw gcnew System::NotSupportedException("WriteByte not supported by GeodeDataInputStream");
+ }
+
+ virtual int Read(array<Byte> ^ buffer, int offset, int count) override
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ int bytesRemaining = m_maxSize - (int) m_buffer->BytesReadInternally;
+ if(bytesRemaining == 0)
+ return bytesRemaining;
+ int actual = bytesRemaining < count ? bytesRemaining : count;
+ if (actual > 0)
+ {
+ /*
+ array<Byte>::ConstrainedCopy(m_buffer->ReadBytesOnly(actual), 0,
+ buffer, offset, actual);
+ */
+ //pin_ptr<Byte> pin_buffer = &buffer[offset];
+ //m_buffer->NativePtr->readBytesOnly((System::Byte*)pin_buffer, actual);
+ m_buffer->ReadBytesOnly(buffer, offset, actual);
+ m_position += actual;
+ }
+ return actual;
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ virtual void Flush() override { /* do nothing */ }
+
+ property System::UInt32 BytesRead
+ {
+ System::UInt32 get()
+ {
+ return m_buffer->BytesReadInternally;
+ }
+ }
+
+ private:
+ int m_position;
+ int m_maxSize;
+ DataInput ^ m_buffer;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/GeodeDataOutputStream.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/GeodeDataOutputStream.hpp b/clicache/src/impl/GeodeDataOutputStream.hpp
new file mode 100644
index 0000000..dc8fc49
--- /dev/null
+++ b/clicache/src/impl/GeodeDataOutputStream.hpp
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include "../DataOutput.hpp"
+#include "../ExceptionTypes.hpp"
+
+using namespace System;
+using namespace System::IO;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class GeodeDataOutputStream : public Stream
+ {
+ public:
+
+ GeodeDataOutputStream(DataOutput^ output)
+ {
+ m_buffer = output;
+ }
+
+ virtual property bool CanSeek { bool get() override { return false; } }
+ virtual property bool CanRead { bool get() override { return false; } }
+ virtual property bool CanWrite { bool get() override { return true; } }
+
+ virtual void Close() override { Stream::Close(); }
+
+ virtual property System::Int64 Length
+ {
+ System::Int64 get() override
+ {
+ return (System::Int64) m_buffer->BufferLength;
+ }
+ }
+
+ virtual property System::Int64 Position
+ {
+ System::Int64 get() override
+ {
+ return (System::Int64) m_position;
+ }
+
+ void set(System::Int64 value) override
+ {
+ m_position = (int) value;
+ }
+ }
+
+ virtual System::Int64 Seek(System::Int64 offset, SeekOrigin origin) override
+ {
+ throw gcnew System::NotSupportedException("Seek not supported by GeodeDataOutputStream");
+ }
+
+ virtual void SetLength(System::Int64 value) override
+ {
+ //TODO: overflow check
+ //m_buffer->NativePtr->ensureCapacity((System::UInt32)value);
+ }
+
+ virtual void Write(array<Byte> ^ buffer, int offset, int count) override
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ /*
+ array<Byte> ^ chunk = gcnew array<Byte>(count);
+ array<Byte>::ConstrainedCopy(buffer, offset, chunk, 0, count);
+ m_buffer->WriteBytesOnly(chunk, count);
+ */
+ //pin_ptr<const Byte> pin_bytes = &buffer[offset];
+ //m_buffer->NativePtr->writeBytesOnly((const System::Byte*)pin_bytes, count);
+ m_buffer->WriteBytesOnly(buffer, count, offset);
+ m_position += count;
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ virtual void WriteByte(unsigned char value) override
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ m_buffer->WriteByte(value);
+ m_position++;
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ virtual int Read(array<Byte> ^ buffer, int offset, int count) override
+ {
+ throw gcnew System::NotSupportedException("Read not supported by GeodeDataOutputStream");
+ }
+
+ virtual void Flush() override { /* do nothing */ }
+
+ private:
+ int m_position;
+ DataOutput ^ m_buffer;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/GeodeNullStream.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/GeodeNullStream.hpp b/clicache/src/impl/GeodeNullStream.hpp
new file mode 100644
index 0000000..12a87f9
--- /dev/null
+++ b/clicache/src/impl/GeodeNullStream.hpp
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+
+using namespace System;
+using namespace System::IO;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class GeodeNullStream : public Stream
+ {
+ public:
+
+ virtual property bool CanSeek { bool get() override { return false; } }
+ virtual property bool CanRead { bool get() override { return false; } }
+ virtual property bool CanWrite { bool get() override { return true; } }
+
+ virtual void Close() override { Stream::Close(); }
+
+ virtual property System::Int64 Length
+ {
+ System::Int64 get() override
+ {
+ return (System::Int64) m_position;
+ }
+ }
+
+ virtual property System::Int64 Position
+ {
+ System::Int64 get() override
+ {
+ return (System::Int64) m_position;
+ }
+
+ void set(System::Int64 value) override
+ {
+ m_position = (int) value;
+ }
+ }
+
+ virtual System::Int64 Seek(System::Int64 offset, SeekOrigin origin) override
+ {
+ throw gcnew System::NotSupportedException("Seek not supported by GeodeNullStream");
+ /*
+ int actual = 0;
+ switch (origin)
+ {
+ case SeekOrigin::Begin:
+ actual = (int) offset;
+ m_position = (int) actual;
+ break;
+
+ case SeekOrigin::Current:
+ actual = (int) offset;
+ m_position += (int) actual;
+ break;
+
+ case SeekOrigin::End:
+ actual = (int) offset;
+ m_position += (int) actual;
+ break;
+ }
+ // Seek is meaningless here?
+ return m_position;
+ */
+ }
+
+ virtual void SetLength(System::Int64 value) override { /* do nothing */ }
+
+ virtual void Write(array<Byte> ^ buffer, int offset, int count) override
+ {
+ m_position += count;
+ }
+
+ virtual void WriteByte(unsigned char value) override
+ {
+ m_position++;
+ }
+
+ virtual int Read(array<Byte> ^ buffer, int offset, int count) override
+ {
+ throw gcnew System::NotSupportedException("Seek not supported by GeodeNullStream");
+ /*
+ int actual = count;
+ m_position += actual;
+ return actual;
+ */
+ }
+
+ virtual void Flush() override { /* do nothing */ }
+
+ private:
+ int m_position;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedAuthInitialize.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedAuthInitialize.cpp b/clicache/src/impl/ManagedAuthInitialize.cpp
new file mode 100644
index 0000000..61e0683
--- /dev/null
+++ b/clicache/src/impl/ManagedAuthInitialize.cpp
@@ -0,0 +1,206 @@
+/*
+ * 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.
+ */
+
+//#include "../geode_includes.hpp"
+#include "ManagedAuthInitialize.hpp"
+#include "../IAuthInitialize.hpp"
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "Properties.hpp"
+#include <string>
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ AuthInitialize* ManagedAuthInitializeGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+ System::Int32 dotIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+
+ mg_typeName = mg_factoryFunctionName->Substring(0, dotIndx);
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+
+ Object^ typeInst = assmb->CreateInstance(mg_typeName, true);
+
+ //Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ /*
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) );
+ }
+ */
+
+ //typeInst = typeInst->GetType()->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ /*
+ MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase );
+ */
+
+ MethodInfo^ mInfo = typeInst->GetType()->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ userptr = nullptr;
+ try
+ {
+ userptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^)
+ {
+ userptr = nullptr;
+ }
+ if (userptr == nullptr)
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+ ManagedAuthInitializeGeneric * maig = new ManagedAuthInitializeGeneric(safe_cast<Apache::Geode::Client::IAuthInitialize^>(userptr));
+ return maig;
+ }
+ else
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedAuthInitializeGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::AuthenticationRequiredException&)
+ {
+ throw;
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += ex.getName();
+ ex_str += ": ";
+ ex_str += ex.getMessage();
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedAuthInitializeGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw AuthenticationRequiredException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ PropertiesPtr ManagedAuthInitializeGeneric::getCredentials(const PropertiesPtr&
+ securityprops, const char* server)
+ {
+ try {
+ auto mprops = Apache::Geode::Client::Properties<String^, String^>::Create(securityprops);
+ String^ mg_server = Apache::Geode::Client::ManagedString::Get(server);
+
+ return m_getCredentials->Invoke(mprops, mg_server)->GetNative();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ void ManagedAuthInitializeGeneric::close()
+ {
+ try {
+ m_close->Invoke();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedAuthInitialize.hpp b/clicache/src/impl/ManagedAuthInitialize.hpp
new file mode 100644
index 0000000..83f7961
--- /dev/null
+++ b/clicache/src/impl/ManagedAuthInitialize.hpp
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/AuthInitialize.hpp>
+#include "end_native.hpp"
+
+#include <vcclr.h>
+#include "../IAuthInitialize.hpp"
+
+//using namespace apache::geode::client;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IAuthInitialize" />
+ /// object and implements the native <c>apache::geode::client::AuthInitialize</c> interface.
+ /// </summary>
+ class ManagedAuthInitializeGeneric
+ : public apache::geode::client::AuthInitialize
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedAuthInitializeGeneric(Apache::Geode::Client::IAuthInitialize^ managedptr)
+ : m_managedptr(managedptr) {
+ m_getCredentials = gcnew Apache::Geode::Client::IAuthInitialize::GetCredentialsDelegate(managedptr,
+ &Apache::Geode::Client::IAuthInitialize::GetCredentials);
+ m_close = gcnew Apache::Geode::Client::IAuthInitialize::CloseDelegate(managedptr,
+ &Apache::Geode::Client::IAuthInitialize::Close);
+ }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedAuthInitialize</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>IAuthInitialize</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>IAuthInitialize</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static AuthInitialize* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Called when the cache is going down
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external
+ /// resources, such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Apache.Geode.Client.Cache.Close" />
+ virtual void close();
+
+ /// <summary>
+ /// Initialize with the given set of security properties and return the
+ /// credentials for the given client as properties.
+ /// </summary>
+ /// <param name="securityprops">Given set of properties with which
+ /// to initialize
+ /// </param>
+ /// <param name="server">It is the ID of the endpoint
+ /// </param>
+ virtual PropertiesPtr getCredentials(const PropertiesPtr& securityprops, const char* server);
+
+ virtual ~ManagedAuthInitializeGeneric() { }
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IAuthInitialize^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheLoader
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IAuthInitialize^> m_managedptr;
+ gcroot<Apache::Geode::Client::IAuthInitialize::GetCredentialsDelegate^> m_getCredentials;
+ gcroot<Apache::Geode::Client::IAuthInitialize::CloseDelegate^> m_close;
+
+ // Disable the copy and assignment constructors
+ ManagedAuthInitializeGeneric(const ManagedAuthInitializeGeneric&);
+ ManagedAuthInitializeGeneric& operator = (const ManagedAuthInitializeGeneric&);
+ };
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheListener.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheListener.cpp b/clicache/src/impl/ManagedCacheListener.cpp
new file mode 100644
index 0000000..171eeb4
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheListener.cpp
@@ -0,0 +1,362 @@
+/*
+ * 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.
+ */
+
+//#include "../geode_includes.hpp"
+#include "ManagedCacheListener.hpp"
+#include "../ICacheListener.hpp"
+#include "../EntryEvent.hpp"
+#include "../RegionEvent.hpp"
+#include "../Region.hpp"
+#include "../Log.hpp"
+#include "../ExceptionTypes.hpp"
+#include "../EntryEvent.hpp"
+#include "ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::CacheListener* ManagedCacheListenerGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ userptr = nullptr;
+ try
+ {
+ userptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ userptr = nullptr;
+ }
+ if (userptr == nullptr)
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ ManagedCacheListenerGeneric * mgcl = new ManagedCacheListenerGeneric(userptr);
+
+ Type^ clgType = Type::GetType("Apache.Geode.Client.CacheListenerGeneric`2");
+ clgType = clgType->MakeGenericType(types);
+ Object^ clg = Activator::CreateInstance(clgType);
+
+ mInfo = clgType->GetMethod("SetCacheListener");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = userptr;
+ mInfo->Invoke(clg, params);
+
+ mgcl->setptr((Apache::Geode::Client::ICacheListener<Object^, Object^>^)clg);
+
+ return mgcl;
+ }
+ else
+ {
+ std::string ex_str = "ManagedCacheListenerGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedCacheListenerGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCacheListenerGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ void ManagedCacheListenerGeneric::afterCreate(const apache::geode::client::EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterCreate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterUpdate(const apache::geode::client::EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterUpdate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterInvalidate(const apache::geode::client::EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterInvalidate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterDestroy(const apache::geode::client::EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterDestroy(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+ void ManagedCacheListenerGeneric::afterRegionClear(const apache::geode::client::RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterRegionClear(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterRegionInvalidate(const apache::geode::client::RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterRegionInvalidate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterRegionDestroy(const apache::geode::client::RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterRegionDestroy(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::afterRegionLive(const apache::geode::client::RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->AfterRegionLive(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheListenerGeneric::close(const apache::geode::client::RegionPtr& region)
+ {
+ try {
+ Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region);
+
+ m_managedptr->Close(mregion);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+ void ManagedCacheListenerGeneric::afterRegionDisconnected(const apache::geode::client::RegionPtr& region)
+ {
+ try {
+ Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region);
+ m_managedptr->AfterRegionDisconnected(mregion);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheListener.hpp b/clicache/src/impl/ManagedCacheListener.hpp
new file mode 100644
index 0000000..ccc80d7
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheListener.hpp
@@ -0,0 +1,232 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CacheListener.hpp>
+#include "end_native.hpp"
+
+#include "../ICacheListener.hpp"
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ICacheListener" />
+ /// object and implements the native <c>apache::geode::client::CacheListener</c> interface.
+ /// </summary>
+ class ManagedCacheListenerGeneric
+ : public apache::geode::client::CacheListener
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheListenerGeneric(
+ /*Apache::Geode::Client::ICacheListener^ managedptr,*/ Object^ userptr)
+ : /*m_managedptr( managedptr ),*/ m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedCacheListener</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICacheListener</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>ICacheListener</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static apache::geode::client::CacheListener* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedCacheListenerGeneric() { }
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <param name="ev">
+ /// Denotes the event object associated with the entry creation.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Create" />
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ /// <seealso cref="Apache.Geode.Client.Region.Get" />
+ virtual void afterCreate(const apache::geode::client::EntryEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ virtual void afterUpdate(const apache::geode::client::EntryEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being invalidated.
+ /// </summary>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with the entry invalidation.
+ /// </param>
+ virtual void afterInvalidate(const apache::geode::client::EntryEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry being destroyed.
+ /// </summary>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with the entry destruction.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Destroy" />
+ virtual void afterDestroy(const apache::geode::client::EntryEvent& ev);
+
+ /// <summary>
+ /// Handles the event of a region being cleared.
+ /// </summary>
+ virtual void afterRegionClear(const apache::geode::client::RegionEvent& ev);
+
+ /// <summary>
+ /// Handles the event of a region being invalidated.
+ /// </summary>
+ /// <remarks>
+ /// Events are not invoked for each individual value that is invalidated
+ /// as a result of the region being invalidated. Each subregion, however,
+ /// gets its own <c>regionInvalidated</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region invalidation.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.InvalidateRegion" />
+ virtual void afterRegionInvalidate(const apache::geode::client::RegionEvent& ev);
+
+ /// <summary>
+ /// Handles the event of a region being destroyed.
+ /// </summary>
+ /// <remarks>
+ /// Events are not invoked for each individual entry that is destroyed
+ /// as a result of the region being destroyed. Each subregion, however,
+ /// gets its own <c>afterRegionDestroyed</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region destruction.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.DestroyRegion" />
+ virtual void afterRegionDestroy(const apache::geode::client::RegionEvent& ev);
+
+ /// <summary>
+ /// Handles the event of a region being live.
+ /// </summary>
+ /// <remarks>
+ /// Each subregion gets its own <c>afterRegionLive</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region going live.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Cache.ReadyForEvents" />
+ virtual void afterRegionLive(const apache::geode::client::RegionEvent& ev);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources,
+ /// such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Apache.Geode.Client.Cache.Close" />
+ /// <seealso cref="Apache.Geode.Client.Region.DestroyRegion" />
+ virtual void close(const apache::geode::client::RegionPtr& region);
+
+ ///<summary>
+ ///Called when all the endpoints associated with region are down.
+ ///This will be called when all the endpoints are down for the first time.
+ ///If endpoints come up and again go down it will be called again.
+ ///This will also be called when all endpoints are down and region is attached to the pool.
+ ///</summary>
+ ///<remarks>
+ ///</remark>
+ ///<param>
+ ///region Region^ denotes the assosiated region.
+ ///</param>
+ virtual void afterRegionDisconnected(const apache::geode::client::RegionPtr& region);
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ICacheListener<Object^, Object^>^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::ICacheListener<Object^, Object^>^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheListener
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ICacheListener<Object^, Object^>^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheLoader.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheLoader.cpp b/clicache/src/impl/ManagedCacheLoader.cpp
new file mode 100644
index 0000000..21e9657
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheLoader.cpp
@@ -0,0 +1,252 @@
+/*
+ * 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.
+ */
+
+//#include "../gf_includesN.hpp"
+#include "ManagedCacheLoader.hpp"
+#include "../Region.hpp"
+#include "ManagedString.hpp"
+//#include "../legacy/impl/SafeConvert.hpp"
+//#include "../../../LogM.hpp"
+//#include "../../../RegionM.hpp"
+#include "CacheLoader.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ CacheLoader* ManagedCacheLoaderGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ managedptr = nullptr;
+ try
+ {
+ managedptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ ManagedCacheLoaderGeneric* mgcl = new ManagedCacheLoaderGeneric(managedptr);
+
+ Type^ clgType = Type::GetType("Apache.Geode.Client.CacheLoaderGeneric`2");
+ clgType = clgType->MakeGenericType(types);
+ Object^ clg = Activator::CreateInstance(clgType);
+
+ mInfo = clgType->GetMethod("SetCacheLoader");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = managedptr;
+ mInfo->Invoke(clg, params);
+
+ mgcl->setptr((Apache::Geode::Client::ICacheLoaderProxy^)clg);
+
+ return mgcl;
+ }
+ else
+ {
+ std::string ex_str = "ManagedCacheLoaderGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedCacheLoaderGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCacheLoaderGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ CacheablePtr ManagedCacheLoaderGeneric::load(const RegionPtr& region,
+ const CacheableKeyPtr& key, const UserDataPtr& aCallbackArgument)
+ {
+ try {
+ return m_managedptr->load(region, key, aCallbackArgument);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ void ManagedCacheLoaderGeneric::close(const RegionPtr& region)
+ {
+ try {
+ /*
+ Apache::Geode::Client::Region^ mregion =
+ Apache::Geode::Client::Region::Create( region.get() );
+ */
+
+ m_managedptr->close(region);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
[21/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqQuery.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqQuery.hpp b/clicache/src/CqQuery.hpp
new file mode 100644
index 0000000..8cbf9f8
--- /dev/null
+++ b/clicache/src/CqQuery.hpp
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CqState.hpp"
+#include "begin_native.hpp"
+#include <geode/CqQuery.hpp>
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ interface class ICqResults;
+
+ generic<class TKey, class TResult>
+ ref class CqAttributes;
+
+ ref class CqStatistics;
+
+ generic<class TKey, class TResult>
+ ref class CqAttributesMutator;
+
+ generic<class TResult>
+ ref class Query;
+
+ /// <summary>
+ /// Class to encapsulate a continuous query (CQ).
+ /// </summary>
+ /// <remarks>
+ /// A CqQuery is obtained from a QueryService which in turn is obtained
+ /// from the Cache.
+ /// This can be executed to return SelectResults which can be either
+ /// a ResultSet or a StructSet, or it can be just registered on the
+ /// java server without returning results immediately rather only
+ /// the incremental results.
+ ///
+ /// This class is intentionally not thread-safe. So multiple threads
+ /// should not operate on the same <c>CqQuery</c> object concurrently
+ /// rather should have their own <c>CqQuery</c> objects.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ public ref class CqQuery sealed
+ {
+ public:
+
+ /// <summary>
+ /// Executes the Cq Query on the cache server
+ /// </summary>
+ void Execute( );
+
+ /// <summary>
+ /// Executes the Cq Query on the cache server
+ /// and returns the Cqresults.
+ /// </summary>
+ ICqResults<TResult>^ ExecuteWithInitialResults();
+
+ /// <summary>
+ /// Executes the Cq Query on the cache server
+ /// with the specified timeout and returns the results.
+ /// </summary>
+ /// <param name="timeout">The time (in seconds) to wait for query response.
+ /// This should be less than or equal to 2^31/1000 i.e. 2147483.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if timeout parameter is greater than 2^31/1000.
+ /// </exception>
+ ICqResults<TResult>^ ExecuteWithInitialResults(System::UInt32 timeout);
+
+ /// <summary>
+ /// Get the string for this cq query.
+ /// </summary>
+ property String^ QueryString
+ {
+ String^ get( );
+ }
+
+ /// <summary>
+ /// Get the name for this cq query.
+ /// </summary>
+ property String^ Name
+ {
+ String^ get( );
+ }
+
+ /// <summary>
+ /// Get the Attributes for this cq query.
+ /// </summary>
+ CqAttributes<TKey, TResult>^ GetCqAttributes();
+
+ /// <summary>
+ /// Get the Attributes Mutator for this cq query.
+ /// </summary>
+ CqAttributesMutator<TKey, TResult>^ GetCqAttributesMutator();
+
+ /// <summary>
+ /// Get the stats for this cq query.
+ /// </summary>
+ CqStatistics^ GetStatistics();
+
+ /// <summary>
+ /// Get the Query for this cq query.
+ /// </summary>
+ Query<TResult>^ GetQuery();
+
+ /// <summary>
+ /// stop the cq query
+ /// </summary>
+ void Stop( );
+
+ /// <summary>
+ /// stop the cq query
+ /// </summary>
+ void Close( );
+
+ /// <summary>
+ /// get the state of this cq query
+ /// </summary>
+ CqStateType GetState();
+
+ /// <summary>
+ /// Is this Cq in running state?
+ /// </summary>
+ bool IsRunning();
+
+ /// <summary>
+ /// Is this Cq in stopped state?
+ /// </summary>
+ bool IsStopped();
+
+ /// <summary>
+ /// Is this Cq in closed state?
+ /// </summary>
+ bool IsClosed();
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CqQuery<TKey, TResult>^ Create( native::CqQueryPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqQuery<TKey, TResult>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqQuery( native::CqQueryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqQuery>(nativeptr);
+ }
+
+
+ native_shared_ptr<native::CqQuery>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqServiceStatistics.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqServiceStatistics.cpp b/clicache/src/CqServiceStatistics.cpp
new file mode 100644
index 0000000..6a9da4c
--- /dev/null
+++ b/clicache/src/CqServiceStatistics.cpp
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#include "CqServiceStatistics.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ using namespace System;
+
+ System::UInt32 CqServiceStatistics::numCqsActive()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsActive();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsCreated()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsCreated();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsClosed()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsClosed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsStopped()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsStopped();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsOnClient()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsOnClient();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqServiceStatistics.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqServiceStatistics.hpp b/clicache/src/CqServiceStatistics.hpp
new file mode 100644
index 0000000..d711d8a
--- /dev/null
+++ b/clicache/src/CqServiceStatistics.hpp
@@ -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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqServiceStatistics.hpp>
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Defines common statistical information for cqservice
+ /// </summary>
+ public ref class CqServiceStatistics sealed
+ {
+ public:
+
+ /// <summary>
+ ///Get the number of CQs currently active.
+ ///Active CQs are those which are executing (in running state).
+ /// </summary>
+ System::UInt32 numCqsActive( );
+
+ /// <summary>
+ ///Get the total number of CQs created. This is a cumulative number.
+ /// </summary>
+ System::UInt32 numCqsCreated( );
+
+ /// <summary>
+ ///Get the total number of closed CQs. This is a cumulative number.
+ /// </summary>
+ System::UInt32 numCqsClosed( );
+
+ /// <summary>
+ ///Get the number of stopped CQs currently.
+ /// </summary>
+ System::UInt32 numCqsStopped( );
+
+ /// <summary>
+ ///Get number of CQs that are currently active or stopped.
+ ///The CQs included in this number are either running or stopped (suspended).
+ ///Closed CQs are not included.
+ /// </summary>
+ System::UInt32 numCqsOnClient( );
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CqServiceStatistics^ Create( apache::geode::client::CqServiceStatisticsPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqServiceStatistics( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqServiceStatistics( apache::geode::client::CqServiceStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqServiceStatistics>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqServiceStatistics>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqState.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqState.cpp b/clicache/src/CqState.cpp
new file mode 100644
index 0000000..0a83a1d
--- /dev/null
+++ b/clicache/src/CqState.cpp
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "CqState.hpp"
+#include <vcclr.h>
+
+#include "impl/ManagedString.hpp"
+using namespace System;
+using namespace System::Runtime::InteropServices;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ String^ CqState::ToString()
+ {
+ return ManagedString::Get(m_nativeptr->toString());
+ }
+
+ bool CqState::IsRunning()
+ {
+ return m_nativeptr->isRunning();
+ }
+
+ bool CqState::IsStopped()
+ {
+ return m_nativeptr->isStopped();
+ }
+
+ bool CqState::IsClosed()
+ {
+ return m_nativeptr->isClosed();
+ }
+
+ bool CqState::IsClosing()
+ {
+ return m_nativeptr->isClosing();
+ }
+
+ void CqState::SetState( CqStateType state )
+ {
+ apache::geode::client::CqState::StateType st =apache::geode::client::CqState::INVALID;
+ if(state == CqStateType::STOPPED)
+ st = apache::geode::client::CqState::STOPPED;
+ else if(state == CqStateType::RUNNING)
+ st = apache::geode::client::CqState::RUNNING;
+ else if(state == CqStateType::CLOSED)
+ st = apache::geode::client::CqState::CLOSED;
+ else if(state == CqStateType::CLOSING)
+ st = apache::geode::client::CqState::CLOSING;
+
+ m_nativeptr->setState( st );
+ }
+
+ CqStateType CqState::GetState( )
+ {
+ apache::geode::client::CqState::StateType st = m_nativeptr->getState( );
+ CqStateType state;
+ if(st==apache::geode::client::CqState::STOPPED)
+ state = CqStateType::STOPPED;
+ else if(st==apache::geode::client::CqState::RUNNING)
+ state = CqStateType::RUNNING;
+ else if(st==apache::geode::client::CqState::CLOSED)
+ state = CqStateType::CLOSED;
+ else if(st==apache::geode::client::CqState::CLOSING)
+ state = CqStateType::CLOSING;
+ else
+ state = CqStateType::INVALID;
+ return state;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqState.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqState.hpp b/clicache/src/CqState.hpp
new file mode 100644
index 0000000..21ad5e6
--- /dev/null
+++ b/clicache/src/CqState.hpp
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqState.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Enumerated type for cq state
+ /// @nativeclient
+ /// For Native Clients:
+ /// @endnativeclient
+ /// </summary>
+ public enum class CqStateType
+ {
+ STOPPED = 0,
+ RUNNING,
+ CLOSED,
+ CLOSING,
+ INVALID
+ };
+
+
+ /// <summary>
+ /// Static class containing convenience methods for <c>CqState</c>.
+ /// </summary>
+ public ref class CqState sealed
+ {
+ public:
+
+ /// <summary>
+ /// Returns the state in string form.
+ /// </summary>
+ virtual String^ ToString( ) override;
+
+ /// <summary>
+ /// Returns true if the CQ is in Running state.
+ /// </summary>
+ bool IsRunning();
+
+ /// <summary>
+ /// Returns true if the CQ is in Stopped state.
+ /// </summary>
+ bool IsStopped();
+
+ /// <summary>
+ /// Returns true if the CQ is in Closed state.
+ /// </summary>
+ bool IsClosed();
+
+ /// <summary>
+ /// Returns true if the CQ is in Closing state.
+ /// </summary>
+ bool IsClosing();
+ void SetState(CqStateType state);
+ CqStateType GetState();
+
+ internal:
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqState( native::CqState* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ private:
+ native::CqState* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqStatistics.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqStatistics.cpp b/clicache/src/CqStatistics.cpp
new file mode 100644
index 0000000..ad19481
--- /dev/null
+++ b/clicache/src/CqStatistics.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+#include "CqStatistics.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ using namespace System;
+
+ System::UInt32 CqStatistics::numInserts()
+ {
+ try
+ {
+ return m_nativeptr->get()->numInserts();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numDeletes()
+ {
+ try
+ {
+ return m_nativeptr->get()->numDeletes();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numUpdates()
+ {
+ try
+ {
+ return m_nativeptr->get()->numUpdates();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numEvents()
+ {
+ try
+ {
+ return m_nativeptr->get()->numEvents();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqStatistics.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqStatistics.hpp b/clicache/src/CqStatistics.hpp
new file mode 100644
index 0000000..05aa23c
--- /dev/null
+++ b/clicache/src/CqStatistics.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqStatistics.hpp>
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Defines common statistical information for a cq.
+ /// </summary>
+ public ref class CqStatistics sealed
+ {
+ public:
+
+ /// <summary>
+ /// get number of inserts qualified by this Cq
+ /// </summary>
+ System::UInt32 numInserts( );
+
+ /// <summary>
+ /// get number of deletes qualified by this Cq
+ /// </summary>
+ System::UInt32 numDeletes( );
+
+ /// <summary>
+ /// get number of updates qualified by this Cq
+ /// </summary>
+ System::UInt32 numUpdates( );
+
+ /// <summary>
+ /// get number of events qualified by this Cq
+ /// </summary>
+ System::UInt32 numEvents( );
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CqStatistics^ Create( apache::geode::client::CqStatisticsPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqStatistics( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqStatistics( apache::geode::client::CqStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqStatistics>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqStatistics>^ m_nativeptr;
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DataInput.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/DataInput.cpp b/clicache/src/DataInput.cpp
new file mode 100644
index 0000000..a3ca689
--- /dev/null
+++ b/clicache/src/DataInput.cpp
@@ -0,0 +1,1165 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include <GeodeTypeIdsImpl.hpp>
+#include "SerializationRegistry.hpp"
+#include "CacheRegionHelper.hpp"
+#include "end_native.hpp"
+
+#include <vcclr.h>
+
+#include "DataInput.hpp"
+#include "Cache.hpp"
+#include "CacheableString.hpp"
+#include "CacheableHashMap.hpp"
+#include "CacheableStack.hpp"
+#include "CacheableVector.hpp"
+#include "CacheableArrayList.hpp"
+#include "CacheableIDentityHashMap.hpp"
+#include "CacheableDate.hpp"
+#include "CacheableObjectArray.hpp"
+#include "Serializable.hpp"
+#include "impl/PdxHelper.hpp"
+
+using namespace System;
+using namespace System::IO;
+using namespace apache::geode::client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ DataInput::DataInput(System::Byte* buffer, int size, const native::Cache* cache)
+ {
+ m_ispdxDesrialization = false;
+ m_isRootObjectPdx = false;
+ m_cache = cache;
+ if (buffer != nullptr && size > 0) {
+ _GF_MG_EXCEPTION_TRY2
+
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(cache->createDataInput(buffer, size));
+ m_cursor = 0;
+ m_isManagedObject = false;
+ m_forStringDecode = gcnew array<Char>(100);
+
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ else {
+ throw gcnew IllegalArgumentException("DataInput.ctor(): "
+ "provided buffer is null or empty");
+ }
+ }
+
+ DataInput::DataInput(array<Byte>^ buffer, const native::Cache * cache)
+ {
+ m_ispdxDesrialization = false;
+ m_isRootObjectPdx = false;
+ m_cache = cache;
+ if (buffer != nullptr && buffer->Length > 0) {
+ _GF_MG_EXCEPTION_TRY2
+
+ System::Int32 len = buffer->Length;
+ GF_NEW(m_buffer, System::Byte[len]);
+ pin_ptr<const Byte> pin_buffer = &buffer[0];
+ memcpy(m_buffer, (void*)pin_buffer, len);
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->createDataInput(m_buffer, len));
+
+ m_cursor = 0;
+ m_isManagedObject = false;
+ m_forStringDecode = gcnew array<Char>(100);
+
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ else {
+ throw gcnew IllegalArgumentException("DataInput.ctor(): "
+ "provided buffer is null or empty");
+ }
+ }
+
+ DataInput::DataInput(array<Byte>^ buffer, System::Int32 len, const native::Cache* cache)
+ {
+ m_ispdxDesrialization = false;
+ m_isRootObjectPdx = false;
+ m_cache = cache;
+ if (buffer != nullptr) {
+ if (len == 0 || (System::Int32)len > buffer->Length) {
+ throw gcnew IllegalArgumentException(String::Format(
+ "DataInput.ctor(): given length {0} is zero or greater than "
+ "size of buffer {1}", len, buffer->Length));
+ }
+ //m_bytes = gcnew array<Byte>(len);
+ //System::Array::Copy(buffer, 0, m_bytes, 0, len);
+ _GF_MG_EXCEPTION_TRY2
+
+ GF_NEW(m_buffer, System::Byte[len]);
+ pin_ptr<const Byte> pin_buffer = &buffer[0];
+ memcpy(m_buffer, (void*)pin_buffer, len);
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(m_cache->createDataInput(m_buffer, len));
+
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ else {
+ throw gcnew IllegalArgumentException("DataInput.ctor(): "
+ "provided buffer is null");
+ }
+ }
+
+ void DataInput::CheckBufferSize(int size)
+ {
+ if ((unsigned int)(m_cursor + size) > m_bufferLength)
+ {
+ Log::Debug("DataInput::CheckBufferSize m_cursor:" + m_cursor + " size:" + size + " m_bufferLength:" + m_bufferLength);
+ throw gcnew OutOfRangeException("DataInput: attempt to read beyond buffer");
+ }
+ }
+
+ DataInput^ DataInput::GetClone()
+ {
+ return gcnew DataInput(m_buffer, m_bufferLength, m_cache);
+ }
+
+ Byte DataInput::ReadByte()
+ {
+ CheckBufferSize(1);
+ return m_buffer[m_cursor++];
+ }
+
+ SByte DataInput::ReadSByte()
+ {
+ CheckBufferSize(1);
+ return m_buffer[m_cursor++];
+ }
+
+ bool DataInput::ReadBoolean()
+ {
+ CheckBufferSize(1);
+ Byte val = m_buffer[m_cursor++];
+ if (val == 1)
+ return true;
+ else
+ return false;
+ }
+
+ Char DataInput::ReadChar()
+ {
+ CheckBufferSize(2);
+ Char data = m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ return data;
+ }
+
+ array<Byte>^ DataInput::ReadBytes()
+ {
+ System::Int32 length;
+ length = ReadArrayLen();
+
+ if (length >= 0) {
+ if (length == 0)
+ return gcnew array<Byte>(0);
+ else {
+ array<Byte>^ bytes = ReadBytesOnly(length);
+ return bytes;
+ }
+ }
+ return nullptr;
+ }
+
+ int DataInput::ReadArrayLen()
+ {
+ int code;
+ int len;
+
+ code = Convert::ToInt32(ReadByte());
+
+ if (code == 0xFF) {
+ len = -1;
+ }
+ else {
+ unsigned int result = code;
+ if (result > 252) { // 252 is java's ((byte)-4 && 0xFF)
+ if (code == 0xFE) {
+ result = ReadUInt16();
+ }
+ else if (code == 0xFD) {
+ result = ReadUInt32();
+ }
+ else {
+ throw gcnew IllegalStateException("unexpected array length code");
+ }
+ //TODO:: illegal length
+ }
+ len = (int)result;
+ }
+ return len;
+ }
+
+ array<SByte>^ DataInput::ReadSBytes()
+ {
+ System::Int32 length;
+ length = ReadArrayLen();
+
+ if (length > -1) {
+ if (length == 0)
+ return gcnew array<SByte>(0);
+ else {
+ array<SByte>^ bytes = ReadSBytesOnly(length);
+ return bytes;
+ }
+ }
+ return nullptr;
+ }
+
+ array<Byte>^ DataInput::ReadBytesOnly(System::UInt32 len)
+ {
+ if (len > 0) {
+ CheckBufferSize(len);
+ array<Byte>^ bytes = gcnew array<Byte>(len);
+
+ for (unsigned int i = 0; i < len; i++)
+ bytes[i] = m_buffer[m_cursor++];
+
+ return bytes;
+ }
+ return nullptr;
+ }
+
+ void DataInput::ReadBytesOnly(array<Byte> ^ buffer, int offset, int count)
+ {
+ if (count > 0) {
+ CheckBufferSize((System::UInt32)count);
+
+ for (int i = 0; i < count; i++)
+ buffer[offset + i] = m_buffer[m_cursor++];
+ }
+ }
+
+ array<SByte>^ DataInput::ReadSBytesOnly(System::UInt32 len)
+ {
+ if (len > 0) {
+ CheckBufferSize(len);
+ array<SByte>^ bytes = gcnew array<SByte>(len);
+
+ for (unsigned int i = 0; i < len; i++)
+ bytes[i] = (SByte)m_buffer[m_cursor++];
+
+ return bytes;
+ }
+ return nullptr;
+ }
+
+ System::UInt16 DataInput::ReadUInt16()
+ {
+ CheckBufferSize(2);
+ System::UInt16 data = m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ return data;
+ }
+
+ System::UInt32 DataInput::ReadUInt32()
+ {
+ CheckBufferSize(4);
+ System::UInt32 data = m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+
+ return data;
+ }
+
+ System::UInt64 DataInput::ReadUInt64()
+ {
+ System::UInt64 data;
+
+ CheckBufferSize(8);
+
+ data = m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+ data = (data << 8) | m_buffer[m_cursor++];
+
+ return data;
+ }
+
+ System::Int16 DataInput::ReadInt16()
+ {
+ return ReadUInt16();
+ }
+
+ System::Int32 DataInput::ReadInt32()
+ {
+ return ReadUInt32();
+ }
+
+ System::Int64 DataInput::ReadInt64()
+ {
+ return ReadUInt64();
+ }
+
+ array<Byte>^ DataInput::ReadReverseBytesOnly(int len)
+ {
+ CheckBufferSize(len);
+
+ int i = 0;
+ int j = m_cursor + len - 1;
+ array<Byte>^ bytes = gcnew array<Byte>(len);
+
+ while (i < len)
+ {
+ bytes[i++] = m_buffer[j--];
+ }
+ m_cursor += len;
+ return bytes;
+ }
+
+ float DataInput::ReadFloat()
+ {
+ float data;
+
+ array<Byte>^ bytes = nullptr;
+ if (BitConverter::IsLittleEndian)
+ bytes = ReadReverseBytesOnly(4);
+ else
+ bytes = ReadBytesOnly(4);
+
+ data = BitConverter::ToSingle(bytes, 0);
+
+ return data;
+ }
+
+ double DataInput::ReadDouble()
+ {
+ double data;
+
+ array<Byte>^ bytes = nullptr;
+ if (BitConverter::IsLittleEndian)
+ bytes = ReadReverseBytesOnly(8);
+ else
+ bytes = ReadBytesOnly(8);
+
+ data = BitConverter::ToDouble(bytes, 0);
+
+ return data;
+ }
+
+ String^ DataInput::ReadUTF()
+ {
+ int length = ReadUInt16();
+ CheckBufferSize(length);
+ String^ str = DecodeBytes(length);
+ return str;
+ }
+
+ String^ DataInput::ReadUTFHuge()
+ {
+ int length = ReadUInt32();
+ CheckBufferSize(length);
+
+ array<Char>^ chArray = gcnew array<Char>(length);
+
+ for (int i = 0; i < length; i++)
+ {
+ Char ch = ReadByte();
+ ch = ((ch << 8) | ReadByte());
+ chArray[i] = ch;
+ }
+
+ String^ str = gcnew String(chArray);
+
+ return str;
+ }
+
+ String^ DataInput::ReadASCIIHuge()
+ {
+ int length = ReadInt32();
+ CheckBufferSize(length);
+ String^ str = DecodeBytes(length);
+ return str;
+ }
+
+ Object^ DataInput::ReadObject()
+ {
+ return ReadInternalObject();
+ }
+
+ /* Object^ DataInput::ReadGenericObject( )
+ {
+ return ReadInternalGenericObject();
+ }*/
+
+ Object^ DataInput::ReadDotNetTypes(int8_t typeId)
+ {
+ switch (typeId)
+ {
+ case apache::geode::client::GeodeTypeIds::CacheableByte:
+ {
+ return ReadSByte();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableBoolean:
+ {
+ bool obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableWideChar:
+ {
+ Char obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDouble:
+ {
+ Double obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableASCIIString:
+ {
+ /* CacheableString^ cs = static_cast<CacheableString^>(CacheableString::CreateDeserializable());
+ cs->FromData(this);
+ return cs->Value;*/
+ return ReadUTF();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge:
+ {
+ /*CacheableString^ cs = static_cast<CacheableString^>(CacheableString::createDeserializableHuge());
+ cs->FromData(this);
+ return cs->Value;*/
+ return ReadASCIIHuge();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableString:
+ {
+ /*CacheableString^ cs = static_cast<CacheableString^>(CacheableString::createUTFDeserializable());
+ cs->FromData(this);
+ return cs->Value;*/
+ return ReadUTF();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableStringHuge:
+ {
+ //TODO: need to look all strings types
+ /*CacheableString^ cs = static_cast<CacheableString^>(CacheableString::createUTFDeserializableHuge());
+ cs->FromData(this);
+ return cs->Value;*/
+ return ReadUTFHuge();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableFloat:
+ {
+ float obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt16:
+ {
+ Int16 obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt32:
+ {
+ Int32 obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt64:
+ {
+ Int64 obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDate:
+ {
+ CacheableDate^ cd = CacheableDate::Create();
+ cd->FromData(this);
+ return cd->Value;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableBytes:
+ {
+ return ReadBytes();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDoubleArray:
+ {
+ array<Double>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableFloatArray:
+ {
+ array<float>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt16Array:
+ {
+ array<Int16>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt32Array:
+ {
+ array<Int32>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::BooleanArray:
+ {
+ array<bool>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CharArray:
+ {
+ array<Char>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt64Array:
+ {
+ array<Int64>^ obj;
+ ReadObject(obj);
+ return obj;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableStringArray:
+ {
+ return ReadStringArray();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableHashTable:
+ {
+ return ReadHashtable();
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableHashMap:
+ {
+ CacheableHashMap^ chm = static_cast<CacheableHashMap^>(CacheableHashMap::CreateDeserializable());
+ chm->FromData(this);
+ return chm->Value;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ CacheableIdentityHashMap^ chm = static_cast<CacheableIdentityHashMap^>(CacheableIdentityHashMap::CreateDeserializable());
+ chm->FromData(this);
+ return chm->Value;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableVector:
+ {
+ /*CacheableVector^ cv = static_cast<CacheableVector^>(CacheableVector::CreateDeserializable());
+ cv->FromData(this);
+ return cv->Value;*/
+ int len = ReadArrayLen();
+ System::Collections::ArrayList^ retA = gcnew System::Collections::ArrayList(len);
+
+ for (int i = 0; i < len; i++)
+ {
+ retA->Add(this->ReadObject());
+ }
+ return retA;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableArrayList:
+ {
+ /*CacheableArrayList^ cv = static_cast<CacheableArrayList^>(CacheableArrayList::CreateDeserializable());
+ cv->FromData(this);
+ return cv->Value;*/
+ int len = ReadArrayLen();
+ System::Collections::Generic::List<Object^>^ retA = gcnew System::Collections::Generic::List<Object^>(len);
+ for (int i = 0; i < len; i++)
+ {
+ retA->Add(this->ReadObject());
+ }
+ return retA;
+
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableLinkedList:
+ {
+ /*CacheableArrayList^ cv = static_cast<CacheableArrayList^>(CacheableArrayList::CreateDeserializable());
+ cv->FromData(this);
+ return cv->Value;*/
+ int len = ReadArrayLen();
+ System::Collections::Generic::LinkedList<Object^>^ retA = gcnew System::Collections::Generic::LinkedList<Object^>();
+ for (int i = 0; i < len; i++)
+ {
+ retA->AddLast(this->ReadObject());
+ }
+ return retA;
+
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableStack:
+ {
+ CacheableStack^ cv = static_cast<CacheableStack^>(CacheableStack::CreateDeserializable());
+ cv->FromData(this);
+ return cv->Value;
+ }
+ default:
+ return nullptr;
+ }
+ }
+
+ Object^ DataInput::ReadInternalObject()
+ {
+ try
+ {
+ //Log::Debug("DataInput::ReadInternalObject m_cursor " + m_cursor);
+ bool findinternal = false;
+ int8_t typeId = ReadByte();
+ System::Int64 compId = typeId;
+ TypeFactoryMethodGeneric^ createType = nullptr;
+
+ if (compId == GeodeTypeIds::NullObj) {
+ return nullptr;
+ }
+ else if (compId == GeodeClassIds::PDX)
+ {
+ //cache current state and reset after reading pdx object
+ int cacheCursor = m_cursor;
+ System::Byte* cacheBuffer = m_buffer;
+ unsigned int cacheBufferLength = m_bufferLength;
+ Object^ ret = Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ int tmp = m_nativeptr->get()->getBytesRemaining();
+ m_cursor = cacheBufferLength - tmp;
+ m_buffer = cacheBuffer;
+ m_bufferLength = cacheBufferLength;
+ m_nativeptr->get()->rewindCursor(m_cursor);
+
+ if (ret != nullptr)
+ {
+ PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
+
+ if (pdxWrapper != nullptr)
+ {
+ return pdxWrapper->GetObject();
+ }
+ }
+ return ret;
+ }
+ else if (compId == GeodeClassIds::PDX_ENUM)
+ {
+ int8_t dsId = ReadByte();
+ int tmp = ReadArrayLen();
+ int enumId = (dsId << 24) | (tmp & 0xFFFFFF);
+
+ Object^ enumVal = Internal::PdxHelper::GetEnum(enumId, m_cache);
+ return enumVal;
+ }
+ else if (compId == GeodeTypeIds::CacheableNullString) {
+ //return SerializablePtr(CacheableString::createDeserializable());
+ //TODO::
+ return nullptr;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData) {
+ int8_t classId = ReadByte();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData2) {
+ System::Int16 classId = ReadInt16();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData4) {
+ System::Int32 classId = ReadInt32();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDByte) {//TODO: need to verify again
+ int8_t fixedId = ReadByte();
+ compId = fixedId;
+ findinternal = true;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDShort) {
+ System::Int16 fixedId = ReadInt16();
+ compId = fixedId;
+ findinternal = true;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDInt) {
+ System::Int32 fixedId = ReadInt32();
+ compId = fixedId;
+ findinternal = true;
+ }
+ if (findinternal) {
+ compId += 0x80000000;
+ createType = Serializable::GetManagedDelegateGeneric((System::Int64)compId);
+ }
+ else {
+ createType = Serializable::GetManagedDelegateGeneric(compId);
+ if (createType == nullptr)
+ {
+ Object^ retVal = ReadDotNetTypes(typeId);
+
+ if (retVal != nullptr)
+ return retVal;
+
+ if (m_ispdxDesrialization && typeId == apache::geode::client::GeodeTypeIds::CacheableObjectArray)
+ {//object array and pdxSerialization
+ return readDotNetObjectArray();
+ }
+ compId += 0x80000000;
+ createType = Serializable::GetManagedDelegateGeneric(compId);
+
+ /*if (createType == nullptr)
+ {
+ //TODO:: final check for user type if its not in cache
+ compId -= 0x80000000;
+ createType = Serializable::GetManagedDelegate(compId);
+ }*/
+ }
+ }
+
+ if (createType == nullptr) {
+ throw gcnew IllegalStateException("Unregistered typeId " + typeId + " in deserialization, aborting.");
+ }
+
+ bool isPdxDeserialization = m_ispdxDesrialization;
+ m_ispdxDesrialization = false;//for nested objects
+ IGeodeSerializable^ newObj = createType();
+ newObj->FromData(this);
+ m_ispdxDesrialization = isPdxDeserialization;
+ return newObj;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ Object^ DataInput::readDotNetObjectArray()
+ {
+ int len = ReadArrayLen();
+ String^ className = nullptr;
+ if (len >= 0)
+ {
+ ReadByte(); // ignore CLASS typeid
+ className = (String^)ReadObject();
+ className = Serializable::GetLocalTypeName(className);
+ System::Collections::IList^ list = nullptr;
+ if (len == 0)
+ {
+ list = (System::Collections::IList^)Serializable::GetArrayObject(className, len);
+ return list;
+ }
+ //read first object
+
+ Object^ ret = ReadObject();//in case it returns pdxinstance or java.lang.object
+
+ list = (System::Collections::IList^)Serializable::GetArrayObject(ret->GetType()->FullName, len);
+
+ list[0] = ret;
+ for (System::Int32 index = 1; index < list->Count; ++index)
+ {
+ list[index] = ReadObject();
+ }
+ return list;
+ }
+ return nullptr;
+ }
+
+ Object^ DataInput::ReadInternalGenericObject()
+ {
+ bool findinternal = false;
+ int8_t typeId = ReadByte();
+ System::Int64 compId = typeId;
+ TypeFactoryMethodGeneric^ createType = nullptr;
+
+ if (compId == GeodeTypeIds::NullObj) {
+ return nullptr;
+ }
+ else if (compId == GeodeClassIds::PDX)
+ {
+ return Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache)->getSerializationRegistry().get());
+ }
+ else if (compId == GeodeTypeIds::CacheableNullString) {
+ //return SerializablePtr(CacheableString::createDeserializable());
+ //TODO::
+ return nullptr;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData) {
+ int8_t classId = ReadByte();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData2) {
+ System::Int16 classId = ReadInt16();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::CacheableUserData4) {
+ System::Int32 classId = ReadInt32();
+ //compId |= ( ( (System::Int64)classId ) << 32 );
+ compId = (System::Int64)classId;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDByte) {//TODO: need to verify again
+ int8_t fixedId = ReadByte();
+ compId = fixedId;
+ findinternal = true;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDShort) {
+ System::Int16 fixedId = ReadInt16();
+ compId = fixedId;
+ findinternal = true;
+ }
+ else if (compId == GeodeTypeIdsImpl::FixedIDInt) {
+ System::Int32 fixedId = ReadInt32();
+ compId = fixedId;
+ findinternal = true;
+ }
+ if (findinternal) {
+ compId += 0x80000000;
+ createType = Serializable::GetManagedDelegateGeneric((System::Int64)compId);
+ }
+ else {
+ createType = Serializable::GetManagedDelegateGeneric(compId);
+ if (createType == nullptr)
+ {
+ Object^ retVal = ReadDotNetTypes(typeId);
+
+ if (retVal != nullptr)
+ return retVal;
+
+ compId += 0x80000000;
+ createType = Serializable::GetManagedDelegateGeneric(compId);
+ }
+ }
+
+ if (createType != nullptr)
+ {
+ IGeodeSerializable^ newObj = createType();
+ newObj->FromData(this);
+ return newObj;
+ }
+
+ throw gcnew IllegalStateException("Unregistered typeId in deserialization, aborting.");
+ }
+
+ System::UInt32 DataInput::BytesRead::get()
+ {
+ AdvanceUMCursor();
+ SetBuffer();
+
+ try
+ {
+ return m_nativeptr->get()->getBytesRead();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::UInt32 DataInput::BytesReadInternally::get()
+ {
+ return m_cursor;
+ }
+
+ System::UInt32 DataInput::BytesRemaining::get()
+ {
+ AdvanceUMCursor();
+ SetBuffer();
+ try
+ {
+ return m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void DataInput::AdvanceCursor(System::Int32 offset)
+ {
+ m_cursor += offset;
+ }
+
+ void DataInput::RewindCursor(System::Int32 offset)
+ {
+ AdvanceUMCursor();
+ try
+ {
+ m_nativeptr->get()->rewindCursor(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ SetBuffer();
+ }
+
+ void DataInput::Reset()
+ {
+ AdvanceUMCursor();
+ try
+ {
+ m_nativeptr->get()->reset();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ SetBuffer();
+ }
+
+ void DataInput::Cleanup()
+ {
+ //TODO:
+ //GF_SAFE_DELETE_ARRAY(m_buffer);
+ }
+
+ void DataInput::ReadDictionary(System::Collections::IDictionary^ dict)
+ {
+ int len = this->ReadArrayLen();
+
+ if (len > 0)
+ {
+ for (int i = 0; i < len; i++)
+ {
+ Object^ key = this->ReadObject();
+ Object^ val = this->ReadObject();
+
+ dict->Add(key, val);
+ }
+ }
+ }
+
+ IDictionary<Object^, Object^>^ DataInput::ReadDictionary()
+ {
+ int len = this->ReadArrayLen();
+
+ if (len == -1)
+ return nullptr;
+ else
+ {
+ IDictionary<Object^, Object^>^ dict = gcnew Dictionary<Object^, Object^>();
+ for (int i = 0; i < len; i++)
+ {
+ Object^ key = this->ReadObject();
+ Object^ val = this->ReadObject();
+
+ dict->Add(key, val);
+ }
+ return dict;
+ }
+ }
+
+ System::DateTime DataInput::ReadDate()
+ {
+ long ticks = (long)ReadInt64();
+ if (ticks != -1L)
+ {
+ m_cursor -= 8;//for above
+ CacheableDate^ cd = CacheableDate::Create();
+ cd->FromData(this);
+ return cd->Value;
+ }
+ else
+ {
+ DateTime dt(0);
+ return dt;
+ }
+ }
+
+ void DataInput::ReadCollection(System::Collections::IList^ coll)
+ {
+ int len = ReadArrayLen();
+ for (int i = 0; i < len; i++)
+ {
+ coll->Add(ReadObject());
+ }
+ }
+
+ array<Char>^ DataInput::ReadCharArray()
+ {
+ array<Char>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<bool>^ DataInput::ReadBooleanArray()
+ {
+ array<bool>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<Int16>^ DataInput::ReadShortArray()
+ {
+ array<Int16>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<Int32>^ DataInput::ReadIntArray()
+ {
+ array<Int32>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<Int64>^ DataInput::ReadLongArray()
+ {
+ array<Int64>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<float>^ DataInput::ReadFloatArray()
+ {
+ array<float>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ array<double>^ DataInput::ReadDoubleArray()
+ {
+ array<double>^ arr;
+ this->ReadObject(arr);
+ return arr;
+ }
+
+ List<Object^>^ DataInput::ReadObjectArray()
+ {
+ //this to know whether it is null or it is empty
+ int storeCursor = m_cursor;
+ int len = this->ReadArrayLen();
+ if (len == -1)
+ return nullptr;
+ //this will be read further by fromdata
+ m_cursor = m_cursor - (m_cursor - storeCursor);
+
+
+ CacheableObjectArray^ coa = CacheableObjectArray::Create();
+ coa->FromData(this);
+ List<Object^>^ retObj = (List<Object^>^)coa;
+
+ if (retObj->Count >= 0)
+ return retObj;
+ return nullptr;
+ }
+
+ array<array<Byte>^>^ DataInput::ReadArrayOfByteArrays()
+ {
+ int len = ReadArrayLen();
+ if (len >= 0)
+ {
+ array<array<Byte>^>^ retVal = gcnew array<array<Byte>^>(len);
+ for (int i = 0; i < len; i++)
+ {
+ retVal[i] = this->ReadBytes();
+ }
+ return retVal;
+ }
+ else
+ return nullptr;
+ }
+
+ void DataInput::ReadObject(array<UInt16>^% obj)
+ {
+ int len = ReadArrayLen();
+ if (len >= 0)
+ {
+ obj = gcnew array<UInt16>(len);
+ for (int i = 0; i < len; i++)
+ {
+ obj[i] = this->ReadUInt16();
+ }
+ }
+ }
+
+ void DataInput::ReadObject(array<UInt32>^% obj)
+ {
+ int len = ReadArrayLen();
+ if (len >= 0)
+ {
+ obj = gcnew array<UInt32>(len);
+ for (int i = 0; i < len; i++)
+ {
+ obj[i] = this->ReadUInt32();
+ }
+ }
+ }
+
+ void DataInput::ReadObject(array<UInt64>^% obj)
+ {
+ int len = ReadArrayLen();
+ if (len >= 0)
+ {
+ obj = gcnew array<UInt64>(len);
+ for (int i = 0; i < len; i++)
+ {
+ obj[i] = this->ReadUInt64();
+ }
+ }
+ }
+
+ String^ DataInput::ReadString()
+ {
+ UInt32 typeId = (Int32)ReadByte();
+
+ if (typeId == GeodeTypeIds::CacheableNullString)
+ return nullptr;
+
+ if (typeId == GeodeTypeIds::CacheableASCIIString ||
+ typeId == GeodeTypeIds::CacheableString)
+ {
+ return ReadUTF();
+ }
+ else if (typeId == GeodeTypeIds::CacheableASCIIStringHuge)
+ {
+ return ReadASCIIHuge();
+ }
+ else
+ {
+ return ReadUTFHuge();
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DataInput.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/DataInput.hpp b/clicache/src/DataInput.hpp
new file mode 100644
index 0000000..80ed2b0
--- /dev/null
+++ b/clicache/src/DataInput.hpp
@@ -0,0 +1,711 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/DataInput.hpp>
+#include "end_native.hpp"
+
+#include "native_conditional_unique_ptr.hpp"
+#include "Log.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ /// <summary>
+ /// Provides operations for reading primitive data values, byte arrays,
+ /// strings, <c>IGeodeSerializable</c> objects from a byte stream.
+ /// </summary>
+ public ref class DataInput sealed
+ {
+ public:
+
+ /// <summary>
+ /// Construct <c>DataInput</c> using an given array of bytes.
+ /// </summary>
+ /// <param name="buffer">
+ /// The buffer to use for reading data values
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the buffer is null
+ /// </exception>
+ DataInput( array<Byte>^ buffer, const native::Cache* cache );
+
+ /// <summary>
+ /// Construct <c>DataInput</c> using a given length of an array of
+ /// bytes.
+ /// </summary>
+ /// <param name="buffer">
+ /// The buffer to use for reading data values.
+ /// </param>
+ /// <param name="len">
+ /// The number of bytes from the start of the buffer to use.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the buffer is null
+ /// </exception>
+ DataInput( array<Byte>^ buffer, System::Int32 len, const native::Cache* cache );
+
+ /// <summary>
+ /// Dispose: frees the internal buffer.
+ /// </summary>
+ ~DataInput( ) { Cleanup( ); }
+
+ /// <summary>
+ /// Finalizer: frees the internal buffer.
+ /// </summary>
+ !DataInput( ) { Cleanup( ); }
+
+ /// <summary>
+ /// Read a signed byte from the stream.
+ /// </summary>
+ SByte ReadSByte( );
+
+ /// <summary>
+ /// Read a boolean value from the stream.
+ /// </summary>
+ bool ReadBoolean( );
+
+ /// <summary>
+ /// Read a char value from the stream.
+ /// </summary>
+ Char ReadChar( );
+
+ /// <summary>
+ /// Read an array of bytes from the stream reading the length
+ /// from the stream first.
+ /// </summary>
+ array<Byte>^ ReadBytes( );
+
+ /// <summary>
+ /// Read an array of signed bytes from the stream reading the length
+ /// from the stream first.
+ /// </summary>
+ array<SByte>^ ReadSBytes( );
+
+ /// <summary>
+ /// Read the given number of bytes from the stream.
+ /// </summary>
+ /// <param name="len">Number of bytes to read.</param>
+ array<Byte>^ ReadBytesOnly( System::UInt32 len );
+
+ void ReadBytesOnly( array<Byte> ^ buffer, int offset, int count );
+
+ /// <summary>
+ /// Read the given number of signed bytes from the stream.
+ /// </summary>
+ /// <param name="len">Number of signed bytes to read.</param>
+ array<SByte>^ ReadSBytesOnly( System::UInt32 len );
+
+ /// <summary>
+ /// Read a array len based on array size.
+ /// </summary>
+ int ReadArrayLen( );
+
+ /// <summary>
+ /// Read a 16-bit integer from the stream.
+ /// </summary>
+ System::Int16 ReadInt16( );
+
+ /// <summary>
+ /// Read a 32-bit integer from the stream.
+ /// </summary>
+ System::Int32 ReadInt32( );
+
+ /// <summary>
+ /// Read a 64-bit integer from the stream.
+ /// </summary>
+ System::Int64 ReadInt64( );
+
+ /// <summary>
+ /// Read a floating point number from the stream.
+ /// </summary>
+ float ReadFloat( );
+
+ /// <summary>
+ /// Read a double precision number from the stream.
+ /// </summary>
+ double ReadDouble( );
+
+ /// <summary>
+ /// Read a string after java-modified UTF-8 decoding from the stream.
+ /// The maximum length supported is 2^16-1 beyond which the string
+ /// shall be truncated.
+ /// </summary>
+ String^ ReadUTF( );
+
+ /// <summary>
+ /// Read a string after java-modified UTF-8 decoding from the stream.
+ /// </summary>
+ String^ ReadUTFHuge( );
+
+ /// <summary>
+ /// Read a ASCII string from the stream. Where size is more than 2^16-1
+ /// </summary>
+ String^ ReadASCIIHuge( );
+
+ /// <summary>
+ /// Read a serializable object from the data. Null objects are handled.
+ /// </summary>
+ Object^ ReadObject( );
+
+ /// <summary>
+ /// Get the count of bytes that have been read from the stream.
+ /// </summary>
+ property System::UInt32 BytesRead
+ {
+ System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// Get the count of bytes that are remaining in the buffer.
+ /// </summary>
+ property System::UInt32 BytesRemaining
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Advance the cursor of the buffer by the given offset.
+ /// </summary>
+ /// <param name="offset">
+ /// The offset(number of bytes) by which to advance the cursor.
+ /// </param>
+ void AdvanceCursor( System::Int32 offset );
+
+ /// <summary>
+ /// Rewind the cursor of the buffer by the given offset.
+ /// </summary>
+ /// <param name="offset">
+ /// The offset(number of bytes) by which to rewind the cursor.
+ /// </param>
+ void RewindCursor( System::Int32 offset );
+
+ /// <summary>
+ /// Reset the cursor to the start of buffer.
+ /// </summary>
+ void Reset();
+
+ /// <summary>
+ /// Read a dictionary from the stream in a given dictionary instance.
+ /// </summary>
+ /// <param name="dictionary">Object which implements System::Collections::IDictionary interface.</param>
+ void ReadDictionary(System::Collections::IDictionary^ dictionary);
+
+ /// <summary>
+ /// Read a date from the stream.
+ /// </summary>
+ System::DateTime ReadDate( );
+
+ /// <summary>
+ /// Read a collection from the stream in a given collection instance.
+ /// </summary>
+ /// <param name="list">Object which implements System::Collections::IList interface.</param>
+ void ReadCollection(System::Collections::IList^ list);
+
+ /// <summary>
+ /// Read a char array from the stream.
+ /// </summary>
+ array<Char>^ ReadCharArray( );
+
+ /// <summary>
+ /// Read a bool array from the stream.
+ /// </summary>
+ array<bool>^ ReadBooleanArray( );
+
+ /// <summary>
+ /// Read a short int array from the stream.
+ /// </summary>
+ array<Int16>^ ReadShortArray( );
+
+ /// <summary>
+ /// Read a int array from the stream.
+ /// </summary>
+ array<Int32>^ ReadIntArray();
+
+ /// <summary>
+ /// Read a long array from the stream.
+ /// </summary>
+ array<Int64>^ ReadLongArray();
+
+ /// <summary>
+ /// Read a float array from the stream.
+ /// </summary>
+ array<float>^ ReadFloatArray();
+
+ /// <summary>
+ /// Read a double array from the stream.
+ /// </summary>
+ array<double>^ ReadDoubleArray();
+
+ /// <summary>
+ /// Read a object array from the stream from the stream.
+ /// </summary>
+ List<Object^>^ ReadObjectArray();
+
+ /// <summary>
+ /// Read a array of signed byte array from the stream.
+ /// </summary>
+ array<array<Byte>^>^ ReadArrayOfByteArrays( );
+
+ internal:
+
+ native::DataInput* GetNative()
+ {
+ return m_nativeptr->get();
+ }
+
+ void setPdxdeserialization(bool val)
+ {
+ m_ispdxDesrialization = true;
+ }
+ bool isRootObjectPdx()
+ {
+ return m_isRootObjectPdx;
+ }
+ void setRootObjectPdx(bool val)
+ {
+ m_isRootObjectPdx = val;
+ }
+
+ Object^ readDotNetObjectArray();
+ System::Collections::Generic::IDictionary<Object^, Object^>^ ReadDictionary();
+
+ String^ ReadString();
+
+ const char * GetPoolName()
+ {
+ try
+ {
+ return m_nativeptr->get()->getPoolName();
+ }
+ finally {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ Object^ ReadDotNetTypes(int8_t typeId);
+
+ /// <summary>
+ /// Get the count of bytes that have been read from the stream, for internal use only.
+ /// </summary>
+ property System::UInt32 BytesReadInternally
+ {
+ System::UInt32 get( );
+ }
+
+ void ReadObject(bool% obj)
+ {
+ obj = ReadBoolean();
+ }
+
+ void ReadObject(Byte% obj)
+ {
+ obj = ReadByte();
+ }
+
+ void ReadObject(Char% obj)
+ {
+ obj = (Char)ReadUInt16();
+ }
+
+ inline Char decodeChar( )
+ {
+ Char retChar;
+ int b = m_buffer[ m_cursor++ ] & 0xff;
+ int k = b >> 5;
+ switch ( k )
+ {
+ default:
+ retChar = ( Char ) ( b & 0x7f );
+ break;
+ case 6:
+ {
+ // two byte encoding
+ // 110yyyyy 10xxxxxx
+ // use low order 6 bits
+ int y = b & 0x1f;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int x = m_buffer[ m_cursor++ ] & 0x3f;
+ // 00000yyy yyxxxxxx
+ retChar = ( Char ) ( y << 6 | x );
+ break;
+ }
+ case 7:
+ {
+ // three byte encoding
+ // 1110zzzz 10yyyyyy 10xxxxxx
+ //assert ( b & 0x10 )
+ // == 0 : "UTF8Decoder does not handle 32-bit characters";
+ // use low order 4 bits
+ int z = b & 0x0f;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int y = m_buffer[ m_cursor++ ] & 0x3f;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int x = m_buffer[ m_cursor++ ] & 0x3f;
+ // zzzzyyyy yyxxxxxx
+ int asint = ( z << 12 | y << 6 | x );
+ retChar = ( Char ) asint;
+ break;
+ }
+ }// end switch
+
+ return retChar;
+ }
+
+ System::Collections::Hashtable^ ReadHashtable()
+ {
+ int len = this->ReadArrayLen();
+
+ if(len == -1)
+ return nullptr;
+ else
+ {
+ System::Collections::Hashtable^ dict = gcnew System::Collections::Hashtable();
+ for(int i =0; i< len; i++)
+ {
+ Object^ key = this->ReadObject();
+ Object^ val = this->ReadObject();
+
+ dict->Add(key, val);
+ }
+ return dict;
+ }
+ }
+
+ /// <summary>
+ /// Read a byte from the stream.
+ /// </summary>
+ Byte ReadByte( );
+
+ /// <summary>
+ /// Read a 16-bit unsigned integer from the stream.
+ /// </summary>
+ System::UInt16 ReadUInt16( );
+
+ /// <summary>
+ /// Read a 32-bit unsigned integer from the stream.
+ /// </summary>
+ System::UInt32 ReadUInt32( );
+
+ /// <summary>
+ /// Read a 64-bit unsigned integer from the stream.
+ /// </summary>
+ System::UInt64 ReadUInt64( );
+
+ void ReadObject(Double% obj)
+ {
+ obj = ReadDouble();
+ }
+
+ void ReadObject(Single% obj)
+ {
+ obj = ReadFloat();
+ }
+
+ void ReadObject(System::Int16% obj)
+ {
+ obj = ReadInt16();
+ }
+
+ void ReadObject(System::Int32% obj)
+ {
+ obj = ReadInt32();
+ }
+
+ void ReadObject(System::Int64% obj)
+ {
+ obj = ReadInt64();
+ }
+
+ void ReadObject(array<SByte>^% obj)
+ {
+ obj = ReadSBytes();
+ }
+
+ void DataInput::ReadObject(array<UInt16>^% obj);
+ void DataInput::ReadObject(array<UInt32>^% obj);
+ void DataInput::ReadObject(array<UInt64>^% obj);
+
+ template <typename mType>
+ void ReadObject(array<mType>^ %objArray)
+ {
+ int arrayLen = ReadArrayLen();
+ if(arrayLen >= 0) {
+ objArray = gcnew array<mType>(arrayLen);
+
+ int i = 0;
+ for( i = 0; i < arrayLen; i++ ){
+ mType tmp;
+ ReadObject(tmp);
+ objArray[i] = tmp;
+ }
+ }
+ }
+
+ array<String^>^ ReadStringArray()
+ {
+ int len = this->ReadArrayLen();
+ if ( len == -1)
+ {
+ return nullptr;
+ }
+ else
+ {
+ array<String^>^ ret = gcnew array<String^>(len);
+ if (len > 0)
+ {
+ for( int i = 0; i < len; i++)
+ {
+ Object^ obj = this->ReadObject();
+ if(obj != nullptr)
+ ret[i] = static_cast<String^>(obj);
+ else
+ ret[i] = nullptr;
+ }
+ }
+ return ret;
+ }
+ }
+
+ System::Byte* GetCursor()
+ {
+ return m_buffer + m_cursor;
+ }
+
+ System::Byte* GetBytes(System::Byte* src, System::UInt32 size)
+ {
+ try
+ {
+ return m_nativeptr->get()->getBufferCopyFrom(src, size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+
+ void AdvanceUMCursor()
+ {
+ try {
+ m_nativeptr->get()->advanceCursor(m_cursor);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ m_cursor = 0;
+ m_bufferLength = 0;
+ }
+
+ void AdvanceCursorPdx(int offset)
+ {
+ m_cursor += offset;
+ }
+
+ void RewindCursorPdx(int rewind)
+ {
+ m_cursor = 0;
+ }
+
+ void ResetAndAdvanceCursorPdx(int offset)
+ {
+ m_cursor = offset;
+ }
+
+ void ResetPdx(int offset)
+ {
+ try
+ {
+ m_nativeptr->get()->reset(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ SetBuffer();
+ }
+
+ inline array<Byte>^ ReadReverseBytesOnly(int len);
+
+ void SetBuffer()
+ {
+ try
+ {
+ m_buffer = const_cast<System::Byte*> (m_nativeptr->get()->currentBufferPosition());
+ m_cursor = 0;
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ String^ DecodeBytes(int length)
+ {
+ //array<Char>^ output = gcnew array<Char>(length);
+
+ if(m_forStringDecode->Length < length)
+ m_forStringDecode = gcnew array<Char>(length);
+ // index input[]
+ int i = 0;
+ // index output[]
+ int j = 0;
+ while ( i < length )
+ {
+ // get next byte unsigned
+ //Byte b = m_buffer[ m_cursor++ ] & 0xff;
+ Byte b = ReadByte();
+ i++;
+ Byte k = b >> 5;
+ // classify based on the high order 3 bits
+ switch ( k )
+ {
+ default:
+ // one byte encoding
+ // 0xxxxxxx
+ // use just low order 7 bits
+ // 00000000 0xxxxxxx
+ m_forStringDecode[ j++ ] = ( Char ) ( b & 0x7f );
+ break;
+ case 6:
+ {
+ // two byte encoding
+ // 110yyyyy 10xxxxxx
+ // use low order 6 bits
+ int y = b & 0x1f;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int x = m_buffer[ m_cursor++ ] & 0x3f;
+ i++;
+ // 00000yyy yyxxxxxx
+ m_forStringDecode[ j++ ] = ( Char ) ( y << 6 | x );
+ break;
+ }
+ case 7:
+ {
+ // three byte encoding
+ // 1110zzzz 10yyyyyy 10xxxxxx
+ //assert ( b & 0x10 )
+ // == 0 : "UTF8Decoder does not handle 32-bit characters";
+ // use low order 4 bits
+ int z = b & 0x0f;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int y = m_buffer[ m_cursor++ ] & 0x3f;
+ i++;
+ // use low order 6 bits of the next byte
+ // It should have high order bits 10, which we don't check.
+ int x = m_buffer[ m_cursor++ ] & 0x3f;
+ i++;
+ // zzzzyyyy yyxxxxxx
+ int asint = ( z << 12 | y << 6 | x );
+ m_forStringDecode[ j++ ] = ( Char ) asint;
+ break;
+ }
+ }// end switch
+ }// end while
+
+ String^ str = gcnew String(m_forStringDecode, 0, j);
+ return str;
+ }
+
+ void CheckBufferSize(int size);
+
+
+ Object^ ReadInternalGenericObject();
+
+ Object^ ReadInternalObject();
+
+ DataInput^ GetClone();
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline DataInput( apache::geode::client::DataInput* nativeptr, bool managedObject, const native::Cache* cache )
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(nativeptr);
+ m_ispdxDesrialization = false;
+ m_isRootObjectPdx = false;
+ m_cache = cache;
+ m_cursor = 0;
+ m_isManagedObject = managedObject;
+ m_forStringDecode = gcnew array<Char>(100);
+ m_buffer = const_cast<System::Byte*>(nativeptr->currentBufferPosition());
+ if ( m_buffer != NULL) {
+ m_bufferLength = nativeptr->getBytesRemaining();
+ }
+ else {
+ m_bufferLength = 0;
+ }
+ }
+
+ DataInput( System::Byte* buffer, int size, const native::Cache* cache );
+
+ bool IsManagedObject()
+ {
+ return m_isManagedObject;
+ }
+
+ int GetPdxBytes()
+ {
+ return m_bufferLength;
+ }
+
+ private:
+
+ /// <summary>
+ /// Internal buffer managed by the class.
+ /// This is freed in the disposer/destructor.
+ /// </summary>
+ bool m_ispdxDesrialization;
+ bool m_isRootObjectPdx;
+ const native::Cache* m_cache;
+ System::Byte* m_buffer;
+ unsigned int m_bufferLength;
+ int m_cursor;
+ bool m_isManagedObject;
+ array<Char>^ m_forStringDecode;
+
+ native_conditional_unique_ptr<native::DataInput>^ m_nativeptr;
+
+ void Cleanup( );
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[36/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientPoolTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientPoolTestsN.cs b/clicache/integration-test/ThinClientPoolTestsN.cs
new file mode 100644
index 0000000..32e0d5e
--- /dev/null
+++ b/clicache/integration-test/ThinClientPoolTestsN.cs
@@ -0,0 +1,901 @@
+/*
+ * 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.Collections.Generic;
+using System.IO;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ [TestFixture]
+ [Category("group2")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientPoolTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ bool checkPoolAttributes
+ (
+ Client.Pool pool,
+ string[] locators,
+ string[] servers,
+ int freeConnectionTimeout,
+ int loadConditioningInterval,
+ int minConnections,
+ int maxConnections,
+ int retryAttempts,
+ int idleTimeout,
+ int pingInterval,
+ string name,
+ int readTimeout,
+ string serverGroup,
+ int socketBufferSize,
+ bool subscriptionEnabled,
+ int subscriptionMessageTrackingTimeout,
+ int subscriptionAckInterval,
+ int subscriptionRedundancy,
+ int statisticInterval,
+ int threadLocalConnections,
+ bool prSingleHopEnabled,
+ int updateLocatorListInterval
+ )
+ {
+ if (pool == null)
+ {
+ Util.Log("checkPoolAttributes: pool is null");
+ return false;
+ }
+ Util.Log("checkPoolAttributes: Checking pool " + pool.Name);
+ if (!pool.Name.Equals(name))
+ {
+ Util.Log("checkPoolAttributes: Pool name expected [{0}], actual [{1}]", name, pool.Name);
+ return false;
+ }
+ if (!Util.CompareArrays(locators, pool.Locators))
+ {
+ Util.Log("checkPoolAttributes: locator list mismatch");
+ return false;
+ }
+ if (servers != null && !Util.CompareArrays(servers, pool.Servers))
+ {
+ Util.Log("checkPoolAttributes: server list mismatch");
+ return false;
+ }
+ if (freeConnectionTimeout != pool.FreeConnectionTimeout)
+ {
+ Util.Log("checkPoolAttributes: FreeConnectionTimeout expected {0}, actual {1}",
+ freeConnectionTimeout, pool.FreeConnectionTimeout);
+ return false;
+ }
+ if (loadConditioningInterval != pool.LoadConditioningInterval)
+ {
+ Util.Log("checkPoolAttributes: LoadConditioningInterval expected {0}, actual {1}",
+ loadConditioningInterval, pool.LoadConditioningInterval);
+ return false;
+ }
+ if (minConnections != pool.MinConnections)
+ {
+ Util.Log("checkPoolAttributes: MinConnections expected {0}, actual {1}",
+ minConnections, pool.MinConnections);
+ return false;
+ }
+ if (maxConnections != pool.MaxConnections)
+ {
+ Util.Log("checkPoolAttributes: MaxConnections expected {0}, actual {1}",
+ maxConnections, pool.MaxConnections);
+ return false;
+ }
+ if (retryAttempts != pool.RetryAttempts)
+ {
+ Util.Log("checkPoolAttributes: RetryAttempts expected {0}, actual {1}",
+ retryAttempts, pool.RetryAttempts);
+ return false;
+ }
+ if (idleTimeout != pool.IdleTimeout)
+ {
+ Util.Log("checkPoolAttributes: IdleTimeout expected {0}, actual {1}",
+ idleTimeout, pool.IdleTimeout);
+ return false;
+ }
+ if (pingInterval != pool.PingInterval)
+ {
+ Util.Log("checkPoolAttributes: PingInterval expected {0}, actual {1}",
+ pingInterval, pool.PingInterval);
+ return false;
+ }
+ if (readTimeout != pool.ReadTimeout)
+ {
+ Util.Log("checkPoolAttributes: ReadTimeout expected {0}, actual {1}",
+ readTimeout, pool.ReadTimeout);
+ return false;
+ }
+ if (!serverGroup.Equals(pool.ServerGroup))
+ {
+ Util.Log("checkPoolAttributes: ServerGroup expected {0}, actual {1}",
+ serverGroup, pool.ServerGroup);
+ return false;
+ }
+ if (socketBufferSize != pool.SocketBufferSize)
+ {
+ Util.Log("checkPoolAttributes: SocketBufferSize expected {0}, actual {1}",
+ socketBufferSize, pool.SocketBufferSize);
+ return false;
+ }
+ if (subscriptionEnabled != pool.SubscriptionEnabled)
+ {
+ Util.Log("checkPoolAttributes: SubscriptionEnabled expected {0}, actual {1}",
+ subscriptionEnabled, pool.SubscriptionEnabled);
+ return false;
+ }
+ if (subscriptionMessageTrackingTimeout != pool.SubscriptionMessageTrackingTimeout)
+ {
+ Util.Log("checkPoolAttributes: SubscriptionMessageTrackingTimeout expected {0}, actual {1}",
+ subscriptionMessageTrackingTimeout, pool.SubscriptionMessageTrackingTimeout);
+ return false;
+ }
+ if (subscriptionAckInterval != pool.SubscriptionAckInterval)
+ {
+ Util.Log("checkPoolAttributes: SubscriptionAckInterval expected {0}, actual {1}",
+ subscriptionAckInterval, pool.SubscriptionAckInterval);
+ return false;
+ }
+ if (subscriptionRedundancy != pool.SubscriptionRedundancy)
+ {
+ Util.Log("checkPoolAttributes: SubscriptionRedundancy expected {0}, actual {1}",
+ subscriptionRedundancy, pool.SubscriptionRedundancy);
+ return false;
+ }
+ if (statisticInterval != pool.StatisticInterval)
+ {
+ Util.Log("checkPoolAttributes: StatisticInterval expected {0}, actual {1}",
+ statisticInterval, pool.StatisticInterval);
+ return false;
+ }
+ if (prSingleHopEnabled != pool.PRSingleHopEnabled)
+ {
+ Util.Log("checkPoolAttributes: PRSingleHopEnabled expected {0}, actual {1}",
+ prSingleHopEnabled, pool.PRSingleHopEnabled);
+ return false;
+ }
+ if (updateLocatorListInterval != pool.UpdateLocatorListInterval)
+ {
+ Util.Log("checkPoolAttributes: updateLocatorListInterval expected {0}, actual {1}",
+ updateLocatorListInterval, pool.UpdateLocatorListInterval);
+ return false;
+ }
+ /* TODO: Enable this check when available
+ if (threadLocalConnections != pool.ThreadLocalConnections)
+ {
+ Util.Log("checkPoolAttributes: ThreadLocalConnections expected {0}, actual {1}",
+ threadLocalConnections, pool.ThreadLocalConnections);
+ return false;
+ }
+ * */
+ Util.Log("checkPoolAttributes: Checked pool: OK");
+ return true;
+ }
+
+ public void runPoolXmlCreation()
+ {
+ string xmlLocation = CacheHelper.TestDir + Path.DirectorySeparatorChar + "valid_cache_pool.xml";
+
+ string duplicateXMLFile = Util.Rand(3432898).ToString() + "valid_cache_pool.xml";
+ CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
+ xmlLocation = duplicateXMLFile;
+
+ Cache cache = CacheFactory.CreateCacheFactory()
+ .Set("cache-xml-file", xmlLocation)
+ .Create();
+
+ Region[] rootRegions = cache.RootRegions<object, object>();
+ Assert.AreEqual(2, rootRegions.Length);
+
+ ICollection<IRegion<object, object>> subRegionsCol = rootRegions[0].SubRegions(true);
+ Region[] subRegions = new Region[subRegionsCol.Count];
+ subRegionsCol.CopyTo(subRegions, 0);
+ Assert.AreEqual(1, subRegions.Length);
+
+ ICollection<IRegion<object, object>> subRegions2Col = rootRegions[1].SubRegions(true);
+ Region[] subRegions2 = new Region[subRegions2Col.Count];
+ subRegions2Col.CopyTo(subRegions2, 0);
+ Assert.AreEqual(0, subRegions2.Length);
+
+ string poolNameRegion1 = rootRegions[0].Attributes.PoolName;
+ string poolNameRegion2 = rootRegions[1].Attributes.PoolName;
+ string poolNameSubRegion = subRegions[0].Attributes.PoolName;
+
+ Assert.AreEqual("test_pool_1", poolNameRegion1);
+ Assert.AreEqual("test_pool_2", poolNameRegion2);
+ Assert.AreEqual("test_pool_2", poolNameSubRegion);
+
+ Pool poolOfRegion1 = CacheHelper.DCache.GetPoolManager().Find(poolNameRegion1);
+ Pool poolOfRegion2 = CacheHelper.DCache.GetPoolManager().Find(poolNameRegion2);
+ Pool poolOfSubRegion = CacheHelper.DCache.GetPoolManager().Find(poolNameSubRegion);
+
+ string[] locators = new string[1] { "localhost:" + CacheHelper.LOCATOR_PORT_1 };
+ string[] servers = new string[2] { "localhost:" + CacheHelper.HOST_PORT_1, "localhost:" + CacheHelper.HOST_PORT_2 };
+
+ // ARB:
+ // TODO: check if server list contains the two endpoints (currently using null argument for servers list)
+ bool check1 = checkPoolAttributes(poolOfRegion1, locators, null, 12345, 23456, 3, 7, 3, 5555, 12345,
+ "test_pool_1", 23456, "ServerGroup1", 32768, true, 900123, 567, 0, 10123, 5, true, 250001);
+
+ bool check2 = checkPoolAttributes(poolOfRegion2, null, servers, 23456, 34567, 2, 8, 5, 6666, 23456,
+ "test_pool_2", 34567, "ServerGroup2", 65536, false, 800222, 678, 1, 20345, 3, false, 5000);
+
+ bool check3 = checkPoolAttributes(poolOfSubRegion, null, servers, 23456, 34567, 2, 8, 5, 6666, 23456,
+ "test_pool_2", 34567, "ServerGroup2", 65536, false, 800222, 678, 1, 20345, 3, false, 5000);
+
+ Assert.IsTrue(check1, "Attribute check 1 failed");
+ Assert.IsTrue(check2, "Attribute check 2 failed");
+ Assert.IsTrue(check3, "Attribute check 3 failed");
+
+ cache.Close();
+ try
+ {
+ Util.Log("Testing invalid_cache_pool.xml");
+ xmlLocation = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_cache_pool.xml";
+ duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool.xml";
+ CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
+ xmlLocation = duplicateXMLFile;
+ cache = CacheFactory.CreateCacheFactory()
+ .Set("cache-xml-file", xmlLocation)
+ .Create();
+ Assert.Fail("invalid_cache_pool.xml did not throw exception");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Expected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+
+ try
+ {
+ Util.Log("Testing invalid_cache_pool2.xml");
+ xmlLocation = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_cache_pool2.xml";
+ duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool2.xml";
+ CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
+ xmlLocation = duplicateXMLFile;
+ cache = CacheFactory.CreateCacheFactory()
+ .Set("cache-xml-file", xmlLocation)
+ .Create();
+ Assert.Fail("invalid_cache_pool2.xml did not throw exception");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Expected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+
+ try
+ {
+ Util.Log("Testing invalid_cache_pool3.xml");
+ xmlLocation = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_cache_pool3.xml";
+ duplicateXMLFile = "invalid_cache_pool3.xml";
+ CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
+ xmlLocation = duplicateXMLFile;
+ cache = CacheFactory.CreateCacheFactory()
+ .Set("cache-xml-file", xmlLocation)
+ .Create();
+ Assert.Fail("invalid_cache_pool3.xml did not throw exception");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Expected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+
+ try
+ {
+ Util.Log("Testing invalid_cache_pool4.xml");
+ xmlLocation = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_cache_pool4.xml";
+ duplicateXMLFile = Util.Rand(3432898).ToString() + "invalid_cache_pool4.xml";
+ CacheHelper.createDuplicateXMLFile(xmlLocation, duplicateXMLFile);
+ xmlLocation = duplicateXMLFile;
+ cache = CacheFactory.CreateCacheFactory()
+ .Set("cache-xml-file", xmlLocation)
+ .Create();
+ Assert.Fail("invalid_cache_pool4.xml did not throw exception");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Expected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+
+ }
+
+ public void createPoolAndTestAttrs(string poolName)
+ {
+ CacheHelper.Init();
+
+ PoolFactory factory = CacheHelper.DCache.GetPoolManager().CreateFactory();
+ factory.SetFreeConnectionTimeout(10000);
+ factory.SetLoadConditioningInterval(1);
+ factory.SetSocketBufferSize(1024);
+ factory.SetReadTimeout(10);
+ factory.SetMinConnections(2);
+ factory.SetMaxConnections(5);
+ factory.SetIdleTimeout(5);
+ factory.SetRetryAttempts(5);
+ factory.SetPingInterval(1);
+ factory.SetUpdateLocatorListInterval(122000);
+ factory.SetStatisticInterval(1);
+ factory.SetServerGroup("ServerGroup1");
+ factory.SetSubscriptionEnabled(true);
+ factory.SetSubscriptionRedundancy(1);
+ factory.SetSubscriptionMessageTrackingTimeout(5);
+ factory.SetSubscriptionAckInterval(1);
+ factory.AddLocator("localhost", CacheHelper.LOCATOR_PORT_1);
+ factory.SetPRSingleHopEnabled(false);
+
+ Pool pool = factory.Create(poolName, CacheHelper.DCache);
+
+ Assert.AreEqual(10000, pool.FreeConnectionTimeout, "FreeConnectionTimeout");
+ Assert.AreEqual(1, pool.LoadConditioningInterval, "LoadConditioningInterval");
+ Assert.AreEqual(1024, pool.SocketBufferSize, "SocketBufferSize");
+ Assert.AreEqual(10, pool.ReadTimeout, "ReadTimeout");
+ Assert.AreEqual(2, pool.MinConnections, "MinConnections");
+ Assert.AreEqual(5, pool.MaxConnections, "MaxConnections");
+ Assert.AreEqual(5, pool.IdleTimeout, "IdleTimeout");
+ Assert.AreEqual(5, pool.RetryAttempts, "RetryAttempts");
+ Assert.AreEqual(1, pool.PingInterval, "PingInterval");
+ Assert.AreEqual(122000, pool.UpdateLocatorListInterval, "UpdateLocatorListInterval");
+ Assert.AreEqual(1, pool.StatisticInterval, "StatisticInterval");
+ Assert.AreEqual("ServerGroup1", pool.ServerGroup, "ServerGroup");
+ Assert.AreEqual(true, pool.SubscriptionEnabled, "SubscriptionEnabled");
+ Assert.AreEqual(1, pool.SubscriptionRedundancy, "SubscriptionRedundancy");
+ Assert.AreEqual(5, pool.SubscriptionMessageTrackingTimeout, "SubscriptionMessageTrackingTimeout");
+ Assert.AreEqual(1, pool.SubscriptionAckInterval, "SubscriptionAckInterval");
+ Assert.AreEqual(false, pool.PRSingleHopEnabled, "PRSingleHopEnabled");
+ }
+
+ public void testPoolAttrs(string poolName)
+ {
+ string xmlFile = CacheHelper.TestDir + Path.DirectorySeparatorChar + "cacheserver_pool_client.xml";
+ string duplicateXMLFile = Util.Rand(3432898).ToString() + "cacheserver_pool_client.xml";
+ CacheHelper.createDuplicateXMLFile(xmlFile, duplicateXMLFile);
+ xmlFile = duplicateXMLFile;
+ Properties<string, string> config = Properties<string, string>.Create<string, string>();
+ config.Insert("cache-xml-file", xmlFile);
+ CacheHelper.InitConfig(config);
+
+ Pool pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
+
+ Assert.AreEqual("clientPool", pool.Name, "Pool Name");
+ Assert.AreEqual(10000, pool.FreeConnectionTimeout, "FreeConnectionTimeout");
+ Assert.AreEqual(1, pool.LoadConditioningInterval, "LoadConditioningInterval");
+ Assert.AreEqual(1024, pool.SocketBufferSize, "SocketBufferSize");
+ Assert.AreEqual(10, pool.ReadTimeout, "ReadTimeout");
+ Assert.AreEqual(2, pool.MinConnections, "MinConnections");
+ Assert.AreEqual(5, pool.MaxConnections, "MaxConnections");
+ Assert.AreEqual(5, pool.IdleTimeout, "IdleTimeout");
+ Assert.AreEqual(5, pool.RetryAttempts, "RetryAttempts");
+ Assert.AreEqual(1, pool.PingInterval, "PingInterval");
+ Assert.AreEqual(25000, pool.UpdateLocatorListInterval, "UpdateLocatorListInterval");
+ Assert.AreEqual(1, pool.StatisticInterval, "StatisticInterval");
+ Assert.AreEqual("ServerGroup1", pool.ServerGroup, "ServerGroup");
+ Assert.AreEqual(true, pool.SubscriptionEnabled, "SubscriptionEnabled");
+ Assert.AreEqual(1, pool.SubscriptionRedundancy, "SubscriptionRedundancy");
+ Assert.AreEqual(5, pool.SubscriptionMessageTrackingTimeout, "SubscriptionMessageTrackingTimeout");
+ Assert.AreEqual(1, pool.SubscriptionAckInterval, "SubscriptionAckInterval");
+ Assert.AreEqual(false, pool.PRSingleHopEnabled, "PRSingleHopEnabled");
+ }
+
+ public void testExistingPool(string poolName)
+ {
+ PoolFactory factory = CacheHelper.DCache.GetPoolManager().CreateFactory();
+ try
+ {
+ factory.Create(poolName, CacheHelper.DCache);
+ Assert.Fail("Did not get expected IllegalStateException");
+ }
+ catch (IllegalStateException /*excp*/)
+ {
+ Util.Log("Got expected IllegalStateException");
+ }
+ catch (Exception excp)
+ {
+ Assert.Fail("Got unexpected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+ }
+
+ public void createRegionAndAttachPool(string regionName, string poolName)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, null, poolName, false);
+ }
+
+ public void testPoolLevels()
+ {
+ // Currently we do not have a way to get CacheImpl test helpers in C#
+ Util.Log("testPoolLevels: Currently we do not have a way to get CacheImpl test helpers in C#");
+
+ // Step 1: Check pool level == min
+
+ // Step 2: Spawn multiple threads doing ops
+
+ // Step 3: Check pool level == max since threads are active.
+
+ // Step 4: Wait for pool.IdleTimeout to pass.
+
+ // Step 5: Check pool level again == min.
+
+ return;
+ }
+
+ void runPoolAttributes()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pool.xml", "cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client1.Call(createPoolAndTestAttrs, "__TEST_POOL1__");
+ m_client1.Call(testExistingPool, "__TEST_POOL1__");
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion1", "__TEST_POOL1__");
+
+ m_client2.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client2.Call(testPoolAttrs, "clientPool");
+
+ m_client1.Call(testPoolLevels);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void createPooledRegion(string regionName, string poolName, string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, locators, poolName, false);
+ }
+
+ public void createPooledRegionWithNotification(string regionName, string poolName, string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, locators, poolName, true);
+ }
+
+ public void createPool(string name, string locators, string serverGroup,
+ int redundancy, bool subscription)
+ {
+ CacheHelper.CreatePool<object, object>(name, locators, serverGroup, redundancy, subscription);
+ }
+
+ public void checkLocators1()
+ {
+ try
+ {
+ InvalidateEntry(RegionName, m_keys[1]);
+ UpdateEntry(RegionName, m_keys[0], m_vals[0], false);
+ Assert.Fail("Did not get expected NotConnectedException");
+ }
+ catch (NotConnectedException /*excp*/)
+ {
+ Util.Log("Got expected NotConnectedException");
+ }
+ }
+
+ public void checkLocators2()
+ {
+ try
+ {
+ InvalidateEntry(RegionName, m_keys[0]);
+ UpdateEntry(RegionName, m_keys[1], m_vals[1], false);
+ Assert.Fail("Did not get expected NotConnectedException with cause NoAvailableLocatorsException");
+ }
+ catch (NotConnectedException excp)
+ {
+ if (excp.InnerException is NoAvailableLocatorsException)
+ {
+ Util.Log("Got expected NoAvailableLocatorsException");
+ }
+ else
+ {
+ Assert.Fail("Did not get expected NotConnectedException with cause NoAvailableLocatorsException");
+ }
+ }
+ }
+
+ void runPoolLocator()
+ {
+ CacheHelper.createRandomPorts();
+ string locators = "localhost:" + (CacheHelper.LOCATOR_PORT_1);
+ locators = locators + ",localhost:" + (CacheHelper.LOCATOR_PORT_2);
+ m_client1.Call(createPooledRegion, RegionName, "Pool1", locators.Split(',')[0]);
+ m_client2.Call(createPooledRegion, RegionName, "Pool2", locators.Split(',')[0]);
+
+ m_client1.Call(createPooledRegionWithNotification, RegionNames[1], "Pool3", locators.Split(',')[0]);
+ m_client2.Call(createPooledRegionWithNotification, RegionNames[1], "Pool3", locators.Split(',')[0]);
+
+ m_client1.Call(CreateEntryWithLocatorException, RegionName, m_keys[0], m_vals[0]);
+ m_client1.Call(CreateEntryWithLocatorException, RegionNames[1], m_keys[0], m_vals[0]);
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaLocator(2, "GFELOC2");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+
+ m_client1.Call(CreateEntry, RegionName, m_keys[0], m_vals[0]);
+ m_client2.Call(DoNetsearch, RegionName, m_keys[0], m_vals[0], true);
+ m_client2.Call(CreateEntry, RegionName, m_keys[1], m_vals[1]);
+
+ m_client1.Call(CreateEntry, RegionNames[1], m_keys[0], m_vals[0]);
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 2);
+ CacheHelper.StopJavaServer(1);
+
+ m_client2.Call(DoNetsearch, RegionNames[1], m_keys[0], m_vals[0], false);
+
+ m_client1.Call(DoNetsearch, RegionName, m_keys[1], m_vals[1], true);
+ m_client1.Call(UpdateEntry, RegionName, m_keys[0], m_nvals[0], true);
+
+ m_client2.Call(InvalidateEntry, RegionName, m_keys[0]);
+ m_client2.Call(DoNetsearch, RegionName, m_keys[0], m_nvals[0], false);
+ m_client2.Call(UpdateEntry, RegionName, m_keys[1], m_nvals[1], true);
+
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StopJavaServer(2);
+
+ m_client1.Call(checkLocators1);
+
+ CacheHelper.StopJavaLocator(2);
+ m_client2.Call(checkLocators2);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void checkCacheServerException(string region, string key, string val)
+ {
+ try
+ {
+ CreateEntry(region, key, val);
+ Assert.Fail("Did not get expected RegionNotFoundException");
+ }
+ catch (CacheServerException excp)
+ {
+ Util.Log("Got expected {0}: {1}", excp.GetType().Name, excp.Message);
+ }
+ }
+
+ void runPoolServer()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pool.xml", "cacheserver2_pool.xml", "cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, "ServerGroup1", 0, false);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion1", "__TEST_POOL1__");
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion2", "__TEST_POOL1__");
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion3", "__TEST_POOL1__");
+
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, false);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion1", "__TEST_POOL1__");
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion2", "__TEST_POOL1__");
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion3", "__TEST_POOL1__");
+
+ m_client1.Call(CreateEntry, "PoolRegion1", m_keys[0], m_vals[0]);
+
+ m_client1.Call(checkCacheServerException, "PoolRegion2", m_keys[0], m_vals[0]);
+
+ m_client2.Call(CreateEntry, "PoolRegion1", m_keys[0], m_vals[0]);
+ m_client2.Call(CreateEntry, "PoolRegion2", m_keys[0], m_vals[0]);
+
+ m_client2.Call(checkCacheServerException, "PoolRegion3", m_keys[0], m_vals[0]);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ CacheHelper.StopJavaServer(3);
+
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void feedEntries(int keyIndex, bool newValue, bool update)
+ {
+ if (!update)
+ {
+ CreateEntry("PoolRegion1", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ CreateEntry("PoolRegion2", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ CreateEntry("PoolRegion3", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ }
+ else
+ {
+ UpdateEntry("PoolRegion1", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ UpdateEntry("PoolRegion2", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ UpdateEntry("PoolRegion3", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ }
+ }
+
+ public void verifyEntries(int keyIndex, bool netSearch, bool newValue)
+ {
+ if (!netSearch)
+ {
+ VerifyEntry("PoolRegion1", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ VerifyEntry("PoolRegion2", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ VerifyEntry("PoolRegion3", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex]);
+ }
+ else
+ {
+ DoNetsearch("PoolRegion1", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ DoNetsearch("PoolRegion2", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ DoNetsearch("PoolRegion3", m_keys[keyIndex], newValue ? m_nvals[keyIndex] : m_vals[keyIndex], false);
+ }
+ }
+
+ public void verifyEntries2()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>("PoolRegion3");
+ string cKey = m_keys[1];
+
+ string cVal = (string)region[cKey];
+
+ Assert.IsNotNull(cVal, "Value should not be null.");
+ if (cVal != m_nvals[1])
+ return;//ServerGroup2 is no more up
+
+ Assert.Fail("Looks like value from ServerGroup2 found, even no server is up");
+ }
+
+ public void registerAllKeys()
+ {
+ Region region1 = CacheHelper.GetVerifyRegion<object, object>("PoolRegion1");
+ region1.GetSubscriptionService().RegisterAllKeys(false, null, true);
+ Region region2 = CacheHelper.GetVerifyRegion<object, object>("PoolRegion2");
+ region2.GetSubscriptionService().RegisterAllKeys(false, null, true);
+ Region region3 = CacheHelper.GetVerifyRegion<object, object>("PoolRegion3");
+ region3.GetSubscriptionService().RegisterAllKeys(false, null, true);
+ }
+
+ void runPoolRedundancy()
+ {
+ for (int runIndex = 0; runIndex < 2; runIndex++)
+ {
+ CacheHelper.SetupJavaServers(true, "CacheServPoolRedun1.xml", "CacheServPoolRedun2.xml",
+ "CacheServPoolRedun3.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client2.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+
+ if (runIndex == 0)
+ {
+ m_client1.Call(createPool, "Pool1", CacheHelper.Locators, "ServerGroup1", 2, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion1", "Pool1");
+ m_client1.Call(createPool, "Pool2", CacheHelper.Locators, "ServerGroup1", 1, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion2", "Pool2");
+ m_client1.Call(createPool, "Pool3", CacheHelper.Locators, "ServerGroup1", 0, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion3", "Pool3");
+ m_client1.Call(feedEntries, 0, false, false);
+ m_client1.Call(registerAllKeys);
+
+ m_client2.Call(createPool, "Pool1", CacheHelper.Locators, (string)null, 2, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion1", "Pool1");
+ m_client2.Call(createPool, "Pool2", CacheHelper.Locators, (string)null, 1, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion2", "Pool2");
+ m_client2.Call(createPool, "Pool3", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion3", "Pool3");
+ m_client2.Call(feedEntries, 1, false, false);
+ m_client2.Call(registerAllKeys);
+ m_client2.Call(verifyEntries, 0, true, false);
+ }
+ else
+ {
+ m_client1.Call(createPool, "Pool1", CacheHelper.Locators, "ServerGroup1", 2, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion1", "Pool1");
+ m_client1.Call(createPool, "Pool2", CacheHelper.Locators, "ServerGroup2", 1, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion2", "Pool2");
+ m_client1.Call(createPool, "Pool3", CacheHelper.Locators, "ServerGroup3", 0, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion3", "Pool3");
+ m_client1.Call(feedEntries, 0, false, false);
+ m_client1.Call(registerAllKeys);
+
+ m_client2.Call(createPool, "Pool1", CacheHelper.Locators, (string)null, 2, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion1", "Pool1");
+ m_client2.Call(createPool, "Pool2", CacheHelper.Locators, (string)null, 1, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion2", "Pool2");
+ m_client2.Call(createPool, "Pool3", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createRegionAndAttachPool, "PoolRegion3", "Pool3");
+ m_client2.Call(feedEntries, 1, false, false);
+ m_client2.Call(registerAllKeys);
+ m_client2.Call(verifyEntries, 0, true, false);
+ }
+
+ m_client1.Call(verifyEntries, 1, false, false);
+
+ if (runIndex == 0)
+ {
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ }
+
+ /*CacheHelper.StopJavaServer(3);
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);*/
+
+ Thread.Sleep(20000);
+ m_client1.Call(feedEntries, 0, true, true);
+ m_client2.Call(verifyEntries, 0, false, true);
+ if (runIndex == 1)
+ {
+ CacheHelper.StopJavaServer(1);
+ }
+ Thread.Sleep(20000);
+ m_client2.Call(feedEntries, 1, true, true);
+ if (runIndex == 0)
+ m_client1.Call(verifyEntries, 1, false, true);
+ else
+ m_client1.Call(verifyEntries2);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ //CacheHelper.StopJavaServer(1);
+ if (runIndex == 1)
+ CacheHelper.StopJavaServer(2);
+ CacheHelper.StopJavaServer(3);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runPoolRegisterInterest()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pool.xml", "cacheserver3_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, "ServerGroup1", 0, true);
+ m_client1.Call(createRegionAndAttachPool, "PoolRegion1", "__TEST_POOL1__");
+ m_client1.Call(RegisterAllKeys, new string[] { "PoolRegion1" });
+
+ Util.Log("TODO: Code to check client notification connection with Server1 and not Server2");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region Tests
+
+ [Test]
+ public void PoolXmlCreation()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pool.xml", "cacheserver2_pool.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ // ARB:
+ // TODO: in validation, check if server list contains the two endpoints (currently using null argument for servers list)
+ // Following lines should be uncommented for checking the above.
+ //CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ //CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+
+ m_client1.Call(CacheHelper.setPorts, CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2, CacheHelper.HOST_PORT_3, CacheHelper.LOCATOR_PORT_1, CacheHelper.LOCATOR_PORT_2);
+ m_client1.Call(runPoolXmlCreation);
+
+ //CacheHelper.StopJavaServer(1);
+ //CacheHelper.StopJavaServer(2);
+ CacheHelper.StopJavaLocator(1);
+ }
+
+ [Test]
+ public void PoolAttributes()
+ {
+ runPoolAttributes();
+ }
+
+ [Test]
+ public void PoolLocator()
+ {
+ runPoolLocator();
+ }
+
+ [Test]
+ public void PoolServer()
+ {
+ runPoolServer();
+ }
+
+ [Test]
+ public void PoolRedundancy()
+ {
+ runPoolRedundancy();
+ }
+
+ [Test]
+ public void PoolRegisterInterest()
+ {
+ runPoolRegisterInterest();
+ }
+
+ #endregion
+ }
+}
[32/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientSecurityAuthTestsMUN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientSecurityAuthTestsMUN.cs b/clicache/integration-test/ThinClientSecurityAuthTestsMUN.cs
new file mode 100644
index 0000000..fe74b93
--- /dev/null
+++ b/clicache/integration-test/ThinClientSecurityAuthTestsMUN.cs
@@ -0,0 +1,716 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientSecurityAuthTestsMU : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private const string CacheXml1 = "cacheserver_notify_subscription.xml";
+ private const string CacheXml2 = "cacheserver_notify_subscription2.xml";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ void runValidCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("ValidCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("ValidCredentials: Using authenticator: " + authenticator);
+ Util.Log("ValidCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(1);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("ValidCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(2);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("ValidCredentials: For second client credentials: " +
+ credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, new Properties<string, string>(), true);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, new Properties<string, string>(), true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 10, credentials1, true);
+
+ // Verify that the puts succeeded
+ m_client2.Call(DoGetsMU, 10, credentials2, true);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("NoCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("NoCredentials: Using authenticator: " + authenticator);
+ Util.Log("NoCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(3);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 4, (Properties<string, string>)null, true, ExpectedResult.AuthFailedException);
+ m_client1.Call(DoPutsMU, 4, new Properties<string, string>(), true, ExpectedResult.AuthFailedException);
+
+ // Creating region on client2 should throw authentication
+ // required exception
+ /* m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ ExpectedResult.AuthRequiredException, true);
+ */
+ m_client1.Call(Close);
+ //m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("InvalidCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidCredentials: Using authenticator: " + authenticator);
+ Util.Log("InvalidCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(8);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("InvalidCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(7);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("InvalidCredentials: For second client credentials: " +
+ credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 4, credentials1, true);
+
+ // Creating region on client2 should throw authentication
+ // failure exception
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client2.Call(DoPutsMU, 4, credentials2, true, ExpectedResult.AuthFailedException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidAuthInit()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+
+ Util.Log("InvalidAuthInit: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidAuthInit: Using authenticator: " + authenticator);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Creating region on client1 with invalid authInit callback should
+ // throw authentication required exception
+ Properties<string, string> credentials = gen.GetValidCredentials(5);
+ javaProps = gen.JavaProperties;
+ Util.Log("InvalidAuthInit: For first client credentials: " +
+ credentials + " : " + javaProps);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, "Apache.Geode.Templates.Cache.Security.none",
+ (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 20, credentials, true);
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidAuthenticator()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authInit = gen.AuthInit;
+
+ if (authInit == null || authInit.Length == 0)
+ {
+ // Skip a scheme which does not have an authInit in the first place
+ // (e.g. SSL) since that will fail with AuthReqEx before
+ // authenticator is even invoked
+ Util.Log("InvalidAuthenticator: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authInit");
+ continue;
+ }
+
+ Util.Log("InvalidAuthenticator: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidAuthenticator: Using authinit: " + authInit);
+
+ // Start the server with invalid authenticator
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ "org.apache.geode.none", extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Starting the client with valid credentials should throw
+ // authentication failed exception
+ Properties<string, string> credentials1 = gen.GetValidCredentials(1);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("InvalidAuthenticator: For first client valid credentials: " +
+ credentials1 + " : " + javaProps1);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 20, credentials1, true, ExpectedResult.AuthFailedException);
+
+ // Also try with invalid credentials
+ /*Properties<string, string> credentials2 = gen.GetInvalidCredentials(1);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("InvalidAuthenticator: For first client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ ExpectedResult.AuthFailedException);
+ */
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoAuthInitWithCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ if (authInit == null || authInit.Length == 0)
+ {
+ // If the scheme does not have an authInit in the first place
+ // (e.g. SSL) then skip it
+ Util.Log("NoAuthInitWithCredentials: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authInit");
+ continue;
+ }
+
+ Util.Log("NoAuthInitWithCredentials: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("NoAuthInitWithCredentials: Using authenticator: " +
+ authenticator);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid credentials and client2 with invalid
+ // credentials; both should fail without an authInit
+ Properties<string, string> credentials1 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoAuthInitWithCredentials: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(2);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("NoAuthInitWithCredentials: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials1,
+ ExpectedResult.AuthRequiredException);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials2,
+ ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoAuthenticatorWithCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ if (authenticator == null || authenticator.Length == 0)
+ {
+ // If the scheme does not have an authenticator in the first place
+ // (e.g. SSL) then skip it since this test is useless
+ Util.Log("NoAuthenticatorWithCredentials: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authenticator");
+ continue;
+ }
+
+ Util.Log("NoAuthenticatorWithCredentials: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("NoAuthenticatorWithCredentials: Using authinit: " +
+ authInit);
+
+ // Start the servers
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ null, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid credentials and client2 with invalid
+ // credentials; both should succeed with no authenticator on server
+ Properties<string, string> credentials1 = gen.GetValidCredentials(3);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoAuthenticatorWithCredentials: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(12);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("NoAuthenticatorWithCredentials: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 4, credentials1, true);
+
+ // Verify that the puts succeeded
+ m_client2.Call(DoGetsMU, 4, credentials2, true);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runCredentialsWithFailover()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("CredentialsWithFailover: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("CredentialsWithFailover: Using authenticator: " +
+ authenticator);
+ Util.Log("CredentialsWithFailover: Using authinit: " + authInit);
+
+ // Start the first server; do not start second server yet to force
+ // the clients to connect to the first server.
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(5);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For second client valid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 2, credentials1, true);
+ // Verify that the puts succeeded
+ m_client2.Call(DoGetsMU, 2, credentials2, true);
+
+ // Start the second server and stop the first one to force a failover
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StopJavaServer(1);
+
+ // Perform some create/update operations from client1
+ // and verify from client2
+ m_client1.Call(DoPutsMU, 4, credentials1, true);
+ m_client2.Call(DoGetsMU, 4, credentials2, true);
+
+ // Try to connect client2 with no credentials
+ // Verify that the creation of region throws security exception
+ /*m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ ExpectedResult.AuthRequiredException);
+
+ // Now try to connect client1 with invalid credentials
+ // Verify that the creation of region throws security exception
+ credentials1 = gen.GetInvalidCredentials(7);
+ javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For first client invalid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1,
+ ExpectedResult.AuthFailedException);
+ */
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+ }
+
+ public void registerPdxTypes()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ }
+
+ void runCredentialsForNotifications()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(true))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("CredentialsForNotifications: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("CredentialsForNotifications: Using authenticator: " +
+ authenticator);
+ Util.Log("CredentialsForNotifications: Using authinit: " + authInit);
+
+ // Start the two servers.
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 2 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(5);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For second client valid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+ // Set up zero forward connections to check notification handshake only
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ 0, ExpectedResult.Success);
+
+ m_client1.Call(registerPdxTypes);
+ m_client2.Call(registerPdxTypes);
+
+ // Register interest for all keys on second client
+ m_client2.Call(RegisterAllKeys, new string[] { RegionName });
+
+ // Wait for secondary server to see second client
+ Thread.Sleep(1000);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 2);
+ // Verify that the puts succeeded
+ m_client2.Call(DoLocalGets, 2);
+
+ // Stop the first server
+ CacheHelper.StopJavaServer(1);
+
+ // Perform some create/update operations from client1
+ m_client1.Call(DoPuts, 4, true, ExpectedResult.Success);
+ // Verify that the creates/updates succeeded
+ m_client2.Call(DoLocalGets, 4, true);
+
+ // Start server1 again and try to connect client1 using zero forward
+ // connections with no credentials.
+ // Verify that the creation of region throws authentication
+ // required exception
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ 0, ExpectedResult.AuthRequiredException);
+
+ // Now try to connect client2 using zero forward connections
+ // with invalid credentials.
+ // Verify that the creation of region throws security exception
+ credentials2 = gen.GetInvalidCredentials(3);
+ javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ 0, ExpectedResult.AuthFailedException);
+
+ // Now try to connect client2 with invalid auth-init method
+ // Trying to create the region on client with valid credentials should
+ // throw an authentication failed exception
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, "Apache.Geode.Templates.Cache.Security.none",
+ credentials1, 0, ExpectedResult.AuthRequiredException);
+
+ // Try connection with null auth-init on clients.
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials1,
+ 0, ExpectedResult.AuthRequiredException);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials2,
+ 0, ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+ }
+
+ [Test]
+ public void ValidCredentials()
+ {
+ runValidCredentials();
+ }
+
+ [Test]
+ public void NoCredentials()
+ {
+ runNoCredentials();
+ }
+
+ [Test]
+ public void InvalidCredentials()
+ {
+ runInvalidCredentials();
+ }
+
+ [Test]
+ public void InvalidAuthInit()
+ {
+ runInvalidAuthInit();
+ }
+
+ [Test]
+ public void InvalidAuthenticator()
+ {
+ runInvalidAuthenticator();
+ }
+
+ [Test]
+ public void NoAuthInitWithCredentials()
+ {
+ runNoAuthInitWithCredentials();
+ }
+
+ [Test]
+ public void NoAuthenticatorWithCredentials()
+ {
+ runNoAuthenticatorWithCredentials();
+ }
+
+ [Test]
+ public void CredentialsWithFailover()
+ {
+ runCredentialsWithFailover();
+ }
+
+ [Test]
+ public void CredentialsForNotifications()
+ {
+ runCredentialsForNotifications();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientSecurityAuthTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientSecurityAuthTestsN.cs b/clicache/integration-test/ThinClientSecurityAuthTestsN.cs
new file mode 100644
index 0000000..adb659e
--- /dev/null
+++ b/clicache/integration-test/ThinClientSecurityAuthTestsN.cs
@@ -0,0 +1,731 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientSecurityAuthTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private const string CacheXml1 = "cacheserver_notify_subscription.xml";
+ private const string CacheXml2 = "cacheserver_notify_subscription2.xml";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ public void DoTxPuts()
+ {
+ CacheHelper.CSTXManager.Begin();
+
+ IRegion<object, object> reg = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ reg[10000] = new PdxTests.PdxTypes8();
+ reg[100001] = "qqqqqqqqqqqqqq";
+ CacheHelper.CSTXManager.Commit();
+ }
+
+ public void DoGetsTx()
+ {
+ Util.Log("In DoGetsTx get after Tx");
+ IRegion<object, object> reg = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ Assert.AreEqual(reg[100001], "qqqqqqqqqqqqqq", "Tx get value did not match for reg[100001].");
+ object ret1 = reg[10000];
+ Assert.IsTrue(ret1 != null && ret1 is PdxTests.PdxTypes8);
+ Util.Log("In DoGetsTx get after Tx Done");
+ }
+
+ void runValidCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("ValidCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("ValidCredentials: Using authenticator: " + authenticator);
+ Util.Log("ValidCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(1);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("ValidCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(2);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("ValidCredentials: For second client credentials: " +
+ credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 4);
+
+ m_client1.Call(DoTxPuts);
+
+ // Verify that the puts succeeded
+ m_client2.Call(DoGets, 4);
+
+ m_client2.Call(DoGetsTx);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("NoCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("NoCredentials: Using authenticator: " + authenticator);
+ Util.Log("NoCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(3);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 4);
+
+ // Creating region on client2 should throw authentication
+ // required exception
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("InvalidCredentials: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidCredentials: Using authenticator: " + authenticator);
+ Util.Log("InvalidCredentials: Using authinit: " + authInit);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(8);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("InvalidCredentials: For first client credentials: " +
+ credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(7);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("InvalidCredentials: For second client credentials: " +
+ credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 4);
+
+ // Creating region on client2 should throw authentication
+ // failure exception
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ ExpectedResult.AuthFailedException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidAuthInit()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+
+ Util.Log("InvalidAuthInit: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidAuthInit: Using authenticator: " + authenticator);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Creating region on client1 with invalid authInit callback should
+ // throw authentication required exception
+ Properties<string, string> credentials = gen.GetValidCredentials(5);
+ javaProps = gen.JavaProperties;
+ Util.Log("InvalidAuthInit: For first client credentials: " +
+ credentials + " : " + javaProps);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, "Apache.Geode.Templates.Cache.Security.none",
+ credentials, ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runInvalidAuthenticator()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authInit = gen.AuthInit;
+
+ if (authInit == null || authInit.Length == 0)
+ {
+ // Skip a scheme which does not have an authInit in the first place
+ // (e.g. SSL) since that will fail with AuthReqEx before
+ // authenticator is even invoked
+ Util.Log("InvalidAuthenticator: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authInit");
+ continue;
+ }
+
+ Util.Log("InvalidAuthenticator: Using scheme: " + gen.GetClassCode());
+ Util.Log("InvalidAuthenticator: Using authinit: " + authInit);
+
+ // Start the server with invalid authenticator
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ "org.apache.geode.none", extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Starting the client with valid credentials should throw
+ // authentication failed exception
+ Properties<string, string> credentials1 = gen.GetValidCredentials(1);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("InvalidAuthenticator: For first client valid credentials: " +
+ credentials1 + " : " + javaProps1);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1,
+ ExpectedResult.AuthFailedException);
+
+ // Also try with invalid credentials
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(1);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("InvalidAuthenticator: For first client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ ExpectedResult.AuthFailedException);
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoAuthInitWithCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ if (authInit == null || authInit.Length == 0)
+ {
+ // If the scheme does not have an authInit in the first place
+ // (e.g. SSL) then skip it
+ Util.Log("NoAuthInitWithCredentials: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authInit");
+ continue;
+ }
+
+ Util.Log("NoAuthInitWithCredentials: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("NoAuthInitWithCredentials: Using authenticator: " +
+ authenticator);
+
+ // Start the server
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid credentials and client2 with invalid
+ // credentials; both should fail without an authInit
+ Properties<string, string> credentials1 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoAuthInitWithCredentials: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(2);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("NoAuthInitWithCredentials: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials1,
+ ExpectedResult.AuthRequiredException);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials2,
+ ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runNoAuthenticatorWithCredentials()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ if (authenticator == null || authenticator.Length == 0)
+ {
+ // If the scheme does not have an authenticator in the first place
+ // (e.g. SSL) then skip it since this test is useless
+ Util.Log("NoAuthenticatorWithCredentials: Skipping scheme [" +
+ gen.GetClassCode() + "] which has no authenticator");
+ continue;
+ }
+
+ Util.Log("NoAuthenticatorWithCredentials: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("NoAuthenticatorWithCredentials: Using authinit: " +
+ authInit);
+
+ // Start the servers
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ null, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid credentials and client2 with invalid
+ // credentials; both should succeed with no authenticator on server
+ Properties<string, string> credentials1 = gen.GetValidCredentials(3);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("NoAuthenticatorWithCredentials: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetInvalidCredentials(12);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("NoAuthenticatorWithCredentials: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 4);
+
+ // Verify that the puts succeeded
+ m_client2.Call(DoGets, 4);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ }
+
+ void runCredentialsWithFailover()
+ {
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("CredentialsWithFailover: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("CredentialsWithFailover: Using authenticator: " +
+ authenticator);
+ Util.Log("CredentialsWithFailover: Using authinit: " + authInit);
+
+ // Start the first server; do not start second server yet to force
+ // the clients to connect to the first server.
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(5);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For second client valid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 2);
+ // Verify that the puts succeeded
+ m_client2.Call(DoGets, 2);
+
+ // Start the second server and stop the first one to force a failover
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StopJavaServer(1);
+
+ // Perform some create/update operations from client1
+ // and verify from client2
+ m_client1.Call(DoPuts, 4, true, ExpectedResult.Success);
+ m_client2.Call(DoGets, 4, true);
+
+ // Try to connect client2 with no credentials
+ // Verify that the creation of region throws security exception
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ ExpectedResult.AuthRequiredException);
+
+ // Now try to connect client1 with invalid credentials
+ // Verify that the creation of region throws security exception
+ credentials1 = gen.GetInvalidCredentials(7);
+ javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsWithFailover: For first client invalid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1,
+ ExpectedResult.AuthFailedException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+ }
+
+ public void registerPdxType8()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ }
+
+ void runCredentialsForNotifications()
+ {
+
+ foreach (CredentialGenerator gen in SecurityTestUtil.getAllGenerators(false))
+ {
+ Properties<string, string> extraProps = gen.SystemProperties;
+ Properties<string, string> javaProps = gen.JavaProperties;
+ string authenticator = gen.Authenticator;
+ string authInit = gen.AuthInit;
+
+ Util.Log("CredentialsForNotifications: Using scheme: " +
+ gen.GetClassCode());
+ Util.Log("CredentialsForNotifications: Using authenticator: " +
+ authenticator);
+ Util.Log("CredentialsForNotifications: Using authinit: " + authInit);
+
+ // Start the two servers.
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 2 started.");
+
+ // Start the clients with valid credentials
+ Properties<string, string> credentials1 = gen.GetValidCredentials(5);
+ Properties<string, string> javaProps1 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For first client valid " +
+ "credentials: " + credentials1 + " : " + javaProps1);
+ Properties<string, string> credentials2 = gen.GetValidCredentials(6);
+ Properties<string, string> javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For second client valid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials1);
+ // Set up zero forward connections to check notification handshake only
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ 0, ExpectedResult.Success);
+
+ m_client1.Call(registerPdxType8);
+ m_client2.Call(registerPdxType8);
+
+ // Register interest for all keys on second client
+ m_client2.Call(RegisterAllKeys, new string[] { RegionName });
+
+ // Wait for secondary server to see second client
+ Thread.Sleep(1000);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPuts, 2);
+ // Verify that the puts succeeded
+ m_client2.Call(DoLocalGets, 2);
+
+ // Stop the first server
+ CacheHelper.StopJavaServer(1);
+
+ // Perform some create/update operations from client1
+ m_client1.Call(DoPuts, 4, true, ExpectedResult.Success);
+ // Verify that the creates/updates succeeded
+ m_client2.Call(DoLocalGets, 4, true);
+
+ // Start server1 again and try to connect client1 using zero forward
+ // connections with no credentials.
+ // Verify that the creation of region throws authentication
+ // required exception
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, SecurityTestUtil.GetServerArgs(
+ authenticator, extraProps, javaProps));
+ Util.Log("Cacheserver 1 started.");
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, (Properties<string, string>)null,
+ 0, ExpectedResult.AuthRequiredException);
+
+ // Now try to connect client2 using zero forward connections
+ // with invalid credentials.
+ // Verify that the creation of region throws security exception
+ credentials2 = gen.GetInvalidCredentials(3);
+ javaProps2 = gen.JavaProperties;
+ Util.Log("CredentialsForNotifications: For second client invalid " +
+ "credentials: " + credentials2 + " : " + javaProps2);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, authInit, credentials2,
+ 0, ExpectedResult.AuthFailedException);
+ // Now try to connect client2 with invalid auth-init method
+ // Trying to create the region on client with valid credentials should
+ // throw an authentication failed exception
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, "Apache.Geode.Templates.Cache.Security.none",
+ credentials1, 0, ExpectedResult.AuthRequiredException);
+
+ // Try connection with null auth-init on clients.
+ m_client1.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials1,
+ 0, ExpectedResult.AuthRequiredException);
+ m_client2.Call(SecurityTestUtil.CreateClient, RegionName,
+ CacheHelper.Locators, (string)null, credentials2,
+ 0, ExpectedResult.AuthRequiredException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+ }
+
+ [Test]
+ public void ValidCredentials()
+ {
+ runValidCredentials();
+ }
+
+ [Test]
+ public void NoCredentials()
+ {
+ runNoCredentials();
+ }
+
+ [Test]
+ public void InvalidCredentials()
+ {
+ runInvalidCredentials();
+ }
+
+ [Test]
+ public void InvalidAuthInit()
+ {
+ runInvalidAuthInit();
+ }
+
+ [Test]
+ public void InvalidAuthenticator()
+ {
+ runInvalidAuthenticator();
+ }
+
+ [Test]
+ public void NoAuthInitWithCredentials()
+ {
+ runNoAuthInitWithCredentials();
+ }
+
+ [Test]
+ public void NoAuthenticatorWithCredentials()
+ {
+ runNoAuthenticatorWithCredentials();
+ }
+
+ [Test]
+ public void CredentialsWithFailover()
+ {
+ runCredentialsWithFailover();
+ }
+
+ [Test]
+ public void CredentialsForNotifications()
+ {
+ runCredentialsForNotifications();
+ }
+ }
+}
[22/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableString.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableString.cpp b/clicache/src/CacheableString.cpp
new file mode 100644
index 0000000..ceea6d6
--- /dev/null
+++ b/clicache/src/CacheableString.cpp
@@ -0,0 +1,212 @@
+/*
+ * 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.
+ */
+
+
+
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+
+//#include "geode_includes.hpp"
+#include "CacheableString.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void CacheableString::ToData(DataOutput^ output)
+ {
+ if (m_type == GeodeClassIds::CacheableASCIIString ||
+ m_type == GeodeClassIds::CacheableString)
+ {
+ output->WriteUTF(m_value);
+ }
+ else if (m_type == GeodeClassIds::CacheableASCIIStringHuge)
+ {
+ output->WriteASCIIHuge(m_value);
+ }
+ else
+ {
+ output->WriteUTFHuge(m_value);
+ }
+ }
+
+ IGeodeSerializable^ CacheableString::FromData(DataInput^ input)
+ {
+ if (m_type == GeodeClassIds::CacheableASCIIString ||
+ m_type == GeodeClassIds::CacheableString)
+ {
+ m_value = input->ReadUTF();
+ }
+ else if (m_type == GeodeClassIds::CacheableASCIIStringHuge)
+ {
+ m_value = input->ReadASCIIHuge();
+ }
+ else
+ {
+ m_value = input->ReadUTFHuge();
+ }
+
+ return this;
+ }
+
+
+ inline void CacheableString::GetCacheableString(String^ value,
+ apache::geode::client::CacheableStringPtr& cStr)
+ {
+ size_t len;
+ if (value != nullptr && (len = value->Length) > 0) {
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
+ cStr = apache::geode::client::CacheableString::create(pin_value, (System::Int32)len);
+ }
+ else {
+ cStr.reset(
+ static_cast<apache::geode::client::CacheableString*>(apache::geode::client::CacheableString::createDeserializable()));
+ }
+ }
+
+ inline void CacheableString::GetCacheableString(array<Char>^ value,
+ apache::geode::client::CacheableStringPtr& cStr)
+ {
+ size_t len;
+ if (value != nullptr && (len = value->Length) > 0) {
+ pin_ptr<const Char> pin_value = &value[0];
+ cStr = apache::geode::client::CacheableString::create(
+ (const wchar_t*)pin_value, (System::Int32)len);
+ }
+ else {
+ cStr.reset(
+ static_cast<apache::geode::client::CacheableString*>(apache::geode::client::CacheableString::createDeserializable()));
+ }
+ }
+
+ CacheableString::CacheableString(String^ value)
+ : CacheableKey()
+ {
+ if (value == nullptr) {
+ throw gcnew IllegalArgumentException("CacheableString: null or " +
+ "zero-length string provided to the constructor.");
+ }
+ m_value = value;
+
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(array<Char>^ value)
+ : CacheableKey()
+ {
+ if (value == nullptr) {
+ throw gcnew IllegalArgumentException("CacheableString: null or " +
+ "zero-length character array provided to the constructor.");
+ }
+ m_value = gcnew String(value);
+
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(String^ value, bool noParamCheck)
+ : CacheableKey()
+ {
+ m_value = value;
+ this->SetStringType();
+ }
+
+ CacheableString::CacheableString(array<Char>^ value, bool noParamCheck)
+ : CacheableKey()
+ {
+ m_value = gcnew String(value);
+ this->SetStringType();
+ }
+
+ System::UInt32 CacheableString::ObjectSize::get()
+ {
+ return (m_value->Length * sizeof(char));
+ }
+
+ bool CacheableString::Equals(Apache::Geode::Client::ICacheableKey^ other)
+ {
+ if (other == nullptr || other->ClassId != ClassId) {
+ return false;
+ }
+
+ CacheableString^ otherStr =
+ dynamic_cast<CacheableString^>(other);
+
+ if (otherStr == nullptr)
+ return false;
+
+ return m_value->Equals(otherStr->Value);//TODO::
+ }
+
+ bool CacheableString::Equals(Object^ obj)
+ {
+ CacheableString^ otherStr =
+ dynamic_cast<CacheableString^>(obj);
+
+ if (otherStr != nullptr) {
+ return m_value->Equals(otherStr->Value);
+ }
+ return false;
+ }
+
+ System::Int32 CacheableString::GetHashCode()
+ {
+ if (String::IsNullOrEmpty(m_value)) {
+ return 0;
+ }
+ //TODO: need to need java hashcode
+ //return m_value->GetHashCode();
+ if (m_hashcode == 0)
+ {
+ System::Int32 prime = 31;
+ System::Int32 localHash = 0;
+ for (System::Int32 i = 0; i < m_value->Length; i++)
+ localHash = prime*localHash + m_value[i];
+ m_hashcode = localHash;
+ }
+ return m_hashcode;
+ }
+
+ void CacheableString::SetStringType()
+ {
+ int len = DataOutput::getEncodedLength(m_value);
+
+ if (len == m_value->Length)//ASCII string
+ {
+ if (len > 0xFFFF)
+ m_type = GeodeClassIds::CacheableASCIIStringHuge;
+ else
+ m_type = GeodeClassIds::CacheableASCIIString;
+ }
+ else
+ {
+ if (len > 0xFFFF)
+ m_type = GeodeClassIds::CacheableStringHuge;
+ else
+ m_type = GeodeClassIds::CacheableString;
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+} //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableString.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableString.hpp b/clicache/src/CacheableString.hpp
new file mode 100644
index 0000000..d24adc5
--- /dev/null
+++ b/clicache/src/CacheableString.hpp
@@ -0,0 +1,326 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableString.hpp>
+#include "end_native.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "CacheableKey.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An immutable string wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ ref class CacheableString
+ : public CacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new instance copying from the given string.
+ /// </summary>
+ /// <param name="value">the string value of the new instance</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the provided string is null or has zero length
+ /// </exception>
+ CacheableString(String^ value);
+
+ /// <summary>
+ /// Allocates a new instance copying from the given character array.
+ /// </summary>
+ /// <param name="value">
+ /// the character array value of the new instance
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if the provided array is null or has zero length
+ /// </exception>
+ CacheableString(array<Char>^ value);
+
+ /// <summary>
+ /// Static function to create a new instance copying from
+ /// the given string.
+ /// </summary>
+ /// <remarks>
+ /// Providing a null or zero size string will return a null
+ /// <c>CacheableString</c> object.
+ /// </remarks>
+ /// <param name="value">the string value of the new instance</param>
+ inline static CacheableString^ Create(String^ value)
+ {
+ return (value != nullptr ?
+ gcnew CacheableString(value, true) : nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this managed object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output) override;
+
+ /// <summary>
+ /// Deserializes the managed object -- returns an instance of the
+ /// <c>IGeodeSerializable</c> class.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input) override;
+
+ // <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return m_type;
+ }
+ }
+
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get() override;
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from
+ /// the given character array.
+ /// </summary>
+ /// <remarks>
+ /// Providing a null or zero size character array will return a null
+ /// <c>CacheableString</c> object.
+ /// </remarks>
+ /// <param name="value">
+ /// the character array value of the new instance
+ /// </param>
+ inline static CacheableString^ Create(array<Char>^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableString(value, true) : nullptr);
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// This returns the same string as <c>Value</c> property.
+ /// </summary>
+ virtual String^ ToString() override
+ {
+ return m_value;
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// <c>apache::geode::client::CacheableString</c> object.
+ /// </summary>
+ virtual bool Equals(Apache::Geode::Client::ICacheableKey^ other) override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// <c>apache::geode::client::CacheableString</c> object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 GetHashCode() override;
+
+ /// <summary>
+ /// Gets the string value.
+ /// </summary>
+ property String^ Value
+ {
+ inline String^ get()
+ {
+ return m_value;
+ }
+ }
+
+ /// <summary>
+ /// Static function to check whether IsNullOrEmpty.
+ /// </summary>
+ /// <remarks>
+ /// This is similar to the C# string.IsNullOrEmpty method.
+ /// </remarks>
+ /// <param name="value">the CacheableString value to check</param>
+ inline static bool IsNullOrEmpty(CacheableString^ value)
+ {
+ return (value == nullptr || value->Length == 0);
+ }
+
+ /// <summary>
+ /// Implicit conversion operator to underlying <c>System.String</c>.
+ /// </summary>
+ inline static operator String ^ (CacheableString^ str)
+ {
+ return (str != nullptr ? CacheableString::GetString(str) : nullptr);
+ }
+
+ /// <summary>
+ /// Gets the length of the underlying C string.
+ /// </summary>
+ property System::UInt32 Length
+ {
+ inline System::UInt32 get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ /// <summary>
+ /// True when the underlying C string is a wide-character string.
+ /// </summary>
+ property bool IsWideString
+ {
+ inline bool get()
+ {
+ return true;//TODO:
+ }
+ }
+
+ internal:
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableString(GeodeClassIds::CacheableASCIIString);
+ }
+
+ static IGeodeSerializable^ createDeserializableHuge()
+ {
+ return gcnew CacheableString(GeodeClassIds::CacheableASCIIStringHuge);
+ }
+
+ static IGeodeSerializable^ createUTFDeserializable()
+ {
+ return gcnew CacheableString(GeodeClassIds::CacheableString);
+ }
+
+ static IGeodeSerializable^ createUTFDeserializableHuge()
+ {
+ return gcnew CacheableString(GeodeClassIds::CacheableStringHuge);
+ }
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj)
+ {
+ return (obj != nullptr ?
+ gcnew CacheableString(obj) : nullptr);
+ }
+
+ /// <summary>
+ /// Internal function to create a <c>apache::geode::client::CacheableString</c>
+ /// from the given managed string.
+ /// </summary>
+ static void GetCacheableString(String^ value,
+ apache::geode::client::CacheableStringPtr& cStr);
+
+ /// <summary>
+ /// Internal function to create a <c>apache::geode::client::CacheableString</c>
+ /// from the given managed array of characters.
+ /// </summary>
+ static void GetCacheableString(array<Char>^ value,
+ apache::geode::client::CacheableStringPtr& cStr);
+
+ /// <summary>
+ /// Get the <c>System.String</c> from the given
+ /// <c>apache::geode::client::CacheableString</c>
+ /// </summary>
+ inline static String^ GetString(apache::geode::client::CacheableString * cStr)
+ {
+ if (cStr == NULL) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+
+ inline static String^ GetString(CacheableString^ cStr)
+ {
+ return cStr->Value;
+ }
+
+ CacheableString(System::UInt32 type) : CacheableKey()
+ {
+ m_type = type;
+ }
+
+ private:
+ String^ m_value;
+ System::UInt32 m_type;
+ int m_hashcode;
+
+ CacheableString() : CacheableKey()
+ {
+ m_type = GeodeClassIds::CacheableASCIIString;
+ }
+
+ void SetStringType();
+ /// <summary>
+ /// Private constructor to create a CacheableString without checking
+ /// for arguments.
+ /// </summary>
+ CacheableString(String^ value, bool noParamCheck);
+
+ /// <summary>
+ /// Private constructor to create a CacheableString without checking
+ /// for arguments.
+ /// </summary>
+ CacheableString(array<Char>^ value, bool noParamCheck);
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableString(apache::geode::client::SerializablePtr nativeptr)
+ : CacheableKey(nativeptr) { }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableStringArray.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableStringArray.cpp b/clicache/src/CacheableStringArray.cpp
new file mode 100644
index 0000000..34c27ae
--- /dev/null
+++ b/clicache/src/CacheableStringArray.cpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+
+#include "CacheableStringArray.hpp"
+#include "CacheableString.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ CacheableStringArray::CacheableStringArray(array<String^>^ strings)
+ : Serializable()
+ {
+ m_value = strings;
+ }
+
+
+ array<String^>^ CacheableStringArray::GetValues()
+ {
+ return m_value;
+ }
+
+ String^ CacheableStringArray::default::get(System::Int32 index)
+ {
+ return m_value[index];
+ }
+
+ void CacheableStringArray::ToData(DataOutput^ output)
+ {
+ if (m_value == nullptr)
+ {
+ output->WriteArrayLen(-1);
+ }
+ else
+ {
+ output->WriteArrayLen(m_value->Length);
+ if (m_value->Length > 0)
+ {
+ for(int i = 0; i < m_value->Length; i++)
+ {
+ output->WriteObject(m_value[i]);
+ }
+ GC::KeepAlive(this);
+ }
+ }
+ }
+
+
+ IGeodeSerializable^ CacheableStringArray::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ if ( len == -1)
+ {
+ m_value = nullptr;
+ return nullptr;
+ }
+ else
+ {
+ m_value = gcnew array<String^>(len);
+ if (len > 0)
+ {
+ for( int i = 0; i < len; i++)
+ {
+ m_value[i] = dynamic_cast<String^>(input->ReadObject());
+ }
+ }
+ return this;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableStringArray.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableStringArray.hpp b/clicache/src/CacheableStringArray.hpp
new file mode 100644
index 0000000..e8c66f6
--- /dev/null
+++ b/clicache/src/CacheableStringArray.hpp
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
+#include "Serializable.hpp"
+#include "GeodeClassIds.hpp"
+#include "CacheableString.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class CacheableString;
+
+ /// <summary>
+ /// An immutable wrapper for array of strings that can serve as
+ /// a distributable object for caching.
+ /// </summary>
+ ref class CacheableStringArray
+ : public Serializable
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance copying from the given
+ /// string array.
+ /// </summary>
+ /// <remarks>
+ /// If the given array of strings is null or of zero-length then
+ /// this method returns null.
+ /// </remarks>
+ /// <exception cref="IllegalArgumentException">
+ /// If the array contains a string greater than or equal 64K in length.
+ /// </exception>
+ inline static CacheableStringArray^ Create(array<String^>^ strings)
+ {
+ return (strings != nullptr && strings->Length > 0 ?
+ gcnew CacheableStringArray(strings) : nullptr);
+ }
+
+ /// <summary>
+ /// Serializes this managed object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output) override;
+
+ /// <summary>
+ /// Deserializes the managed object -- returns an instance of the
+ /// <c>IGeodeSerializable</c> class.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input) override;
+
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return GeodeClassIds::CacheableStringArray;
+ }
+ }
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get() override
+ {
+ int size = 0;
+ for (int i = 0; i < m_value->Length; i++)
+ {
+ size += m_value[i]->Length;
+ }
+ return (System::UInt32)(size + sizeof(this));
+ }
+
+ }
+
+ /// <summary>
+ /// Returns a copy of the underlying array of strings.
+ /// </summary>
+ array<String^>^ GetValues();
+
+ /// <summary>
+ /// Returns a copy of the underlying string at the given index.
+ /// </summary>
+ property String^ GFINDEXER(System::Int32)
+ {
+ String^ get(System::Int32 index);
+ }
+
+ /// <summary>
+ /// Gets the length of the array.
+ /// </summary>
+ property System::Int32 Length
+ {
+ inline System::Int32 get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return m_value->ToString();
+ }
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableStringArray();
+ }
+
+ internal:
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj)
+ {
+ return (obj != nullptr ?
+ gcnew CacheableStringArray(obj) : nullptr);
+ }
+
+ private:
+ array<String^>^ m_value;
+ /// <summary>
+ /// Allocates a new instance copying from the given string array.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// If the array contains a string greater than or equal 64K in length.
+ /// </exception>
+ CacheableStringArray(array<String^>^ strings);
+
+
+ inline CacheableStringArray()
+ : Serializable()
+ {
+ //apache::geode::client::Serializable* sp = apache::geode::client::CacheableStringArray::createDeserializable();
+ //SetSP(sp);
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableStringArray(apache::geode::client::SerializablePtr nativeptr)
+ : Serializable(nativeptr) { }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableUndefined.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableUndefined.cpp b/clicache/src/CacheableUndefined.cpp
new file mode 100644
index 0000000..c6545c8
--- /dev/null
+++ b/clicache/src/CacheableUndefined.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "CacheableUndefined.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // Region: IGeodeSerializable Members
+
+ void CacheableUndefined::ToData(DataOutput^ output)
+ {
+ }
+
+ IGeodeSerializable^ CacheableUndefined::FromData(DataInput^ input)
+ {
+ return this;
+ }
+
+ System::UInt32 CacheableUndefined::ObjectSize::get()
+ {
+ return static_cast<System::UInt32> (sizeof(CacheableUndefined^));
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableUndefined.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableUndefined.hpp b/clicache/src/CacheableUndefined.hpp
new file mode 100644
index 0000000..83b40ff
--- /dev/null
+++ b/clicache/src/CacheableUndefined.hpp
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "GeodeClassIds.hpp"
+#include "Log.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Encapsulate an undefined result.
+ /// </summary>
+ public ref class CacheableUndefined
+ : public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableUndefined() { }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableUndefined^ Create()
+ {
+ return gcnew CacheableUndefined();
+ }
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableUndefined;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableUndefined();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableVector.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableVector.cpp b/clicache/src/CacheableVector.cpp
new file mode 100644
index 0000000..36f0e3a
--- /dev/null
+++ b/clicache/src/CacheableVector.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "CacheableVector.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // Region: IGeodeSerializable Members
+
+ void CacheableVector::ToData(DataOutput^ output)
+ {
+ if(m_arrayList != nullptr)
+ {
+ output->WriteArrayLen(m_arrayList->Count);
+ for each (Object^ obj in m_arrayList) {
+ //TODO::split
+ output->WriteObject(obj);
+ }
+ }
+ else
+ output->WriteByte(0xFF);
+ }
+
+ IGeodeSerializable^ CacheableVector::FromData(DataInput^ input)
+ {
+ int len = input->ReadArrayLen();
+ for( int i = 0; i < len; i++)
+ {
+ m_arrayList->Add(input->ReadObject());
+ }
+ return this;
+ }
+
+ System::UInt32 CacheableVector::ObjectSize::get()
+ {
+ //TODO::
+ /*System::UInt32 size = static_cast<System::UInt32> (sizeof(CacheableVector^));
+ for each (IGeodeSerializable^ val in this) {
+ if (val != nullptr) {
+ size += val->ObjectSize;
+ }
+ }*/
+ return m_arrayList->Count;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableVector.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableVector.hpp b/clicache/src/CacheableVector.hpp
new file mode 100644
index 0000000..886f6a0
--- /dev/null
+++ b/clicache/src/CacheableVector.hpp
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "GeodeClassIds.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>IGeodeSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching. This class extends .NET generic
+ /// <c>List</c> class.
+ /// </summary>
+ ref class CacheableVector
+ : public IGeodeSerializable
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableVector(System::Collections::IList^ arrayList)
+ {
+ m_arrayList = arrayList;
+ }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableVector^ Create()
+ {
+ return gcnew CacheableVector(gcnew System::Collections::ArrayList());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableVector^ Create(System::Collections::IList^ list)
+ {
+ return gcnew CacheableVector(list);
+ }
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableVector;
+ }
+ }
+
+ virtual property System::Collections::IList^ Value
+ {
+ virtual System::Collections::IList^ get()
+ {
+ return m_arrayList;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableVector(gcnew System::Collections::ArrayList());
+ }
+
+ private:
+ System::Collections::IList^ m_arrayList;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributes.cpp b/clicache/src/CqAttributes.cpp
new file mode 100644
index 0000000..ef10045
--- /dev/null
+++ b/clicache/src/CqAttributes.cpp
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+
+//#include "geode_includes.hpp"
+#include "CqAttributes.hpp"
+#include "impl/ManagedCqListener.hpp"
+#include "ICqListener.hpp"
+#include "impl/ManagedCqStatusListener.hpp"
+#include "ICqStatusListener.hpp"
+
+#include "begin_native.hpp"
+#include <geode/CqAttributes.hpp>
+#include "end_native.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ using namespace System;
+
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ array<ICqListener<TKey, TResult>^>^ CqAttributes<TKey, TResult>::getCqListeners( )
+ {
+ native::CqAttributes::listener_container_type vrr;
+ try
+ {
+ m_nativeptr->get()->getCqListeners(vrr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto listners = gcnew array<ICqListener<TKey, TResult>^>(vrr.size());
+
+ for (System::Int32 index = 0; index < vrr.size(); index++)
+ {
+ auto nativeptr = vrr[index];
+ if (auto mg_listener = std::dynamic_pointer_cast<native::ManagedCqListenerGeneric>(nativeptr))
+ {
+ listners[index] = (ICqListener<TKey, TResult>^) mg_listener->userptr();
+ }
+ else if (auto mg_statuslistener = std::dynamic_pointer_cast<native::ManagedCqStatusListenerGeneric>(nativeptr))
+ {
+ listners[index] = (ICqStatusListener<TKey, TResult>^) mg_statuslistener->userptr();
+ }
+ else
+ {
+ listners[index] = nullptr;
+ }
+ }
+ return listners;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributes.hpp b/clicache/src/CqAttributes.hpp
new file mode 100644
index 0000000..cf3fb56
--- /dev/null
+++ b/clicache/src/CqAttributes.hpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqAttributes.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ interface class ICqListener;
+
+ /// <summary>
+ /// Defines attributes for configuring a cq.
+ /// </summary>
+ generic<class TKey, class TResult>
+ public ref class CqAttributes sealed
+ {
+ public:
+
+ /// <summary>
+ /// get all listeners in this attributes
+ /// </summary>
+ virtual array<Client::ICqListener<TKey, TResult>^>^ getCqListeners();
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CqAttributes<TKey, TResult>^ Create( native::CqAttributesPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqAttributes( nativeptr );
+ }
+
+ std::shared_ptr<native::CqAttributes> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqAttributes( native::CqAttributesPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqAttributes>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqAttributes>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributesFactory.cpp b/clicache/src/CqAttributesFactory.cpp
new file mode 100644
index 0000000..45dcbb7
--- /dev/null
+++ b/clicache/src/CqAttributesFactory.cpp
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <geode/QueryService.hpp>
+#include "end_native.hpp"
+
+//#include "geode_includes.hpp"
+#include "CqAttributesFactory.hpp"
+#include "impl/ManagedCqListener.hpp"
+#include "ICqListener.hpp"
+#include "impl/ManagedCqStatusListener.hpp"
+#include "ICqStatusListener.hpp"
+#include "CqAttributesMutator.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ void CqAttributesFactory<TKey, TResult>::AddCqListener( Client::ICqListener<TKey, TResult>^ cqListener )
+ {
+ native_shared_ptr<native::CqListener>^ listenerptr;
+ if ( cqListener != nullptr ) {
+ if (auto cqStatusListener = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener)) {
+ auto sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ sLstr->AddCqListener(cqListener);
+ listenerptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(cqListener)));
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = listenerptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, listenerptr);
+ }
+ }
+ finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqStatusListenerGeneric*)listenerptr->get())->setptr(sLstr);
+ }
+ else {
+ //TODO::split
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(cqListener);
+ listenerptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(cqListener)));
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = listenerptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, listenerptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqListenerGeneric*)listenerptr->get())->setptr(cqlg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->addCqListener( listenerptr->get_shared_ptr() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void CqAttributesFactory<TKey, TResult>::InitCqListeners(array<Client::ICqListener<TKey, TResult>^>^ newListeners)
+ {
+ native::CqAttributes::listener_container_type vrr;
+ for( int i = 0; i < newListeners->Length; i++ )
+ {
+ if (auto lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(newListeners[i])) {
+ auto cptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(lister)));
+ vrr.push_back(cptr->get_shared_ptr());
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(newListeners[i]);
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = cptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], cptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqStatusListenerGeneric*)cptr->get())->setptr(cqlg);
+ }
+ else {
+ auto cptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(newListeners[i])));
+ vrr.push_back(cptr->get_shared_ptr());
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(newListeners[i]);
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = cptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], cptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqListenerGeneric*)cptr->get())->setptr(cqlg);
+ }
+ }
+
+ try
+ {
+ m_nativeptr->get()->initCqListeners( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ Client::CqAttributes<TKey, TResult>^ CqAttributesFactory<TKey, TResult>::Create( )
+ {
+ try
+ {
+ return Client::CqAttributes<TKey, TResult>::Create(m_nativeptr->get()->create());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributesFactory.hpp b/clicache/src/CqAttributesFactory.hpp
new file mode 100644
index 0000000..6fa5ab0
--- /dev/null
+++ b/clicache/src/CqAttributesFactory.hpp
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqAttributesFactory.hpp>
+#include "end_native.hpp"
+
+#include "impl/SafeConvert.hpp"
+#include "CqAttributes.hpp"
+#include "native_unique_ptr.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ interface class ICqListener;
+
+ /// <summary>
+ /// Creates instances of <c>CqAttributes</c>.
+ /// </summary>
+ /// <seealso cref="CqAttributes" />
+ generic<class TKey, class TResult>
+ public ref class CqAttributesFactory sealed
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new instance of <c>CqAttributesFactory</c> ready
+ /// to create a <c>CqAttributes</c> with default settings.
+ /// </summary>
+ inline CqAttributesFactory( )
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::CqAttributesFactory>(std::make_unique<native::CqAttributesFactory>());
+ }
+
+ inline CqAttributesFactory(Client::CqAttributes<TKey, TResult>^ cqAttributes )
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::CqAttributesFactory>(std::make_unique<native::CqAttributesFactory>(cqAttributes->GetNative()));
+ }
+
+ // ATTRIBUTES
+
+ /// <summary>
+ /// add a cqListener
+ /// </summary>
+ void AddCqListener(Client::ICqListener<TKey, TResult>^ cqListener);
+
+ /// <summary>
+ /// Initialize with an array of listeners
+ /// </summary>
+ void InitCqListeners( array<Client::ICqListener<TKey, TResult>^>^ cqListeners );
+
+ // FACTORY METHOD
+
+ /// <summary>
+ /// Creates a <c>CqAttributes</c> with the current settings.
+ /// </summary>
+ Client::CqAttributes<TKey, TResult>^ Create( );
+
+ private:
+
+ native_unique_ptr<native::CqAttributesFactory>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributesMutator.cpp b/clicache/src/CqAttributesMutator.cpp
new file mode 100644
index 0000000..d728746
--- /dev/null
+++ b/clicache/src/CqAttributesMutator.cpp
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <memory>
+#include <geode/QueryService.hpp>
+#include "end_native.hpp"
+
+#include "CqAttributesMutator.hpp"
+#include "impl/ManagedCqListener.hpp"
+#include "impl/ManagedCqStatusListener.hpp"
+
+using namespace System;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ void CqAttributesMutator<TKey, TResult>::AddCqListener( Client::ICqListener<TKey, TResult>^ cqListener )
+ {
+ native_shared_ptr<native::CqListener>^ listenerptr;
+ if ( cqListener != nullptr ) {
+ if (auto cqStatusListener = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener)) {
+ auto sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ sLstr->AddCqListener(cqListener);
+ listenerptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(cqListener)));
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = listenerptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, listenerptr);
+ }
+ }
+ finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqStatusListenerGeneric*)listenerptr->get())->setptr(sLstr);
+ }
+ else {
+ //TODO::split
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(cqListener);
+ listenerptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(cqListener)));
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = listenerptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, listenerptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqListenerGeneric*)listenerptr->get())->setptr(cqlg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->addCqListener( listenerptr->get_shared_ptr() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void CqAttributesMutator<TKey, TResult>::RemoveCqListener( Client::ICqListener<TKey, TResult>^ cqListener )
+ {
+ if (auto lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(cqListener)) {
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(cqListener);
+ native::CqStatusListenerPtr lptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(
+ new native::ManagedCqStatusListenerGeneric(lister));
+ ((native::ManagedCqStatusListenerGeneric*)lptr.get())->setptr(cqlg);
+ try {
+ native_shared_ptr<native::CqListener>^ value;
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->TryGetValue(cqListener, value) ) {
+ try
+ {
+ m_nativeptr->get()->removeCqListener(value->get_shared_ptr());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ }
+ else {
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(cqListener);
+ native::CqListenerPtr lptr = std::shared_ptr<native::ManagedCqListenerGeneric>(
+ new native::ManagedCqListenerGeneric(cqListener));
+ ((native::ManagedCqListenerGeneric*)lptr.get())->setptr(cqlg);
+ try {
+ native_shared_ptr<native::CqListener>^ value;
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->TryGetValue(cqListener, value) ) {
+ try
+ {
+ m_nativeptr->get()->removeCqListener(value->get_shared_ptr());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void CqAttributesMutator<TKey, TResult>::SetCqListeners(array<Client::ICqListener<TKey, TResult>^>^ newListeners)
+ {
+ native::CqAttributes::listener_container_type vrr;
+ for( int i = 0; i < newListeners->Length; i++ )
+ {
+ if (auto lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(newListeners[i])) {
+ auto cptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(lister)));
+ vrr.push_back(cptr->get_shared_ptr());
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(newListeners[i]);
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = cptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], cptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqStatusListenerGeneric*)cptr->get())->setptr(cqlg);
+ }
+ else {
+ auto cptr = gcnew native_shared_ptr<native::CqListener>(std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(newListeners[i])));
+ vrr.push_back(cptr->get_shared_ptr());
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ cqlg->AddCqListener(newListeners[i]);
+ try {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
+ if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = cptr;
+ }
+ else {
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], cptr);
+ }
+ } finally {
+ CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
+ }
+ ((native::ManagedCqListenerGeneric*)cptr->get())->setptr(cqlg);
+ }
+ }
+
+ try
+ {
+ m_nativeptr->get()->setCqListeners( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqAttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqAttributesMutator.hpp b/clicache/src/CqAttributesMutator.hpp
new file mode 100644
index 0000000..7e04b65
--- /dev/null
+++ b/clicache/src/CqAttributesMutator.hpp
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqAttributesMutator.hpp>
+#include "end_native.hpp"
+
+
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Threading;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ interface class ICqListener;
+
+ generic<class TKey, class TResult>
+ private ref class CqListenerHelper sealed{
+ public:
+ static Dictionary<Client::ICqListener<TKey, TResult>^, native_shared_ptr<native::CqListener>^>^
+ m_ManagedVsUnManagedCqLstrDict = gcnew
+ Dictionary<Client::ICqListener<TKey, TResult>^, native_shared_ptr<native::CqListener>^>();
+
+ static ReaderWriterLock^ g_readerWriterLock = gcnew ReaderWriterLock();
+ };
+
+ /// <summary>
+ /// Supports modification of certain cq attributes after the cq
+ /// has been created.
+ /// </summary>
+ generic<class TKey, class TResult>
+ public ref class CqAttributesMutator sealed
+ {
+ public:
+
+ /// <summary>
+ /// Adds the CqListener for the cq.
+ /// </summary>
+ /// <param name="cqListener">
+ /// user-defined cq listener, or null for no cache listener
+ /// </param>
+ void AddCqListener( Client::ICqListener<TKey, TResult>^ cqListener );
+
+ /// <summary>
+ /// Remove a CqListener for the cq.
+ /// </summary>
+
+ void RemoveCqListener(Client::ICqListener<TKey, TResult>^ aListener);
+
+
+ /// <summary>
+ /// Initialize with an array of listeners
+ /// </summary>
+
+ void SetCqListeners(array<Client::ICqListener<TKey, TResult>^>^ newListeners);
+
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Client::CqAttributesMutator<TKey, TResult>^ Create( native::CqAttributesMutatorPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Client::CqAttributesMutator<TKey, TResult>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqAttributesMutator<TKey, TResult>( native::CqAttributesMutatorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqAttributesMutator>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqAttributesMutator>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqEvent.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqEvent.cpp b/clicache/src/CqEvent.cpp
new file mode 100644
index 0000000..ae1c668
--- /dev/null
+++ b/clicache/src/CqEvent.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "CqEvent.hpp"
+#include "Log.hpp"
+#include "impl/SafeConvert.hpp"
+#include "CacheableBuiltins.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ CqQuery<TKey, TResult>^ CqEvent<TKey, TResult>::getCq( )
+ {
+ native::CqQueryPtr& cQueryptr( m_nativeptr->getCq( ) );
+ return CqQuery<TKey, TResult>::Create( cQueryptr);
+ }
+
+ generic<class TKey, class TResult>
+ CqOperationType CqEvent<TKey, TResult>::getBaseOperation( )
+ {
+ return CqOperation::ConvertFromNative(m_nativeptr->getBaseOperation());
+ }
+
+ generic<class TKey, class TResult>
+ CqOperationType CqEvent<TKey, TResult>::getQueryOperation( )
+ {
+ return CqOperation::ConvertFromNative(m_nativeptr->getQueryOperation());
+ }
+
+ generic<class TKey, class TResult>
+ TKey CqEvent<TKey, TResult>::getKey( )
+ {
+ native::CacheableKeyPtr& keyptr( m_nativeptr->getKey( ) );
+ return Serializable::GetManagedValueGeneric<TKey>(keyptr);
+ }
+
+ generic<class TKey, class TResult>
+ TResult CqEvent<TKey, TResult>::getNewValue( )
+ {
+ native::CacheablePtr& valptr( m_nativeptr->getNewValue( ) );
+ return Serializable::GetManagedValueGeneric<TResult>(valptr);
+ }
+
+ generic<class TKey, class TResult>
+ array< Byte >^ CqEvent<TKey, TResult>::getDeltaValue( )
+ {
+ auto deltaBytes = m_nativeptr->getDeltaValue( );
+ auto managedDeltaBytes = ( CacheableBytes^ ) CacheableBytes::Create( deltaBytes );
+ return ( array< Byte >^ ) managedDeltaBytes;
+ }
+ } // namespace Client
+ } // namespace Geode
+} //namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqEvent.hpp b/clicache/src/CqEvent.hpp
new file mode 100644
index 0000000..d0ddcc1
--- /dev/null
+++ b/clicache/src/CqEvent.hpp
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "native_shared_ptr.hpp"
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqEvent.hpp>
+#include "end_native.hpp"
+
+#include "CqQuery.hpp"
+#include "CqOperation.hpp"
+
+#include "ICqEvent.hpp"
+#include "ICacheableKey.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ /// <summary>
+ /// This class encapsulates events that occur for cq.
+ /// </summary>
+ generic<class TKey, class TResult>
+ public ref class CqEvent sealed
+ {
+ public:
+
+
+ /// <summary>
+ /// Return the cqquery this event occurred in.
+ /// </summary>
+ CqQuery<TKey, TResult>^ getCq();
+
+ /// <summary>
+ /// Get the operation on the base operation that triggered this event.
+ /// </summary>
+ CqOperationType getBaseOperation();
+
+ /// <summary>
+ /// Get the operation on the query operation that triggered this event.
+ /// </summary>
+ CqOperationType getQueryOperation();
+
+ /// <summary>
+ /// Get the key relating to the event.
+ /// In case of REGION_CLEAR and REGION_INVALIDATE operation, the key will be null.
+ /// </summary>
+ TKey /*Generic::ICacheableKey^*/ getKey( );
+
+ /// <summary>
+ /// Get the new value of the modification.
+ /// If there is no new value returns null, this will happen during delete
+ /// operation.
+ /// </summary>
+ /*Object^*/ TResult getNewValue( );
+
+ array< Byte >^ getDeltaValue( );
+
+ internal:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqEvent( const native::CqEvent* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ const native::CqEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ private:
+ const native::CqEvent* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqOperation.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqOperation.hpp b/clicache/src/CqOperation.hpp
new file mode 100644
index 0000000..e6292c9
--- /dev/null
+++ b/clicache/src/CqOperation.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CqOperation.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Enumerated type for CqOperationType
+ /// </summary>
+ public enum class CqOperationType
+ {
+ OP_TYPE_INVALID = -1,
+ OP_TYPE_CREATE = 0,
+ OP_TYPE_UPDATE = 2,
+ OP_TYPE_INVALIDATE = 4,
+ OP_TYPE_REGION_CLEAR = 8,
+ OP_TYPE_DESTROY = 16,
+ OP_TYPE_MARKER = 32
+ };
+
+ public ref class CqOperation sealed
+ {
+ public:
+
+ /// <summary>
+ /// conenience function for convertin from c++
+ /// native::CqOperation::CqOperationType to
+ /// CqOperationType here.
+ /// </summary>
+ inline static CqOperationType ConvertFromNative(native::CqOperation::CqOperationType tp)
+ {
+ if(tp==native::CqOperation::OP_TYPE_CREATE)
+ return CqOperationType::OP_TYPE_CREATE;
+ if(tp==native::CqOperation::OP_TYPE_UPDATE)
+ return CqOperationType::OP_TYPE_UPDATE;
+ if(tp==native::CqOperation::OP_TYPE_INVALIDATE)
+ return CqOperationType::OP_TYPE_INVALIDATE;
+ if(tp==native::CqOperation::OP_TYPE_REGION_CLEAR)
+ return CqOperationType::OP_TYPE_REGION_CLEAR;
+ if(tp==native::CqOperation::OP_TYPE_DESTROY)
+ return CqOperationType::OP_TYPE_DESTROY;
+ if(tp==native::CqOperation::OP_TYPE_MARKER)
+ return CqOperationType::OP_TYPE_MARKER;
+ return CqOperationType::OP_TYPE_INVALID;
+ }
+ internal:
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CqOperation( native::CqOperation* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ private:
+ const native::CqOperation* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CqQuery.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CqQuery.cpp b/clicache/src/CqQuery.cpp
new file mode 100644
index 0000000..25c93d9
--- /dev/null
+++ b/clicache/src/CqQuery.cpp
@@ -0,0 +1,286 @@
+/*
+ * 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.
+ */
+
+
+#include "CqQuery.hpp"
+#include "Query.hpp"
+#include "CqAttributes.hpp"
+#include "CqAttributesMutator.hpp"
+#include "CqStatistics.hpp"
+#include "ISelectResults.hpp"
+#include "ResultSet.hpp"
+#include "StructSet.hpp"
+#include "ExceptionTypes.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ ICqResults<TResult>^ CqQuery<TKey, TResult>::ExecuteWithInitialResults()
+ {
+ return ExecuteWithInitialResults(DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+
+ generic<class TKey, class TResult>
+ ICqResults<TResult>^ CqQuery<TKey, TResult>::ExecuteWithInitialResults(System::UInt32 timeout)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->executeWithInitialResults(timeout);
+
+ if (auto structptr = std::dynamic_pointer_cast<native::StructSet>(nativeptr))
+ {
+ return StructSet<TResult>::Create(structptr);
+ }
+
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ void CqQuery<TKey, TResult>::Execute()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->execute();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ String^ CqQuery<TKey, TResult>::QueryString::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getQueryString( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ String^ CqQuery<TKey, TResult>::Name::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ Query<TResult>^ CqQuery<TKey, TResult>::GetQuery( )
+ {
+ try
+ {
+ return Query<TResult>::Create(m_nativeptr->get()->getQuery());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqAttributes<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributes( )
+ {
+ try
+ {
+ return CqAttributes<TKey, TResult>::Create(m_nativeptr->get()->getCqAttributes( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqAttributesMutator<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributesMutator( )
+ {
+ try
+ {
+ return CqAttributesMutator<TKey, TResult>::Create(m_nativeptr->get()->getCqAttributesMutator());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqStatistics^ CqQuery<TKey, TResult>::GetStatistics( )
+ {
+ try
+ {
+ return CqStatistics::Create(m_nativeptr->get()->getStatistics());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ CqStateType CqQuery<TKey, TResult>::GetState( )
+ {
+ try
+ {
+ auto st = m_nativeptr->get()->getState();
+ CqStateType state;
+ switch (st)
+ {
+ case native::CqState::STOPPED: {
+ state = CqStateType::STOPPED;
+ break;
+ }
+ case native::CqState::RUNNING: {
+ state = CqStateType::RUNNING;
+ break;
+ }
+ case native::CqState::CLOSED: {
+ state = CqStateType::CLOSED;
+ break;
+ }
+ case native::CqState::CLOSING: {
+ state = CqStateType::CLOSING;
+ break;
+ }
+ default: {
+ state = CqStateType::INVALID;
+ break;
+ }
+ }
+ return state;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TResult>
+ void CqQuery<TKey, TResult>::Stop( )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->stop( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ void CqQuery<TKey, TResult>::Close( )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->close( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ bool CqQuery<TKey, TResult>::IsRunning( )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->isRunning( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ bool CqQuery<TKey, TResult>::IsStopped( )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->isStopped( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TResult>
+ bool CqQuery<TKey, TResult>::IsClosed()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->isClosed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[35/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientQueryTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientQueryTestsN.cs b/clicache/integration-test/ThinClientQueryTestsN.cs
new file mode 100644
index 0000000..ef6c0e1
--- /dev/null
+++ b/clicache/integration-test/ThinClientQueryTestsN.cs
@@ -0,0 +1,1981 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+
+ using Apache.Geode.Client;
+
+ using QueryStatics = Apache.Geode.Client.Tests.QueryStatics;
+ using QueryCategory = Apache.Geode.Client.Tests.QueryCategory;
+ using QueryStrings = Apache.Geode.Client.Tests.QueryStrings;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientQueryTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+ "Portfolios3" };
+ private static string QERegionName = "Portfolios";
+ private static string endpoint1;
+ private static string endpoint2;
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTest();
+ }
+
+ [SetUp]
+ public override void InitTest()
+ {
+ m_client1.Call(InitClient);
+ m_client2.Call(InitClient);
+ }
+
+ #region Functions invoked by the tests
+
+ public void InitClient()
+ {
+ CacheHelper.Init();
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(Apache.Geode.Client.Tests.PositionPdx.CreateDeserializable);
+ }
+
+ public void StepOneQE(string locators, bool isPdx)
+ {
+ m_isPdx = isPdx;
+ try
+ {
+ QueryService<object, object> qsFail = null;
+ qsFail = CacheHelper.DCache.GetPoolManager().CreateFactory().Create("_TESTFAILPOOL_", CacheHelper.DCache).GetQueryService<object, object>();
+ Query<object> qryFail = qsFail.NewQuery("select distinct * from /" + QERegionName);
+ ISelectResults<object> resultsFail = qryFail.Execute();
+ Assert.Fail("Since no endpoints defined, so exception expected");
+ }
+ catch (IllegalStateException ex)
+ {
+ Util.Log("Got expected exception: {0}", ex);
+ }
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ if (!m_isPdx)
+ {
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 100);
+ Portfolio p3 = new Portfolio(3, 100);
+ Portfolio p4 = new Portfolio(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+ }
+ else
+ {
+ PortfolioPdx p1 = new PortfolioPdx(1, 100);
+ PortfolioPdx p2 = new PortfolioPdx(2, 100);
+ PortfolioPdx p3 = new PortfolioPdx(3, 100);
+ PortfolioPdx p4 = new PortfolioPdx(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+ }
+
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ Query<object> qry = qs.NewQuery("select distinct * from /" + QERegionName);
+ ISelectResults<object> results = qry.Execute();
+ Int32 count = results.Size;
+ Assert.AreEqual(4, count, "Expected 4 as number of portfolio objects.");
+
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+
+ public void StepTwoQE()
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ Util.Log("Going to execute the query");
+ Query<object> qry = qs.NewQuery("select distinct * from /" + QERegionName);
+ ISelectResults<object> results = qry.Execute();
+ Int32 count = results.Size;
+ Assert.AreEqual(4, count, "Expected 4 as number of portfolio objects.");
+ }
+
+ public void StepOne(string locators, bool isPdx)
+ {
+ m_isPdx = isPdx;
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+ region.CreateSubRegion(QueryRegionNames[1], regattrs);
+ }
+
+ public void StepTwo(bool isPdx)
+ {
+ m_isPdx = isPdx;
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = (IRegion<object, object>)region0.GetSubRegion(QueryRegionNames[1]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+ IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+ IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+
+ if (!m_isPdx)
+ {
+ qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+ else
+ {
+ qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionPdxData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionPdxData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+ }
+
+ public void StepTwoQT()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ if (!m_isPdx)
+ {
+ qh.PopulatePortfolioData(region0, 100, 20, 100);
+ qh.PopulatePositionData(subRegion0, 100, 20);
+ }
+ else
+ {
+ qh.PopulatePortfolioPdxData(region0, 100, 20, 100);
+ qh.PopulatePositionPdxData(subRegion0, 100, 20);
+ }
+ }
+
+ public void StepThreeRS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ if (m_isPdx == true)
+ {
+ if (qryIdx == 2 || qryIdx == 3 || qryIdx == 4)
+ {
+ Util.Log("Skipping query index {0} for Pdx because it is function type.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+
+ Util.Log("Evaluating query index {0}. Query string {1}", qryIdx, qrystr.Query);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ ISelectResults<object> results = query.Execute();
+
+ int expectedRowCount = qh.IsExpectedRowsConstantRS(qryIdx) ?
+ QueryStatics.ResultSetRowCounts[qryIdx] : QueryStatics.ResultSetRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+ if (!qh.VerifyRS(results, expectedRowCount))
+ {
+ ErrorOccurred = true;
+ Util.Log("Query verify failed for query index {0}.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ ResultSet<object> rs = results as ResultSet<object>;
+
+ foreach (object item in rs)
+ {
+ if (!m_isPdx)
+ {
+ Portfolio port = item as Portfolio;
+ if (port == null)
+ {
+ Position pos = item as Position;
+ if (pos == null)
+ {
+ string cs = item.ToString();
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ else
+ {
+ PortfolioPdx port = item as PortfolioPdx;
+ if (port == null)
+ {
+ PositionPdx pos = item as PositionPdx;
+ if (pos == null)
+ {
+ string cs = item.ToString();
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.secId, pos.getSharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ }
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ }
+
+ public void StepThreePQRS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings paramqrystr in QueryStatics.ResultSetParamQueries)
+ {
+ if (paramqrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}. {1}", qryIdx, paramqrystr.Query);
+
+ Query<object> query = qs.NewQuery(paramqrystr.Query);
+
+ //Populate the parameter list (paramList) for the query.
+ object[] paramList = new object[QueryStatics.NoOfQueryParam[qryIdx]];
+ int numVal = 0;
+ for (int ind = 0; ind < QueryStatics.NoOfQueryParam[qryIdx]; ind++)
+ {
+ //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSet[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSet[qryIdx][ind]);
+
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSet[qryIdx][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS::361 Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSet[qryIdx][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: routingObj[0] = {1}", ind, routingObj[ind].ToString());
+ }
+ }
+
+ ISelectResults<object> results = query.Execute(paramList);
+
+ //Varify the result
+ int expectedRowCount = qh.IsExpectedRowsConstantPQRS(qryIdx) ?
+ QueryStatics.ResultSetPQRowCounts[qryIdx] : QueryStatics.ResultSetPQRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+ if (!qh.VerifyRS(results, expectedRowCount))
+ {
+ ErrorOccurred = true;
+ Util.Log("Query verify failed for query index {0}.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ ResultSet<object> rs = results as ResultSet<object>;
+
+ foreach (object item in rs)
+ {
+ if (!m_isPdx)
+ {
+ Portfolio port = item as Portfolio;
+ if (port == null)
+ {
+ Position pos = item as Position;
+ if (pos == null)
+ {
+ string cs = item as string;
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ else
+ {
+ PortfolioPdx port = item as PortfolioPdx;
+ if (port == null)
+ {
+ PositionPdx pos = item as PositionPdx;
+ if (pos == null)
+ {
+ string cs = item as string;
+ if (cs == null)
+ {
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got PositionPdx object with secId {0}, shares {1}.", pos.secId, pos.getSharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got PortfolioPdx object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ }
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ }
+
+ public void StepFourRS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.ResultSetQueries)
+ {
+ if (qrystr.Category != QueryCategory.Unsupported)
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ try
+ {
+ ISelectResults<object> results = query.Execute();
+
+ Util.Log("Query exception did not occur for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (GeodeException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ public void StepFourPQRS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.ResultSetParamQueries)
+ {
+ if (qrystr.Category != QueryCategory.Unsupported)
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ object[] paramList = new object[QueryStatics.NoOfQueryParam[qryIdx]];
+
+ Int32 numVal = 0;
+ for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParam[qryIdx]; ind++)
+ {
+ //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSet[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSet[qryIdx, ind]);
+
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSet[qryIdx][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSet[qryIdx][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+ }
+ }
+
+ try
+ {
+ ISelectResults<object> results = query.Execute(paramList);
+
+ Util.Log("Query exception did not occur for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (GeodeException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ public void StepThreeSS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.StructSetQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ if (m_isPdx == true)
+ {
+ if (qryIdx == 12 || qryIdx == 4 || qryIdx == 7 || qryIdx == 22 || qryIdx == 30 || qryIdx == 34)
+ {
+ Util.Log("Skipping query index {0} for pdx because it has function.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+
+ Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ ISelectResults<object> results = query.Execute();
+
+ int expectedRowCount = qh.IsExpectedRowsConstantSS(qryIdx) ?
+ QueryStatics.StructSetRowCounts[qryIdx] : QueryStatics.StructSetRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+ if (!qh.VerifySS(results, expectedRowCount, QueryStatics.StructSetFieldCounts[qryIdx]))
+ {
+ ErrorOccurred = true;
+ Util.Log("Query verify failed for query index {0}.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ StructSet<object> ss = results as StructSet<object>;
+ if (ss == null)
+ {
+ Util.Log("Zero records found for query index {0}, continuing.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ uint rows = 0;
+ Int32 fields = 0;
+ foreach (Struct si in ss)
+ {
+ rows++;
+ fields = (Int32)si.Length;
+ }
+
+ Util.Log("Query index {0} has {1} rows and {2} fields.", qryIdx, rows, fields);
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ }
+
+ public void StepThreePQSS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.StructSetParamQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+ if (m_isPdx == true)
+ {
+ if (qryIdx == 16)
+ {
+ Util.Log("Skipping query index {0} for pdx because it has function.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ //Populate the param list, paramList for parameterized query
+ object[] paramList = new object[QueryStatics.NoOfQueryParamSS[qryIdx]];
+
+ Int32 numVal = 0;
+ for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[qryIdx]; ind++)
+ {
+ //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSetSS[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSetSS[qryIdx, ind]);
+
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[qryIdx][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[qryIdx][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+ }
+ }
+
+ ISelectResults<object> results = query.Execute(paramList);
+
+ int expectedRowCount = qh.IsExpectedRowsConstantPQSS(qryIdx) ?
+ QueryStatics.StructSetPQRowCounts[qryIdx] : QueryStatics.StructSetPQRowCounts[qryIdx] * qh.PortfolioNumSets;
+
+ if (!qh.VerifySS(results, expectedRowCount, QueryStatics.StructSetPQFieldCounts[qryIdx]))
+ {
+ ErrorOccurred = true;
+ Util.Log("Query verify failed for query index {0}.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ StructSet<object> ss = results as StructSet<object>;
+ if (ss == null)
+ {
+ Util.Log("Zero records found for query index {0}, continuing.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ uint rows = 0;
+ Int32 fields = 0;
+ foreach (Struct si in ss)
+ {
+ rows++;
+ fields = (Int32)si.Length;
+ }
+
+ Util.Log("Query index {0} has {1} rows and {2} fields.", qryIdx, rows, fields);
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ }
+
+ public void StepFourSS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.StructSetQueries)
+ {
+ if (qrystr.Category != QueryCategory.Unsupported)
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ try
+ {
+ ISelectResults<object> results = query.Execute();
+
+ Util.Log("Query exception did not occur for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (GeodeException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ public void StepFourPQSS()
+ {
+ bool ErrorOccurred = false;
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.StructSetParamQueries)
+ {
+ if (qrystr.Category != QueryCategory.Unsupported)
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ Query<object> query = qs.NewQuery(qrystr.Query);
+
+ //Populate the param list
+ object[] paramList = new object[QueryStatics.NoOfQueryParamSS[qryIdx]];
+
+ Int32 numVal = 0;
+ for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[qryIdx]; ind++)
+ {
+ //Util.Log("NIL::PQRS:: QueryStatics.QueryParamSetSS[{0},{1}] = {2}", qryIdx, ind, QueryStatics.QueryParamSetSS[qryIdx, ind]);
+
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[qryIdx][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[qryIdx][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+ }
+ }
+
+ try
+ {
+ ISelectResults<object> results = query.Execute(paramList);
+
+ Util.Log("Query exception did not occur for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (GeodeException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ Util.Log("Query unexpected exception occurred for index {0}.", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ public void KillServer()
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ public delegate void KillServerDelegate();
+
+ public void StepOneFailover(bool isPdx)
+ {
+ m_isPdx = isPdx;
+ // This is here so that Client1 registers information of the cacheserver
+ // that has been already started
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_remoteoqlN.xml",
+ "cacheserver_remoteoql2N.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true, null,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QueryRegionNames[0]);
+ if (!m_isPdx)
+ {
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 200);
+ Portfolio p3 = new Portfolio(3, 300);
+ Portfolio p4 = new Portfolio(4, 400);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+ }
+ else
+ {
+ PortfolioPdx p1 = new PortfolioPdx(1, 100);
+ PortfolioPdx p2 = new PortfolioPdx(2, 200);
+ PortfolioPdx p3 = new PortfolioPdx(3, 300);
+ PortfolioPdx p4 = new PortfolioPdx(4, 400);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+ }
+ }
+
+ public void StepTwoFailover()
+ {
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ IAsyncResult killRes = null;
+ KillServerDelegate ksd = new KillServerDelegate(KillServer);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ for (int i = 0; i < 10000; i++)
+ {
+ Query<object> qry = qs.NewQuery("select distinct * from /" + QueryRegionNames[0]);
+
+ ISelectResults<object> results = qry.Execute();
+
+ if (i == 10)
+ {
+ killRes = ksd.BeginInvoke(null, null);
+ }
+
+ Int32 resultSize = results.Size;
+
+ if (i % 100 == 0)
+ {
+ Util.Log("Iteration upto {0} done, result size is {1}", i, resultSize);
+ }
+
+ Assert.AreEqual(4, resultSize, "Result size is not 4!");
+ }
+
+ killRes.AsyncWaitHandle.WaitOne();
+ ksd.EndInvoke(killRes);
+ }
+
+ public void StepTwoPQFailover()
+ {
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ IAsyncResult killRes = null;
+ KillServerDelegate ksd = new KillServerDelegate(KillServer);
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ for (int i = 0; i < 10000; i++)
+ {
+ Query<object> qry = qs.NewQuery("select distinct * from /" + QueryRegionNames[0] + " where ID > $1");
+
+ //Populate the param list
+ object[] paramList = new object[1];
+ paramList[0] = 1;
+
+ ISelectResults<object> results = qry.Execute(paramList);
+
+ if (i == 10)
+ {
+ killRes = ksd.BeginInvoke(null, null);
+ }
+
+ Int32 resultSize = results.Size;
+
+ if (i % 100 == 0)
+ {
+ Util.Log("Iteration upto {0} done, result size is {1}", i, resultSize);
+ }
+
+ Assert.AreEqual(3, resultSize, "Result size is not 3!");
+ }
+
+ killRes.AsyncWaitHandle.WaitOne();
+ ksd.EndInvoke(killRes);
+ }
+
+ public void StepThreeQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ Util.Log("query " + QueryStatics.ResultSetQueries[34].Query);
+ Query<object> query = qs.NewQuery(QueryStatics.ResultSetQueries[34].Query);
+
+ try
+ {
+ Util.Log("EXECUTE 1 START for query: ", query.QueryString);
+ ISelectResults<object> results = query.Execute(3);
+ Util.Log("EXECUTE 1 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ Assert.Fail("Didnt get expected timeout exception for first execute");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("First execute expected exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepFourQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ Query<object> query = qs.NewQuery(QueryStatics.ResultSetQueries[35].Query);
+
+ try
+ {
+ Util.Log("EXECUTE 2 START for query: ", query.QueryString);
+ ISelectResults<object> results = query.Execute(850);
+ Util.Log("EXECUTE 2 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ }
+ catch (GeodeException excp)
+ {
+ Assert.Fail("Second execute unwanted exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepFiveQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ Query<object> query = qs.NewQuery(QueryStatics.StructSetQueries[17].Query);
+
+ try
+ {
+ Util.Log("EXECUTE 3 START for query: ", query.QueryString);
+ ISelectResults<object> results = query.Execute(2);
+ Util.Log("EXECUTE 3 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ Assert.Fail("Didnt get expected timeout exception for third execute");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Third execute expected exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepSixQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ Query<object> query = qs.NewQuery(QueryStatics.StructSetQueries[17].Query);
+
+ try
+ {
+ Util.Log("EXECUTE 4 START for query: ", query.QueryString);
+ ISelectResults<object> results = query.Execute(850);
+ Util.Log("EXECUTE 4 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ }
+ catch (GeodeException excp)
+ {
+ Assert.Fail("Fourth execute unwanted exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepThreePQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ Query<object> query = qs.NewQuery(QueryStatics.StructSetParamQueries[5].Query);
+
+
+ try
+ {
+ Util.Log("EXECUTE 5 START for query: ", query.QueryString);
+ //Populate the param list, paramList for parameterized query
+ object[] paramList = new object[QueryStatics.NoOfQueryParamSS[5]];
+
+ Int32 numVal = 0;
+ for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[5]; ind++)
+ {
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[5][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[5][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+ }
+ }
+
+ ISelectResults<object> results = query.Execute(paramList, 1);
+ Util.Log("EXECUTE 5 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ Assert.Fail("Didnt get expected timeout exception for Fifth execute");
+ }
+ catch (GeodeException excp)
+ {
+ Util.Log("Fifth execute expected exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepFourPQT()
+ {
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ Query<object> query = qs.NewQuery(QueryStatics.StructSetParamQueries[5].Query);
+
+ try
+ {
+ Util.Log("EXECUTE 6 START for query: ", query.QueryString);
+ //Populate the param list, paramList for parameterized query
+ object[] paramList = new object[QueryStatics.NoOfQueryParamSS[5]];
+
+ Int32 numVal = 0;
+ for (Int32 ind = 0; ind < QueryStatics.NoOfQueryParamSS[5]; ind++)
+ {
+ try
+ {
+ numVal = Convert.ToInt32(QueryStatics.QueryParamSetSS[5][ind]);
+ paramList[ind] = numVal;
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind]);
+ }
+ catch (FormatException)
+ {
+ //Console.WriteLine("Param string is not a sequence of digits.");
+ paramList[ind] = (System.String)QueryStatics.QueryParamSetSS[5][ind];
+ //Util.Log("NIL::PQRS:: Interger Args:: paramList[0] = {1}", ind, paramList[ind].ToString());
+ }
+ }
+
+ ISelectResults<object> results = query.Execute(paramList, 850);
+ Util.Log("EXECUTE 6 STOP");
+ Util.Log("Result size is {0}", results.Size);
+ }
+ catch (GeodeException excp)
+ {
+ Assert.Fail("Sixth execute unwanted exception: {0}", excp.Message);
+ }
+ }
+
+ public void StepThreeRQ()
+ {
+ bool ErrorOccurred = false;
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}. {1}", qryIdx, qrystr.Query);
+
+ if (m_isPdx)
+ {
+ if (qryIdx == 18)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported for pdx type.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+
+ ISelectResults<object> results = region.Query<object>(qrystr.Query);
+
+ if (results.Size != QueryStatics.RegionQueryRowCounts[qryIdx])
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} expected result size is {1}, actual is {2}", qryIdx,
+ QueryStatics.RegionQueryRowCounts[qryIdx], results.Size);
+ qryIdx++;
+ continue;
+ }
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+
+ try
+ {
+ ISelectResults<object> results = region.Query<object>("");
+ Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+ Util.Log(ex.Message);
+ }
+
+
+ try
+ {
+ ISelectResults<object> results = region.Query<object>(QueryStatics.RegionQueries[0].Query, 2200000);
+ Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+ Util.Log(ex.Message);
+ }
+
+
+ try
+ {
+ ISelectResults<object> results = region.Query<object>("bad predicate");
+ Assert.Fail("Expected QueryException exception for wrong predicate");
+ }
+ catch (QueryException ex)
+ {
+ Util.Log("got expected QueryException exception for wrong predicate:");
+ Util.Log(ex.Message);
+ }
+ }
+
+ public void StepFourRQ()
+ {
+ bool ErrorOccurred = false;
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}.{1}", qryIdx, qrystr.Query);
+
+ bool existsValue = region.ExistsValue(qrystr.Query);
+ bool expectedResult = QueryStatics.RegionQueryRowCounts[qryIdx] > 0 ? true : false;
+
+ if (existsValue != expectedResult)
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} existsValue expected is {1}, actual is {2}", qryIdx,
+ expectedResult ? "true" : "false", existsValue ? "true" : "false");
+ qryIdx++;
+ continue;
+ }
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+ try
+ {
+ bool existsValue = region.ExistsValue("");
+ Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+ Util.Log(ex.Message);
+ }
+
+
+ try
+ {
+ bool existsValue = region.ExistsValue(QueryStatics.RegionQueries[0].Query, 2200000);
+ Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+ Util.Log(ex.Message);
+ }
+
+
+ try
+ {
+ bool existsValue = region.ExistsValue("bad predicate");
+ Assert.Fail("Expected QueryException exception for wrong predicate");
+ }
+ catch (QueryException ex)
+ {
+ Util.Log("got expected QueryException exception for wrong predicate:");
+ Util.Log(ex.Message);
+ }
+ }
+
+ public void StepFiveRQ()
+ {
+ bool ErrorOccurred = false;
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+ {
+ if (qrystr.Category == QueryCategory.Unsupported)
+ {
+ Util.Log("Skipping query index {0} because it is unsupported.", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating query index {0}.", qryIdx);
+
+ try
+ {
+ Object result = region.SelectValue(qrystr.Query);
+
+ if (!(QueryStatics.RegionQueryRowCounts[qryIdx] == 0 ||
+ QueryStatics.RegionQueryRowCounts[qryIdx] == 1))
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} expected query exception did not occur", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+ catch (QueryException)
+ {
+ if (QueryStatics.RegionQueryRowCounts[qryIdx] == 0 ||
+ QueryStatics.RegionQueryRowCounts[qryIdx] == 1)
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} unexpected query exception occured", qryIdx);
+ qryIdx++;
+ continue;
+ }
+ }
+ catch (Exception)
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} unexpected exception occured", qryIdx);
+ qryIdx++;
+ continue;
+ }
+
+ qryIdx++;
+ }
+
+ Assert.IsFalse(ErrorOccurred, "One or more query validation errors occurred.");
+
+ try
+ {
+ Object result = region.SelectValue("");
+ Assert.Fail("Expected IllegalArgumentException exception for empty predicate");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for empty predicate:");
+ Util.Log(ex.Message);
+ }
+
+
+ try
+ {
+ Object result = region.SelectValue(QueryStatics.RegionQueries[0].Query, 2200000);
+ Assert.Fail("Expected IllegalArgumentException exception for invalid timeout");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("got expected IllegalArgumentException exception for invalid timeout:");
+ Util.Log(ex.Message);
+ }
+
+ try
+ {
+ Object result = region.SelectValue("bad predicate");
+ Assert.Fail("Expected QueryException exception for wrong predicate");
+ }
+ catch (QueryException ex)
+ {
+ Util.Log("got expected QueryException exception for wrong predicate:");
+ Util.Log(ex.Message);
+ }
+ }
+
+ public void StepSixRQ()
+ {
+ bool ErrorOccurred = false;
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+
+ int qryIdx = 0;
+
+ foreach (QueryStrings qrystr in QueryStatics.RegionQueries)
+ {
+ if ((qrystr.Category != QueryCategory.Unsupported) || (qryIdx == 3))
+ {
+ qryIdx++;
+ continue;
+ }
+
+ Util.Log("Evaluating unsupported query index {0}.", qryIdx);
+
+ try
+ {
+ ISelectResults<object> results = region.Query<object>(qrystr.Query);
+
+ Util.Log("Query # {0} expected exception did not occur", qryIdx);
+ ErrorOccurred = true;
+ qryIdx++;
+ }
+ catch (QueryException)
+ {
+ // ok, exception expected, do nothing.
+ qryIdx++;
+ }
+ catch (Exception)
+ {
+ ErrorOccurred = true;
+ Util.Log("FAIL: Query # {0} unexpected exception occured", qryIdx);
+ qryIdx++;
+ }
+ }
+
+ Assert.IsFalse(ErrorOccurred, "Query expected exceptions did not occur.");
+ }
+
+ //private void CreateRegions(object p, object USE_ACK, object endPoint1, bool p_4)
+ //{
+ // throw new Exception("The method or operation is not implemented.");
+ //}
+
+
+ //public void CompareMap(CacheableHashMap map1, CacheableHashMap map2)
+ //{
+ // if (map1.Count != map2.Count)
+ // Assert.Fail("Number of Keys dont match");
+ // if (map1.Count == 0) return;
+ // foreach (KeyValuePair<ICacheableKey, IGeodeSerializable> entry in map1)
+ // {
+ // IGeodeSerializable value;
+ // if (!(map2.TryGetValue(entry.Key,out value)))
+ // {
+ // Assert.Fail("Key was not found");
+ // return;
+ // }
+ // if(entry.Value.Equals(value))
+ // {
+ // Assert.Fail("Value was not found");
+ // return;
+ // }
+ // }
+ //}
+
+ //public void GetAllRegionQuery()
+ //{
+ // IRegion<object, object> region0 = CacheHelper.GetVerifyRegion(QueryRegionNames[0]);
+ // IRegion<object, object> region1 = region0.GetSubRegion(QueryRegionNames[1] );
+ // IRegion<object, object> region2 = CacheHelper.GetVerifyRegion(QueryRegionNames[1]);
+ // IRegion<object, object> region3 = CacheHelper.GetVerifyRegion(QueryRegionNames[2]);
+ // IRegion<object, object> region4 = CacheHelper.GetVerifyRegion(QueryRegionNames[3]);
+ // string[] SecIds = Portfolio.SecIds;
+ // int NumSecIds = SecIds.Length;
+ // List<ICacheableKey> PosKeys = new List<ICacheableKey>();
+ // List<ICacheableKey> PortKeys = new List<ICacheableKey>();
+ // CacheableHashMap ExpectedPosMap = new CacheableHashMap();
+ // CacheableHashMap ExpectedPortMap = new CacheableHashMap();
+ // QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ // int SetSize = qh.PositionSetSize;
+ // int NumSets = qh.PositionNumSets;
+ // for (int set = 1; set <= NumSets; set++)
+ // {
+ // for (int current = 1; current <= SetSize; current++)
+ // {
+ // CacheableKey PosKey = "pos" + set + "-" + current;
+ // Position pos = new Position(SecIds[current % NumSecIds], current * 100 );
+ // PosKeys.Add(PosKey);
+ // ExpectedPosMap.Add(PosKey, pos);
+ // }
+ // }
+ // SetSize = qh.PortfolioSetSize;
+ // NumSets = qh.PortfolioNumSets;
+ // for (int set = 1; set <= NumSets; set++)
+ // {
+ // for (int current = 1; current <= SetSize; current++)
+ // {
+ // CacheableKey PortKey = "port" + set + "-" + current;
+ // Portfolio Port = new Portfolio(current,1);
+ // PortKeys.Add(PortKey);
+ // ExpectedPortMap.Add(PortKey, Port);
+ // }
+ // }
+ // CacheableHashMap ResMap = new CacheableHashMap();
+ // Dictionary<ICacheableKey, Exception> ExMap = new Dictionary<ICacheableKey, Exception>();
+ // region0.GetAll(PortKeys.ToArray(), ResMap, ExMap);
+ // CompareMap(ResMap, ExpectedPortMap);
+ // if (ExMap.Count != 0)
+ // {
+ // Assert.Fail("Expected No Exception");
+ // }
+ // ResMap.Clear();
+
+ // region1.GetAll(PosKeys.ToArray(), ResMap, ExMap);
+ // CompareMap(ResMap, ExpectedPosMap);
+ // if (ExMap.Count != 0)
+ // {
+ // Assert.Fail("Expected No Exception");
+ // }
+ // ResMap.Clear();
+ // region2.GetAll(PosKeys.ToArray(), ResMap, ExMap);
+ // CompareMap(ResMap, ExpectedPosMap);
+ // if (ExMap.Count != 0)
+ // {
+ // Assert.Fail("Expected No Exception");
+ // }
+ // ResMap.Clear();
+
+ // region3.GetAll(PortKeys.ToArray(), ResMap, ExMap);
+ // CompareMap(ResMap, ExpectedPortMap);
+ // if (ExMap.Count != 0)
+ // {
+ // Assert.Fail("Expected No Exception");
+ // }
+ // ResMap.Clear();
+
+ // region4.GetAll(PortKeys.ToArray(), ResMap, ExMap);
+ // CompareMap(ResMap, ExpectedPortMap);
+ // if (ExMap.Count != 0)
+ // {
+ // Assert.Fail("Expected No Exception");
+ // }
+ // ResMap.Clear();
+ //}
+ #endregion
+
+ void runRemoteQueryRS()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwo, m_isPdx);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThreeRS);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(StepFourRS);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runRemoteParamQueryRS()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwo, m_isPdx);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThreePQRS);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(StepFourPQRS);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runRemoteQuerySS()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(StepTwo, m_isPdx);
+ Util.Log("StepTwo complete.");
+
+ m_client2.Call(StepThreeSS);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourSS);
+ Util.Log("StepFour complete.");
+
+ //m_client2.Call(GetAllRegionQuery);
+
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runRemoteParamQuerySS()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(StepTwo, m_isPdx);
+ Util.Log("StepTwo complete.");
+
+ m_client2.Call(StepThreePQSS);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourPQSS);
+ Util.Log("StepFour complete.");
+
+ //m_client2.Call(GetAllRegionQuery);
+
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runRemoteQueryFailover()
+ {
+ try
+ {
+ m_client1.Call(StepOneFailover, m_isPdx);
+ Util.Log("StepOneFailover complete.");
+
+ m_client1.Call(StepTwoFailover);
+ Util.Log("StepTwoFailover complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+ }
+ finally
+ {
+ m_client1.Call(CacheHelper.StopJavaServers);
+ m_client1.Call(CacheHelper.StopJavaLocator, 1);
+ }
+ }
+
+ void runRemoteParamQueryFailover()
+ {
+ try
+ {
+ m_client1.Call(StepOneFailover, m_isPdx);
+ Util.Log("StepOneFailover complete.");
+
+ m_client1.Call(StepTwoPQFailover);
+ Util.Log("StepTwoPQFailover complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+ }
+ finally
+ {
+ m_client1.Call(CacheHelper.StopJavaServers);
+ m_client1.Call(CacheHelper.StopJavaLocator, 1);
+ }
+ }
+
+ void runQueryExclusiveness()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_remoteoqlN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOneQE, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwoQE);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runQueryTimeout()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwoQT);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThreeQT);
+ Util.Log("StepThree complete.");
+
+ Thread.Sleep(150000); // sleep 2.5min to allow server query to complete
+
+ m_client1.Call(StepFourQT);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFiveQT);
+ Util.Log("StepFive complete.");
+
+ Thread.Sleep(60000); // sleep 1min to allow server query to complete
+
+ m_client1.Call(StepSixQT);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runParamQueryTimeout()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started. WITH PDX = " + m_isPdx);
+
+ m_client1.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwoQT);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThreePQT);
+ Util.Log("StepThreePQT complete.");
+
+ Thread.Sleep(60000); // sleep 1min to allow server query to complete
+
+ m_client1.Call(StepFourPQT);
+ Util.Log("StepFourPQT complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runRegionQuery()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client2.Call(StepOne, CacheHelper.Locators, m_isPdx);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(StepTwo, m_isPdx);
+ Util.Log("StepTwo complete.");
+
+ //Extra Step
+ //m_client1.Call(StepExtra);
+
+ m_client2.Call(StepThreeRQ);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourRQ);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(StepFiveRQ);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixRQ);
+ Util.Log("StepSix complete.");
+
+ m_client2.Call(Close);
+ Util.Log("Client closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ static bool m_isPdx = false;
+
+ [Test]
+ public void RemoteQueryRS()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteQueryRS();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ public void RemoteParamQueryRS()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteParamQueryRS();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ public void RemoteQuerySS()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteQuerySS();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ public void RemoteParamQuerySS()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteParamQuerySS();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ [Ignore]
+ public void RemoteQueryFailover()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteQueryFailover();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ [Ignore]
+ public void RemoteParamQueryFailover()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRemoteParamQueryFailover();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ public void QueryExclusiveness()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runQueryExclusiveness();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ [Ignore]
+ public void QueryTimeout()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runQueryTimeout();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ [Test]
+ [Ignore]
+ public void ParamQueryTimeout()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runParamQueryTimeout();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ //Successful@8th_march
+ [Test]
+ public void RegionQuery()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runRegionQuery();
+ m_isPdx = true;
+ }
+ m_isPdx = false;
+ }
+
+ }
+}
[14/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/LocalRegion.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/LocalRegion.hpp b/clicache/src/LocalRegion.hpp
new file mode 100644
index 0000000..aa9679d
--- /dev/null
+++ b/clicache/src/LocalRegion.hpp
@@ -0,0 +1,263 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "IRegion.hpp"
+#include "Log.hpp"
+#include "ExceptionTypes.hpp"
+#include "RegionAttributes.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TValue>
+ ref class RegionEntry;
+
+ generic<class TKey, class TValue>
+ ref class AttributesMutator;
+
+ generic<class TKey, class TValue>
+ public ref class LocalRegion : public IRegion<TKey, TValue>
+ {
+ public:
+
+ virtual property TValue default[TKey]
+ {
+ TValue get(TKey key);
+ void set(TKey key, TValue value);
+ }
+
+ virtual System::Collections::Generic::IEnumerator<KeyValuePair<TKey,TValue>>^ GetEnumerator();
+
+ virtual System::Collections::IEnumerator^ GetEnumeratorOld() =
+ System::Collections::IEnumerable::GetEnumerator;
+
+ virtual bool ContainsKey(TKey key);
+
+ virtual void Add(TKey key, TValue val);
+
+ virtual void Add(KeyValuePair<TKey, TValue> keyValuePair);
+
+ virtual void Add(TKey key, TValue value, Object^ callbackArg);
+
+ virtual bool Remove(TKey key);
+
+ virtual bool Remove( TKey key, Object^ callbackArg );
+
+ virtual bool Remove(KeyValuePair<TKey,TValue> keyValuePair);
+
+ virtual bool Remove(TKey key, TValue value, Object^ callbackArg );
+
+ virtual bool Contains(KeyValuePair<TKey,TValue> keyValuePair);
+
+ virtual void Clear();
+
+ virtual void Clear(Object^ callbackArg);
+
+ virtual void CopyTo(array<KeyValuePair<TKey,TValue>>^ toArray, int startIdx);
+
+ virtual bool TryGetValue(TKey key, TValue %val);
+
+ virtual property int Count
+ {
+ int get();
+ }
+
+ virtual property bool IsReadOnly
+ {
+ bool get() {throw gcnew System::NotImplementedException;/*return false;*/}
+ }
+
+ virtual property System::Collections::Generic::ICollection<TKey>^ Keys
+ {
+ System::Collections::Generic::ICollection<TKey>^ get();
+ }
+
+ virtual property System::Collections::Generic::ICollection<TValue>^ Values
+ {
+ System::Collections::Generic::ICollection<TValue>^ get();
+ }
+
+ virtual void Put(TKey key, TValue value, Object^ callbackArg);
+
+ virtual TValue Get(TKey key, Object^ callbackArg);
+
+ virtual void InvalidateRegion();
+
+ virtual void InvalidateRegion(Object^ callbackArg);
+
+ virtual void DestroyRegion();
+
+ virtual void DestroyRegion(Object^ callbackArg);
+
+ virtual void Invalidate(TKey key);
+
+ virtual void Invalidate(TKey key, Object^ callbackArg);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout);
+
+ virtual void PutAll(System::Collections::Generic::IDictionary<TKey, TValue>^ map, int timeout, Object^ callbackArg);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache);
+
+ virtual void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache, Object^ callbackArg);
+
+ virtual void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys);
+ virtual void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ Object^ callbackArg);
+
+ virtual property String^ Name
+ {
+ String^ get();
+ }
+
+ virtual property String^ FullPath
+ {
+ String^ get();
+ }
+
+ virtual property IRegion<TKey, TValue>^ ParentRegion
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ virtual property RegionAttributes<TKey, TValue>^ Attributes
+ {
+ RegionAttributes<TKey, TValue>^ get();
+ }
+
+ virtual property AttributesMutator<TKey, TValue>^ AttributesMutator
+ {
+ Apache::Geode::Client::AttributesMutator<TKey, TValue>^ get();
+ }
+
+ virtual property Apache::Geode::Client::CacheStatistics^ Statistics
+ {
+ Apache::Geode::Client::CacheStatistics^ get();
+ }
+
+ virtual IRegion<TKey, TValue>^ GetSubRegion( String^ path );
+
+ virtual IRegion<TKey, TValue>^ CreateSubRegion( String^ subRegionName,
+ RegionAttributes<TKey,TValue>^ attributes );
+
+ virtual System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ SubRegions( bool recursive );
+
+ virtual RegionEntry<TKey, TValue>^ GetEntry( TKey key );
+
+ virtual System::Collections::Generic::ICollection<RegionEntry<TKey,TValue>^>^ GetEntries(bool recursive);
+
+ virtual property Apache::Geode::Client::IRegionService^ RegionService
+ {
+ Apache::Geode::Client::IRegionService^ get( );
+ }
+
+ virtual bool ContainsValueForKey( TKey key );
+
+ //Additional Region properties and methods
+ virtual property bool IsDestroyed
+ {
+ bool get();
+ }
+
+ generic<class TResult>
+ virtual ISelectResults<TResult>^ Query( String^ predicate );
+
+ generic<class TResult>
+ virtual ISelectResults<TResult>^ Query( String^ predicate, System::UInt32 timeout );
+
+ virtual bool ExistsValue( String^ predicate );
+
+ virtual bool ExistsValue( String^ predicate, System::UInt32 timeout );
+
+ virtual Object^ SelectValue( String^ predicate );
+
+ virtual Object^ SelectValue( String^ predicate, System::UInt32 timeout );
+
+ virtual ISubscriptionService<TKey>^ GetSubscriptionService();
+
+ virtual IRegion<TKey, TValue>^ GetLocalView();
+
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ //generic<class TKey, class TValue>
+ inline static IRegion<TKey, TValue>^ Create( native::RegionPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew LocalRegion<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::Region> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline LocalRegion( native::RegionPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Region>(nativeptr);
+ }
+
+ private:
+ inline apache::geode::client::SerializablePtr getRegionEntryValue(apache::geode::client::CacheableKeyPtr& key);
+ bool AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2);
+
+ native_shared_ptr<native::Region>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Log.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Log.cpp b/clicache/src/Log.cpp
new file mode 100644
index 0000000..2a1f6ab
--- /dev/null
+++ b/clicache/src/Log.cpp
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "Log.hpp"
+#include "impl/ManagedString.hpp"
+#include "impl/SafeConvert.hpp"
+#include "ExceptionTypes.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void Log::Init(LogLevel level, String^ logFileName)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_lfname(logFileName);
+ apache::geode::client::Log::init(static_cast<apache::geode::client::Log::LogLevel>(level),
+ mg_lfname.CharPtr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Log::Init(LogLevel level, String^ logFileName, System::Int32 logFileLimit)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_lfname(logFileName);
+ apache::geode::client::Log::init(static_cast<apache::geode::client::Log::LogLevel>(level),
+ mg_lfname.CharPtr, logFileLimit);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Log::Close()
+ {
+ apache::geode::client::Log::close();
+ }
+
+ LogLevel Log::Level()
+ {
+ return static_cast<LogLevel>(apache::geode::client::Log::logLevel());
+ }
+
+ void Log::SetLevel(LogLevel level)
+ {
+ apache::geode::client::Log::setLogLevel(
+ static_cast<apache::geode::client::Log::LogLevel>(level));
+ }
+
+ String^ Log::LogFileName()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return ManagedString::Get(apache::geode::client::Log::logFileName());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool Log::Enabled(LogLevel level)
+ {
+ return apache::geode::client::Log::enabled(
+ static_cast<apache::geode::client::Log::LogLevel>(level));
+ }
+
+ void Log::Write(LogLevel level, String^ msg)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_msg(msg);
+ apache::geode::client::Log::log(static_cast<apache::geode::client::Log::LogLevel>(level),
+ mg_msg.CharPtr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Log::LogThrow(LogLevel level, String^ msg, System::Exception^ ex)
+ {
+ if (ex != nullptr)
+ {
+ String^ logMsg = String::Format(
+ System::Globalization::CultureInfo::CurrentCulture,
+ "Geode exception {0} thrown: {1}{2}{3}", ex->GetType(),
+ ex->Message, Environment::NewLine, msg);
+ Log::Write(level, logMsg);
+ }
+ }
+
+ void Log::LogCatch(LogLevel level, String^ msg, System::Exception^ ex)
+ {
+ if (ex != nullptr)
+ {
+ String^ logMsg = String::Format(
+ System::Globalization::CultureInfo::CurrentCulture,
+ "Geode exception {0} caught: {1}{2}{3}", ex->GetType(),
+ ex->Message, Environment::NewLine, msg);
+ Log::Write(level, logMsg);
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Log.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Log.hpp b/clicache/src/Log.hpp
new file mode 100644
index 0000000..ed5dd28
--- /dev/null
+++ b/clicache/src/Log.hpp
@@ -0,0 +1,330 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Log.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Logging levels.
+ /// </summary>
+ public enum class LogLevel
+ {
+ /// <summary>
+ /// No log.
+ /// </summary>
+ Null = 0,
+
+ /// <summary>
+ /// Indicates serious failure.
+ /// </summary>
+ Error,
+ /// <summary>
+ /// Indicates potential problem.
+ /// </summary>
+ Warning,
+ /// <summary>
+ /// For informational purpose.
+ /// </summary>
+ Info,
+
+ /// <summary>
+ /// The default logging level.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// For Static configuration messages.
+ /// </summary>
+ Config,
+
+ /// <summary>
+ /// For tracing information.
+ /// </summary>
+ Fine,
+ /// <summary>
+ /// For moderately detailed tracing information.
+ /// </summary>
+ Finer,
+ /// <summary>
+ /// For very detailed tracing information.
+ /// </summary>
+ Finest,
+
+ /// <summary>
+ /// For highly detailed tracing information.
+ /// </summary>
+ Debug,
+
+ /// <summary>
+ /// All the log messages.
+ /// </summary>
+ All,
+ };
+
+
+ /// <summary>
+ /// Defines methods available to clients that want to write a log message
+ /// to their Geode system's shared log file.
+ /// </summary>
+ /// <remarks>
+ /// Any attempt to use an instance after its connection is disconnected
+ /// will throw a <c>NotConnectedException</c>.
+ /// <para>
+ /// For any logged message the log file will contain:
+ /// <ul>
+ /// <li> The message's log level.</li>
+ /// <li> The time the message was logged.</li>
+ /// <li> The ID of the connection and thread that logged the message.</li>
+ /// <li> The message itself, perhaps with
+ /// an exception including the exception's stack trace.</li>
+ /// </ul>
+ /// </para><para>
+ /// A message always has a level.
+ /// Logging levels are ordered. Enabling logging at a given level also
+ /// enables logging at higher levels. The higher the level the more
+ /// important and urgent the message.
+ /// </para><para>
+ /// The levels, in descending order of severity, are:
+ /// <ul>
+ ///
+ /// <li> <c>Error</c> (highest severity) is a message level
+ /// indicating a serious failure. In general <c>error</c>
+ /// messages should describe events that are of considerable
+ /// importance and which will prevent normal program execution. They
+ /// should be reasonably intelligible to end users and to system
+ /// administrators.</li>
+ ///
+ /// <li> <c>Warning</c> is a message level indicating a
+ /// potential problem. In general <c>warning</c> messages
+ /// should describe events that will be of interest to end users or
+ /// system managers, or which indicate potential problems.</li>
+ ///
+ /// <li> <c>Info</c> is a message level for informational
+ /// messages. Typically <c>info</c> messages should be
+ /// reasonably significant and should make sense to end users and
+ /// system administrators.</li>
+ ///
+ /// <li> <c>Config</c> is a message level for static
+ /// configuration messages. <c>config</c> messages are intended
+ /// to provide a variety of static configuration information, to
+ /// assist in debugging problems that may be associated with
+ /// particular configurations.</li>
+ ///
+ /// <li> <c>Fine</c> is a message level providing tracing
+ /// information. In general the <c>fine</c> level should be
+ /// used for information that will be broadly interesting to
+ /// developers. This level is for the lowest volume, and most
+ /// important, tracing messages.</li>
+ ///
+ /// <li> <c>Finer</c> indicates a moderately detailed tracing
+ /// message. This is an intermediate level between <c>fine</c>
+ /// and <c>finest</c>.</li>
+ ///
+ /// <li> <c>Finest</c> indicates a very detailed tracing
+ /// message. Logging calls for entering, returning, or throwing an
+ /// exception are traced at the <c>finest</c> level.</li>
+ ///
+ /// <li> <c>Debug</c> (lowest severity) indicates a highly
+ /// detailed tracing message. In general the <c>debug</c> level
+ /// should be used for the most voluminous detailed tracing messages.</li>
+ /// </ul>
+ ///
+ /// </para>
+ /// </remarks>
+ public ref class Log STATICCLASS
+ {
+ public:
+
+
+
+ /// <summary>
+ /// Initializes the logging facility with the given level and filename.
+ /// </summary>
+ /// <param name="level">the logging level</param>
+ /// <param name="logFileName">the log file name</param>
+ static void Init(LogLevel level, String^ logFileName);
+
+ /// <summary>
+ /// Initializes logging facility with given level, filename, and file size limit.
+ /// </summary>
+ /// <param name="level">the logging level</param>
+ /// <param name="logFileName">the log file name</param>
+ /// <param name="logFileLimit">maximum allowable size of the log file, in bytes,
+ /// or 0 for the default (1 Gbyte)</param>
+ static void Init(LogLevel level, String^ logFileName, System::Int32 logFileLimit);
+
+ /// <summary>
+ /// Closes logging facility (until next init).
+ /// </summary>
+ static void Close();
+
+ /// <summary>
+ /// Returns the current log level.
+ /// </summary>
+ static LogLevel Level();
+
+ /// <summary>
+ /// Sets the current log level.
+ /// </summary>
+ static void SetLevel(LogLevel level);
+
+ /// <summary>
+ /// Returns the name of the current log file.
+ /// NOTE: This function is for debugging only, as it is not completely
+ /// thread-safe!
+ /// </summary>
+ static String^ LogFileName();
+
+ /// <summary>
+ /// True if log messages at the given level are enabled.
+ /// </summary>
+ static bool Enabled(LogLevel level);
+
+ /// <summary>
+ /// Logs a message at the given level.
+ /// </summary>
+ static void Write(LogLevel level, String^ msg);
+
+ /// <summary>
+ /// Logs both a message and a thrown exception.
+ /// </summary>
+ static void LogThrow(LogLevel level, String^ msg, System::Exception^ ex);
+
+ /// <summary>
+ /// Logs both a message and a caught exception.
+ /// </summary>
+ static void LogCatch(LogLevel level, String^ msg, System::Exception^ ex);
+
+ // Convenience functions with variable number of arguments
+ // as in String.Format
+
+ /// <summary>
+ /// Error level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Error(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Error)
+ Log::Write(LogLevel::Error, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Warning level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Warning(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Warning)
+ Log::Write(LogLevel::Warning, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Info level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Info(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Info)
+ Log::Write(LogLevel::Info, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Config level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Config(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Config)
+ Log::Write(LogLevel::Config, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Fine level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Fine(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Fine)
+ Log::Write(LogLevel::Fine, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Finer level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Finer(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Finer)
+ Log::Write(LogLevel::Finer, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Finest level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Finest(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Finest)
+ Log::Write(LogLevel::Finest, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+
+ /// <summary>
+ /// Debug level logging with variable number of arguments using
+ /// format as in <c>System.String.Format</c>.
+ /// </summary>
+ inline static void Debug(String^ format, ... array<Object^>^ args)
+ {
+ if (staticLogLevel >= LogLevel::Debug)
+ Log::Write(LogLevel::Debug, String::Format(
+ System::Globalization::CultureInfo::CurrentCulture, format, args));
+ }
+ internal:
+
+ static void SetLogLevel(LogLevel level)
+ {
+ staticLogLevel = level;
+ }
+
+ private:
+ static LogLevel staticLogLevel = LogLevel::Null;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/PdxIdentityFieldAttribute.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/PdxIdentityFieldAttribute.hpp b/clicache/src/PdxIdentityFieldAttribute.hpp
new file mode 100755
index 0000000..0c43f84
--- /dev/null
+++ b/clicache/src/PdxIdentityFieldAttribute.hpp
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+using namespace System;
+using namespace System::Reflection;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ///<summary>
+ /// PdxIdentityField attribute one can specify on member fields.
+ /// This attribute is used by <see cref="ReflectionBasedAutoSerializer">,
+ /// When it serializes the fields in Pdx <see cref="IPdxSerializable"> format.
+ /// This fields will be treated as identity fields for hashcode and equals methods.
+ ///<summary>
+
+ [AttributeUsage(AttributeTargets::Field)]
+ public ref class PdxIdentityFieldAttribute : Attribute
+ {
+ public:
+
+ PdxIdentityFieldAttribute()
+ {
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Pool.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Pool.cpp b/clicache/src/Pool.cpp
new file mode 100644
index 0000000..6bb1f91
--- /dev/null
+++ b/clicache/src/Pool.cpp
@@ -0,0 +1,463 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "Pool.hpp"
+#include "QueryService.hpp"
+#include "CacheableString.hpp"
+#include "Cache.hpp"
+//#include "Properties.hpp"
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+
+ String^ Pool::Name::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::FreeConnectionTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getFreeConnectionTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::LoadConditioningInterval::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getLoadConditioningInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::SocketBufferSize::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getSocketBufferSize();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::ReadTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getReadTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::MinConnections::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getMinConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::MaxConnections::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getMaxConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::IdleTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getIdleTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::PingInterval::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getPingInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::UpdateLocatorListInterval::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getUpdateLocatorListInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::StatisticInterval::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getStatisticInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::RetryAttempts::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getRetryAttempts();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Boolean Pool::SubscriptionEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionEnabled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Boolean Pool::PRSingleHopEnabled::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getPRSingleHopEnabled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::SubscriptionRedundancy::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionRedundancy();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::SubscriptionMessageTrackingTimeout::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionMessageTrackingTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Int32 Pool::SubscriptionAckInterval::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionAckInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ String^ Pool::ServerGroup::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getServerGroup( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ array<String^>^ Pool::Locators::get()
+ {
+ try
+ {
+ auto locators = m_nativeptr->get()->getLocators();
+ int length = locators->length();
+ if (length > 0)
+ {
+ array<String^>^ result = gcnew array<String^>(length);
+ for (int item = 0; item < length; item++)
+ {
+ result[item] = CacheableString::GetString((*locators)[item].get());
+ }
+ return result;
+ }
+ else
+ {
+ return nullptr;
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+
+ array<String^>^ Pool::Servers::get()
+ {
+ try
+ {
+ auto servers = m_nativeptr->get()->getServers();
+ int length = servers->length();
+ if (length > 0)
+ {
+ array<String^>^ result = gcnew array<String^>(length);
+ for (int item = 0; item < length; item++)
+ {
+ result[item] = CacheableString::GetString((*servers)[item].get());
+ }
+ return result;
+ }
+ else
+ {
+ return nullptr;
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ //generic<class TKey, class TValue>
+ Boolean Pool::ThreadLocalConnections::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getThreadLocalConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ bool Pool::MultiuserAuthentication::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getMultiuserAuthentication();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ void Pool::Destroy(Boolean KeepAlive)
+ {
+ try
+ {
+ m_nativeptr->get()->destroy(KeepAlive);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+ void Pool::ReleaseThreadLocalConnection()
+ {
+ try
+ {
+ m_nativeptr->get()->releaseThreadLocalConnection();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ void Pool::Destroy()
+ {
+ try
+ {
+ m_nativeptr->get()->destroy();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+
+ Boolean Pool::Destroyed::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+ generic<class TKey, class TResult>
+ QueryService<TKey, TResult>^ Pool::GetQueryService()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ Int32 Pool::PendingEventCount::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->getPendingEventCount();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Pool.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Pool.hpp b/clicache/src/Pool.hpp
new file mode 100644
index 0000000..5be1cd3
--- /dev/null
+++ b/clicache/src/Pool.hpp
@@ -0,0 +1,353 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Pool.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ ref class QueryService;
+
+ ref class Cache;
+
+ /// <summary>
+ /// A pool of connections.
+ /// </summary>
+ /// <remarks>
+ /// A pool of connections from a Geode client to a set of Geode servers.
+ /// </remarks>
+ // generic<class TKey, class TValue>
+ public ref class Pool sealed
+ {
+ public:
+
+ /// <summary>
+ /// Get the name of the pool
+ /// </summary>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the connection timeout of this pool.
+ /// </summary>
+ property Int32 FreeConnectionTimeout
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the load conditioning interval of this pool.
+ /// </summary>
+ property Int32 LoadConditioningInterval
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the socket buffer size of this pool.
+ /// </summary>
+ property Int32 SocketBufferSize
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the read timeout of this pool.
+ /// </summary>
+ property Int32 ReadTimeout
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the minimum connections for this pool.
+ /// </summary>
+ property Int32 MinConnections
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the maximum connections for this pool.
+ /// </summary>
+ property Int32 MaxConnections
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the Idle connection timeout for this pool.
+ /// </summary>
+ property Int32 IdleTimeout
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the ping interval for this pool.
+ /// </summary>
+ property Int32 PingInterval
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the update locator list interval for this pool.
+ /// </summary>
+ property Int32 UpdateLocatorListInterval
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the statistic interval for this pool.
+ /// </summary>
+ property Int32 StatisticInterval
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Get the retry attempts for this pool.
+ /// </summary>
+ property Int32 RetryAttempts
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the true if a server-to-client subscriptions are enabled on this pool.
+ /// </summary>
+ property Boolean SubscriptionEnabled
+ {
+ Boolean get();
+ }
+
+ /// <summary>
+ /// Returns the true if a pr-single-hop is set to true on this pool.
+ /// </summary>
+ property Boolean PRSingleHopEnabled
+ {
+ Boolean get();
+ }
+
+ /// <summary>
+ /// Returns the subscription redundancy level of this pool.
+ /// </summary>
+ property Int32 SubscriptionRedundancy
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the subscription message tracking timeout of this pool.
+ /// </summary>
+ property Int32 SubscriptionMessageTrackingTimeout
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the subscription ack interval of this pool.
+ /// </summary>
+ property Int32 SubscriptionAckInterval
+ {
+ Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the server group of this pool.
+ /// </summary>
+ property String^ ServerGroup
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns an unmodifiable list of locators
+ /// this pool is using. Each locator is either one
+ /// added explicitly when the pool was created or
+ /// were discovered using the explicit locators.
+ /// </summary>
+ /// <remarks>
+ /// If a pool has no locators then it can not discover servers or locators at runtime.
+ /// </remarks>
+ property array< String^ >^ Locators
+ {
+ array< String^ >^ get();
+ }
+
+ /// <summary>
+ /// Returns an unmodifiable list of
+ /// servers this pool is using. These servers were added
+ /// explicitly when the pool was created.
+ property array< String^ >^ Servers
+ {
+ array< String^ >^ get();
+ }
+
+ /// <summary>
+ /// Returns the true if ThreadLocalConnections are enabled on this pool.
+ /// </summary>
+ property Boolean ThreadLocalConnections
+ {
+ Boolean get();
+ }
+
+ /// <summary>
+ /// Returns <code>true</code> if multiuser authentication is enabled on this pool.
+ /// <summary>
+ property bool MultiuserAuthentication
+ {
+ bool get();
+ }
+ /// <summary>
+ /// Destroys this pool closing any connections it produced.
+ /// </summary>
+ /// <param name="keepAlive">
+ /// whether the server should keep the durable client's
+ /// subscriptions alive for the timeout period
+ /// </param>
+ /// <exception cref="IllegalStateException">
+ /// if the pool is still in use
+ /// </exception>
+ void Destroy(Boolean keepAlive);
+
+ /// <summary>
+ /// Destroys this pool closing any connections it produced.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the pool is still in use
+ /// </exception>
+ void Destroy();
+
+ /// <summary>
+ /// Indicates whether this Pool has been
+ /// destroyed.
+ /// </summary>
+ property Boolean Destroyed
+ {
+ Boolean get();
+ }
+
+ /// <summary>
+ /// Returns the QueryService for this Pool.
+ /// </summary>
+ /// <remarks>
+ /// The query operations performed using this QueryService will be executed
+ /// on the servers that are associated with this pool.
+ /// To perform Query operation on the local cache obtain the QueryService
+ /// instance from the Cache.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ QueryService<TKey, TResult>^ GetQueryService();
+
+ void ReleaseThreadLocalConnection();
+
+ /// <summary>
+ /// Returns the approximate number of pending subscription events maintained at
+ /// server for this durable client pool at the time it (re)connected to the
+ /// server. Server would start dispatching these events to this durable client
+ /// pool when it receives {@link Cache#readyForEvents()} from it.
+ /// <p>
+ /// Durable clients can call this method on reconnect to assess the amount of
+ /// 'stale' data i.e. events accumulated at server while this client was away
+ /// and, importantly, before calling {@link Cache#readyForEvents()}.
+ /// <p>
+ /// Any number of invocations of this method during a single session will
+ /// return the same value.
+ /// <p>
+ /// It may return a zero value if there are no events pending at server for
+ /// this client pool. A negative value returned tells us that no queue was
+ /// available at server for this client pool.
+ /// <p>
+ /// A value -1 indicates that this client pool reconnected to server after its
+ /// 'durable-client-timeout' period elapsed and hence its subscription queue at
+ /// server was removed, possibly causing data loss.
+ /// <p>
+ /// A value -2 indicates that this client pool connected to server for the
+ /// first time.
+ ///
+ /// @return int The number of subscription events maintained at server for this
+ /// durable client pool at the time this pool (re)connected. A negative
+ /// value indicates no queue was found for this client pool.
+ /// @throws IllegalStateException
+ /// If called by a non-durable client or if invoked any time after
+ /// invocation of {@link Cache#readyForEvents()}.
+ /// @since 8.1
+ ///
+ /// </summary>
+ property Int32 PendingEventCount
+ {
+ Int32 get();
+ }
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Pool^ Create(native::PoolPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Pool( nativeptr );
+ }
+
+ std::shared_ptr<native::Pool> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Pool(native::PoolPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Pool>(nativeptr);
+ }
+
+ native_shared_ptr<native::Pool>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/PoolFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/PoolFactory.cpp b/clicache/src/PoolFactory.cpp
new file mode 100644
index 0000000..bf3c0b1
--- /dev/null
+++ b/clicache/src/PoolFactory.cpp
@@ -0,0 +1,452 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "Pool.hpp"
+#include "PoolFactory.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+
+#include "Cache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+
+ PoolFactory^ PoolFactory::SetFreeConnectionTimeout( Int32 connectionTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setFreeConnectionTimeout( connectionTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetLoadConditioningInterval( Int32 loadConditioningInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setLoadConditioningInterval( loadConditioningInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetSocketBufferSize( Int32 bufferSize )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setSocketBufferSize( bufferSize );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetReadTimeout( Int32 timeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setReadTimeout( timeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetMinConnections( Int32 minConnections )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setMinConnections( minConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetMaxConnections( Int32 maxConnections )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setMaxConnections( maxConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetIdleTimeout( Int32 idleTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetRetryAttempts( Int32 retryAttempts )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setRetryAttempts( retryAttempts );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetPingInterval( Int32 pingInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setPingInterval( pingInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetUpdateLocatorListInterval( Int32 updateLocatorListInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setUpdateLocatorListInterval( updateLocatorListInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetStatisticInterval( Int32 statisticInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setStatisticInterval( statisticInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetServerGroup( String^ group )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_servergroup( group );
+ try
+ {
+ m_nativeptr->get()->setServerGroup( mg_servergroup.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::AddLocator( String^ host, Int32 port )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_host( host );
+ try
+ {
+ m_nativeptr->get()->addLocator( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::AddServer( String^ host, Int32 port )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_host( host );
+ try
+ {
+ m_nativeptr->get()->addServer( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetSubscriptionEnabled( Boolean enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setSubscriptionEnabled( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetPRSingleHopEnabled( Boolean enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setPRSingleHopEnabled(enabled);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetSubscriptionRedundancy( Int32 redundancy )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setSubscriptionRedundancy( redundancy );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetSubscriptionMessageTrackingTimeout( Int32 messageTrackingTimeout )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::SetSubscriptionAckInterval( Int32 ackInterval )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setSubscriptionAckInterval( ackInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+ PoolFactory^ PoolFactory::SetThreadLocalConnections( Boolean enabled )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setThreadLocalConnections( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ return this;
+ }
+
+ PoolFactory^ PoolFactory::SetMultiuserAuthentication( bool multiuserAuthentication )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setMultiuserAuthentication( multiuserAuthentication );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ PoolFactory^ PoolFactory::Reset()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->reset( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return this;
+ }
+
+
+ Pool^ PoolFactory::Create(String^ name, Cache^ cache)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_name(name);
+ try
+ {
+ return Pool::Create(m_nativeptr->get()->create(mg_name.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/PoolFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/PoolFactory.hpp b/clicache/src/PoolFactory.hpp
new file mode 100644
index 0000000..cf16906
--- /dev/null
+++ b/clicache/src/PoolFactory.hpp
@@ -0,0 +1,427 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/PoolFactory.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+
+ ref class Pool;
+
+ /// <summary>
+ /// This interface provides for the configuration and creation of instances of Pool.
+ /// </summary>
+
+ public ref class PoolFactory sealed
+ {
+ public:
+
+ /// <summary>
+ /// Sets the free connection timeout for this pool.
+ /// </summary>
+ /// <remarks>
+ /// If the pool has a max connections setting, operations will block
+ /// if all of the connections are in use. The free connection timeout
+ /// specifies how long those operations will block waiting for
+ /// a free connection before receiving an AllConnectionsInUseException.
+ /// If max connections is not set this setting has no effect.
+ /// </remarks>
+ /// <param>
+ /// connectionTimeout the connection timeout in milliseconds
+ /// </param>
+ /// <exception>
+ /// IllegalArgumentException if connectionTimeout
+ /// is less than or equal to 0.
+ /// </exception>
+ PoolFactory^ SetFreeConnectionTimeout(Int32 connectionTimeout);
+
+ /// <summary>
+ /// Sets the load conditioning interval for this pool.
+ /// </summary>
+ /// <remarks>
+ /// This interval controls how frequently the pool will check to see if
+ /// a connection to a given server should be moved to a different
+ /// server to improve the load balance.
+ /// </remarks>
+ /// <param>
+ /// loadConditioningInterval the connection lifetime in milliseconds
+ /// A value of -1 disables load conditioning.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if connectionLifetime
+ /// is less than -1.
+ /// </exception>
+ PoolFactory^ SetLoadConditioningInterval(Int32 loadConditioningInterval);
+
+ /// <summary>
+ /// Sets the socket buffer size for each connection made in this pool.
+ /// </summary>
+ /// <remarks>
+ /// Large messages can be received and sent faster when this buffer is larger.
+ /// Larger buffers also optimize the rate at which servers can send events
+ /// for client subscriptions.
+ /// </remarks>
+ /// <param>
+ /// bufferSize the size of the socket buffers used for reading and
+ /// writing on each connection in this pool.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if bufferSize
+ /// is less than or equal to 0.
+ /// </exception>
+ PoolFactory^ SetSocketBufferSize(Int32 bufferSize);
+
+ /// <summary>
+ /// Sets the number of milliseconds to wait for a response from a server before
+ /// timing out the operation and trying another server (if any are available).
+ /// </summary>
+ /// <param>
+ /// timeout number of milliseconds to wait for a response from a server
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if timeout
+ /// is less than or equal to 0.
+ /// </exception>
+ PoolFactory^ SetReadTimeout(Int32 timeout);
+
+ /// <summary>
+ /// Set the minimum number of connections to keep available at all times.
+ /// </summary>
+ /// <remarks>
+ /// When the pool is created, it will create this many connections.
+ /// If 0 then connections will not be made until an actual operation
+ /// is done that requires client-to-server communication.
+ /// </remarks>
+ /// <param>
+ /// minConnections the initial number of connections this pool will create.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if minConnections is less than 0.
+ /// </exception>
+ PoolFactory^ SetMinConnections(Int32 minConnections);
+
+ /// <summary>
+ /// Set the max number of client to server connections that the pool will create.
+ /// </summary>
+ /// <remarks>
+ /// If all of the connections are in use, an operation requiring a client to
+ /// server connection will block until a connection is available.
+ /// see setFreeConnectionTimeout(int)
+ /// </remarks>
+ /// <param>
+ /// maxConnections the maximum number of connections in the pool.
+ /// -1 indicates that there is no maximum number of connections.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if maxConnections is less than minConnections.
+ /// </exception>
+ PoolFactory^ SetMaxConnections(Int32 maxConnections);
+
+ /// <summary>
+ /// Set the amount of time a connection can be idle before expiring the connection.
+ /// </summary>
+ /// <remarks>
+ /// If the pool size is greater than the minimum specified, connections which have
+ /// been idle for longer than the idleTimeout will be closed.
+ /// </remarks>
+ /// <param>
+ /// idleTimeout The amount of time in milliseconds that an idle connection
+ /// should live before expiring. -1 indicates that connections should never expire.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if idleTimout is less than 0.
+ /// </exception>
+ PoolFactory^ SetIdleTimeout(Int32 idleTimeout);
+
+ /// <summary>
+ /// Set the number of times to retry a request after timeout/exception.
+ /// </summary>
+ /// <param>
+ /// retryAttempts The number of times to retry a request
+ /// after timeout/exception. -1 indicates that a request should be
+ /// tried against every available server before failing.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if idleTimout is less than 0.
+ /// </exception>
+ PoolFactory^ SetRetryAttempts(Int32 retryAttempts);
+
+ /// <summary>
+ /// Set how often to ping servers to verify that they are still alive.
+ /// </summary>
+ /// <remarks>
+ /// Each server will be sent a ping every pingInterval if there has not
+ /// been any other communication with the server.
+ /// These pings are used by the server to monitor the health of
+ /// the client. Make sure that the pingInterval is less than the
+ /// maximum time between pings allowed by the bridge server.
+ /// see in CacheServer: setMaximumTimeBetweenPings(int)
+ /// </remarks>
+ /// <param>
+ /// pingInterval The amount of time in milliseconds between pings.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if pingInterval is less than 0.
+ /// </exception>
+ PoolFactory^ SetPingInterval(Int32 pingInterval);
+
+ /// <summary>
+ /// Set how often to update locator list from locator
+ /// </summary>
+ /// <param>
+ /// updateLocatorListInterval The amount of time in milliseconds between
+ /// updating locator list. If its set to 0 then client will not update
+ /// the locator list.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ PoolFactory^ SetUpdateLocatorListInterval(Int32 updateLocatorListInterval);
+
+ /// <summary>
+ /// Set how often to send client statistics to the server.
+ /// </summary>
+ /// <remarks>
+ /// Doing this allows gfmon to monitor clients.
+ /// A value of -1 disables the sending of client statistics
+ /// to the server.
+ /// </remarks>
+ /// <param>
+ /// statisticInterval The amount of time in milliseconds between
+ /// sends of client statistics to the server.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if statisticInterval
+ /// is less than -1.
+ /// </exception>
+ PoolFactory^ SetStatisticInterval(Int32 statisticInterval);
+
+ /// <summary>
+ /// Configures the group that all servers this pool connects to must belong to.
+ /// </summary>
+ /// <param>
+ /// group the server group that this pool will connect to.
+ /// If null or "" then all servers will be connected to.
+ /// </param>
+ PoolFactory^ SetServerGroup(String^ group);
+
+ /// <summary>
+ /// Add a locator, given its host and port, to this factory.
+ /// </summary>
+ /// <remarks>
+ /// The locator must be a server locator and will be used to discover other running
+ /// bridge servers and locators.
+ /// </remarks>
+ /// <param>
+ /// host the host name or ip address that the locator is listening on.
+ /// </param>
+ /// <param>
+ /// port the port that the locator is listening on
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if host is an unknown host
+ /// or if port is outside the valid range of [1..65535] inclusive.
+ /// </exception>
+ /// <exception>
+ /// throws IllegalStateException if a locator has already been added to this factory.
+ /// </exception>
+ PoolFactory^ AddLocator(String^ host, Int32 port);
+
+ /// <summary>
+ /// Add a server, given its host and port, to this factory.
+ /// </summary>
+ /// <remarks>
+ /// The server must be a bridge server and this client will
+ /// directly connect to without consulting a server locator.
+ /// </remarks>
+ /// <param>
+ /// host the host name or ip address that the server is listening on.
+ /// </param>
+ /// <param>
+ /// port the port that the server is listening on
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if host is an unknown host
+ /// or if port is outside the valid range of [1..65535] inclusive.
+ /// </exception>
+ /// <exception>
+ /// throws IllegalStateException if a server has already been added to this factory.
+ /// </exception>
+ PoolFactory^ AddServer(String^ host, Int32 port);
+
+ /// <summary>
+ /// Enable subscriptions.
+ /// </summary>
+ /// <remarks>
+ /// If set to true then the created pool will have server-to-client
+ /// subscriptions enabled. If set to false then all Subscription*
+ /// attributes are ignored at create time.
+ /// </remarks>
+ PoolFactory^ SetSubscriptionEnabled(Boolean enabled);
+
+ /// <summary>
+ /// By default SetPRSingleHopEnabled is true.
+ /// </summary>
+ /// <remarks>
+ /// The client is aware of location of partitions on servers hosting
+ /// Using this information, the client routes the client cache operations
+ /// directly to the server which is hosting the required partition for the
+ /// cache operation.
+ /// If SetPRSingleHopEnabled is false the client can do an extra hop on servers
+ /// to go to the required partition for that cache operation.
+ /// The SetPRSingleHopEnabled avoids extra hops only for following cache operations :
+ /// put, get & destroy operations.
+ /// </remarks>
+ PoolFactory^ SetPRSingleHopEnabled(Boolean enabled);
+
+ /// <summary>
+ /// Sets the redundancy level for this pools server-to-client subscriptions.
+ /// </summary>
+ /// <remarks>
+ /// If 0 then no redundant copies will be kept on the servers.
+ /// Otherwise an effort will be made to maintain the requested number of
+ /// copies of the server-to-client subscriptions. At most one copy per server will
+ /// be made up to the requested level.
+ /// </remarks>
+ /// <param>
+ /// redundancy the number of redundant servers for this client's subscriptions.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if redundancyLevel is less than -1.
+ /// </exception>
+ PoolFactory^ SetSubscriptionRedundancy(Int32 redundancy);
+
+ /// <summary>
+ /// Sets the messageTrackingTimeout attribute which is the time-to-live period,
+ /// in milliseconds, for subscription events the client has received from the server.
+ /// </summary>
+ /// <remarks>
+ /// It's used to minimize duplicate events. Entries that have not been modified
+ /// for this amount of time are expired from the list.
+ /// </remarks>
+ /// <param>
+ /// messageTrackingTimeout number of milliseconds to set the timeout to.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if messageTrackingTimeout is less than or equal to 0.
+ /// </exception>
+ PoolFactory^ SetSubscriptionMessageTrackingTimeout(Int32 messageTrackingTimeout);
+
+ /// <summary>
+ /// Sets the is the interval in milliseconds to wait before sending
+ /// acknowledgements to the bridge server for events received from the server subscriptions.
+ /// </summary>
+ /// <param>
+ /// ackInterval number of milliseconds to wait before sending event acknowledgements.
+ /// </param>
+ /// <exception>
+ /// throws IllegalArgumentException if ackInterval is less than or equal to 0.
+ /// </exception>
+ PoolFactory^ SetSubscriptionAckInterval(Int32 ackInterval);
+
+ /// <summary>
+ /// Enable ThreadLocalConnection.
+ /// </summary>
+ /// <remarks>
+ /// Sets the thread local connections policy for this pool.
+ /// If true then any time a thread goes to use a connection
+ /// from this pool it will check a thread local cache and see if it already
+ /// has a connection in it. If so it will use it. If not it will get one from
+ /// this pool and cache it in the thread local. This gets rid of thread contention
+ /// for the connections but increases the number of connections the servers see.
+ /// If false then connections are returned to the pool as soon
+ /// as the operation being done with the connection completes. This allows
+ /// connections to be shared amonst multiple threads keeping the number of
+ /// connections down.
+ /// </remarks>
+ PoolFactory^ SetThreadLocalConnections(Boolean enabled);
+
+ /// <summary>
+ /// Sets whether pool is in multiuser mode
+ /// If its in multiuser mode then app needs to get instance of cache from pool.getCache("creds"), to do the operations on cache.
+ /// </summary>
+ /// <param>
+ /// multiuserAuthentication should be true/false. Default value is false;
+ /// </param>
+ PoolFactory^ SetMultiuserAuthentication(bool multiuserAuthentication);
+
+ /// <summary>
+ /// Resets the configuration of this factory to its defaults.
+ /// </summary>
+ PoolFactory^ Reset();
+
+ /// <summary>
+ /// Create a new Pool for connecting a client to a set of Geode Cache Servers.
+ /// using this factory's settings for attributes.
+ /// </summary>
+ /// <param>
+ /// name the name of the pool, used when connecting regions to it
+ /// </param>
+ /// <exception>
+ /// throws IllegalStateException if a pool with name already exists
+ /// throws IllegalStateException if a locator or server has not been added.
+ /// </exception>
+ Pool^ Create(String^ name, Cache^ cache);
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static PoolFactory^ Create(native::PoolFactoryPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew PoolFactory( nativeptr );
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline PoolFactory(native::PoolFactoryPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::PoolFactory>(nativeptr);
+ }
+
+ native_shared_ptr<native::PoolFactory>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/PoolManager.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/PoolManager.cpp b/clicache/src/PoolManager.cpp
new file mode 100644
index 0000000..3f641a7
--- /dev/null
+++ b/clicache/src/PoolManager.cpp
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "Region.hpp"
+#include "Pool.hpp"
+#include "PoolManager.hpp"
+#include "PoolFactory.hpp"
+#include "CacheableString.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ PoolFactory^ PoolManager::CreateFactory()
+ {
+ return PoolFactory::Create(m_nativeref.createFactory());
+ }
+
+ const Dictionary<String^, Pool^>^ PoolManager::GetAll()
+ {
+ auto pools = m_nativeref.getAll();
+ auto result = gcnew Dictionary<String^, Pool^>();
+ for (const auto& iter : pools)
+ {
+ auto key = gcnew String(iter.first.c_str());
+ auto val = Pool::Create(iter.second);
+ result->Add(key, val);
+ }
+ return result;
+ }
+
+ Pool^ PoolManager::Find(String^ name)
+ {
+ ManagedString mg_name( name );
+ auto pool = m_nativeref.find(mg_name.CharPtr);
+ return Pool::Create(pool);
+ }
+
+ Pool^ PoolManager::Find(Client::Region<Object^, Object^>^ region)
+ {
+ return Pool::Create(m_nativeref.find(region->GetNative()));
+ }
+
+ void PoolManager::Close(Boolean KeepAlive)
+ {
+ m_nativeref.close(KeepAlive);
+ }
+
+ void PoolManager::Close()
+ {
+ m_nativeref.close();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/PoolManager.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/PoolManager.hpp b/clicache/src/PoolManager.hpp
new file mode 100644
index 0000000..0ea139d
--- /dev/null
+++ b/clicache/src/PoolManager.hpp
@@ -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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/PoolManager.hpp>
+#include "end_native.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ //generic<class TKey, class TValue>
+ ref class Pool;
+ // generic<class TKey, class TValue>
+ ref class PoolFactory;
+
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// This interface provides for the configuration and creation of instances of PoolFactory.
+ /// </summary>
+ // generic<class TKey, class TValue>
+ public ref class PoolManager
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new PoolFactory which is used to configure and create Pools.
+ /// </summary>
+ PoolFactory/*<TKey, TValue>*/^ CreateFactory();
+
+ /// <summary>
+ /// Returns a map containing all the pools in this manager.
+ /// The keys are pool names and the values are Pool instances.
+ /// </summary>
+ const Dictionary<String^, Pool/*<TKey, TValue>*/^>^ GetAll();
+
+ /// <summary>
+ /// Find by name an existing connection pool.
+ /// </summary>
+ Pool/*<TKey, TValue>*/^ Find(String^ name);
+
+ /// <summary>
+ /// Find the pool used by the given region.
+ /// </summary>
+ Pool/*<TKey, TValue>*/^ Find(Client::Region<Object^, Object^>^ region);
+
+ /// <summary>
+ /// Destroys all created pools.
+ /// </summary>
+ void Close(Boolean KeepAlive);
+
+ /// <summary>
+ /// Destroys all created pools.
+ /// </summary>
+ void Close();
+
+ internal:
+
+ native::PoolManager& GetNative()
+ {
+ return m_nativeref;
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline PoolManager(native::PoolManager& nativeref)
+ : m_nativeref(nativeref)
+ {
+ }
+
+ native::PoolManager& m_nativeref;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[40/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientDeltaTestN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientDeltaTestN.cs b/clicache/integration-test/ThinClientDeltaTestN.cs
new file mode 100644
index 0000000..a7ee6b3
--- /dev/null
+++ b/clicache/integration-test/ThinClientDeltaTestN.cs
@@ -0,0 +1,914 @@
+/*
+ * 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.Collections.Generic;
+using System.IO;
+using System.Threading;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+ using DeltaEx = Apache.Geode.Client.Tests.DeltaEx;
+
+ public class CqDeltaListener<TKey, TResult> : ICqListener<TKey, TResult>
+ {
+
+ public CqDeltaListener()
+ {
+ m_deltaCount = 0;
+ m_valueCount = 0;
+ }
+
+ public void OnEvent(CqEvent<TKey, TResult> aCqEvent)
+ {
+ byte[] deltaValue = aCqEvent.getDeltaValue();
+ DeltaTestImpl newValue = new DeltaTestImpl();
+ DataInput input = CacheHelper.DCache.CreateDataInput(deltaValue);
+ newValue.FromDelta(input);
+ if (newValue.GetIntVar() == 5)
+ {
+ m_deltaCount++;
+ }
+ DeltaTestImpl fullObject = (DeltaTestImpl)(object)aCqEvent.getNewValue();
+ if (fullObject.GetIntVar() == 5)
+ {
+ m_valueCount++;
+ }
+
+ }
+
+ public void OnError(CqEvent<TKey, TResult> aCqEvent)
+ {
+ }
+
+ public void Close()
+ {
+ }
+
+ public int GetDeltaCount()
+ {
+ return m_deltaCount;
+ }
+
+ public int GetValueCount()
+ {
+ return m_valueCount;
+ }
+
+ private int m_deltaCount;
+ private int m_valueCount;
+ }
+
+ public class DeltaTestAD : IGeodeDelta, IGeodeSerializable
+ {
+ private int _deltaUpdate;
+ private string _staticData;
+
+ public static DeltaTestAD Create()
+ {
+ return new DeltaTestAD();
+ }
+
+ public DeltaTestAD()
+ {
+ _deltaUpdate = 1;
+ _staticData = "Data which don't get updated";
+ }
+
+
+ #region IGeodeDelta Members
+
+ public void FromDelta(DataInput input)
+ {
+ _deltaUpdate = input.ReadInt32();
+ }
+
+ public bool HasDelta()
+ {
+ _deltaUpdate++;
+ bool isDelta = (_deltaUpdate % 2) == 1;
+ Util.Log("In DeltaTestAD.HasDelta _deltaUpdate:" + _deltaUpdate + " : isDelta:" + isDelta);
+ return isDelta;
+ }
+
+ public void ToDelta(DataOutput output)
+ {
+ output.WriteInt32(_deltaUpdate);
+ }
+
+ #endregion
+
+ #region IGeodeSerializable Members
+
+ public uint ClassId
+ {
+ get { return 151; }
+ }
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ _deltaUpdate = input.ReadInt32();
+ _staticData = input.ReadUTF();
+
+ return this;
+ }
+
+ public uint ObjectSize
+ {
+ get { return (uint)(4 + _staticData.Length); }
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(_deltaUpdate);
+ output.WriteUTF(_staticData);
+ }
+
+ public int DeltaUpdate
+ {
+ get { return _deltaUpdate; }
+ set { _deltaUpdate = value; }
+ }
+
+ #endregion
+ }
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientDeltaTest : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2;
+ private CqDeltaListener<object, DeltaTestImpl> myCqListener;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ public void createLRURegionAndAttachPool(string regionName, string poolName)
+ {
+ CacheHelper.CreateLRUTCRegion_Pool<object, object>(regionName, true, true, null, null, poolName, false, 3);
+ }
+
+ public void createRegionAndAttachPool(string regionName, string poolName)
+ {
+ createRegionAndAttachPool(regionName, poolName, false);
+ }
+
+ public void createRegionAndAttachPool(string regionName, string poolName, bool cloningEnabled)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true, null, null, poolName, false,
+ false, cloningEnabled);
+ }
+
+ //public void createPooledRegion(string regionName, string poolName, string endpoints, string locators)
+ //{
+ // CacheHelper.CreateTCRegion_Pool(regionName, true, true, null, endpoints, locators, poolName, false);
+ //}
+
+ public void createPool(string name, string locators, string serverGroup,
+ int redundancy, bool subscription)
+ {
+ CacheHelper.CreatePool<object, object>(name, locators, serverGroup, redundancy, subscription);
+ }
+
+ public void createExpirationRegion(string name, string poolName)
+ {
+ IRegion<object, object> region = CacheHelper.CreateExpirationRegion<object, object>(name,
+ poolName, ExpirationAction.LocalInvalidate, 5);
+ }
+
+ public void createExpirationRegion(string name)
+ {
+ createExpirationRegion(name, null);
+ }
+
+ public void CreateRegion(string name)
+ {
+ CreateRegion(name, false);
+ }
+
+ public void CreateRegion(string name, bool enableNotification)
+ {
+ CreateRegion(name, enableNotification, false);
+ }
+ public void CreateRegion(string name, bool enableNotification, bool cloningEnabled)
+ {
+ Apache.Geode.Client.RegionAttributes<object, object> attrs;
+ AttributesFactory<object, object> attrFac = new AttributesFactory<object, object>();
+ attrFac.SetCacheListener(new SimpleCacheListener<object, object>());
+ attrFac.SetCloningEnabled(cloningEnabled);
+ attrs = attrFac.CreateRegionAttributes();
+ CacheHelper.CreateRegion<object, object>(name, attrs);
+ }
+
+ //public void CreateOverflowRegion(string name, uint entriesLimit)
+ //{
+ // AttributesFactory af = new AttributesFactory();
+ // af.SetScope(ScopeType.DistributedAck);
+ // af.SetCachingEnabled(true);
+ // af.SetClientNotificationEnabled(true);
+ // af.SetLruEntriesLimit(entriesLimit);// LRU Entry limit set to 3
+
+ // af.SetDiskPolicy(DiskPolicyType.Overflows);
+ // Properties bdbProperties = Properties.Create();
+ // bdbProperties.Insert("CacheSizeGb", "0");
+ // bdbProperties.Insert("CacheSizeMb", "512");
+ // bdbProperties.Insert("PageSize", "65536");
+ // bdbProperties.Insert("MaxFileSize", "512000000");
+ // String wdPath = Directory.GetCurrentDirectory();
+ // String absPersistenceDir = wdPath + "/absBDB";
+ // String absEnvDir = wdPath + "/absBDBEnv";
+ // bdbProperties.Insert("PersistenceDirectory", absPersistenceDir);
+ // bdbProperties.Insert("EnvironmentDirectory", absEnvDir);
+ // af.SetPersistenceManager("BDBImpl", "createBDBInstance", bdbProperties);
+
+ // CacheHelper.CreateRegion(name, af.CreateRegionAttributes());
+ //}
+
+ void DoPutWithDelta()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothng
+ }
+ string cKey = m_keys[0];
+ DeltaEx val = new DeltaEx();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+
+ reg[cKey] = (object)val;
+ val.SetDelta(true);
+ reg[cKey] = (object)val;
+
+ DeltaEx val1 = new DeltaEx(0); // In this case JAVA side will throw invalid DeltaException
+ reg[cKey] = (object)val1;
+ val1.SetDelta(true);
+ reg[cKey] = (object)val1;
+ if (DeltaEx.ToDeltaCount != 2)
+ {
+ Util.Log("DeltaEx.ToDataCount = " + DeltaEx.ToDataCount);
+ Assert.Fail(" Delta count should have been 2, is " + DeltaEx.ToDeltaCount);
+ }
+ if (DeltaEx.ToDataCount != 3)
+ Assert.Fail("Data count should have been 3, is " + DeltaEx.ToDataCount);
+ DeltaEx.ToDeltaCount = 0;
+ DeltaEx.ToDataCount = 0;
+ DeltaEx.FromDataCount = 0;
+ DeltaEx.FromDeltaCount = 0;
+ }
+
+ void Do_Put_Contains_Remove_WithDelta()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothng
+ }
+ string cKey = m_keys[0];
+ DeltaEx val = new DeltaEx();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+
+ reg[cKey] = (object)val;
+ val.SetDelta(true);
+ reg[cKey] = (object)val;
+
+ DeltaEx val1 = new DeltaEx(0); // In this case JAVA side will throw invalid DeltaException
+ reg[cKey] = (object)val1;
+ val1.SetDelta(true);
+ reg[cKey] = (object)val1;
+ if (DeltaEx.ToDeltaCount != 2)
+ {
+ Util.Log("DeltaEx.ToDataCount = " + DeltaEx.ToDataCount);
+ Assert.Fail(" Delta count should have been 2, is " + DeltaEx.ToDeltaCount);
+ }
+ if (DeltaEx.ToDataCount != 3)
+ Assert.Fail("Data count should have been 3, is " + DeltaEx.ToDataCount);
+ DeltaEx.ToDeltaCount = 0;
+ DeltaEx.ToDataCount = 0;
+ DeltaEx.FromDataCount = 0;
+ DeltaEx.FromDeltaCount = 0;
+
+ // Try Contains with key & value that are present. Result should be true.
+ KeyValuePair<object, object> myentry = new KeyValuePair<object, object>(cKey, val1);
+ bool containsOpflag = reg.Contains(myentry);
+ Assert.IsTrue(containsOpflag, "Result should be true as key & value are present");
+
+ // Try Remove with key & value that are present. Result should be true.
+ bool removeOpflag = reg.Remove(cKey);
+ Assert.IsTrue(removeOpflag, "Result should be true as key & value are present");
+
+ //Check Contains with removed entry. Result should be false.
+ bool updatedcontainsOpflag = reg.Contains(myentry);
+ Assert.IsFalse(updatedcontainsOpflag, "Result should be false as key & value are removed");
+ }
+
+ void DoNotificationWithDelta()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothig.
+ }
+
+ string cKey = m_keys[0];
+ DeltaEx val = new DeltaEx();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ reg[cKey] = val;
+ val.SetDelta(true);
+ reg[cKey] = val;
+
+ string cKey1 = m_keys[1];
+ DeltaEx val1 = new DeltaEx();
+ reg[cKey1] = val1;
+ val1.SetDelta(true);
+ reg[cKey1] = val1;
+ DeltaEx.ToDeltaCount = 0;
+ DeltaEx.ToDataCount = 0;
+ }
+
+ void DoNotificationWithDefaultCloning()
+ {
+ string cKey = m_keys[0];
+ DeltaTestImpl val = new DeltaTestImpl();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ reg[cKey] = val;
+ val.SetIntVar(2);
+ val.SetDelta(true);
+ reg[cKey] = val;
+
+ javaobject.PdxDelta pd = new javaobject.PdxDelta(1001);
+ for (int i = 0; i < 10; i++)
+ {
+ reg["pdxdelta"] = pd;
+ }
+ }
+
+ void DoNotificationWithDeltaLRU()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothig.
+ }
+
+ string cKey1 = "key1";
+ string cKey2 = "key2";
+ string cKey3 = "key3";
+ string cKey4 = "key4";
+ string cKey5 = "key5";
+ string cKey6 = "key6";
+ DeltaEx val1 = new DeltaEx();
+ DeltaEx val2 = new DeltaEx();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ reg[cKey1] = val1;
+ reg[cKey2] = val1;
+ reg[cKey3] = val1;
+ reg[cKey4] = val1;
+ reg[cKey5] = val1;
+ reg[cKey6] = val1;
+ val2.SetDelta(true);
+ reg[cKey1] = val2;
+
+ DeltaEx.ToDeltaCount = 0;
+ DeltaEx.ToDataCount = 0;
+ }
+
+ void DoExpirationWithDelta()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothig.
+ }
+
+ DeltaEx val1 = new DeltaEx();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ reg[1] = val1;
+ // Sleep 10 seconds to allow expiration of entry in client 2
+ Thread.Sleep(10000);
+ val1.SetDelta(true);
+ reg[1] = val1;
+ DeltaEx.ToDeltaCount = 0;
+ DeltaEx.ToDataCount = 0;
+ }
+
+ void DoCqWithDelta()
+ {
+ string cKey1 = "key1";
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ DeltaTestImpl value = new DeltaTestImpl();
+ reg[cKey1] = value;
+ value.SetIntVar(5);
+ value.SetDelta(true);
+ reg[cKey1] = value;
+ }
+
+ void initializeDeltaClientAD()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaTestAD.Create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothng
+ }
+ }
+
+ void DoDeltaAD_C1_1()
+ {
+ DeltaTestAD val = new DeltaTestAD();
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ reg.GetSubscriptionService().RegisterAllKeys();
+ Util.Log("clientAD1 put");
+ reg[1] = val;
+ Util.Log("clientAD1 put done");
+ }
+
+ void DoDeltaAD_C2_1()
+ {
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+
+ Util.Log("clientAD2 get");
+ DeltaTestAD val = (DeltaTestAD)reg[1];
+
+ Assert.AreEqual(2, val.DeltaUpdate);
+ Util.Log("clientAD2 get done");
+ reg[1] = val;
+ Util.Log("clientAD2 put done");
+
+ javaobject.PdxDelta pd = new javaobject.PdxDelta(1001);
+ for (int i = 0; i < 10; i++)
+ {
+ reg["pdxdelta"] = pd;
+ }
+ }
+
+ void DoDeltaAD_C1_afterC2Put()
+ {
+ Thread.Sleep(15000);
+ DeltaTestAD val = null;
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ Util.Log("client fetching entry from local cache");
+ val = (DeltaTestAD)reg.GetEntry(1).Value;
+ Assert.IsNotNull(val);
+ Assert.AreEqual(3, val.DeltaUpdate);
+ Util.Log("done");
+
+ System.Threading.Thread.Sleep(5000);
+ //Assert.Greater(javaobject.PdxDelta.GotDelta, 7, "this should have recieve delta");
+ javaobject.PdxDelta pd = (javaobject.PdxDelta)(reg.GetLocalView()["pdxdelta"]);
+ Assert.Greater(pd.Delta, 7, "this should have recieve delta");
+ }
+
+ void runDeltaWithAppdomian(bool cloningenable)
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_deltaAD.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+ string regionName = "DistRegionAck";
+ // if (usePools)
+ {
+ //CacheHelper.CreateTCRegion_Pool_AD("DistRegionAck", false, false, null, null, CacheHelper.Locators, "__TEST_POOL1__", false, false, false);
+ m_client1.Call(CacheHelper.CreateTCRegion_Pool_AD1, regionName, false, true, CacheHelper.Locators, (string)"__TEST_POOL1__", true, cloningenable);
+ m_client2.Call(CacheHelper.CreateTCRegion_Pool_AD1, regionName, false, true, CacheHelper.Locators, (string)"__TEST_POOL1__", false, cloningenable);
+
+ // m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, false);
+ // m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+ }
+
+
+ m_client1.Call(initializeDeltaClientAD);
+ m_client2.Call(initializeDeltaClientAD);
+
+ m_client1.Call(DoDeltaAD_C1_1);
+ m_client2.Call(DoDeltaAD_C2_1);
+ m_client1.Call(DoDeltaAD_C1_afterC2Put);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runPutWithDelta()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, false);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client1.Call(DoPutWithDelta);
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runPut_Contains_Remove_WithDelta()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, false);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client1.Call(Do_Put_Contains_Remove_WithDelta);
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void registerClassCl2()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaEx.create, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ //do nothing
+ }
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+
+ reg.GetSubscriptionService().RegisterRegex(".*");
+ AttributesMutator<object, object> attrMutator = reg.AttributesMutator;
+ attrMutator.SetCacheListener(new SimpleCacheListener<object, object>());
+ }
+
+ void registerClassDeltaTestImpl()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(DeltaTestImpl.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ARB: ignore exception caused by type reregistration.
+ }
+ DeltaTestImpl.ResetDataCount();
+
+ Thread.Sleep(2000);
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ try
+ {
+ reg.GetSubscriptionService().RegisterRegex(".*");
+ }
+ catch (Exception)
+ {
+ // ARB: ignore regex exception for missing notification channel.
+ }
+ }
+
+ void registerCq()
+ {
+ Pool thePool = CacheHelper.DCache.GetPoolManager().Find("__TEST_POOL1__");
+ QueryService<object, DeltaTestImpl> cqService = null;
+ cqService = thePool.GetQueryService<object, DeltaTestImpl>();
+ CqAttributesFactory<object, DeltaTestImpl> attrFac = new CqAttributesFactory<object, DeltaTestImpl>();
+ myCqListener = new CqDeltaListener<object, DeltaTestImpl>();
+ attrFac.AddCqListener(myCqListener);
+ CqAttributes<object, DeltaTestImpl> cqAttr = attrFac.Create();
+ CqQuery<object, DeltaTestImpl> theQuery = cqService.NewCq("select * from /DistRegionAck d where d.intVar > 4", cqAttr, false);
+ theQuery.Execute();
+ }
+
+ void VerifyDeltaCount()
+ {
+ Thread.Sleep(1000);
+ Util.Log("Total Data count" + DeltaEx.FromDataCount);
+ Util.Log("Total Data count" + DeltaEx.FromDeltaCount);
+ if (DeltaEx.FromDataCount != 3)
+ Assert.Fail("Count of fromData called should be 3 ");
+ if (DeltaEx.FromDeltaCount != 2)
+ Assert.Fail("Count of fromDelta called should be 2 ");
+ if (SimpleCacheListener<object, object>.isSuccess == false)
+ Assert.Fail("Listener failure");
+ SimpleCacheListener<object, object>.isSuccess = false;
+ if (DeltaEx.CloneCount != 2)
+ Assert.Fail("Clone count should be 2, is " + DeltaEx.CloneCount);
+
+ DeltaEx.FromDataCount = 0;
+ DeltaEx.FromDeltaCount = 0;
+ DeltaEx.CloneCount = 0;
+ }
+
+ void VerifyCloning()
+ {
+ Thread.Sleep(1000);
+ string cKey = m_keys[0];
+ IRegion<object, object> reg = CacheHelper.GetRegion<object, object>("DistRegionAck");
+ DeltaTestImpl val = reg[cKey] as DeltaTestImpl;
+
+ if (val.GetIntVar() != 2)
+ Assert.Fail("Int value after cloning should be 2, is " + val.GetIntVar());
+ if (DeltaTestImpl.GetFromDataCount() != 2)
+ Assert.Fail("After cloning, fromDataCount should have been 2, is " + DeltaTestImpl.GetFromDataCount());
+ if (DeltaTestImpl.GetToDataCount() != 1)
+ Assert.Fail("After cloning, toDataCount should have been 1, is " + DeltaTestImpl.GetToDataCount());
+
+ System.Threading.Thread.Sleep(5000);
+ //Assert.Greater(javaobject.PdxDelta.GotDelta, 7, "this should have recieve delta");
+ javaobject.PdxDelta pd = (javaobject.PdxDelta)(reg.GetLocalView()["pdxdelta"]);
+ Assert.Greater(pd.Delta, 7, "this should have recieve delta");
+ }
+
+ void VerifyDeltaCountLRU()
+ {
+ Thread.Sleep(1000);
+ if (DeltaEx.FromDataCount != 8)
+ {
+ Util.Log("DeltaEx.FromDataCount = " + DeltaEx.FromDataCount);
+ Util.Log("DeltaEx.FromDeltaCount = " + DeltaEx.FromDeltaCount);
+ Assert.Fail("Count should have been 8. 6 for common put and two when pulled from database and deserialized");
+ }
+ if (DeltaEx.FromDeltaCount != 1)
+ {
+ Util.Log("DeltaEx.FromDeltaCount = " + DeltaEx.FromDeltaCount);
+ Assert.Fail("Count should have been 1");
+ }
+ DeltaEx.FromDataCount = 0;
+ DeltaEx.FromDeltaCount = 0;
+ }
+
+ void VerifyCqDeltaCount()
+ {
+ // Wait for Cq event processing in listener
+ Thread.Sleep(1000);
+ if (myCqListener.GetDeltaCount() != 1)
+ {
+ Assert.Fail("Delta from CQ event does not have expected value");
+ }
+ if (myCqListener.GetValueCount() != 1)
+ {
+ Assert.Fail("Value from CQ event is incorrect");
+ }
+ }
+ void VerifyExpirationDeltaCount()
+ {
+ Thread.Sleep(1000);
+ if (DeltaEx.FromDataCount != 2)
+ Assert.Fail("Count should have been 2.");
+ if (DeltaEx.FromDeltaCount != 0)
+ Assert.Fail("Count should have been 0.");
+ DeltaEx.FromDataCount = 0;
+ DeltaEx.FromDeltaCount = 0;
+ }
+
+ void runNotificationWithDelta()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__", true);
+
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__", true);
+
+ m_client2.Call(registerClassCl2);
+
+ m_client1.Call(DoNotificationWithDelta);
+ m_client2.Call(VerifyDeltaCount);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runNotificationWithDefaultCloning()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta_test_impl.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__", true);
+
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__", true);
+
+ m_client1.Call(registerClassDeltaTestImpl);
+ m_client2.Call(registerClassDeltaTestImpl);
+
+ m_client1.Call(DoNotificationWithDefaultCloning);
+ m_client2.Call(VerifyCloning);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runNotificationWithDeltaWithOverFlow()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client1.Call(createLRURegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createLRURegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client2.Call(registerClassCl2);
+
+ m_client1.Call(DoNotificationWithDeltaLRU);
+ m_client2.Call(VerifyDeltaCountLRU);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runCqWithDelta()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta_test_impl.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client1.Call(registerClassDeltaTestImpl);
+ m_client2.Call(registerClassDeltaTestImpl);
+ m_client2.Call(registerCq);
+
+ m_client1.Call(DoCqWithDelta);
+ m_client2.Call(VerifyCqDeltaCount);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runExpirationWithDelta()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_with_delta.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS5", 1);
+
+ m_client1.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client1.Call(createRegionAndAttachPool, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client2.Call(createPool, "__TEST_POOL1__", CacheHelper.Locators, (string)null, 0, true);
+ m_client2.Call(createExpirationRegion, "DistRegionAck", "__TEST_POOL1__");
+
+ m_client2.Call(registerClassCl2);
+
+ m_client1.Call(DoExpirationWithDelta);
+ m_client2.Call(VerifyExpirationDeltaCount);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ //#region Tests
+
+ [Test]
+ public void PutWithDeltaAD()
+ {
+ runDeltaWithAppdomian(false);
+ runDeltaWithAppdomian(true);//cloning enable
+ }
+
+ [Test]
+ public void PutWithDelta()
+ {
+ runPutWithDelta();
+ }
+
+ [Test]
+ public void Put_Contains_Remove_WithDelta()
+ {
+ runPut_Contains_Remove_WithDelta();
+ }
+
+ [Test]
+ public void NotificationWithDelta()
+ {
+ runNotificationWithDelta();
+ }
+
+ [Test]
+ public void NotificationWithDefaultCloning()
+ {
+ runNotificationWithDefaultCloning();
+ }
+
+ [Test]
+ public void NotificationWithDeltaWithOverFlow()
+ {
+ runNotificationWithDeltaWithOverFlow();
+ }
+
+ [Test]
+ public void CqWithDelta()
+ {
+ runCqWithDelta();
+ }
+
+ [Test]
+ public void ExpirationWithDelta()
+ {
+ runExpirationWithDelta();
+ }
+
+ //#endregion
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientDurableCqTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientDurableCqTestsN.cs b/clicache/integration-test/ThinClientDurableCqTestsN.cs
new file mode 100644
index 0000000..b6b0a01
--- /dev/null
+++ b/clicache/integration-test/ThinClientDurableCqTestsN.cs
@@ -0,0 +1,325 @@
+/*
+ * 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 NUnit.Framework;
+using Apache.Geode.DUnitFramework;
+using Apache.Geode.Client.Tests;
+using Apache.Geode.Client;
+using System;
+
+namespace Apache.Geode.Client.UnitTests
+{
+
+ [TestFixture]
+ [Category("group3")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientDurableCqTests : ThinClientRegionSteps
+ {
+ #region Private Members
+ private UnitProcess m_client1 = null;
+ private UnitProcess m_client2 = null;
+ private string[] m_client1DurableCqNames = { "client1DurableCQ1", "client1DurableCQ2", "client1DurableCQ3", "client1DurableCQ4", "client1DurableCQ5", "client1DurableCQ6", "client1DurableCQ7", "client1DurableCQ8" };
+ private string[] m_client2DurableCqNames = { "client2DurableCQ1", "client2DurableCQ2", "client2DurableCQ3", "client2DurableCQ4", "client2DurableCQ5", "client2DurableCQ6", "client2DurableCQ7", "client2DurableCQ8" };
+ private static string[] QueryRegionNames = { "ListDurableCqs" };
+ private static int m_NumberOfCqs = 110;
+ #endregion
+
+ #region Test helper methods
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ public void InitDurableClient(string locators, int redundancyLevel,
+ string durableClientId, int durableTimeout)
+ {
+ CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel, durableClientId, durableTimeout);
+ CacheHelper.CreateTCRegion_Pool(QueryRegionNames[0], true, true, (ICacheListener<object, object>)null, CacheHelper.Locators, "__TESTPOOL1_", true);
+ }
+
+
+ public void RegisterCqsClient1(bool isRecycle)
+ {
+ Util.Log("Registering Cqs for client1.");
+ CqAttributesFactory<object, object> cqAf = new CqAttributesFactory<object, object>();
+ CqAttributes<object, object> attributes = cqAf.Create();
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ if (!isRecycle)
+ {
+ qs.NewCq(m_client1DurableCqNames[0], "Select * From /" + QueryRegionNames[0] + " where id = 1", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[1], "Select * From /" + QueryRegionNames[0] + " where id = 10", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[2], "Select * From /" + QueryRegionNames[0], attributes, false).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[3], "Select * From /" + QueryRegionNames[0] + " where id = 3", attributes, false).ExecuteWithInitialResults();
+ }
+ else
+ {
+ qs.NewCq(m_client1DurableCqNames[4], "Select * From /" + QueryRegionNames[0] + " where id = 1", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[5], "Select * From /" + QueryRegionNames[0] + " where id = 10", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[6], "Select * From /" + QueryRegionNames[0], attributes, false).ExecuteWithInitialResults();
+ qs.NewCq(m_client1DurableCqNames[7], "Select * From /" + QueryRegionNames[0] + " where id = 3", attributes, false).ExecuteWithInitialResults();
+ }
+
+ }
+
+ public void RegisterCqsClient1MultipleChunks()
+ {
+ Util.Log("Registering Cqs for client1 for multiple chunks.");
+ CqAttributesFactory<object, object> cqAf = new CqAttributesFactory<object, object>();
+ CqAttributes<object, object> attributes = cqAf.Create();
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ for (int i = 0; i < m_NumberOfCqs; i++)
+ qs.NewCq("MyCq_" + i.ToString(), "Select * From /" + QueryRegionNames[0] + " where id = 1", attributes, true).ExecuteWithInitialResults();
+
+ }
+
+ public void RegisterCqsClient2(bool isRecycle)
+ {
+ Util.Log("Registering Cqs for client2.");
+ CqAttributesFactory<object, object> cqAf = new CqAttributesFactory<object, object>();
+ CqAttributes<object, object> attributes = cqAf.Create();
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ if (!isRecycle)
+ {
+ qs.NewCq(m_client2DurableCqNames[0], "Select * From /" + QueryRegionNames[0] + " where id = 1", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[1], "Select * From /" + QueryRegionNames[0] + " where id = 10", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[2], "Select * From /" + QueryRegionNames[0], attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[3], "Select * From /" + QueryRegionNames[0] + " where id = 3", attributes, true).ExecuteWithInitialResults();
+ }
+ else
+ {
+ qs.NewCq(m_client2DurableCqNames[4], "Select * From /" + QueryRegionNames[0] + " where id = 1", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[5], "Select * From /" + QueryRegionNames[0] + " where id = 10", attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[6], "Select * From /" + QueryRegionNames[0], attributes, true).ExecuteWithInitialResults();
+ qs.NewCq(m_client2DurableCqNames[7], "Select * From /" + QueryRegionNames[0] + " where id = 3", attributes, true).ExecuteWithInitialResults();
+ }
+ }
+
+ public void VerifyDurableCqListClient1MultipleChunks()
+ {
+ Util.Log("Verifying durable Cqs for client1.");
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ System.Collections.Generic.List<string> durableCqList = qs.GetAllDurableCqsFromServer();
+ Assert.AreNotEqual(null, durableCqList);
+
+ Assert.AreEqual(m_NumberOfCqs, durableCqList.Count, "Durable CQ count sholuld be %d", m_NumberOfCqs);
+
+ Util.Log("Completed verifying durable Cqs for client1.");
+ }
+
+ public void VerifyDurableCqListClient1(bool isRecycle)
+ {
+ Util.Log("Verifying durable Cqs for client1.");
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ System.Collections.Generic.List<string> durableCqList = qs.GetAllDurableCqsFromServer();
+ Assert.AreNotEqual(null, durableCqList);
+
+ if (!isRecycle)
+ {
+ Assert.AreEqual(2, durableCqList.Count, "Durable CQ count sholuld be 2");
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[0]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[1]));
+ }
+ else
+ {
+ Assert.AreEqual(4, durableCqList.Count, "Durable CQ count sholuld be 4");
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[0]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[1]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[4]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client1DurableCqNames[5]));
+ }
+ Util.Log("Completed verifying durable Cqs for client1.");
+ }
+
+ public void VerifyDurableCqListClient2(bool isRecycle)
+ {
+ Util.Log("Verifying durable Cqs for client2.");
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ System.Collections.Generic.List<string> durableCqList = qs.GetAllDurableCqsFromServer();
+ Assert.AreNotEqual(null, durableCqList);
+
+ if (!isRecycle)
+ {
+ Assert.AreEqual(4, durableCqList.Count, "Durable CQ count sholuld be 4");
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[0]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[1]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[2]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[3]));
+ }
+ else
+ {
+ Assert.AreEqual(8, durableCqList.Count, "Durable CQ count sholuld be 8");
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[0]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[1]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[2]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[3]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[4]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[5]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[6]));
+ Assert.AreEqual(true, durableCqList.Contains(m_client2DurableCqNames[7]));
+ }
+ }
+
+ public void VerifyEmptyDurableCqListClient1()
+ {
+ Util.Log("Verifying empty durable Cqs for client1.");
+ QueryService<object, object> qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ System.Collections.Generic.List<string> durableCqList = qs.GetAllDurableCqsFromServer();
+ Assert.AreNotEqual(null, durableCqList);
+ Assert.AreEqual(0, durableCqList.Count, "Durable CQ list sholuld be empty");
+ }
+
+
+ private void RunTestGetDurableCqsFromServer()
+ {
+ try
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserverDurableCqs.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cache server 1 started");
+
+ m_client1.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient1", 300);
+ m_client2.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient2", 300);
+ Util.Log("client initialization done.");
+
+ m_client1.Call(RegisterCqsClient1, false);
+ m_client2.Call(RegisterCqsClient2, false);
+ Util.Log("Registered DurableCQs.");
+
+ m_client1.Call(VerifyDurableCqListClient1, false);
+ m_client2.Call(VerifyDurableCqListClient2, false);
+
+ Util.Log("Verified DurableCQ List.");
+ }
+ finally
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ }
+
+ }
+
+ private void RunTestGetDurableCqsFromServerCyclicClients()
+ {
+ try
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserverDurableCqs.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cache server 1 started");
+
+ m_client1.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient1", 300);
+ m_client2.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient2", 300);
+ Util.Log("client initialization done.");
+
+ m_client1.Call(RegisterCqsClient1, false);
+ m_client2.Call(RegisterCqsClient2, false);
+ Util.Log("Registered DurableCQs.");
+
+ m_client1.Call(VerifyDurableCqListClient1, false);
+ m_client1.Call(VerifyDurableCqListClient1, false);
+ Util.Log("Verified DurableCQ List.");
+
+
+ m_client1.Call(CacheHelper.CloseKeepAlive);
+ m_client2.Call(CacheHelper.CloseKeepAlive);
+
+
+ m_client1.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient1", 300);
+ m_client2.Call(InitDurableClient, CacheHelper.Locators, 0, "DurableClient2", 300);
+ Util.Log("client re-initialization done.");
+
+ m_client1.Call(RegisterCqsClient1, true);
+ m_client2.Call(RegisterCqsClient2, true);
+ Util.Log("Registered DurableCQs.");
+
+ m_client1.Call(VerifyDurableCqListClient1, true);
+ m_client1.Call(VerifyDurableCqListClient1, true);
+
+ Util.Log("Verified DurableCQ List.");
+ }
+ finally
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaLocator(1);
+ }
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ m_client1.Exit();
+ m_client2.Exit();
+ base.EndTests();
+ }
+
+ [SetUp]
+ public override void InitTest()
+ {
+ base.InitTest();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ base.EndTest();
+ }
+
+
+ #endregion
+
+ #region Tests
+
+ [Test]
+ public void TestGetDurableCqsFromServerWithLocator()
+ {
+ RunTestGetDurableCqsFromServer();
+ }
+
+ [Test]
+ public void TestGetDurableCqsFromServerCyclicClientsWithLocator()
+ {
+ RunTestGetDurableCqsFromServerCyclicClients();
+ }
+
+ #endregion
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientDurableTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientDurableTestsN.cs b/clicache/integration-test/ThinClientDurableTestsN.cs
new file mode 100644
index 0000000..e75856e
--- /dev/null
+++ b/clicache/integration-test/ThinClientDurableTestsN.cs
@@ -0,0 +1,982 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+
+ using AssertionException = Apache.Geode.Client.AssertionException;
+ [TestFixture]
+ [Category("group2")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientDurableTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2, m_feeder;
+ private string[] m_regexes = { "D-Key-.*", "Key-.*" };
+ private string[] m_mixKeys = { "Key-1", "D-Key-1", "L-Key", "LD-Key" };
+ private string[] keys = { "Key-1", "Key-2", "Key-3", "Key-4", "Key-5" };
+
+ private static string DurableClientId1 = "DurableClientId1";
+ private static string DurableClientId2 = "DurableClientId2";
+
+ private static DurableListener<object, object> m_checker1, m_checker2;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_feeder = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_feeder };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ m_feeder.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ #region Common Functions
+
+ public void InitFeeder(string locators, int redundancyLevel)
+ {
+ CacheHelper.CreatePool<object, object>("__TESTPOOL1_", locators, (string)null, redundancyLevel, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(RegionNames[0], false, true, null,
+ locators, "__TESTPOOL1_", false);
+ }
+
+ public void InitFeeder2(string locators, int redundancyLevel)
+ {
+ CacheHelper.CreatePool<object, object>("__TESTPOOL1_", locators, (string)null, redundancyLevel, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(RegionNames[0], false, true, null,
+ locators, "__TESTPOOL1_", false);
+
+ CacheHelper.CreatePool<object, object>("__TESTPOOL2_", locators, (string)null, redundancyLevel, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(RegionNames[1], false, true, null,
+ locators, "__TESTPOOL2_", false);
+ }
+
+ public void InitDurableClientWithTwoPools(string locators,
+ int redundancyLevel, string durableClientId, int durableTimeout, int expectedQ0, int expectedQ1)
+ {
+ DurableListener<object, object> checker = null;
+ CacheHelper.InitConfigForDurable_Pool2(locators, redundancyLevel,
+ durableClientId, durableTimeout, 35000, "__TESTPOOL1_");
+ CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ CacheHelper.InitConfigForDurable_Pool2(locators, redundancyLevel,
+ durableClientId, durableTimeout, 35000, "__TESTPOOL2_");
+ CacheHelper.CreateTCRegion_Pool(RegionNames[1], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL2_", true);
+
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[1]);
+
+ try
+ {
+ region0.GetSubscriptionService().RegisterAllKeys(true);
+ region1.GetSubscriptionService().RegisterAllKeys(true);
+ }
+ catch (Exception other)
+ {
+ Assert.Fail("RegisterAllKeys threw unexpected exception: {0}", other.Message);
+ }
+
+ Pool pool0 = CacheHelper.DCache.GetPoolManager().Find(region0.Attributes.PoolName);
+ int pendingEventCount0 = pool0.PendingEventCount;
+ Util.Log("pendingEventCount0 for pool = {0} {1} ", pendingEventCount0, region0.Attributes.PoolName);
+ string msg = string.Format("Expected Value ={0}, Actual = {1}", expectedQ0, pendingEventCount0);
+ Assert.AreEqual(expectedQ0, pendingEventCount0, msg);
+
+ Pool pool1 = CacheHelper.DCache.GetPoolManager().Find(region1.Attributes.PoolName);
+ int pendingEventCount1 = pool1.PendingEventCount;
+ Util.Log("pendingEventCount1 for pool = {0} {1} ", pendingEventCount1, region1.Attributes.PoolName);
+ string msg1 = string.Format("Expected Value ={0}, Actual = {1}", expectedQ1, pendingEventCount1);
+ Assert.AreEqual(expectedQ1, pendingEventCount1, msg1);
+
+ CacheHelper.DCache.ReadyForEvents();
+ Thread.Sleep(10000);
+
+ CacheHelper.DCache.Close(true);
+ }
+
+ public void ClearChecker(int client)
+ {
+ if (client == 1)
+ {
+ ThinClientDurableTests.m_checker1 = null;
+ }
+ else // client == 2
+ {
+ ThinClientDurableTests.m_checker2 = null;
+ }
+ }
+
+ public void InitDurableClient(int client, string locators, int redundancyLevel,
+ string durableClientId, int durableTimeout)
+ {
+ // Create DurableListener for first time and use same afterward.
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ if (ThinClientDurableTests.m_checker1 == null)
+ {
+ ThinClientDurableTests.m_checker1 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ if (ThinClientDurableTests.m_checker2 == null)
+ {
+ ThinClientDurableTests.m_checker2 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker2;
+ }
+ CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
+ durableClientId, durableTimeout);
+ CacheHelper.CreateTCRegion_Pool<object, object>(RegionNames[0], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ CacheHelper.DCache.ReadyForEvents();
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
+ region1.GetSubscriptionService().RegisterRegex(m_regexes[1], false);
+ //CacheableKey[] ldkeys = { new CacheableString(m_mixKeys[3]) };
+ ICollection<object> lkeys = new List<object>();
+ lkeys.Add((object)m_mixKeys[3]);
+ region1.GetSubscriptionService().RegisterKeys(lkeys, true, false);
+
+ ICollection<object> ldkeys = new List<object>(); ;
+ ldkeys.Add((object)m_mixKeys[2]);
+ region1.GetSubscriptionService().RegisterKeys(ldkeys, false, false);
+ }
+
+ public void InitClientXml(string cacheXml)
+ {
+ CacheHelper.InitConfig(cacheXml);
+ }
+
+ public void ReadyForEvents()
+ {
+ CacheHelper.DCache.ReadyForEvents();
+ }
+
+ public void PendingEventCount(IRegion<object, object> region, int expectedPendingQSize, bool exception)
+ {
+ Util.Log("PendingEventCount regionName = {0} ", region);
+ string poolName = region.Attributes.PoolName;
+ if (poolName != null)
+ {
+ Util.Log("PendingEventCount poolName = {0} ", poolName);
+ Pool pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
+ if (exception)
+ {
+ try
+ {
+ int pendingEventCount = pool.PendingEventCount;
+ Util.Log("PendingEventCount Should have got exception ");
+ Assert.Fail("PendingEventCount Should have got exception");
+ }
+ catch (IllegalStateException ex)
+ {
+ Util.Log("Got expected exception for PendingEventCount {0} ", ex.Message);
+ }
+ }
+ else
+ {
+ int pendingEventCount = pool.PendingEventCount;
+ Util.Log("pendingEventCount = {0} ", pendingEventCount);
+ string msg = string.Format("Expected Value ={0}, Actual = {1}", expectedPendingQSize, pendingEventCount);
+ Assert.AreEqual(expectedPendingQSize, pendingEventCount, msg);
+ }
+ }
+ }
+
+ public void FeederUpdate(int value, int sleep)
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+
+ region1[m_mixKeys[0]] = value;
+ Thread.Sleep(sleep);
+ region1[m_mixKeys[1]] = value;
+ Thread.Sleep(sleep);
+ region1[m_mixKeys[2]] = value;
+ Thread.Sleep(sleep);
+ region1[m_mixKeys[3]] = value;
+ Thread.Sleep(sleep);
+
+ region1.Remove(m_mixKeys[0]);
+ Thread.Sleep(sleep);
+ region1.Remove(m_mixKeys[1]);
+ Thread.Sleep(sleep);
+ region1.Remove(m_mixKeys[2]);
+ Thread.Sleep(sleep);
+ region1.Remove(m_mixKeys[3]);
+ Thread.Sleep(sleep);
+ }
+
+ public void FeederUpdate2(int pool1, int pool2)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[1]);
+
+ for (int i = 0; i < pool1; i++)
+ {
+ region0[i] = i;
+ }
+
+ for (int i = 0; i < pool2; i++)
+ {
+ region1[i] = i;
+ }
+ }
+
+ public void ClientDown(bool keepalive)
+ {
+ if (keepalive)
+ {
+ CacheHelper.CloseKeepAlive();
+ }
+ else
+ {
+ CacheHelper.Close();
+ }
+ }
+
+ public void CrashClient()
+ {
+ // TODO: crash client here.
+ }
+
+ public void KillServer()
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ public delegate void KillServerDelegate();
+
+ #endregion
+
+
+ public void VerifyTotal(int client, int keys, int total)
+ {
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ checker = ThinClientDurableTests.m_checker2;
+ }
+
+ if (checker != null)
+ {
+ checker.validate(keys, total);
+ }
+ else
+ {
+ Assert.Fail("Checker is NULL!");
+ }
+ }
+
+ public void VerifyBasic(int client, int keyCount, int eventCount, int durableValue, int nonDurableValue)
+ {//1 4 8 1 1
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ checker = ThinClientDurableTests.m_checker2;
+ }
+
+ if (checker != null)
+ {
+ try
+ {
+ checker.validateBasic(keyCount, eventCount, durableValue, nonDurableValue);//4 8 1 1
+ }
+ catch (AssertionException e)
+ {
+ Util.Log("VERIFICATION FAILED for client {0}: {1} ", client, e);
+ throw e;
+ }
+ }
+ else
+ {
+ Assert.Fail("Checker is NULL!");
+ }
+ }
+
+ #region Basic Durable Test
+
+
+ void runDurableAndNonDurableBasic()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml", "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+
+ for (int redundancy = 0; redundancy <= 1; redundancy++)
+ {
+ for (int closeType = 1; closeType <= 2; closeType++)
+ {
+ for (int downtime = 0; downtime <= 1; downtime++) // downtime updates
+ {
+ Util.Log("Starting loop with closeType = {0}, redundancy = {1}, downtime = {2} ", closeType, redundancy, downtime);
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ if (redundancy == 1)
+ {
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ }
+
+ m_feeder.Call(InitFeeder, CacheHelper.Locators, 0);
+ Util.Log("Feeder initialized.");
+
+ m_client1.Call(ClearChecker, 1);
+ m_client2.Call(ClearChecker, 2);
+
+ m_client1.Call(InitDurableClient, 1, CacheHelper.Locators, redundancy, DurableClientId1, 300);
+ m_client2.Call(InitDurableClient, 2, CacheHelper.Locators, redundancy, DurableClientId2, 3);
+
+ Util.Log("Clients initialized.");
+
+ m_feeder.Call(FeederUpdate, 1, 10);
+
+ Util.Log("Feeder performed first update.");
+ Thread.Sleep(45000); // wait for HA Q to drain and notify ack to go out.
+
+ switch (closeType)
+ {
+ case 1:
+
+ m_client1.Call(ClientDown, true);
+ m_client2.Call(ClientDown, true);
+
+ Util.Log("Clients downed with keepalive true.");
+ break;
+ case 2:
+
+ m_client1.Call(ClientDown, false);
+ m_client2.Call(ClientDown, false);
+
+ Util.Log("Clients downed with keepalive false.");
+ break;
+ case 3:
+
+ m_client1.Call(CrashClient);
+
+ m_client2.Call(CrashClient);
+
+ Util.Log("Clients downed as crash.");
+ break;
+ default:
+ break;
+ }
+
+ if (downtime == 1)
+ {
+ m_feeder.Call(FeederUpdate, 2, 10);
+
+ Util.Log("Feeder performed update during downtime.");
+ Thread.Sleep(20000); // wait for HA Q to drain and notify ack to go out.
+ }
+
+ m_client1.Call(InitDurableClient, 1, CacheHelper.Locators, redundancy, DurableClientId1, 300);
+
+ // Sleep for 45 seconds since durable timeout is 30 seconds so that client2 times out
+ Thread.Sleep(45000);
+
+ m_client2.Call(InitDurableClient, 2, CacheHelper.Locators, redundancy, DurableClientId2, 30);
+
+ Util.Log("Clients brought back up.");
+
+ if (closeType != 2 && downtime == 1)
+ {
+ m_client1.Call(VerifyBasic, 1, 4, 12, 2, 1);
+
+ m_client2.Call(VerifyBasic, 2, 4, 8, 1, 1);
+
+ }
+ else
+ {
+
+ m_client1.Call(VerifyBasic, 1, 4, 8, 1, 1);
+
+ m_client2.Call(VerifyBasic, 2, 4, 8, 1, 1);
+
+ }
+
+ Util.Log("Verification completed.");
+
+ m_feeder.Call(ClientDown, false);
+
+ m_client1.Call(ClientDown, false);
+
+ m_client2.Call(ClientDown, false);
+
+ Util.Log("Feeder and Clients closed.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ if (redundancy == 1)
+ {
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ }
+
+ Util.Log("Completed loop with closeType = {0}, redundancy = {1}, downtime = {2} ", closeType, redundancy, downtime);
+
+ } // end for int downtime
+ } // end for int closeType
+ } // end for int redundancy
+ CacheHelper.StopJavaLocator(1);
+ }
+
+ // Basic Durable Test to check durable event recieving for different combination
+ // of Close type ( Keep Alive = true / false ) , Intermediate update and rudundancy
+
+ [Test]
+ public void DurableAndNonDurableBasic()
+ {
+ runDurableAndNonDurableBasic();
+ } // end [Test] DurableAndNonDurableBasic
+
+ #endregion
+
+ #region Durable Intrest Test
+
+ public void InitDurableClientRemoveInterest(int client, string locators,
+ int redundancyLevel, string durableClientId, int durableTimeout)
+ {
+ // Client Registered Durable Intrest on two keys. We need to unregister them all here.
+
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ if (ThinClientDurableTests.m_checker1 == null)
+ {
+ ThinClientDurableTests.m_checker1 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ if (ThinClientDurableTests.m_checker2 == null)
+ {
+ ThinClientDurableTests.m_checker2 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker2;
+ }
+ CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
+ durableClientId, durableTimeout);
+ CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ CacheHelper.DCache.ReadyForEvents();
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+
+ // Unregister Regex only durable
+ region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
+ region1.GetSubscriptionService().UnregisterRegex(m_regexes[0]);
+
+ // Unregister list only durable
+ string[] ldkeys = new string[] { m_mixKeys[3] };
+ region1.GetSubscriptionService().RegisterKeys(ldkeys, true, false);
+ region1.GetSubscriptionService().UnregisterKeys(ldkeys);
+ }
+
+ public void InitDurableClientNoInterest(int client, string locators,
+ int redundancyLevel, string durableClientId, int durableTimeout)
+ {
+ // we use "client" to either create a DurableListener or use the existing ones
+ // if the clients are initialized for the second time
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ if (ThinClientDurableTests.m_checker1 == null)
+ {
+ ThinClientDurableTests.m_checker1 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ if (ThinClientDurableTests.m_checker2 == null)
+ {
+ ThinClientDurableTests.m_checker2 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker2;
+ }
+ CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
+ durableClientId, durableTimeout);
+ CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ CacheHelper.DCache.ReadyForEvents();
+ }
+
+ void runDurableInterest()
+ {
+ 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.");
+
+ m_feeder.Call(InitFeeder, CacheHelper.Locators, 0);
+ Util.Log("Feeder started.");
+
+ m_client1.Call(ClearChecker, 1);
+ m_client2.Call(ClearChecker, 2);
+ m_client1.Call(InitDurableClient, 1, CacheHelper.Locators,
+ 0, DurableClientId1, 60);
+ m_client2.Call(InitDurableClient, 2, CacheHelper.Locators,
+ 0, DurableClientId2, 60);
+ Util.Log("Clients started.");
+
+ m_feeder.Call(FeederUpdate, 1, 10);
+ Util.Log("Feeder performed first update.");
+
+ Thread.Sleep(15000);
+
+ m_client1.Call(ClientDown, true);
+ m_client2.Call(ClientDown, true);
+ Util.Log("Clients downed with keepalive true.");
+
+ m_client1.Call(InitDurableClientNoInterest, 1, CacheHelper.Locators,
+ 0, DurableClientId1, 60);
+ Util.Log("Client 1 started with no interest.");
+
+ m_client2.Call(InitDurableClientRemoveInterest, 2, CacheHelper.Locators,
+ 0, DurableClientId2, 60);
+ Util.Log("Client 2 started with remove interest.");
+
+ m_feeder.Call(FeederUpdate, 2, 10);
+ Util.Log("Feeder performed second update.");
+
+ Thread.Sleep(10000);
+
+ // only durable Intrest will remain.
+ m_client1.Call(VerifyBasic, 1, 4, 12, 2, 1);
+
+ // no second update should be recieved.
+ m_client2.Call(VerifyBasic, 2, 4, 8, 1, 1);
+ Util.Log("Verification completed.");
+
+ m_feeder.Call(ClientDown, false);
+ m_client1.Call(ClientDown, false);
+ m_client2.Call(ClientDown, false);
+ Util.Log("Feeder and Clients closed.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ //This is to test whether durable registered intrests remains on reconnect. and
+ // Unregister works on reconnect.
+
+ [Test]
+ public void DurableInterest()
+ {
+ runDurableInterest();
+ } // end [Test] DurableInterest
+ #endregion
+
+ #region Durable Failover Test
+
+
+ public void InitDurableClientForFailover(int client, string locators,
+ int redundancyLevel, string durableClientId, int durableTimeout)
+ {
+ // we use "client" to either create a DurableListener or use the existing ones
+ // if the clients are initialized for the second time
+ DurableListener<object, object> checker = null;
+ if (client == 1)
+ {
+ if (ThinClientDurableTests.m_checker1 == null)
+ {
+ ThinClientDurableTests.m_checker1 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker1;
+ }
+ else // client == 2
+ {
+ if (ThinClientDurableTests.m_checker2 == null)
+ {
+ ThinClientDurableTests.m_checker2 = DurableListener<object, object>.Create();
+ }
+ checker = ThinClientDurableTests.m_checker2;
+ }
+ CacheHelper.InitConfigForDurable_Pool(locators, redundancyLevel,
+ durableClientId, durableTimeout, 35000);
+ CacheHelper.CreateTCRegion_Pool(RegionNames[0], false, true, checker,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ CacheHelper.DCache.ReadyForEvents();
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+
+ try
+ {
+ region1.GetSubscriptionService().RegisterRegex(m_regexes[0], true);
+ region1.GetSubscriptionService().RegisterRegex(m_regexes[1], false);
+ }
+ catch (Exception other)
+ {
+ Assert.Fail("RegisterKeys threw unexpected exception: {0}", other.Message);
+ }
+ }
+
+ public void FeederUpdateForFailover(string region, int value, int sleep)
+ {
+ //update only 2 keys.
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(region);
+
+ region1[m_mixKeys[0]] = value;
+ Thread.Sleep(sleep);
+ region1[m_mixKeys[1]] = value;
+ Thread.Sleep(sleep);
+
+ }
+
+ void runDurableFailover()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml", "cacheserver_notify_subscription2.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ for (int clientDown = 0; clientDown <= 1; clientDown++)
+ {
+ for (int redundancy = 0; redundancy <= 1; redundancy++)
+ {
+ Util.Log("Starting loop with clientDown = {0}, redundancy = {1}", clientDown, redundancy);
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_feeder.Call(InitFeeder, CacheHelper.Locators, 0);
+ Util.Log("Feeder started with redundancy level as 0.");
+
+ m_client1.Call(ClearChecker, 1);
+ m_client1.Call(InitDurableClientForFailover, 1, CacheHelper.Locators,
+ redundancy, DurableClientId1, 300);
+ Util.Log("Client started with redundancy level as {0}.", redundancy);
+
+ m_feeder.Call(FeederUpdateForFailover, RegionNames[0], 1, 10);
+ Util.Log("Feeder updates 1 completed.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ //Time for redundancy thread to detect.
+ Thread.Sleep(35000);
+
+ if (clientDown == 1)
+ {
+ m_client1.Call(ClientDown, true);
+ }
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ //Time for failover
+ Thread.Sleep(5000);
+
+ m_feeder.Call(FeederUpdateForFailover, RegionNames[0], 2, 10);
+ Util.Log("Feeder updates 2 completed.");
+
+ //Restart Client
+ if (clientDown == 1)
+ {
+ m_client1.Call(InitDurableClientForFailover, 1, CacheHelper.Locators,
+ redundancy, DurableClientId1, 300);
+ Util.Log("Client Restarted with redundancy level as {0}.", redundancy);
+ }
+
+ //Verify
+ if (clientDown == 1)
+ {
+ if (redundancy == 0) // Events missed
+ {
+ m_client1.Call(VerifyBasic, 1, 2, 2, 1, 1);
+ }
+ else // redundancy == 1 Only Durable Events should be recieved.
+ {
+ m_client1.Call(VerifyBasic, 1, 2, 3, 2, 1);
+ }
+ }
+ else // In normal failover all events should be recieved.
+ {
+ m_client1.Call(VerifyBasic, 1, 2, 4, 2, 2);
+ }
+
+ Util.Log("Verification completed.");
+
+ m_feeder.Call(ClientDown, false);
+ m_client1.Call(ClientDown, false);
+ Util.Log("Feeder and Client closed.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ Util.Log("Completed loop with clientDown = {0}, redundancy = {1}", clientDown, redundancy);
+ }// for redundancy
+ } // for clientDown
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void RunDurableClient(int expectedPendingQSize)
+ {
+ Properties<string, string> pp = Properties<string, string>.Create<string, string>();
+ pp.Insert("durable-client-id", "DurableClientId");
+ pp.Insert("durable-timeout", "30");
+
+ CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(pp);
+ Cache cache = cacheFactory.Create();
+ cache.GetPoolFactory().SetSubscriptionEnabled(true);
+ cache.GetPoolFactory().SetSubscriptionAckInterval(5000);
+ cache.GetPoolFactory().SetSubscriptionMessageTrackingTimeout(5000);
+ Util.Log("Created the Geode Cache Programmatically");
+
+ RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);
+ IRegion<object, object> region = regionFactory.Create<object, object>("DistRegionAck");
+ Util.Log("Created the DistRegionAck Region Programmatically");
+
+ QueryService<object, object> qService = cache.GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+
+ ICqListener<object, object> cqLstner = new MyCqListener1<object, object>();
+ cqFac.AddCqListener(cqLstner);
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ Util.Log("Attached CqListener");
+ String query = "select * from /DistRegionAck";
+ CqQuery<object, object> qry = qService.NewCq("MyCq", query, cqAttr, true);
+ Util.Log("Created new CqQuery");
+
+ qry.Execute();
+ Util.Log("Executed new CqQuery");
+ Thread.Sleep(10000);
+
+ PendingEventCount(region, expectedPendingQSize, false);
+
+ //Send ready for Event message to Server( only for Durable Clients ).
+ //Server will send queued events to client after recieving this.
+ cache.ReadyForEvents();
+
+ Util.Log("Sent ReadyForEvents message to server");
+ Thread.Sleep(10000);
+ // Close the Geode Cache with keepalive = true. Server will queue events for
+ // durable registered keys and will deliver all events when client will reconnect
+ // within timeout period and send "readyForEvents()"
+
+ PendingEventCount(region, 0, true);
+
+ cache.Close(true);
+
+ Util.Log("Closed the Geode Cache with keepalive as true");
+ }
+
+ void runDurableClientWithTwoPools()
+ {
+ 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.");
+
+ m_feeder.Call(InitFeeder2, CacheHelper.Locators, 0);
+ Util.Log("Feeder started.");
+
+ m_client1.Call(InitDurableClientWithTwoPools, CacheHelper.Locators, 0, DurableClientId1, 30, -2, -2);
+ Util.Log("DurableClient with Two Pools Initialized");
+
+ m_feeder.Call(FeederUpdate2, 5, 10);
+ Util.Log("Feeder performed first update.");
+ Thread.Sleep(15000);
+
+ m_client1.Call(InitDurableClientWithTwoPools, CacheHelper.Locators, 0, DurableClientId1, 30, 6, 11); //+1 for marker, so 5+1, 10+1 etc
+ Util.Log("DurableClient with Two Pools after first update");
+
+ m_feeder.Call(FeederUpdate2, 10, 5);
+ Util.Log("Feeder performed second update.");
+ Thread.Sleep(15000);
+
+ m_client1.Call(InitDurableClientWithTwoPools, CacheHelper.Locators, 0, DurableClientId1, 30, 16, 16);
+ Util.Log("DurableClient with Two Pools after second update");
+
+ Thread.Sleep(45000); //45 > 30 secs.
+ m_client1.Call(InitDurableClientWithTwoPools, CacheHelper.Locators, 0, DurableClientId1, 30, -1, -1);
+ Util.Log("DurableClient with Two Pools after timeout");
+
+ m_feeder.Call(ClientDown, false);
+ Util.Log("Feeder and Clients closed.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void RunFeeder()
+ {
+ CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
+ Util.Log("Feeder connected to the Geode Distributed System");
+
+ Cache cache = cacheFactory.Create();
+ Util.Log("Created the Geode Cache");
+
+ RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY);
+ Util.Log("Created the RegionFactory");
+
+ // Create the Region Programmatically.
+ IRegion<object, object> region = regionFactory.Create<object, object>("DistRegionAck");
+ Util.Log("Created the Region Programmatically.");
+
+ PendingEventCount(region, 0, true);
+
+ for (int i = 0; i < 10; i++)
+ {
+ region[i] = i;
+ }
+ Thread.Sleep(10000);
+ Util.Log("put on 0-10 keys done.");
+
+ // Close the Geode Cache
+ cache.Close();
+ Util.Log("Closed the Geode Cache");
+ }
+
+ void RunFeeder1()
+ {
+ CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
+ Util.Log("Feeder connected to the Geode Distributed System");
+
+ Cache cache = cacheFactory.Create();
+ Util.Log("Created the Geode Cache");
+
+ RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY);
+ Util.Log("Created the RegionFactory");
+
+ // Create the Region Programmatically.
+ IRegion<object, object> region = regionFactory.Create<object, object>("DistRegionAck");
+ Util.Log("Created the Region Programmatically.");
+
+ PendingEventCount(region, 0, true);
+
+ for (int i = 10; i < 20; i++)
+ {
+ region[i] = i;
+ }
+ Thread.Sleep(10000);
+ Util.Log("put on 10-20 keys done.");
+
+ // Close the Geode Cache
+ cache.Close();
+ Util.Log("Closed the Geode Cache");
+ }
+
+ void VerifyEvents()
+ {
+ Util.Log("MyCqListener1.m_cntEvents = {0} ", MyCqListener1<object, object>.m_cntEvents);
+ Assert.AreEqual(MyCqListener1<object, object>.m_cntEvents, 20, "Incorrect events, expected 20");
+ }
+
+ void runCQDurable()
+ {
+ CacheHelper.SetupJavaServers(false, "serverDurableClient.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ m_client1.Call(RunDurableClient, -2); // 1st time no Q, hence check -2 as PendingEventCount.
+ m_client2.Call(RunFeeder);
+ m_client1.Call(RunDurableClient, 10);
+ m_client2.Call(RunFeeder1);
+ m_client1.Call(RunDurableClient, 10);
+ m_client1.Call(VerifyEvents);
+ Thread.Sleep(45 * 1000); // sleep 45 secs > 30 secs, check -1 as PendingEventCount.
+ m_client1.Call(RunDurableClient, -1);
+ CacheHelper.StopJavaServer(1);
+ }
+
+ [Test]
+ public void DurableFailover()
+ {
+ runDurableFailover();
+ } // end [Test] DurableFailover
+
+ [Test]
+ public void CQDurable()
+ {
+ runCQDurable();
+
+ runDurableClientWithTwoPools();
+ }
+ #endregion
+ }
+}
[25/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/AttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/AttributesFactory.hpp b/clicache/src/AttributesFactory.hpp
new file mode 100644
index 0000000..608c372
--- /dev/null
+++ b/clicache/src/AttributesFactory.hpp
@@ -0,0 +1,513 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/AttributesFactory.hpp>
+#include "end_native.hpp"
+
+#include "ExpirationAction.hpp"
+#include "DiskPolicyType.hpp"
+
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+#include "ICacheListener.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "IPersistenceManager.hpp"
+#include "RegionAttributes.hpp"
+#include "RegionAttributes.hpp"
+#include "native_unique_ptr.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Factory class to create instances of <see cref="RegionAttributes" />.
+ /// </summary>
+ /// <remarks>
+ /// An <see cref="AttributesFactory" />
+ /// instance maintains state for creating <see cref="RegionAttributes" /> instances.
+ /// The setter methods are used to change the settings that will be used for
+ /// creating the next attributes instance with the <see cref="CreateRegionAttributes" />
+ /// method. If you create a factory with the default constructor, then the
+ /// factory is set up to create attributes with all default settings. You can
+ /// also create a factory by providing a preset <see cref="RegionAttributes" />.
+ /// <para>
+ /// Once a <see cref="RegionAttributes" /> is created, it can only be modified
+ /// after it has been used to create a <see cref="Region" />, and then only by
+ /// using an <see cref="AttributesMutator" /> obtained from the region.
+ /// </para><para>
+ /// <h3>Attributes</h3>
+ /// <h4>Callbacks</h4>
+ /// <dl>
+ /// <dt><see cref="ICacheLoader" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for loading data on cache misses.<br />
+ /// see <see cref="SetCacheLoader" />,
+ /// <see cref="RegionAttributes.CacheLoader" /></dd>
+ ///
+ /// <dt><see cref="ICacheWriter" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for intercepting cache modifications, e.g.
+ /// for writing to an external data source.<br />
+ /// see <see cref="SetCacheWriter" />,
+ /// <see cref="RegionAttributes.CacheWriter" /></dd>
+ ///
+ /// <dt><see cref="ICacheListener" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for receiving and handling cache-related events.<br />
+ /// see <see cref="SetCacheListener" />,
+ /// <see cref="RegionAttributes.CacheListener" /></dd>
+ ///
+ /// <dt><see cref="IPartitionResolver" /> [<em>default:</em> null]</dt>
+ /// <dd>User-implemented plug-in for custom partitioning.<br />
+ /// see <see cref="SetPartitionResolver" />,
+ /// <see cref="RegionAttributes.PartitionResolver" /></dd>
+ /// </dl>
+ /// <h4>Expiration</h4>
+ /// <dl>
+ /// <dt>RegionTimeToLive [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for the entire region based on the
+ /// lastModifiedTime ( <see cref="CacheStatistics.LastModifiedTime" /> ).<br />
+ /// see <see cref="SetRegionTimeToLive" />,
+ /// <see cref="RegionAttributes.RegionTimeToLive" />,
+ /// <see cref="AttributesMutator.SetRegionTimeToLive" /></dd>
+ ///
+ /// <dt>RegionIdleTimeout [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for the entire region based on the
+ /// lastAccessedTime ( <see cref="CacheStatistics.LastAccessedTime" /> ).<br />
+ /// see <see cref="SetRegionIdleTimeout" />,
+ /// <see cref="RegionAttributes.RegionIdleTimeout" />,
+ /// <see cref="AttributesMutator.SetRegionIdleTimeout" /></dd>
+ ///
+ /// <dt>EntryTimeToLive [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for individual entries based on the
+ /// lastModifiedTime ( <see cref="CacheStatistics.LastModifiedTime" /> ).<br />
+ /// see <see cref="SetEntryTimeToLive" />,
+ /// <see cref="RegionAttributes.EntryTimeToLive" />,
+ /// <see cref="AttributesMutator.SetEntryTimeToLive" /></dd>
+ ///
+ /// <dt>EntryIdleTimeout [<em>default:</em> no expiration]</dt>
+ /// <dd>Expiration configuration for individual entries based on the
+ /// lastAccessedTime ( <see cref="CacheStatistics.LastAccessedTime" /> ).<br />
+ /// see <see cref="SetEntryIdleTimeout" />,
+ /// <see cref="RegionAttributes.EntryIdleTimeout" />,
+ /// <see cref="AttributesMutator.SetEntryIdleTimeout" /></dd>
+ /// </dl>
+ /// <h4>Storage</h4>
+ /// <dl>
+ /// <dt>InitialCapacity [<em>default:</em> <tt>16</tt>]</dt>
+ /// <dd>The initial capacity of the map used for storing the entries.<br />
+ /// see <see cref="SetInitialCapacity" />,
+ /// <see cref="RegionAttributes.InitialCapacity" /></dd>
+ ///
+ /// <dt>LoadFactor [<em>default:</em> <tt>0.75</tt>]</dt>
+ /// <dd>The load factor of the map used for storing the entries.<br />
+ /// see <see cref="SetLoadFactor" />,
+ /// <see cref="RegionAttributes.LoadFactor" /></dd>
+ ///
+ /// <dt>ConcurrencyLevel [<em>default:</em> <tt>16</tt>]</dt>
+ /// <dd>The allowed concurrency among updates to values in the region
+ /// is guided by the <tt>concurrencyLevel</tt>, which is used as a hint
+ /// for internal sizing. The actual concurrency will vary.
+ /// Ideally, you should choose a value to accommodate as many
+ /// threads as will ever concurrently modify values in the region. Using a
+ /// significantly higher value than you need can waste space and time,
+ /// and a significantly lower value can lead to thread contention. But
+ /// overestimates and underestimates within an order of magnitude do
+ /// not usually have much noticeable impact. A value of one is
+ /// appropriate when it is known that only one thread will modify
+ /// and all others will only read.<br />
+ /// see <see cref="SetConcurrencyLevel" />,
+ /// <see cref="RegionAttributes.ConcurrencyLevel" /></dd>
+ ///
+ /// </dl>
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="RegionAttributes" />
+ /// <seealso cref="AttributesMutator" />
+ /// <seealso cref="Region.CreateSubRegion" />
+ generic<class TKey, class TValue>
+ public ref class AttributesFactory sealed
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new <c>AttributesFactory</c> ready to create
+ /// a <c>RegionAttributes</c> with default settings.
+ /// </summary>
+ inline AttributesFactory<TKey, TValue>( )
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>());
+ }
+
+ /// <summary>
+ /// Creates a new instance of <c>AttributesFactory</c> ready to create
+ /// a <c>RegionAttributes</c> with the same settings as those in the
+ /// specified <c>RegionAttributes</c>.
+ /// </summary>
+ /// <param name="regionAttributes">
+ /// attributes used to initialize this AttributesFactory
+ /// </param>
+ AttributesFactory<TKey, TValue>(RegionAttributes<TKey, TValue>^ regionAttributes);
+
+ // CALLBACKS
+
+ /// <summary>
+ /// Sets the cache loader for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheLoader">
+ /// a user-defined cache loader, or null for no cache loader
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+
+ /// <summary>
+ /// Sets the cache writer for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheWriter">
+ /// user-defined cache writer, or null for no cache writer
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+
+ /// <summary>
+ /// Sets the CacheListener for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="cacheListener">
+ /// user-defined cache listener, or null for no cache listener
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+
+ /// <summary>
+ /// Sets the PartitionResolver for the <c>RegionAttributes</c> being created.
+ /// </summary>
+ /// <param name="partitionresolver">
+ /// user-defined partition resolver, or null for no partition resolver
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the loader of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheLoader</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheLoader</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the writer of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheWriter</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheWriter</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the listener of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheListener</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheListener</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetCacheListener( String^ libPath, String^ factoryFunctionName );
+
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the partition resolver of the region.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>PartitionResolver</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>IPartitionResolver</c> for a managed library.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPartitionResolver( String^ libPath, String^ factoryFunctionName );
+
+
+ // EXPIRATION ATTRIBUTES
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for entries in this region.
+ /// </param>
+ void SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for region entries for the next
+ /// <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for entries in this region.
+ /// </param>
+ void SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive );
+
+ /// <summary>
+ /// Sets the idleTimeout expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for the region as a whole.
+ /// </param>
+ void SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout );
+
+ /// <summary>
+ /// Sets the timeToLive expiration attributes for the region itself for the
+ /// next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="action">
+ /// The expiration action for which to set the timeout.
+ /// </param>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for the region as a whole.
+ /// </param>
+ void SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive );
+
+
+ // PERSISTENCE
+
+ /// <summary>
+ /// Sets the PersistenceManager object that will be invoked for the persistence of the region.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// Persistence Manager object
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager);
+
+ /// <summary>
+ /// Sets the PersistenceManager object that will be invoked for the persistence of the region.
+ /// </summary>
+ /// <param name="persistenceManager">
+ /// Persistence Manager object
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ //generic<class TKey, class TValue>
+ void SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config);
+
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ void SetPersistenceManager( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the persistence of the region.
+ /// If the region is being created from a client on a server, or on a server directly, then
+ /// This must be used to set the PersistenceManager.
+ /// </summary>
+ /// <param name="libPath">The path of the PersistenceManager shared library.</param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function to create an instance of PersistenceManager object.
+ /// </param>
+ /// <param name="config">
+ /// The configuration properties to use for the PersistenceManager.
+ /// </param>
+ void SetPersistenceManager( String^ libPath, String^ factoryFunctionName,
+ /*Dictionary<Object^, Object^>*/Properties<String^, String^>^ config );
+
+
+ // STORAGE ATTRIBUTES
+
+ /// <summary>
+ /// Set the pool name for a Thin Client region.
+ /// </summary>
+ /// <remarks>
+ /// The pool with the name specified must be already created.
+ /// </remarks>
+ /// <param name="poolName">
+ /// The name of the pool to attach to this region.
+ /// </param>
+ void SetPoolName( String^ poolName );
+
+ // MAP ATTRIBUTES
+
+ /// <summary>
+ /// Sets the entry initial capacity for the <c>RegionAttributes</c>
+ /// being created. This value is used in initializing the map that
+ /// holds the entries.
+ /// </summary>
+ /// <param name="initialCapacity">the initial capacity of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if initialCapacity is nonpositive
+ /// </exception>
+ void SetInitialCapacity( System::Int32 initialCapacity );
+
+ /// <summary>
+ /// Sets the entry load factor for the next <c>RegionAttributes</c>
+ /// created. This value is
+ /// used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="loadFactor">the load factor of the entry map</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if loadFactor is nonpositive
+ /// </exception>
+ void SetLoadFactor( Single loadFactor );
+
+ /// <summary>
+ /// Sets the concurrency level of the next <c>RegionAttributes</c>
+ /// created. This value is used in initializing the map that holds the entries.
+ /// </summary>
+ /// <param name="concurrencyLevel">
+ /// the concurrency level of the entry map
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if concurrencyLevel is nonpositive
+ /// </exception>
+ void SetConcurrencyLevel( System::Int32 concurrencyLevel );
+
+ /// <summary>
+ /// Sets a limit on the number of entries that will be held in the cache.
+ /// If a new entry is added while at the limit, the cache will evict the
+ /// least recently used entry.
+ /// </summary>
+ /// <param name="entriesLimit">
+ /// The limit of the number of entries before eviction starts.
+ /// Defaults to 0, meaning no LRU actions will used.
+ /// </param>
+ void SetLruEntriesLimit( System::UInt32 entriesLimit );
+
+ /// <summary>
+ /// Sets the disk policy type for the next <c>RegionAttributes</c> created.
+ /// </summary>
+ /// <param name="diskPolicy">
+ /// the disk policy to use for the region
+ /// </param>
+ void SetDiskPolicy( DiskPolicyType diskPolicy );
+
+ /// <summary>
+ /// Set caching enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then no data is stored in the local process,
+ /// but events and distributions will still occur, and the region
+ /// can still be used to put and remove, etc...
+ /// </para><para>
+ /// The default if not set is 'true', 'false' is illegal for regions
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cachingEnabled">
+ /// if true, cache data for this region in this process.
+ /// </param>
+ void SetCachingEnabled( bool cachingEnabled );
+ /// <summary>
+ /// Set cloning enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then there is no cloning will take place in case of delta.
+ /// Delta will be applied on the old value which will change old value in-place.
+ /// </para><para>
+ /// The default if not set is 'false'
+ /// of <c>ScopeType.Local</c> scope.
+ /// </para>
+ /// </remarks>
+ /// <param name="cloningEnabled">
+ /// if true, clone old value before applying delta so that in-place change would not occour..
+ /// </param>
+ void SetCloningEnabled( bool cloningEnabled );
+
+ /// <summary>
+ /// Sets concurrency checks enabled flag for this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If set to false, then the version checks will not occur.
+ /// </para><para>
+ /// The default if not set is 'true'
+ /// </para>
+ /// </remarks>
+ /// <param name="concurrencyChecksEnabled">
+ /// if true, version checks for region entries will occur.
+ /// </param>
+ void SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled );
+ // FACTORY METHOD
+
+ /// <summary>
+ /// Creates a <c>RegionAttributes</c> with the current settings.
+ /// </summary>
+ /// <returns>the newly created <c>RegionAttributes</c></returns>
+ /// <exception cref="IllegalStateException">
+ /// if the current settings violate the
+ /// compatibility rules.
+ /// </exception>
+ RegionAttributes<TKey, TValue>^ CreateRegionAttributes( );
+
+ private:
+ native_unique_ptr<native::AttributesFactory>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/AttributesMutator.cpp b/clicache/src/AttributesMutator.cpp
new file mode 100644
index 0000000..9702ae3
--- /dev/null
+++ b/clicache/src/AttributesMutator.cpp
@@ -0,0 +1,251 @@
+/*
+ * 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.
+ */
+
+#include "AttributesMutator.hpp"
+
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TValue>
+ System::Int32 AttributesMutator<TKey, TValue>::SetEntryIdleTimeout( System::Int32 idleTimeout )
+ {
+ try
+ {
+ return m_nativeptr->get()->setEntryIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetEntryIdleTimeoutAction(
+ ExpirationAction action )
+ {
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setEntryIdleTimeoutAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ System::Int32 AttributesMutator<TKey, TValue>::SetEntryTimeToLive( System::Int32 timeToLive )
+ {
+ try
+ {
+ return m_nativeptr->get()->setEntryTimeToLive( timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetEntryTimeToLiveAction(
+ ExpirationAction action )
+ {
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setEntryTimeToLiveAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ System::Int32 AttributesMutator<TKey, TValue>::SetRegionIdleTimeout( System::Int32 idleTimeout )
+ {
+ try
+ {
+ return m_nativeptr->get()->setRegionIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetRegionIdleTimeoutAction(
+ ExpirationAction action )
+ {
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setRegionIdleTimeoutAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ System::Int32 AttributesMutator<TKey, TValue>::SetRegionTimeToLive( System::Int32 timeToLive )
+ {
+ try
+ {
+ return m_nativeptr->get()->setRegionTimeToLive( timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ ExpirationAction AttributesMutator<TKey, TValue>::SetRegionTimeToLiveAction(
+ ExpirationAction action )
+ {
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setRegionTimeToLiveAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ System::UInt32 AttributesMutator<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
+ {
+ try
+ {
+ return m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ native::CacheListenerPtr listenerptr;
+ if (cacheListener != nullptr)
+ {
+ auto clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>( new native::ManagedCacheListenerGeneric(cacheListener) );
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheListener( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ native::CacheLoaderPtr loaderptr;
+ if (cacheLoader != nullptr)
+ {
+ auto clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>( new native::ManagedCacheLoaderGeneric(cacheLoader) );
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheLoader( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ native::CacheWriterPtr writerptr;
+ if (cacheWriter != nullptr)
+ {
+ auto cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>( new native::ManagedCacheWriterGeneric(cacheWriter) );
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesMutator<TKey, TValue>::SetCacheWriter( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/AttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/AttributesMutator.hpp b/clicache/src/AttributesMutator.hpp
new file mode 100644
index 0000000..db0bd62
--- /dev/null
+++ b/clicache/src/AttributesMutator.hpp
@@ -0,0 +1,271 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/AttributesMutator.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "ExpirationAction.hpp"
+#include "ICacheListener.hpp"
+#include "ICacheLoader.hpp"
+#include "ICacheWriter.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Supports modification of certain region attributes after the region
+ /// has been created.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// It is required that the attributes be completely initialized using an
+ /// <see cref="AttributesFactory" /> before creating the region.
+ /// AttributesMutator can be applied to adjusting and tuning a subset of
+ /// attributes that are modifiable at runtime.
+ /// </para><para>
+ /// The setter methods all return the previous value of the attribute.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Region.AttributesMutator" />
+ /// <seealso cref="RegionAttributes" />
+ /// <seealso cref="AttributesFactory" />
+ generic<class TKey, class TValue>
+ public ref class AttributesMutator sealed
+ {
+ public:
+
+ /// <summary>
+ /// Sets the idleTimeout duration for region entries.
+ /// </summary>
+ /// <param name="idleTimeout">
+ /// the idleTimeout in seconds for entries in this region, or 0 for no idle timeout
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new idleTimeout changes entry expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ System::Int32 SetEntryIdleTimeout( System::Int32 idleTimeout );
+
+ /// <summary>
+ /// Sets the idleTimeout action for region entries.
+ /// </summary>
+ /// <param name="action">
+ /// the idleTimeout action for entries in this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetEntryIdleTimeoutAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the timeToLive duration for region entries.
+ /// </summary>
+ /// <param name="timeToLive">
+ /// the timeToLive in seconds for entries in this region, or 0 to disable time-to-live
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new timeToLive changes entry expiration from
+ /// disabled to enabled or enabled to disabled
+ /// </exception>
+ System::Int32 SetEntryTimeToLive( System::Int32 timeToLive );
+
+ /// <summary>
+ /// Set the timeToLive action for region entries.
+ /// </summary>
+ /// <param name="action">
+ /// the timeToLive action for entries in this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetEntryTimeToLiveAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the idleTimeout duration for the region itself.
+ /// </summary>
+ /// <param name="idleTimeout">
+ /// the idleTimeout for this region, in seconds, or 0 to disable idle timeout
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new idleTimeout changes region expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ System::Int32 SetRegionIdleTimeout( System::Int32 idleTimeout );
+
+ /// <summary>
+ /// Sets the idleTimeout action for the region itself.
+ /// </summary>
+ /// <param name="action">
+ /// the idleTimeout action for this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetRegionIdleTimeoutAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the timeToLive duration for the region itself.
+ /// </summary>
+ /// <param name="timeToLive">
+ /// the timeToLive for this region, in seconds, or 0 to disable time-to-live
+ /// </param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new timeToLive changes region expiration from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ System::Int32 SetRegionTimeToLive( System::Int32 timeToLive );
+
+ /// <summary>
+ /// Sets the timeToLive action for the region itself.
+ /// </summary>
+ /// <param name="action">
+ /// the timeToLiv eaction for this region
+ /// </param>
+ /// <returns>the previous action</returns>
+ ExpirationAction SetRegionTimeToLiveAction( ExpirationAction action );
+
+ /// <summary>
+ /// Sets the maximum entry count in the region before LRU eviction.
+ /// </summary>
+ /// <param name="entriesLimit">the number of entries to allow, or 0 to disable LRU</param>
+ /// <returns>the previous value</returns>
+ /// <exception cref="IllegalStateException">
+ /// if the new entriesLimit changes LRU from
+ /// disabled to enabled or enabled to disabled.
+ /// </exception>
+ System::UInt32 SetLruEntriesLimit( System::UInt32 entriesLimit );
+
+ /// <summary>
+ /// Sets the CacheListener for the region.
+ /// The previous cache listener (if any) will be replaced with the given <c>cacheListener</c>.
+ /// </summary>
+ /// <param name="cacheListener">
+ /// user-defined cache listener, or null for no cache listener
+ /// </param>
+ void SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the listener of the region.
+ /// The previous cache listener will be replaced with a listener created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheListener</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheListener</c> for a managed library.
+ /// </param>
+ void SetCacheListener( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the CacheLoader for the region.
+ /// The previous cache loader (if any) will be replaced with the given <c>cacheLoader</c>.
+ /// </summary>
+ /// <param name="cacheLoader">
+ /// user-defined cache loader, or null for no cache loader
+ /// </param>
+ void SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the loader of the region.
+ /// The previous cache loader will be replaced with a loader created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheLoader</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheLoader</c> for a managed library.
+ /// </param>
+ void SetCacheLoader( String^ libPath, String^ factoryFunctionName );
+
+ /// <summary>
+ /// Sets the CacheListener for the region.
+ /// The previous cache writer (if any) will be replaced with the given <c>cacheWriter</c>.
+ /// </summary>
+ /// <param name="cacheWriter">
+ /// user-defined cache writer, or null for no cache writer
+ /// </param>
+ void SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter );
+
+ /// <summary>
+ /// Sets the library path for the library that will be invoked for the writer of the region.
+ /// The previous cache writer will be replaced with a writer created
+ /// using the factory function provided in the given library.
+ /// </summary>
+ /// <param name="libPath">
+ /// library pathname containing the factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// Name of factory function that creates a <c>CacheWriter</c>
+ /// for a native library, or the name of the method in the form
+ /// {Namespace}.{Class Name}.{Method Name} that creates an
+ /// <c>ICacheWriter</c> for a managed library.
+ /// </param>
+ void SetCacheWriter( String^ libPath, String^ factoryFunctionName );
+
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static AttributesMutator<TKey, TValue>^ Create( native::AttributesMutatorPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew AttributesMutator<TKey, TValue>( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline AttributesMutator<TKey, TValue>( native::AttributesMutatorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::AttributesMutator>(nativeptr);
+ }
+
+ native_shared_ptr<native::AttributesMutator>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/clicache/src/CMakeLists.txt b/clicache/src/CMakeLists.txt
new file mode 100644
index 0000000..80b0c1c
--- /dev/null
+++ b/clicache/src/CMakeLists.txt
@@ -0,0 +1,73 @@
+# 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.
+cmake_minimum_required(VERSION 3.4)
+project(clicache)
+
+file(GLOB_RECURSE SOURCES "*.cpp")
+
+file(GLOB_RECURSE PRIVATE_HEADERS "*.hpp")
+set_source_files_properties(${PRIVATE_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
+
+set(RESOURCES Apache.Geode.rc)
+
+if(NOT "${STRONG_NAME_PUBLIC_KEY}" STREQUAL "")
+ set(STRONG_NAME_PUBLIC_KEY_ATTRIBUTE ", PublicKey=${STRONG_NAME_PUBLIC_KEY}")
+endif()
+list(APPEND CONFIGURE_IN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/impl/AssemblyInfo.cpp.in)
+list(APPEND CONFIGURE_OUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/impl/AssemblyInfo.cpp)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/impl/AssemblyInfo.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/impl/AssemblyInfo.cpp)
+
+#set_source_files_properties(${CONFIGURE_IN_FILES} PROPERTIES LANGUAGE NONE)
+set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
+
+add_library(Apache.Geode SHARED
+ ${SOURCES}
+ ${PRIVATE_HEADERS} ${CONFIGURE_IN_FILES} ${CONFIGURE_OUT_FILES} ${RESOURCES})
+add_dependencies(client-libraries Apache.Geode)
+
+#TODO get external project library names
+target_link_libraries(Apache.Geode
+ PRIVATE
+ apache-geode-static
+ psapi
+ PUBLIC
+ c++11
+)
+
+string(REPLACE "/EHsc" "/EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr /wd4947 /doc")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SHARED_LINKER_FLAGS_STRONG_KEY}")
+
+include_directories(${CMAKE_SOURCE_DIR}/clicache/include)
+include_directories(${CMAKE_SOURCE_DIR}/clicache/src)
+include_directories(${CMAKE_SOURCE_DIR}/cppcache/src)
+
+set_target_properties(Apache.Geode PROPERTIES
+ OUTPUT_NAME ${PRODUCT_DLL_NAME}
+ VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
+ VS_DOTNET_REFERENCES "System;System.Xml")
+
+add_subdirectory(templates)
+
+install(TARGETS Apache.Geode
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+)
+
+# For Visual Studio organization
+source_group("Header Files" REGULAR_EXPRESSION "\.(hpp|inl)$")
+source_group("Configure In Files" FILES ${CONFIGURE_IN_FILES})
+source_group("Configure Out Files" FILES ${CONFIGURE_OUT_FILES})
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Cache.cpp b/clicache/src/Cache.cpp
new file mode 100644
index 0000000..7438e84
--- /dev/null
+++ b/clicache/src/Cache.cpp
@@ -0,0 +1,382 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+#include "ExceptionTypes.hpp"
+#include "DistributedSystem.hpp"
+#include "PoolFactory.hpp"
+#include "Region.hpp"
+#include "RegionAttributes.hpp"
+#include "QueryService.hpp"
+#include "CacheFactory.hpp"
+#include "impl/AuthenticatedCache.hpp"
+#include "impl/ManagedString.hpp"
+#include "impl/SafeConvert.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+#include "impl/PdxInstanceFactoryImpl.hpp"
+
+#pragma warning(disable:4091)
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ String^ Cache::Name::get( )
+ {
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ).c_str() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ bool Cache::IsClosed::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isClosed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ DistributedSystem^ Cache::DistributedSystem::get( )
+ {
+ try
+ {
+ return Client::DistributedSystem::Create(&(m_nativeptr->get()->getDistributedSystem()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ CacheTransactionManager^ Cache::CacheTransactionManager::get( )
+ {
+ // TODO shared_ptr this should be checking the return type for which tx mgr
+ try
+ {
+ auto nativeptr = std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
+ m_nativeptr->get()->getCacheTransactionManager());
+ return Apache::Geode::Client::CacheTransactionManager::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void Cache::Close( )
+ {
+ Close( false );
+ }
+
+ void Cache::Close( bool keepalive )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ Apache::Geode::Client::DistributedSystem::acquireDisconnectLock();
+
+ Apache::Geode::Client::DistributedSystem::disconnectInstance();
+ CacheFactory::m_connected = false;
+
+ try
+ {
+ m_nativeptr->get()->close( keepalive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ // If DS automatically disconnected due to the new bootstrap API, then cleanup the C++/CLI side
+ //if (!apache::geode::client::DistributedSystem::isConnected())
+ {
+ Apache::Geode::Client::DistributedSystem::UnregisterBuiltinManagedTypes(this);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ finally
+ {
+ CacheRegionHelper::getCacheImpl(m_nativeptr->get())->getPdxTypeRegistry()->clear();
+ Serializable::Clear();
+ Apache::Geode::Client::DistributedSystem::releaseDisconnectLock();
+ Apache::Geode::Client::DistributedSystem::unregisterCliCallback();
+ }
+ }
+
+ void Cache::ReadyForEvents( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->readyForEvents( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ Client::IRegion<TKey,TValue>^ Cache::GetRegion( String^ path )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ ManagedString mg_path( path );
+ try
+ {
+ return Client::Region<TKey, TValue>::Create(m_nativeptr->get()->getRegion(mg_path.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ array<Client::IRegion<TKey, TValue>^>^ Cache::RootRegions( )
+ {
+ apache::geode::client::VectorOfRegion vrr;
+ try
+ {
+ m_nativeptr->get()->rootRegions( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ array<Client::IRegion<TKey, TValue>^>^ rootRegions =
+ gcnew array<Client::IRegion<TKey, TValue>^>( vrr.size( ) );
+
+ for( System::Int32 index = 0; index < vrr.size( ); index++ )
+ {
+ apache::geode::client::RegionPtr& nativeptr( vrr[ index ] );
+ rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr );
+ }
+ return rootRegions;
+ }
+
+ generic<class TKey, class TResult>
+ Client::QueryService<TKey, TResult>^ Cache::GetQueryService( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return Client::QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TResult>
+ Client::QueryService<TKey, TResult>^ Cache::GetQueryService(String^ poolName )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_poolName( poolName );
+ try
+ {
+ return QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService(mg_poolName.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ RegionFactory^ Cache::CreateRegionFactory(RegionShortcut preDefinedRegionAttributes)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ apache::geode::client::RegionShortcut preDefineRegionAttr = apache::geode::client::CACHING_PROXY;
+
+ switch(preDefinedRegionAttributes)
+ {
+ case RegionShortcut::PROXY:
+ preDefineRegionAttr = apache::geode::client::PROXY;
+ break;
+ case RegionShortcut::CACHING_PROXY:
+ preDefineRegionAttr = apache::geode::client::CACHING_PROXY;
+ break;
+ case RegionShortcut::CACHING_PROXY_ENTRY_LRU:
+ preDefineRegionAttr = apache::geode::client::CACHING_PROXY_ENTRY_LRU;
+ break;
+ case RegionShortcut::LOCAL:
+ preDefineRegionAttr = apache::geode::client::LOCAL;
+ break;
+ case RegionShortcut::LOCAL_ENTRY_LRU:
+ preDefineRegionAttr = apache::geode::client::LOCAL_ENTRY_LRU;
+ break;
+ }
+
+ try
+ {
+ return RegionFactory::Create(m_nativeptr->get()->createRegionFactory(preDefineRegionAttr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return AuthenticatedCache::Create((m_nativeptr->get()->createAuthenticatedView(credentials->GetNative())));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool Cache::GetPdxIgnoreUnreadFields()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->getPdxIgnoreUnreadFields();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool Cache::GetPdxReadSerialized()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->getPdxReadSerialized();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials, String^ poolName)
+ {
+ ManagedString mg_poolName( poolName );
+
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return AuthenticatedCache::Create( (m_nativeptr->get()->createAuthenticatedView(credentials->GetNative(), mg_poolName.CharPtr)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Cache::InitializeDeclarativeCache( String^ cacheXml )
+ {
+ ManagedString mg_cacheXml( cacheXml );
+ try
+ {
+ m_nativeptr->get()->initializeDeclarativeCache( mg_cacheXml.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ IPdxInstanceFactory^ Cache::CreatePdxInstanceFactory(String^ className)
+ {
+
+ return gcnew Internal::PdxInstanceFactoryImpl(className, (m_nativeptr->get()));
+
+ }
+
+ DataInput^ Cache::CreateDataInput(array<Byte>^ buffer, System::Int32 len)
+ {
+ return gcnew DataInput(buffer, len, m_nativeptr->get());
+ }
+
+
+ DataInput^ Cache::CreateDataInput(array<Byte>^ buffer)
+ {
+ return gcnew DataInput(buffer, m_nativeptr->get());
+ }
+
+ DataOutput^ Cache::CreateDataOutput()
+ {
+ return gcnew DataOutput( m_nativeptr->get());
+ }
+
+ PoolFactory^ Cache::GetPoolFactory()
+ {
+ return PoolFactory::Create(m_nativeptr->get_shared_ptr()->getPoolManager().createFactory());
+ }
+
+ PoolManager^ Cache::GetPoolManager()
+ {
+ return gcnew PoolManager(m_nativeptr->get_shared_ptr()->getPoolManager());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Cache.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Cache.hpp b/clicache/src/Cache.hpp
new file mode 100644
index 0000000..666e562
--- /dev/null
+++ b/clicache/src/Cache.hpp
@@ -0,0 +1,302 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "RegionShortcut.hpp"
+#include "IGeodeCache.hpp"
+#include "IRegion.hpp"
+#include "RegionAttributes.hpp"
+#include "PoolManager.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TResult>
+ ref class QueryService;
+
+ ref class RegionFactory;
+ enum class ExpirationAction;
+ ref class DistributedSystem;
+ ref class CacheTransactionManager2PC;
+ //ref class FunctionService;
+
+ /// <summary>
+ /// Provides a distributed cache.
+ /// </summary>
+ /// <remarks>
+ /// Caches are obtained from Create methods on the
+ /// <see cref="CacheFactory.Create"/> class.
+ /// <para>
+ /// When a cache will no longer be used, call <see cref="Cache.Close" />.
+ /// Once it <see cref="Cache.IsClosed" /> any attempt to use it
+ /// will cause a <c>CacheClosedException</c> to be thrown.
+ /// </para><para>
+ /// A cache can have multiple root regions, each with a different name.
+ /// </para>
+ /// </remarks>
+ public ref class Cache sealed
+ : public IGeodeCache
+ {
+ public:
+
+ /// <summary>
+ /// Initializes the cache from an XML file.
+ /// </summary>
+ /// <param name="cacheXml">pathname of a <c>cache.xml</c> file</param>
+ virtual void InitializeDeclarativeCache(String^ cacheXml);
+
+ /// <summary>
+ /// Returns the name of this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ /// <returns>the string name of this cache</returns>
+ virtual property String^ Name
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if this cache has been closed.
+ /// </summary>
+ /// <remarks>
+ /// After a new cache object is created, this method returns false.
+ /// After <see cref="Close" /> is called on this cache object, this method
+ /// returns true.
+ /// </remarks>
+ /// <returns>true if this cache is closed, otherwise false</returns>
+ virtual property bool IsClosed
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the distributed system used to
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ /// <remarks>
+ /// This method does not throw
+ /// <c>CacheClosedException</c> if the cache is closed.
+ /// </remarks>
+ virtual property Apache::Geode::Client::DistributedSystem^ DistributedSystem
+ {
+ Apache::Geode::Client::DistributedSystem^ get();
+ }
+
+ /// <summary>
+ /// Returns the cache transaction manager of
+ /// <see cref="CacheFactory.Create" /> this cache.
+ /// </summary>
+ virtual property Apache::Geode::Client::CacheTransactionManager^ CacheTransactionManager
+ {
+ Apache::Geode::Client::CacheTransactionManager^ get();
+ }
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ virtual void Close();
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <param name="keepalive">whether to keep a durable client's queue alive</param>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ virtual void Close(bool keepalive);
+
+ /// <summary>
+ /// Send the client-ready message to the server for a durable client.
+ /// </summary>
+ /// <remarks>
+ /// This method should only be called for durable clients and
+ /// with a cache server version 5.5 onwards.
+ /// </remarks>
+ /// <exception cref="IllegalStateException">
+ /// if there was a problem sending the message to the server.
+ /// </exception>
+ virtual void ReadyForEvents();
+
+ /// <summary>
+ /// Returns an existing region given the full path from root, or null
+ /// if no such region exists.
+ /// </summary>
+ /// <remarks>
+ /// If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance.
+ /// Get region from RegionService instance of Cache.<see cref="Cache.CreateAuthenticatedView(PropertiesPtr)" />.
+ /// </remarks>
+ /// <param name="path">the pathname of the region</param>
+ /// <returns>the region</returns>
+ generic<class TKey, class TValue>
+ virtual IRegion<TKey, TValue>^ GetRegion(String^ path);
+
+ /// <summary>
+ /// Returns an array of root regions in the cache. This set is a
+ /// snapshot and is not backed by the cache.
+ /// </summary>
+ /// <remarks>
+ /// It is not supported when Cache is created from Pool.
+ /// </remarks>
+ /// <returns>array of regions</returns>
+ generic<class TKey, class TValue>
+ virtual array<IRegion<TKey, TValue>^>^ RootRegions();
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// Supported only when cache is created from Pool(pool is in multiuserSecure mode)
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ virtual Client::QueryService<TKey, TResult>^ GetQueryService();
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// Use only when Cache has more than one Pool.
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ virtual Client::QueryService<TKey, TResult>^ GetQueryService(String^ poolName);
+
+ /// <summary>
+ /// Returns the instance of <see cref="RegionFactory" /> to create the region
+ /// </summary>
+ /// <remarks>
+ /// Pass the <see cref="RegionShortcut" /> to set the deafult region attributes
+ /// </remarks>
+ /// <param name="regionShortcut">the regionShortcut to set the default region attributes</param>
+ /// <returns>Instance of RegionFactory</returns>
+ RegionFactory^ CreateRegionFactory(RegionShortcut regionShortcut);
+
+ /// <summary>
+ /// Returns the instance of <see cref="IRegionService" /> to do the operation on Cache with different Credential.
+ /// </summary>
+ /// <remarks>
+ /// Deafault pool should be in multiuser mode <see cref="CacheFactory.SetMultiuserAuthentication" />
+ /// </remarks>
+ /// <param name="credentials">the user Credentials.</param>
+ /// <returns>Instance of IRegionService</returns>
+ IRegionService^ CreateAuthenticatedView(Properties<String^, Object^>^ credentials);
+
+ /// <summary>
+ /// Returns the instance of <see cref="IRegionService" /> to do the operation on Cache with different Credential.
+ /// </summary>
+ /// <remarks>
+ /// Deafault pool should be in multiuser mode <see cref="CacheFactory.SetMultiuserAuthentication" />
+ /// </remarks>
+ /// <param name="credentials">the user Credentials.</param>
+ /// <param name="poolName">Pool, which is in multiuser mode.</param>
+ /// <returns>Instance of IRegionService</returns>
+ IRegionService^ CreateAuthenticatedView(Properties<String^, Object^>^ credentials, String^ poolName);
+
+ ///<summary>
+ /// Returns whether Cache saves unread fields for Pdx types.
+ ///</summary>
+ virtual bool GetPdxIgnoreUnreadFields();
+
+ ///<summary>
+ /// Returns whether { @link PdxInstance} is preferred for PDX types instead of .NET object.
+ ///</summary>
+ virtual bool GetPdxReadSerialized();
+
+ /// <summary>
+ /// Returns a factory that can create a {@link PdxInstance}.
+ /// @param className the fully qualified class name that the PdxInstance will become
+ /// when it is fully deserialized.
+ /// @return the factory
+ /// </summary>
+ virtual IPdxInstanceFactory^ CreatePdxInstanceFactory(String^ className);
+
+ virtual DataInput^ CreateDataInput(array<Byte>^ buffer, System::Int32 len);
+ virtual DataInput^ CreateDataInput(array<Byte>^ buffer);
+
+ virtual DataOutput^ Cache::CreateDataOutput();
+
+ virtual PoolFactory^ GetPoolFactory();
+
+ virtual PoolManager^ GetPoolManager();
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Cache^ Create(native::CachePtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Cache( nativeptr );
+ }
+
+ std::shared_ptr<native::Cache> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Cache(native::CachePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Cache>(nativeptr);
+ }
+
+ native_shared_ptr<native::Cache>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheFactory.cpp b/clicache/src/CacheFactory.cpp
new file mode 100644
index 0000000..2071b20
--- /dev/null
+++ b/clicache/src/CacheFactory.cpp
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+
+#include "ExceptionTypes.hpp"
+
+#include "CacheFactory.hpp"
+#include "Cache.hpp"
+#include "DistributedSystem.hpp"
+#include "SystemProperties.hpp"
+#include "impl/SafeConvert.hpp"
+#include "impl/PdxTypeRegistry.hpp"
+//#pragma warning(disable:4091)
+//#include <msclr/lock.h>
+//#pragma warning(disable:4091)
+#include "impl/AppDomainContext.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ CacheFactory^ CacheFactory::CreateCacheFactory()
+ {
+ return CacheFactory::CreateCacheFactory(Properties<String^, String^>::Create<String^, String^>());
+ }
+
+ CacheFactory^ CacheFactory::CreateCacheFactory(Properties<String^, String^>^ dsProps)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ auto nativeCacheFactory = native::CacheFactory::createCacheFactory(dsProps->GetNative());
+ if (nativeCacheFactory)
+ return gcnew CacheFactory( nativeCacheFactory, dsProps );
+
+ return nullptr;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Cache^ CacheFactory::Create()
+ {
+ bool pdxIgnoreUnreadFields = false;
+ bool pdxReadSerialized = false;
+ bool appDomainEnable = false;
+ native::CachePtr nativeCache = nullptr;
+ _GF_MG_EXCEPTION_TRY2
+ //msclr::lock lockInstance(m_singletonSync);
+ DistributedSystem::acquireDisconnectLock();
+
+ nativeCache = m_nativeptr->get()->create( );
+
+ auto cache = Cache::Create( nativeCache );
+ // TODO global create SerializerRegistry
+ if(!m_connected)
+ {
+ DistributedSystem::AppDomainInstanceInitialization(cache);
+ }
+
+
+ pdxIgnoreUnreadFields = nativeCache->getPdxIgnoreUnreadFields();
+ pdxReadSerialized = nativeCache->getPdxReadSerialized();
+
+ appDomainEnable = cache->DistributedSystem->SystemProperties->AppDomainEnabled;
+ Log::SetLogLevel(static_cast<LogLevel>(native::Log::logLevel( )));
+ //TODO::split
+ SafeConvertClassGeneric::SetAppDomainEnabled(appDomainEnable);
+
+ if (appDomainEnable)
+ {
+ // Register managed AppDomain context with unmanaged.
+ native::createAppDomainContext = &Apache::Geode::Client::createAppDomainContext;
+ }
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::PdxType,
+ gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Internal::PdxType::CreateDeserializable),
+ nullptr, cache);
+
+ if(!m_connected)
+ {
+ //it registers types in unmanage layer, so should be once only
+ DistributedSystem::ManagedPostConnect(cache);
+ DistributedSystem::AppDomainInstancePostInitialization();
+ DistributedSystem::connectInstance();
+ }
+
+ m_connected = true;
+
+
+
+ DistributedSystem::registerCliCallback();
+ Serializable::RegisterPDXManagedCacheableKey(appDomainEnable, cache);
+
+ return cache;
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ finally {
+ GC::KeepAlive(m_nativeptr);
+ Apache::Geode::Client::Internal::PdxTypeRegistry::PdxIgnoreUnreadFields = pdxIgnoreUnreadFields;
+ Apache::Geode::Client::Internal::PdxTypeRegistry::PdxReadSerialized = pdxReadSerialized;
+ DistributedSystem::releaseDisconnectLock();
+ }
+ }
+
+
+ String^ CacheFactory::Version::get( )
+ {
+ return ManagedString::Get( native::CacheFactory::getVersion( ) );
+ }
+
+ String^ CacheFactory::ProductDescription::get( )
+ {
+ return ManagedString::Get(
+ native::CacheFactory::getProductDescription( ) );
+ }
+
+
+ CacheFactory^ CacheFactory::SetPdxIgnoreUnreadFields(bool ignore)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setPdxIgnoreUnreadFields( ignore );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::SetPdxReadSerialized(bool pdxReadSerialized)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->setPdxReadSerialized( pdxReadSerialized );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ CacheFactory^ CacheFactory::Set(String^ name, String^ value)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ ManagedString mg_name( name );
+ ManagedString mg_value( value );
+ try
+ {
+ m_nativeptr->get()->set( mg_name.CharPtr, mg_value.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return this;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheFactory.hpp b/clicache/src/CacheFactory.hpp
new file mode 100644
index 0000000..fb9f8ba
--- /dev/null
+++ b/clicache/src/CacheFactory.hpp
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheFactory.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "Properties.hpp"
+
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ ref class Cache;
+ ref class CacheAttributes;
+ ref class DistributedSystem;
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// </summary>
+ /// <remarks>
+ /// To create a new cache instance, use <see cref="CacheFactory.CreateCacheFactory" />.
+ /// <para>
+ /// To get an existing unclosed cache instance, use <see cref="CacheFactory.GetInstance" />.
+ /// </para>
+ /// </remarks>
+ public ref class CacheFactory
+ {
+ public:
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// This should be called once. Using this one can set default values of <see cref="Pool" />.
+ /// </summary>
+ /// <param name="dsProps">Properties which are applicable at client level.</param>
+ // static CacheFactory^ CreateCacheFactory(Dictionary<Object^, Object^>^ dsProps);
+ static CacheFactory^ CreateCacheFactory(Properties<String^, String^>^ dsProps);
+
+ /// <summary>
+ /// A factory class that must be used to obtain instance of <see cref="Cache" />.
+ /// This should be called once. Using this one can set default values of <see cref="Pool" />.
+ /// </summary>
+ static CacheFactory^ CreateCacheFactory();
+
+ /// <summary>
+ /// To create the instance of <see cref="Cache" />.
+ /// </summary>
+ Cache^ Create();
+
+ /// <summary>
+ /// Set allocators for non default Microsoft CRT versions.
+ /// </summary>
+ /* static void SetNewAndDelete()
+ {
+ native::setNewAndDelete(&operator new, &operator delete);
+ }
+*/
+ /// <summary>
+ /// Returns the version of the cache implementation.
+ /// For the 1.0 release of Geode, the string returned is <c>1.0</c>.
+ /// </summary>
+ /// <returns>the version of the cache implementation as a <c>String</c></returns>
+ static property String^ Version
+ {
+ static String^ get();
+ }
+
+ /// <summary>
+ /// Returns the product description string including product name and version.
+ /// </summary>
+ static property String^ ProductDescription
+ {
+ static String^ get();
+ }
+
+ ///<summary>
+ /// Control whether pdx ignores fields that were unread during deserialization.
+ /// The default is to preserve unread fields be including their data during serialization.
+ /// But if you configure the cache to ignore unread fields then their data will be lost
+ /// during serialization.
+ /// <P>You should only set this attribute to <code>true</code> if you know this member
+ /// will only be reading cache data. In this use case you do not need to pay the cost
+ /// of preserving the unread fields since you will never be reserializing pdx data.
+ ///<summary>
+ /// <param> ignore <code>true</code> if fields not read during pdx deserialization should be ignored;
+ /// <code>false</code>, the default, if they should be preserved.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPdxIgnoreUnreadFields(bool ignore);
+
+ ///<summary>
+ /// Sets the object preference to PdxInstance type.
+ /// When a cached object that was serialized as a PDX is read
+ /// from the cache a {@link PdxInstance} will be returned instead of the actual domain class.
+ /// The PdxInstance is an interface that provides run time access to
+ /// the fields of a PDX without deserializing the entire PDX.
+ /// The PdxInstance implementation is a light weight wrapper
+ /// that simply refers to the raw bytes of the PDX that are kept
+ /// in the cache. Using this method applications can choose to
+ /// access PdxInstance instead of Java object.
+ /// Note that a PdxInstance is only returned if a serialized PDX is found in the cache.
+ /// If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance.
+ ///</summary>
+ /// <param> pdxReadSerialized <code>true</code> to prefer PdxInstance
+ /// <code>false</code>, the default, if they should be preserved.
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ SetPdxReadSerialized(bool pdxReadSerialized);
+
+
+ /// <summary>
+ /// Sets a geode property that will be used when creating the ClientCache.
+ /// </summary>
+ /// <param>
+ /// name the name of the geode property
+ /// </param>
+ /// <param>
+ /// value the value of the geode property
+ /// </param>
+ /// <returns>
+ /// a instance of <c>CacheFactory</c>
+ /// </returns>
+ CacheFactory^ Set(String^ name, String^ value);
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheFactory(native::CacheFactoryPtr nativeptr, Properties<String^, String^>^ dsProps)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CacheFactory>(nativeptr);
+ m_dsProps = dsProps;
+ }
+
+ Properties<String^, String^>^ m_dsProps;
+
+ static System::Object^ m_singletonSync = gcnew System::Object();
+
+ native_shared_ptr<native::CacheFactory>^ m_nativeptr;
+
+ internal:
+ static bool m_connected = false;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheListenerAdapter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheListenerAdapter.hpp b/clicache/src/CacheListenerAdapter.hpp
new file mode 100644
index 0000000..aaf3212
--- /dev/null
+++ b/clicache/src/CacheListenerAdapter.hpp
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ICacheListener.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ICacheListener</c>
+ /// with empty implementations. Applications can subclass this class
+ /// and only override the methods for the events of interest.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class CacheListenerAdapter
+ : public ICacheListener<TKey, TValue>
+ {
+ public:
+ virtual void AfterCreate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterUpdate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterInvalidate(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterDestroy(EntryEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionInvalidate(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionDestroy(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionLive(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void AfterRegionClear(RegionEvent<TKey, TValue>^ ev)
+ {
+ }
+
+ virtual void Close(Apache::Geode::Client::IRegion<TKey, TValue>^ region)
+ {
+ }
+ virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<TKey, TValue>^ region)
+ {
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheStatistics.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheStatistics.cpp b/clicache/src/CacheStatistics.cpp
new file mode 100644
index 0000000..4259246
--- /dev/null
+++ b/clicache/src/CacheStatistics.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#include "CacheStatistics.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ using namespace System;
+
+ System::UInt32 CacheStatistics::LastModifiedTime::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->getLastModifiedTime( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::UInt32 CacheStatistics::LastAccessedTime::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->getLastAccessedTime();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[17/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxReader.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxReader.hpp b/clicache/src/IPdxReader.hpp
new file mode 100644
index 0000000..cccb840
--- /dev/null
+++ b/clicache/src/IPdxReader.hpp
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IRegion.hpp"
+#include "IPdxUnreadFields.hpp"
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A IPdxReader will be passed to IPdxSerializable.fromData or
+ /// during deserialization of a PDX. The domain class needs to deserialize field members
+ /// using this interface. This interface is implemented by Native Client.
+ /// Each readXXX call will return the field's value. If the serialized
+ /// PDX does not contain the named field then a default value will
+ /// be returned. Standard Java defaults are used. For Objects this is
+ /// null and for primitives it is 0 or 0.0.
+ /// </summary>
+ public interface class IPdxReader
+ {
+ public:
+
+ /// <summary>
+ /// Read a signed byte from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ SByte ReadByte( String^ fieldName );
+
+ /// <summary>
+ /// Read a boolean value from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ Boolean ReadBoolean( String^ fieldName );
+
+ /// <summary>
+ /// Read a char value from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ Char ReadChar( String^ fieldName );
+
+ /// <summary>
+ /// Read a 16-bit integer from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ short ReadShort( String^ fieldName );
+
+ /// <summary>
+ /// Read a 32-bit integer from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ Int32 ReadInt( String^ fieldName );
+
+ /// <summary>
+ /// Read a 64-bit integer from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ Int64 ReadLong( String^ fieldName );
+
+ /// <summary>
+ /// Read a floating point number from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ float ReadFloat( String^ fieldName );
+
+ /// <summary>
+ /// Read a double precision number from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ double ReadDouble( String^ fieldName );
+
+ /// <summary>
+ /// Read a string after java-modified UTF-8 decoding from the stream.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ String^ ReadString( String^ fieldName );
+
+ /// <summary>
+ /// Read a serializable object from the data. Null objects are handled.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ Object^ ReadObject( String^ fieldName );
+
+ //TODO:
+ //void WriteMap( String^ fieldName, System::Collections::IDictionary^ map );
+
+ /// <summary>
+ /// Read a Date from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ System::DateTime ReadDate( String^ fieldName) ;
+ //void writeFile(String fieldName, File file) ;
+
+ /// <summary>
+ /// Read a boolean array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<Boolean>^ ReadBooleanArray( String^ fieldName );
+
+ /// <summary>
+ /// Read a char array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<Char>^ ReadCharArray(String^ fieldName );
+
+ /// <summary>
+ /// Read a signed byte array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<Byte>^ ReadByteArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a short from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<short>^ ReadShortArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a int array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<System::Int32>^ ReadIntArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a long array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<Int64>^ ReadLongArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a float from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<float>^ ReadFloatArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a double array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<double>^ ReadDoubleArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a string array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<String^>^ ReadStringArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a object array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ List<Object^>^ ReadObjectArray(String^ fieldName);
+
+ /// <summary>
+ /// Read a two-dimenesional signed byte array from the data.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field whose value to read.</param>
+ array<array<Byte>^>^ ReadArrayOfByteArrays(String^ fieldName );
+
+ //TODO:
+ //void WriteEnum(String^ fieldName, Enum e) ;
+ //void WriteInetAddress(String^ fieldName, InetAddress address);
+
+ /// <summary>
+ /// Whether field is available or not.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field.</param>
+ bool HasField(String^ fieldName);
+
+ /// <summary>
+ /// Whether field is used as identity field or not.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field.</param>
+ bool IsIdentityField(String^ fieldName);
+
+ /// <summary>
+ /// To preserve unread data, which get added in new version of type.
+ /// </summary>
+ /// <return>Unread data.</return>
+ IPdxUnreadFields^ ReadUnreadFields();
+
+ /// <summary>
+ /// Reads the named field of Type "type" and returns its value.
+ /// </summary>
+ /// <param name="fieldName">The name of a member field.</param>
+ /// <param name="type">The type of a member field, which value needs to read.</param>
+ Object^ ReadField(String^ fieldName, Type^ type);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxSerializable.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxSerializable.hpp b/clicache/src/IPdxSerializable.hpp
new file mode 100644
index 0000000..9c8865a
--- /dev/null
+++ b/clicache/src/IPdxSerializable.hpp
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IPdxWriter.hpp"
+#include "IPdxReader.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// When a domain class implements PdxSerializable it marks
+ /// itself as a PDX.
+ /// The implementation of toData provides the serialization
+ /// code and fromData provides the deserialization code.
+ /// These methods also define each field name and field type
+ /// of the PDX. Domain classes should serialize and de-serialize
+ /// all its member fields in same order in toData and fromData
+ /// method.
+ /// A domain class which implements this interface should register delgate <see cref="Serializable.RegisterPdxType" /> to create new
+ /// instance of type for de-serilization.
+ /// </summary>
+ public interface class IPdxSerializable
+ {
+ public:
+
+ /// <summary>
+ /// Serializes this object in geode PDX format.
+ /// </summary>
+ /// <param name="writer">
+ /// the IPdxWriter object to use for serializing the object
+ /// </param>
+ void ToData(IPdxWriter^ writer);
+
+ /// <summary>
+ /// Deserialize this object.
+ /// </summary>
+ /// <param name="reader">
+ /// the IPdxReader stream to use for reading the object data
+ /// </param>
+ void FromData(IPdxReader^ reader);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxSerializer.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxSerializer.hpp b/clicache/src/IPdxSerializer.hpp
new file mode 100755
index 0000000..672c176
--- /dev/null
+++ b/clicache/src/IPdxSerializer.hpp
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IPdxWriter.hpp"
+#include "IPdxReader.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// The IPdxSerializer interface allows domain classes to be
+ /// serialized and deserialized as PDXs without modification
+ /// of the domain class.
+ /// A domain class should register delgate <see cref="Serializable.RegisterPdxType" /> to create new
+ /// instance of type for de-serilization.
+ /// </summary>
+ public interface class IPdxSerializer
+ {
+ public:
+
+ /// <summary>
+ /// Serializes this object in geode PDX format.
+ /// </summary>
+ /// <param name="o">
+ /// the object which need to serialize
+ /// </param>
+ /// <param name="writer">
+ /// the IPdxWriter object to use for serializing the object
+ /// </param>
+ bool ToData(Object^ o, IPdxWriter^ writer);
+
+ /// <summary>
+ /// Deserialize this object.
+ /// </summary>
+ /// <param name="classname">
+ /// the classname whose object need to de-serialize
+ /// </param>
+ /// <param name="reader">
+ /// the IPdxReader stream to use for reading the object data
+ /// </param>
+ Object^ FromData(String^ classname, IPdxReader^ reader);
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxTypeMapper.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxTypeMapper.hpp b/clicache/src/IPdxTypeMapper.hpp
new file mode 100755
index 0000000..f2b5fd6
--- /dev/null
+++ b/clicache/src/IPdxTypeMapper.hpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#pragma once
+using namespace System;
+using namespace System::Collections::Generic;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Application can implement this interface to map pdx type name to local type name.
+ /// Need to set this using <see cref="Serializable.SetPdxTypeMapper" />
+ /// </summary>
+ public interface class IPdxTypeMapper
+ {
+ public:
+ /// <summary>
+ /// To map the local type name to pdx type
+ /// <param name="localTypeName"> local type name </param>
+ /// @return the pdx type name.
+ /// </summary>
+ String^ ToPdxTypeName(String^ localTypeName);
+
+ /// <summary>
+ /// To map the pdx type name to local type
+ /// <param name="pdxTypeName"> pdx type name </param>
+ /// @return the local type name.
+ /// </summary>
+ String^ FromPdxTypeName(String^ pdxTypeName);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxUnreadFields.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxUnreadFields.hpp b/clicache/src/IPdxUnreadFields.hpp
new file mode 100644
index 0000000..96c57aa
--- /dev/null
+++ b/clicache/src/IPdxUnreadFields.hpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Serialize the data in geode Portable Data eXchange(Pdx) Format.
+ /// This format provides class versioning(forward and backward compability of types) in cache.
+ /// This provides ability to query .NET domian objects.
+ /// </summary>
+ public interface class IPdxUnreadFields
+ {
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPdxWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPdxWriter.hpp b/clicache/src/IPdxWriter.hpp
new file mode 100644
index 0000000..3196efe
--- /dev/null
+++ b/clicache/src/IPdxWriter.hpp
@@ -0,0 +1,247 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+//#include "IRegion.hpp"
+#include "IPdxUnreadFields.hpp"
+using namespace System;
+using namespace System::Collections::Generic;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A IPdxWriter will be passed to IPdxSerializable.toData
+ /// when it is serializing the domain class. The domain class needs to serialize member
+ /// fields using this interface. This interface is implemented
+ /// by Native Client.
+ /// </summary>
+ public interface class IPdxWriter
+ {
+ public:
+
+ /// <summary>
+ /// Write a byte to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The byte to write.</param>
+ IPdxWriter^ WriteByte( String^ fieldName, SByte value );
+
+ /// <summary>
+ /// Write a boolean value to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The boolean value to write.</param>
+ IPdxWriter^ WriteBoolean( String^ fieldName, Boolean value );
+
+ /// <summary>
+ /// Write a char value to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The char value to write.</param>
+ IPdxWriter^ WriteChar( String^ fieldName, Char value );
+
+ /// <summary>
+ /// Write a 16-bit integer to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The 16-bit integer to write.</param>
+ IPdxWriter^ WriteShort( String^ fieldName, Int16 value );
+
+ /// <summary>
+ /// Write a 32-bit integer to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The 32-bit integer to write.</param>
+ IPdxWriter^ WriteInt( String^ fieldName, Int32 value );
+
+ /// <summary>
+ /// Write a 64-bit integer to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The 64-bit integer to write.</param>
+ IPdxWriter^ WriteLong( String^ fieldName, Int64 value );
+
+ /// <summary>
+ /// Write a float to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The float value to write.</param>
+ IPdxWriter^ WriteFloat( String^ fieldName, float value );
+
+ /// <summary>
+ /// Write a double precision real number to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">
+ /// The double precision real number to write.
+ /// </param>
+ IPdxWriter^ WriteDouble( String^ fieldName, double value );
+
+ /// <summary>
+ /// Write a string using java-modified UTF-8 encoding to
+ /// <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="value">The UTF encoded string to write.</param>
+ IPdxWriter^ WriteString( String^ fieldName, String^ value );
+
+ /// <summary>
+ /// Write an <c>Object</c> object to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="obj">The object to write.</param>
+ IPdxWriter^ WriteObject( String^ fieldName, Object^ obj );
+
+ //TODO:
+ //IPdxWriter^ WriteMap( String^ fieldName, System::Collections::IDictionary^ map );
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="date">The date to write.</param>
+ IPdxWriter^ WriteDate( String^ fieldName, System::DateTime date);
+
+ //TODO:
+ //IPdxWriter^ writeFile(String fieldName, File file) ;
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="boolArray">The boolArray to write.</param>
+ IPdxWriter^ WriteBooleanArray( String^ fieldName, array<bool>^ boolArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="charArray">The charArray to write.</param>
+ IPdxWriter^ WriteCharArray(String^ fieldName, array<Char>^ charArray) ;
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="byteArray">The byteArray to write.</param>
+ IPdxWriter^ WriteByteArray(String^ fieldName, array<Byte>^ byteArray) ;
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="shortArray">The shortArray to write.</param>
+ IPdxWriter^ WriteShortArray(String^ fieldName, array<System::Int16>^ shortArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="intArray">The intArray to write.</param>
+ IPdxWriter^ WriteIntArray(String^ fieldName, array<System::Int32>^ intArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="longArray">The longArray to write.</param>
+ IPdxWriter^ WriteLongArray(String^ fieldName, array<Int64>^ longArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="floatArray">The floatArray to write.</param>
+ IPdxWriter^ WriteFloatArray(String^ fieldName, array<float>^ floatArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="doubleArray">The doubleArray to write.</param>
+ IPdxWriter^ WriteDoubleArray(String^ fieldName, array<double>^ doubleArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="stringArray">The stringArray to write.</param>
+ IPdxWriter^ WriteStringArray(String^ fieldName, array<String^>^ stringArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="objectArray">The objectArray to write.</param>
+ IPdxWriter^ WriteObjectArray(String^ fieldName, List<Object^>^ objectArray);
+
+ /// <summary>
+ /// Write an collection to the <c>IPdxWriter</c>.
+ /// </summary>
+ /// <param name="fieldName">The name of the field associated with the value.</param>
+ /// <param name="byteArrays">The byteArrays to write.</param>
+ IPdxWriter^ WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ byteArrays);
+
+ //TODO:
+ //IPdxWriter^ WriteEnum(String^ fieldName, Enum e) ;
+ //IPdxWriter^ WriteInetAddress(String^ fieldName, InetAddress address);
+
+ /// <summary>
+ /// Indicate that the given field name should be included in hashCode and equals checks
+ /// of this object on a server that is using {@link CacheFactory#setPdxReadSerialized(boolean)}
+ /// or when a client executes a query on a server.
+ ///
+ /// The fields that are marked as identity fields are used to generate the hashCode and
+ /// equals methods of {@link PdxInstance}. Because of this, the identity fields should themselves
+ /// either be primatives, or implement hashCode and equals.
+ ///
+ /// If no fields are set as identity fields, then all fields will be used in hashCode and equals
+ /// checks.
+ ///
+ /// The identity fields should make marked after they are written using a write* method.
+ /// </summary>
+ /// <param name="fieldName"> the name of the field that should be used in the as part of the identity.</param>
+ /// <returns>this PdxWriter</returns>
+
+ IPdxWriter^ MarkIdentityField(String^ fieldName);
+
+ /// <summary>
+ /// To append unread data with updated data.
+ ///
+ /// </summary>
+ /// <returns>this PdxWriter</returns>
+ IPdxWriter^ WriteUnreadFields(IPdxUnreadFields^ unread);
+
+ /// <summary>
+ /// Writes the named field with the given value and type to the serialized form.
+ /// This method uses the <code>fieldType</code> to determine which WriteXXX method it should call.
+ /// If it can not find a specific match to a writeXXX method it will call <see cref="WriteObject(String^, Object^)">.
+ ///
+ /// </summary>
+ /// <returns>this PdxWriter</returns>
+ IPdxWriter^ WriteField(String^ fieldName, Object^ fieldValue, Type^ type);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IPersistenceManager.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IPersistenceManager.hpp b/clicache/src/IPersistenceManager.hpp
new file mode 100644
index 0000000..b901114
--- /dev/null
+++ b/clicache/src/IPersistenceManager.hpp
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IRegion.hpp"
+#include "Properties.hpp"
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// IPersistenceManager interface for persistence and overflow.
+ /// This class abstracts the disk-related operations in case of persistence or overflow to disk.
+ /// A specific disk storage implementation will implement all the methods described here.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public interface class IPersistenceManager
+ {
+ public:
+ /// <summary>
+ /// Called after an implementation object is created. Initializes all the implementation
+ /// specific environments needed.
+ /// </summary>
+ /// <param name="region">
+ /// Region for which this PersistenceManager is initialized.
+ /// </param>
+ /// <param name="diskProperties">
+ /// Configuration Properties used by PersistenceManager implementation.
+ /// </param>
+ void Init(IRegion<TKey, TValue>^ region, Properties<String^, String^>^ diskProperties);
+
+ /// <summary>
+ /// Writes a key, value pair of region to the disk. The actual file or database related write operations should be implemented
+ /// in this method by the class implementing this method.
+ /// </summary>
+ /// <param name="key">
+ /// the key to write.
+ /// </param>
+ /// <param name="value">
+ /// the value to write.
+ /// </param>
+ void Write(TKey key, TValue value);
+
+ /// <summary>
+ /// Writes all the entries for a region. Refer persistance requirement doc for the use case.
+ /// </summary>
+ /// <returns>
+ /// true if WriteAll is successful.
+ /// </returns>
+ bool WriteAll();
+
+ /// <summary>
+ /// Reads the value for the key from the disk.
+ /// </summary>
+ /// <param name="key">
+ /// key for which the value has to be read.
+ /// </param>
+ TValue Read(TKey key);
+
+ /// <summary>
+ /// Reads all the values from the region.
+ /// </summary>
+ /// <returns>
+ /// true if ReadAll is successful.
+ /// </returns>
+ bool ReadAll();
+
+ /// <summary>
+ /// Destroys the entry specified by the key in the argument.
+ /// </summary>
+ /// <param name="key">
+ /// key of the entry which is being destroyed.
+ /// </param>
+ void Destroy(TKey key);
+
+ /// <summary>
+ /// Closes the persistence manager instance.
+ /// </summary>
+ void Close();
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[34/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientRegionInterestTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientRegionInterestTestsN.cs b/clicache/integration-test/ThinClientRegionInterestTestsN.cs
new file mode 100644
index 0000000..9cf64f2
--- /dev/null
+++ b/clicache/integration-test/ThinClientRegionInterestTestsN.cs
@@ -0,0 +1,1216 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientRegionInterestTests : ThinClientRegionSteps
+ {
+ #region Private members and methods
+
+ private UnitProcess m_client1, m_client2, m_client3, m_feeder;
+ private static string[] m_regexes = { "Key-*1", "Key-*2",
+ "Key-*3", "Key-*4" };
+ private const string m_regex23 = "Key-[23]";
+ private const string m_regexWildcard = "Key-.*";
+ private const int m_numUnicodeStrings = 5;
+
+ private static string[] m_keysNonRegex = { "key-1", "key-2", "key-3" };
+ private static string[] m_keysForRegex = {"key-regex-1",
+ "key-regex-2", "key-regex-3" };
+ private static string[] RegionNamesForInterestNotify =
+ { "RegionTrue", "RegionFalse", "RegionOther" };
+
+ string GetUnicodeString(int index)
+ {
+ return new string('\x0905', 40) + index.ToString("D10");
+ }
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ m_feeder = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3, m_feeder };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(DestroyRegions);
+ m_client2.Call(DestroyRegions);
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ #region Steps for Thin Client IRegion<object, object> with Interest
+
+ public void StepFourIL()
+ {
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[1], m_keys[2]);
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ }
+
+ public void StepFourRegex3()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ try
+ {
+ Util.Log("Registering empty regular expression.");
+ region0.GetSubscriptionService().RegisterRegex(string.Empty);
+ Assert.Fail("Did not get expected exception!");
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Got expected exception {0}: {1}", ex.GetType(), ex.Message);
+ }
+ try
+ {
+ Util.Log("Registering null regular expression.");
+ region1.GetSubscriptionService().RegisterRegex(null);
+ Assert.Fail("Did not get expected exception!");
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Got expected exception {0}: {1}", ex.GetType(), ex.Message);
+ }
+ try
+ {
+ Util.Log("Registering non-existent regular expression.");
+ region1.GetSubscriptionService().UnregisterRegex("Non*Existent*Regex*");
+ Assert.Fail("Did not get expected exception!");
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Got expected exception {0}: {1}", ex.GetType(), ex.Message);
+ }
+ }
+
+ public void StepFourFailoverRegex()
+ {
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[1], m_keys[2]);
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+
+ UpdateEntry(m_regionNames[1], m_keys[1], m_vals[1], true);
+ UnregisterRegexes(null, m_regexes[2]);
+ }
+
+ public void StepFiveIL()
+ {
+ VerifyCreated(m_regionNames[0], m_keys[1]);
+ VerifyCreated(m_regionNames[1], m_keys[3]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], false);
+ }
+
+ public void StepFiveRegex()
+ {
+ CreateEntry(m_regionNames[0], m_keys[2], m_vals[2]);
+ CreateEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+
+ public void CreateAllEntries(string regionName)
+ {
+ CreateEntry(regionName, m_keys[0], m_vals[0]);
+ CreateEntry(regionName, m_keys[1], m_vals[1]);
+ CreateEntry(regionName, m_keys[2], m_vals[2]);
+ CreateEntry(regionName, m_keys[3], m_vals[3]);
+ }
+
+ public void VerifyAllEntries(string regionName, bool newVal, bool checkVal)
+ {
+ string[] vals = newVal ? m_nvals : m_vals;
+ VerifyEntry(regionName, m_keys[0], vals[0], checkVal);
+ VerifyEntry(regionName, m_keys[1], vals[1], checkVal);
+ VerifyEntry(regionName, m_keys[2], vals[2], checkVal);
+ VerifyEntry(regionName, m_keys[3], vals[3], checkVal);
+ }
+
+ public void VerifyInvalidAll(string regionName, params string[] keys)
+ {
+ if (keys != null)
+ {
+ foreach (string key in keys)
+ {
+ VerifyInvalid(regionName, key);
+ }
+ }
+ }
+
+ public void UpdateAllEntries(string regionName, bool checkVal)
+ {
+ UpdateEntry(regionName, m_keys[0], m_nvals[0], checkVal);
+ UpdateEntry(regionName, m_keys[1], m_nvals[1], checkVal);
+ UpdateEntry(regionName, m_keys[2], m_nvals[2], checkVal);
+ UpdateEntry(regionName, m_keys[3], m_nvals[3], checkVal);
+ }
+
+ public void DoNetsearchAllEntries(string regionName, bool newVal,
+ bool checkNoKey)
+ {
+ string[] vals;
+ if (newVal)
+ {
+ vals = m_nvals;
+ }
+ else
+ {
+ vals = m_vals;
+ }
+ DoNetsearch(regionName, m_keys[0], vals[0], checkNoKey);
+ DoNetsearch(regionName, m_keys[1], vals[1], checkNoKey);
+ DoNetsearch(regionName, m_keys[2], vals[2], checkNoKey);
+ DoNetsearch(regionName, m_keys[3], vals[3], checkNoKey);
+ }
+
+ public void StepFiveFailoverRegex()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], false);
+ VerifyEntry(m_regionNames[1], m_keys[1], m_vals[1], false);
+ }
+
+ public void StepSixIL()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(m_regionNames[1]);
+ region0.Remove(m_keys[1]);
+ region1.Remove(m_keys[3]);
+ }
+
+ public void StepSixRegex()
+ {
+ CreateEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ CreateEntry(m_regionNames[1], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[0], m_keys[2], m_vals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+
+ UnregisterRegexes(null, m_regexes[3]);
+ }
+
+ public void StepSixFailoverRegex()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2], false);
+ UpdateEntry(m_regionNames[1], m_keys[1], m_nvals[1], false);
+ }
+
+ public void StepSevenIL()
+ {
+ VerifyDestroyed(m_regionNames[0], m_keys[1]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+
+ public void StepSevenRegex()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[1], m_vals[1]);
+ UpdateEntry(m_regionNames[0], m_keys[2], m_nvals[2], true);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], true);
+
+ UnregisterRegexes(null, m_regexes[1]);
+ }
+
+ public void StepSevenRegex2()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[0], m_keys[2], m_vals[2]);
+
+ DoNetsearch(m_regionNames[0], m_keys[0], m_vals[0], true);
+ DoNetsearch(m_regionNames[0], m_keys[3], m_vals[3], true);
+
+ UpdateAllEntries(m_regionNames[1], true);
+ }
+
+ public void StepSevenInterestResultPolicyInv()
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region.GetSubscriptionService().RegisterRegex(m_regex23);
+
+ VerifyInvalidAll(m_regionNames[0], m_keys[1], m_keys[2]);
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0], true);
+ VerifyEntry(m_regionNames[0], m_keys[3], m_vals[3], true);
+ }
+
+ public void StepSevenFailoverRegex()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_vals[0], true);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_vals[2], true);
+ VerifyEntry(m_regionNames[1], m_keys[1], m_nvals[1]);
+ }
+
+ public void StepEightIL()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ }
+
+ public void StepEightRegex()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[2], m_nvals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], true);
+ UpdateEntry(m_regionNames[1], m_keys[1], m_nvals[1], true);
+ }
+
+ public void StepEightInterestResultPolicyInv()
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region.GetSubscriptionService().RegisterAllKeys();
+
+ VerifyInvalidAll(m_regionNames[1], m_keys[0], m_keys[1],
+ m_keys[2], m_keys[3]);
+ UpdateAllEntries(m_regionNames[0], true);
+ }
+
+ public void StepEightFailoverRegex()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ }
+
+ public void StepNineRegex()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[1], m_vals[1]);
+ }
+
+ public void StepNineRegex2()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ VerifyEntry(m_regionNames[0], m_keys[2], m_nvals[2]);
+ VerifyEntry(m_regionNames[0], m_keys[3], m_vals[3]);
+ }
+
+ public void StepNineInterestResultPolicyInv()
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region.GetSubscriptionService().UnregisterRegex(m_regex23);
+ List<Object> keys = new List<Object>();
+ keys.Add(m_keys[0]);
+ keys.Add(m_keys[1]);
+ keys.Add(m_keys[2]);
+ region.GetSubscriptionService().RegisterKeys(keys);
+
+ VerifyInvalidAll(m_regionNames[0], m_keys[0], m_keys[1], m_keys[2]);
+ }
+
+ public void PutUnicodeKeys(string regionName, bool updates)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ string key;
+ object val;
+ for (int index = 0; index < m_numUnicodeStrings; ++index)
+ {
+ key = GetUnicodeString(index);
+ if (updates)
+ {
+ val = index + 100;
+ }
+ else
+ {
+ val = (float)index + 20.0F;
+ }
+ region[key] = val;
+ }
+ }
+
+ public void RegisterUnicodeKeys(string regionName)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ string[] keys = new string[m_numUnicodeStrings];
+ for (int index = 0; index < m_numUnicodeStrings; ++index)
+ {
+ keys[m_numUnicodeStrings - index - 1] = GetUnicodeString(index);
+ }
+ region.GetSubscriptionService().RegisterKeys(keys);
+ }
+
+ public void VerifyUnicodeKeys(string regionName, bool updates)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ string key;
+ object expectedVal;
+ for (int index = 0; index < m_numUnicodeStrings; ++index)
+ {
+ key = GetUnicodeString(index);
+ if (updates)
+ {
+ expectedVal = index + 100;
+ Assert.AreEqual(expectedVal, region.GetEntry(key).Value,
+ "Got unexpected value");
+ }
+ else
+ {
+ expectedVal = (float)index + 20.0F;
+ Assert.AreEqual(expectedVal, region[key],
+ "Got unexpected value");
+ }
+ }
+ }
+
+ public void CreateRegionsInterestNotify_Pool(string[] regionNames,
+ string locators, string poolName, bool notify, string nbs)
+ {
+ Properties<string, string> props = Properties<string, string>.Create<string, string>();
+ //props.Insert("notify-by-subscription-override", nbs);
+ CacheHelper.InitConfig(props);
+ CacheHelper.CreateTCRegion_Pool(regionNames[0], true, true,
+ new TallyListener<object, object>(), locators, poolName, notify);
+ CacheHelper.CreateTCRegion_Pool(regionNames[1], true, true,
+ new TallyListener<object, object>(), locators, poolName, notify);
+ CacheHelper.CreateTCRegion_Pool(regionNames[2], true, true,
+ new TallyListener<object, object>(), locators, poolName, notify);
+ }
+
+ /*
+ public void CreateRegionsInterestNotify(string[] regionNames,
+ string endpoints, bool notify, string nbs)
+ {
+ Properties props = Properties.Create();
+ //props.Insert("notify-by-subscription-override", nbs);
+ CacheHelper.InitConfig(props);
+ CacheHelper.CreateTCRegion(regionNames[0], true, false,
+ new TallyListener(), endpoints, notify);
+ CacheHelper.CreateTCRegion(regionNames[1], true, false,
+ new TallyListener(), endpoints, notify);
+ CacheHelper.CreateTCRegion(regionNames[2], true, false,
+ new TallyListener(), endpoints, notify);
+ }
+ * */
+
+ public void DoFeed()
+ {
+ foreach (string regionName in RegionNamesForInterestNotify)
+ {
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ foreach (string key in m_keysNonRegex)
+ {
+ region[key] = "00";
+ }
+ foreach (string key in m_keysForRegex)
+ {
+ region[key] = "00";
+ }
+ }
+ }
+
+ public void DoFeederOps()
+ {
+ foreach (string regionName in RegionNamesForInterestNotify)
+ {
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ foreach (string key in m_keysNonRegex)
+ {
+ region[key] = "11";
+ region[key] = "22";
+ region[key] = "33";
+ region.GetLocalView().Invalidate(key);
+ region.Remove(key);
+ }
+ foreach (string key in m_keysForRegex)
+ {
+ region[key] = "11";
+ region[key] = "22";
+ region[key] = "33";
+ region.GetLocalView().Invalidate(key);
+ region.Remove(key);
+ }
+ }
+ }
+
+ public void DoRegister()
+ {
+ DoRegisterInterests(RegionNamesForInterestNotify[0], true);
+ DoRegisterInterests(RegionNamesForInterestNotify[1], false);
+ // We intentionally do not register interest in Region3
+ //DoRegisterInterestsBlah(RegionNamesForInterestNotifyBlah[2]);
+ }
+
+ public void DoRegisterInterests(string regionName, bool receiveValues)
+ {
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ List<string> keys = new List<string>();
+ foreach (string key in m_keysNonRegex)
+ {
+ keys.Add(key);
+ }
+ region.GetSubscriptionService().RegisterKeys(keys.ToArray(), false, false, receiveValues);
+ region.GetSubscriptionService().RegisterRegex("key-regex.*", false, null, false, receiveValues);
+ }
+
+ public void DoUnregister()
+ {
+ DoUnregisterInterests(RegionNamesForInterestNotify[0]);
+ DoUnregisterInterests(RegionNamesForInterestNotify[1]);
+ }
+
+ public void DoUnregisterInterests(string regionName)
+ {
+ List<string> keys = new List<string>();
+ foreach (string key in m_keysNonRegex)
+ {
+ keys.Add(key);
+ }
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ region.GetSubscriptionService().UnregisterKeys(keys.ToArray());
+ region.GetSubscriptionService().UnregisterRegex("key-regex.*");
+ }
+
+ public void DoValidation(string clientName, string regionName,
+ int creates, int updates, int invalidates, int destroys)
+ {
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ TallyListener<object, object> listener = region.Attributes.CacheListener as TallyListener<object, object>;
+
+ Util.Log(clientName + ": " + regionName + ": creates expected=" + creates +
+ ", actual=" + listener.Creates);
+ Util.Log(clientName + ": " + regionName + ": updates expected=" + updates +
+ ", actual=" + listener.Updates);
+ Util.Log(clientName + ": " + regionName + ": invalidates expected=" + invalidates +
+ ", actual=" + listener.Invalidates);
+ Util.Log(clientName + ": " + regionName + ": destroys expected=" + destroys +
+ ", actual=" + listener.Destroys);
+
+ Assert.AreEqual(creates, listener.Creates, clientName + ": " + regionName);
+ Assert.AreEqual(updates, listener.Updates, clientName + ": " + regionName);
+ Assert.AreEqual(invalidates, listener.Invalidates, clientName + ": " + regionName);
+ Assert.AreEqual(destroys, listener.Destroys, clientName + ": " + regionName);
+ }
+
+ #endregion
+
+ void runInterestList()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ m_client1.Call(RegisterKeys, m_keys[1], m_keys[3]);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ m_client2.Call(RegisterKeys, m_keys[0], (string)null);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFiveIL);
+ m_client1.Call(UnregisterKeys, (string)null, m_keys[3]);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixIL);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenIL);
+ Util.Log("StepSeven complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ void RegisterKeysPdx()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ region.GetSubscriptionService().RegisterAllKeys();
+ }
+ void StepThreePdx()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ region[1] = new PdxTests.PdxTypes8();
+ }
+ void StepFourPdx()
+ {
+ Thread.Sleep(2000);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ IRegion<object, object> regionLocal = region.GetLocalView();
+ object ret = regionLocal[1];
+
+ Assert.IsNotNull(ret);
+ Assert.IsTrue(ret is IPdxSerializable);
+ }
+ void runInterestListPdx()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client2.Call(RegisterKeysPdx);
+
+ m_client1.Call(StepThreePdx);
+
+ Util.Log("StepThreePdx complete.");
+
+ m_client2.Call(StepFourPdx);
+ Util.Log("StepFourPdx complete.");
+
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runInterestList2()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ m_client1.Call(RegisterAllKeys,
+ new string[] { RegionNames[0], RegionNames[1] });
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ m_client2.Call(RegisterAllKeys, new string[] { RegionNames[0] });
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFiveIL);
+ m_client1.Call(UnregisterAllKeys, new string[] { RegionNames[1] });
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixIL);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenIL);
+ Util.Log("StepSeven complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRegexInterest()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(RegisterRegexes, m_regexes[0], m_regexes[1]);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(RegisterRegexes, m_regexes[2], m_regexes[3]);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFiveRegex);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixRegex);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenRegex);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightRegex);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNineRegex);
+ Util.Log("StepNine complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRegexInterest2()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(RegisterRegexes, m_regex23, (string)null);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(RegisterRegexes, (string)null, m_regexWildcard);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(CreateAllEntries, RegionNames[1]);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(CreateAllEntries, RegionNames[0]);
+ m_client2.Call(VerifyAllEntries, RegionNames[1], false, false);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenRegex2);
+ m_client1.Call(UpdateAllEntries, RegionNames[1], true);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(VerifyAllEntries, RegionNames[1], true, true);
+ m_client2.Call(UpdateAllEntries, RegionNames[0], true);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNineRegex2);
+ Util.Log("StepNine complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRegexInterest3()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ try
+ {
+ m_client1.Call(RegisterRegexes, "a*", "*[*2-[");
+ Assert.Fail("Did not get expected exception!");
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Got expected exception {0}: {1}", ex.GetType(), ex.Message);
+ }
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourRegex3);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runInterestResultPolicyInv()
+ {
+ 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.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(CreateAllEntries, RegionNames[1]);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(CreateAllEntries, RegionNames[0]);
+ Util.Log("StepFour complete.");
+
+ m_client2.Call(DoNetsearchAllEntries, RegionNames[1], false, true);
+ Util.Log("StepFive complete.");
+
+ m_client1.Call(DoNetsearchAllEntries, RegionNames[0], false, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenInterestResultPolicyInv);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightInterestResultPolicyInv);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNineInterestResultPolicyInv);
+ Util.Log("StepNine complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailoverInterest()
+ {
+ CacheHelper.SetupJavaServers( true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client2.Call(RegisterKeys, m_keys[0], m_keys[2]);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourIL);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(StepFiveFailover);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixFailover);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailoverInterest2()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo complete.");
+
+ m_client2.Call(RegisterAllKeys, RegionNames);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourIL);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(StepFiveFailover);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixFailover);
+ Util.Log("StepSix complete.");
+
+ // Client2, unregister all keys
+ m_client2.Call(UnregisterAllKeys, RegionNames);
+ Util.Log("UnregisterAllKeys complete.");
+
+ m_client1.Call(StepSevenFailover);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightIL);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailoverRegexInterest()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ m_client1.Call(CreateEntry, RegionNames[1], m_keys[1], m_vals[1]);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ m_client2.Call(CreateEntry, RegionNames[1], m_keys[1], m_nvals[1]);
+ m_client2.Call(RegisterRegexes, m_regexes[0], m_regexes[2]);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ m_client1.Call(RegisterRegexes, (string)null, m_regexes[1]);
+ m_client1.Call(DoNetsearch, RegionNames[1],
+ m_keys[1], m_nvals[1], false);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourFailoverRegex);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(StepFiveFailoverRegex);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixFailoverRegex);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenFailoverRegex);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightFailoverRegex);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runInterestNotify()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_interest_notify.xml");
+
+ // start locator and server
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver started.");
+
+ // create feeder and 3 clients each with 3 regions and
+ // populate initial keys
+
+ m_feeder.Call(CreateRegionsInterestNotify_Pool, RegionNamesForInterestNotify,
+ CacheHelper.Locators, "__TESTPOOL1_", false, "server" /* nbs */);
+
+ m_feeder.Call(DoFeed);
+
+ m_client1.Call(CreateRegionsInterestNotify_Pool, RegionNamesForInterestNotify,
+ CacheHelper.Locators, "__TESTPOOL1_", true, "true" /* nbs */);
+ //m_client2.Call(CreateRegionsInterestNotify_Pool, RegionNamesForInterestNotify,
+ // CacheHelper.Locators, "__TESTPOOL1_", true, "false" /* nbs */);
+ //m_client3.Call(CreateRegionsInterestNotify_Pool, RegionNamesForInterestNotify,
+ // CacheHelper.Locators, "__TESTPOOL1_", true, "server" /* nbs */);
+
+ // Register interests and get initial values
+ m_client1.Call(DoRegister);
+ //m_client2.Call(DoRegister);
+ //m_client3.Call(DoRegister);
+
+ // Do ops while interest is registered
+ m_feeder.Call(DoFeederOps);
+
+ m_client1.Call(DoUnregister);
+ //m_client2.Call(DoUnregister);
+ //m_client3.Call(DoUnregister);
+
+ // Do ops while interest is no longer registered
+ m_feeder.Call(DoFeederOps);
+
+ m_client1.Call(DoRegister);
+ //m_client2.Call(DoRegister);
+ //m_client3.Call(DoRegister);
+
+ // Do ops while interest is re-registered
+ m_feeder.Call(DoFeederOps);
+
+ // Validate clients receive relevant expected event counts:
+
+ m_client1.Call(DoValidation, "Client1", RegionNamesForInterestNotify[0], 6, 30, 0, 12);
+ m_client1.Call(DoValidation, "Client1", RegionNamesForInterestNotify[1], 0, 0, 36, 12);
+ m_client1.Call(DoValidation, "Client1", RegionNamesForInterestNotify[2], 0, 0, 0, 0);
+
+ /*
+ m_client2.Call(DoValidation, "Client2", RegionNamesForInterestNotify[0], 0, 0, 54, 18);
+ m_client2.Call(DoValidation, "Client2", RegionNamesForInterestNotify[1], 0, 0, 54, 18);
+ m_client2.Call(DoValidation, "Client2", RegionNamesForInterestNotify[2], 0, 0, 54, 18);
+
+ m_client3.Call(DoValidation, "Client3", RegionNamesForInterestNotify[0], 0, 0, 54, 18);
+ m_client3.Call(DoValidation, "Client3", RegionNamesForInterestNotify[1], 0, 0, 54, 18);
+ m_client3.Call(DoValidation, "Client3", RegionNamesForInterestNotify[2], 0, 0, 54, 18);
+ * */
+
+ // close down
+
+ m_client1.Call(Close);
+ //m_client2.Call(Close);
+ //m_client3.Call(Close);
+ m_feeder.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ [Test]
+ public void InterestList()
+ {
+ runInterestList();
+ }
+
+ [Test]
+ public void InterestListWithPdx()
+ {
+ runInterestListPdx();
+ }
+
+ [Test]
+ public void InterestList2()
+ {
+ runInterestList2();
+ }
+
+ [Test]
+ public void RegexInterest()
+ {
+ runRegexInterest();
+ }
+
+ [Test]
+ public void RegexInterest2()
+ {
+ runRegexInterest2();
+ }
+
+ [Test]
+ public void RegexInterest3()
+ {
+ runRegexInterest3();
+ }
+
+ [Test]
+ public void InterestResultPolicyInv()
+ {
+ runInterestResultPolicyInv();
+ }
+
+ [Test]
+ public void FailoverInterest()
+ {
+ runFailoverInterest();
+ }
+
+ [Test]
+ public void FailoverInterest2()
+ {
+ runFailoverInterest2();
+ }
+
+ [Test]
+ public void FailoverRegexInterest()
+ {
+ runFailoverRegexInterest();
+ }
+
+ [Test]
+ public void InterestNotify()
+ {
+ runInterestNotify();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientRegionStepsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientRegionStepsN.cs b/clicache/integration-test/ThinClientRegionStepsN.cs
new file mode 100644
index 0000000..dc03f78
--- /dev/null
+++ b/clicache/integration-test/ThinClientRegionStepsN.cs
@@ -0,0 +1,705 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using AssertionException = Apache.Geode.Client.AssertionException;
+
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public abstract class ThinClientRegionSteps : DistOpsSteps
+ {
+ #region Protected statics/constants and members
+
+ protected const string RegionName = "DistRegionAck";
+ protected static string[] RegionNames = { RegionName, "DistRegionNoAck" };
+ protected static string[] RegionNames2 = { "exampleRegion", RegionName };
+ protected static string[] RegionNames3 = { "testregion", RegionName };
+ protected const string PartitionRegion1 = "R1";
+ protected const string PartitionRegion2 = "R2";
+ protected const string PartitionRegion3 = "R3";
+ protected const string KeyPrefix = "key-";
+ protected const string ValuePrefix = "value-";
+ protected const string NValuePrefix = "nvalue-";
+ protected const string TradeKeyRegion = "TradeKeyRegion";
+
+ #endregion
+
+ protected override string ExtraPropertiesFile
+ {
+ get
+ {
+ return "geode.properties.nativeclient";
+ }
+ }
+
+ #region Steps for Thin Client IRegion<object, object>
+
+ public void CreateNonExistentRegion(string locators)
+ {
+ string regionName = "non-region";
+
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true,
+ null, locators, "__TESTPOOL1_", false);
+
+ try
+ {
+ CreateEntry(regionName, m_keys[0], m_vals[0]);
+ Assert.Fail("Expected CacheServerException for operations on a " +
+ "non-existent region [{0}].", regionName);
+ }
+ catch (CacheServerException ex)
+ {
+ Util.Log("Got expected exception in CreateNonExistentRegion: {0}",
+ ex.Message);
+ }
+ }
+
+ public override void DestroyRegions()
+ {
+ if (m_regionNames != null)
+ {
+ CacheHelper.DestroyRegion<object, object>(m_regionNames[0], true, false);
+ CacheHelper.DestroyRegion<object, object>(m_regionNames[1], true, false);
+ }
+ }
+
+ public void RegisterKeys(string key0, string key1)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ if (key0 != null)
+ {
+ //region0.RegisterKeys(new CacheableKey[] {new CacheableString(key0) });
+ List<Object> keys0 = new List<Object>();
+ keys0.Add(key0);
+ region0.GetSubscriptionService().RegisterKeys(keys0);
+ }
+ if (key1 != null)
+ {
+ List<Object> keys1 = new List<Object>();
+ keys1.Add(key1);
+ region1.GetSubscriptionService().RegisterKeys(keys1);
+ }
+ }
+
+ public void UnregisterKeys(string key0, string key1)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ if (key0 != null)
+ {
+ List<Object> keys0 = new List<Object>();
+ keys0.Add(key0);
+ region0.GetSubscriptionService().UnregisterKeys(keys0);
+ }
+ if (key1 != null)
+ {
+ List<Object> keys1 = new List<Object>();
+ keys1.Add(key1);
+ region1.GetSubscriptionService().UnregisterKeys(keys1);
+ }
+ }
+
+ public void RegisterAllKeys(string[] regionNames)
+ {
+ IRegion<object, object> region;
+ if (regionNames != null)
+ {
+ foreach (string regionName in regionNames)
+ {
+ region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ region.GetSubscriptionService().RegisterAllKeys();
+ }
+ }
+ }
+
+ public void UnregisterAllKeys(string[] regionNames)
+ {
+ IRegion<object, object> region;
+ if (regionNames != null)
+ {
+ foreach (string regionName in regionNames)
+ {
+ region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ region.GetSubscriptionService().UnregisterAllKeys();
+ }
+ }
+ }
+
+ public void RegisterRegexes(string regex0, string regex1)
+ {
+ if (regex0 != null)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterRegex(regex0);
+ }
+ if (regex1 != null)
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region1.GetSubscriptionService().RegisterRegex(regex1);
+ }
+ }
+
+ public void UnregisterRegexes(string regex0, string regex1)
+ {
+ if (regex0 != null)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().UnregisterRegex(regex0);
+ }
+ if (regex1 != null)
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region1.GetSubscriptionService().UnregisterRegex(regex1);
+ }
+ }
+
+ public void CheckServerKeys()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ //ICacheableKey[] keys0 = region0.GetServerKeys();
+ ICollection<Object> keys0 = region0.Keys;
+ //ICacheableKey[] keys1 = region1.GetServerKeys();
+ ICollection<Object> keys1 = region1.Keys;
+
+ Assert.AreEqual(2, keys0.Count, "Should have 2 keys in region {0}.",
+ m_regionNames[0]);
+ Assert.AreEqual(2, keys1.Count, "Should have 2 keys in region {0}.",
+ m_regionNames[1]);
+
+ string key0, key1;
+
+ IEnumerator<Object> obj = keys0.GetEnumerator();
+ obj.MoveNext();
+ key0 = obj.Current.ToString();
+ //Console.WriteLine("key0 = {0}", key0);
+ obj.MoveNext();
+ key1 = obj.Current.ToString();
+
+ //key0 = keys0[0].ToString();
+ //key1 = keys0[1].ToString();
+ Assert.AreNotEqual(key0, key1,
+ "The two keys should be different in region {0}.", m_regionNames[0]);
+ Assert.IsTrue(key0 == m_keys[0] || key0 == m_keys[1],
+ "Unexpected key in first region.");
+ Assert.IsTrue(key1 == m_keys[0] || key1 == m_keys[1],
+ "Unexpected key in first region.");
+
+ //key0 = keys1[0].ToString();
+ //key1 = keys1[1].ToString();
+ IEnumerator<Object> obj1 = keys1.GetEnumerator();
+ obj1.MoveNext();
+ key0 = obj1.Current.ToString();
+ //Console.WriteLine("key0 = {0}", key0);
+ obj1.MoveNext();
+ key1 = obj1.Current.ToString();
+
+ Assert.AreNotEqual(key0, key1,
+ "The two keys should be different in region {0}.", m_regionNames[1]);
+ Assert.IsTrue(key0 == m_keys[2] || key0 == m_keys[3],
+ "Unexpected key in first region.");
+ Assert.IsTrue(key1 == m_keys[2] || key1 == m_keys[3],
+ "Unexpected key in first region.");
+ }
+
+ //public void StepFiveNotify()
+ //{
+ // DoNetsearch(m_regionNames[0], m_keys[1], m_vals[1], true);
+ // DoNetsearch(m_regionNames[1], m_keys[3], m_vals[3], true);
+ // UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], true);
+ // UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], true);
+ // VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ // VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ //}
+
+ public void StepFiveFailover()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ //DestroyEntry(m_regionNames[0], m_keys[0]);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], false);
+ }
+
+ public override void StepSix(bool checkVal)
+ {
+ DoNetsearch(m_regionNames[0], m_keys[0], m_vals[0], false);
+ DoNetsearch(m_regionNames[1], m_keys[2], m_vals[2], false);
+ UpdateEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ }
+
+ public void StepSixNotify(bool checkVal)
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], checkVal);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2], checkVal);
+ UpdateEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ }
+
+ public void StepSixFailover()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2], false);
+ }
+
+ public void StepSevenNotify(bool checkVal)
+ {
+ VerifyInvalid(m_regionNames[0], m_keys[1]);
+ VerifyInvalid(m_regionNames[1], m_keys[3]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ InvalidateEntry(m_regionNames[0], m_keys[0]);
+ InvalidateEntry(m_regionNames[1], m_keys[2]);
+ }
+
+ public void StepSevenFailover()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_vals[0], false);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_vals[2], false);
+ }
+
+ public void StepEightNotify(bool checkVal)
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], checkVal);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2], checkVal);
+ InvalidateEntry(m_regionNames[0], m_keys[1]);
+ InvalidateEntry(m_regionNames[1], m_keys[3]);
+ }
+
+ public void StepNineNotify(bool checkVal)
+ {
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ DestroyEntry(m_regionNames[0], m_keys[0]);
+ DestroyEntry(m_regionNames[1], m_keys[2]);
+ }
+
+ #endregion
+
+ #region Functions invoked by the tests
+
+ public void Close()
+ {
+ CacheHelper.Close();
+ }
+
+ public void CloseKeepAlive()
+ {
+ CacheHelper.CloseCacheKeepAlive();
+ }
+
+ public void ReadyForEvents2()
+ {
+ CacheHelper.ReadyForEvents();
+ }
+
+ public void DoPutsMU(int numOps, Client.Properties<string, string> credentials, bool multiuserMode, ExpectedResult result)
+ {
+ DoPuts(numOps, false, result, credentials, multiuserMode);
+ }
+
+ public void DoPutsMU(int numOps, Client.Properties<string, string> credentials, bool multiuserMode)
+ {
+ DoPuts(numOps, false, ExpectedResult.Success, credentials, multiuserMode);
+ }
+
+ public void DoPuts(int numOps)
+ {
+ DoPuts(numOps, false, ExpectedResult.Success, null, false);
+ }
+
+ public void DoPuts(int numOps, bool useNewVal)
+ {
+ DoPuts(numOps, useNewVal, ExpectedResult.Success, null, false);
+ }
+
+ public void DoPuts(int numOps, bool useNewVal, ExpectedResult expect)
+ {
+ DoPuts(numOps, useNewVal, expect, null, false);
+ }
+
+ public void DoPuts(int numOps, bool useNewVal, ExpectedResult expect, Client.Properties<string, string> credentials, bool multiuserMode)
+ {
+ string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
+ IRegion<object, object> region;
+ if (multiuserMode)
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName, credentials);
+ else
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ for (int opNum = 1; opNum <= numOps; ++opNum)
+ {
+ try
+ {
+ region[KeyPrefix + opNum] = valPrefix + opNum;
+
+ region.Invalidate(KeyPrefix + opNum);
+
+ region[KeyPrefix + opNum] = valPrefix + opNum;
+
+ Util.Log("Pdx ops starts");
+ region[opNum] = new PdxTests.PdxTypes8();
+ region[opNum + "_pdx1"] = new PdxTests.PdxTypes1();
+ region[opNum + "_pdx_8"] = new PdxTests.PdxTypes8();
+
+ IDictionary<object, object> putall = new Dictionary<object,object>();
+ putall.Add(opNum +"_pdxputall81", new PdxTests.PdxTypes8());
+ putall.Add(opNum + "_pdxputall82", new PdxTests.PdxTypes8());
+ region.PutAll(putall);
+
+
+ Util.Log("Pdx ops ends");
+
+ if (expect != ExpectedResult.Success)
+ {
+ Assert.Fail("DoPuts: Expected an exception in put");
+ }
+ }
+ catch (AssertionException)
+ {
+ throw;
+ }
+ catch (NotAuthorizedException ex)
+ {
+ if (expect == ExpectedResult.NotAuthorizedException)
+ {
+ Util.Log("DoPuts: got expected unauthorized exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ catch (AuthenticationFailedException ex)
+ {
+ if (expect == ExpectedResult.AuthFailedException)
+ {
+ Util.Log("DoPuts: got expected authentication Failed exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (expect == ExpectedResult.OtherException)
+ {
+ Util.Log("DoPuts: got expected exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ }
+ }
+
+ public void DoPutsTx(int numOps, bool useNewVal, ExpectedResult expect, Client.Properties<string, string> credentials, bool multiuserMode)
+ {
+ Util.Log("DoPutsTx starts");
+ CacheHelper.CSTXManager.Begin();
+ string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
+ IRegion<object, object> region;
+ if (multiuserMode)
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName, credentials);
+ else
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ for (int opNum = 1; opNum <= numOps; ++opNum)
+ {
+ try
+ {
+ region[KeyPrefix + opNum] = valPrefix + opNum;
+ region.Invalidate(KeyPrefix + opNum);
+ region[KeyPrefix + opNum] = valPrefix + opNum;
+ Util.Log("Pdx ops starts");
+ region[opNum] = new PdxTests.PdxTypes8();
+ region[opNum + "_pdx1"] = new PdxTests.PdxTypes1();
+ region[opNum + "_pdx_8"] = new PdxTests.PdxTypes8();
+ IDictionary<object, object> putall = new Dictionary<object, object>();
+ putall.Add(opNum + "_pdxputall81", new PdxTests.PdxTypes8());
+ putall.Add(opNum + "_pdxputall82", new PdxTests.PdxTypes8());
+ region.PutAll(putall);
+ Util.Log("Pdx ops ends");
+ if (expect != ExpectedResult.Success)
+ {
+ Assert.Fail("DoPuts: Expected an exception in put");
+ }
+ }
+ catch (AssertionException)
+ {
+ throw;
+ }
+ catch (NotAuthorizedException ex)
+ {
+ if (expect == ExpectedResult.NotAuthorizedException)
+ {
+ Util.Log("DoPuts: got expected unauthorized exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ catch (AuthenticationFailedException ex)
+ {
+ if (expect == ExpectedResult.AuthFailedException)
+ {
+ Util.Log("DoPuts: got expected authentication Failed exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (expect == ExpectedResult.OtherException)
+ {
+ Util.Log("DoPuts: got expected exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ }
+ CacheHelper.CSTXManager.Commit();
+ Util.Log("DoPutsTx Done");
+ }
+
+ public void DoGetsMU(int numOps, Client.Properties<string, string> credential, bool isMultiuser, ExpectedResult result)
+ {
+ DoGets(numOps, false, result, credential, isMultiuser);
+ }
+
+ public void DoGetsMU(int numOps, Client.Properties<string, string> credential, bool isMultiuser)
+ {
+ DoGets(numOps, false, ExpectedResult.Success, credential, isMultiuser);
+ }
+
+ public void DoGets(int numOps)
+ {
+ DoGets(numOps, false, ExpectedResult.Success, null, false);
+ }
+
+ public void DoGets(int numOps, bool useNewVal)
+ {
+ DoGets(numOps, useNewVal, ExpectedResult.Success, null, false);
+ }
+
+ public void DoGets(int numOps, bool useNewVal, ExpectedResult expect)
+ {
+ DoGets(numOps, useNewVal, expect, null, false);
+ }
+ public void DoGets(int numOps, bool useNewVal, ExpectedResult expect, Client.Properties<string, string> credential, bool isMultiuser)
+ {
+ string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
+ IRegion<object, object> region;
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ if (isMultiuser)
+ {
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName, credential);
+ }
+ else
+ {
+ region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ }
+
+ for (int index = 1; index <= numOps; ++index)
+ {
+ try
+ {
+ region.GetLocalView().Invalidate(index + "_pdxputall81");
+ region.GetLocalView().Invalidate(index + "_pdxputall82");
+ }
+ catch (Exception )
+ { }
+ }
+
+ if (expect == ExpectedResult.Success)
+ {
+ for (int index = 1; index <= numOps; ++index)
+ {
+ object ret1 = region[index + "_pdxputall81"];
+ object ret2 = region[index + "_pdxputall82"];
+
+ Assert.IsTrue(ret1 != null && ret1 is PdxTests.PdxTypes8);
+ Assert.IsTrue(ret1 != null && ret2 is PdxTests.PdxTypes8);
+ }
+ }
+
+ for (int index = 1; index <= numOps; ++index)
+ {
+ try
+ {
+ region.GetLocalView().Invalidate(index + "_pdxputall81");
+ region.GetLocalView().Invalidate(index + "_pdxputall82");
+ }
+ catch (Exception )
+ { }
+ }
+
+ if (expect == ExpectedResult.Success)
+ {
+ for (int index = 1; index <= numOps; ++index)
+ {
+ ICollection<object> pdxKeys = new List<object>();
+ pdxKeys.Add(index + "_pdxputall81");
+ pdxKeys.Add(index + "_pdxputall82");
+ IDictionary<object, object> getall = new Dictionary<object, object>();
+ region.GetAll(pdxKeys, getall, null);
+
+ Assert.AreEqual(2, getall.Count);
+ }
+ }
+
+ for (int index = 1; index <= numOps; ++index)
+ {
+ string key = KeyPrefix + index;
+ try
+ {
+ region.GetLocalView().Invalidate(key);
+ }
+ catch (Exception)
+ {
+ // ignore exception if key is not found in the region
+ }
+ Object value = null;
+ try
+ {
+ value = region[key];
+ Object retPdx = region[index];
+
+ Assert.IsTrue(retPdx != null && retPdx is PdxTests.PdxTypes8);
+ if (expect != ExpectedResult.Success)
+ {
+ Assert.Fail("DoGets: Expected an exception in get");
+ }
+ }
+ catch (AssertionException)
+ {
+ throw;
+ }
+ catch (NotAuthorizedException ex)
+ {
+ if (expect == ExpectedResult.NotAuthorizedException)
+ {
+ Util.Log("DoGets: got expected unauthorized exception: " +
+ ex.GetType() + "::" + ex.Message);
+ continue;
+ }
+ else
+ {
+ Assert.Fail("DoGets: unexpected unauthorized exception caught: " +
+ ex);
+ }
+ }
+ catch (AuthenticationFailedException ex)
+ {
+ if (expect == ExpectedResult.AuthFailedException)
+ {
+ Util.Log("DoPuts: got expected authentication Failed exception: " +
+ ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ Assert.Fail("DoPuts: unexpected exception caught: " + ex);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (expect == ExpectedResult.OtherException)
+ {
+ Util.Log("DoGets: got expected exception: " +
+ ex.GetType() + "::" + ex.Message);
+ continue;
+ }
+ else
+ {
+ Assert.Fail("DoGets: unexpected exception caught: " + ex);
+ }
+ }
+ Assert.IsNotNull(value);
+ Assert.AreEqual(valPrefix + index, value.ToString());
+ }
+ }
+
+ public void DoLocalGets(int numOps)
+ {
+ DoLocalGets(numOps, false);
+ }
+
+ public void DoLocalGets(int numOps, bool useNewVal)
+ {
+ string valPrefix = (useNewVal ? NValuePrefix : ValuePrefix);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ for (int index = 1; index <= numOps; ++index)
+ {
+ int sleepMillis = 100;
+ int numTries = 30;
+ string key = KeyPrefix + index;
+ string value = valPrefix + index;
+ while (numTries-- > 0)
+ {
+ if (region.ContainsValueForKey(key))
+ {
+ string foundValue = region[key].ToString();
+ if (value.Equals(foundValue))
+ {
+ break;
+ }
+ }
+ Thread.Sleep(sleepMillis);
+ }
+ }
+ for (int index = 1; index <= numOps; ++index)
+ {
+ string key = KeyPrefix + index;
+ Assert.IsTrue(region.ContainsValueForKey(key));
+ Object value = region[key];
+ Assert.IsNotNull(value);
+ Assert.AreEqual(valPrefix + index, value.ToString());
+ }
+ }
+
+ #endregion
+ }
+}
[24/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheStatistics.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheStatistics.hpp b/clicache/src/CacheStatistics.hpp
new file mode 100644
index 0000000..ec006ac
--- /dev/null
+++ b/clicache/src/CacheStatistics.hpp
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheStatistics.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Defines common statistical information for both the region and its entries.
+ /// </summary>
+ /// <remarks>
+ /// All of these methods may throw a <c>CacheClosedException</c>,
+ /// <c>RegionDestroyedException</c>, or <c>EntryDestroyedException</c>.
+ /// </remarks>
+ /// <seealso cref="Region.Statistics" />
+ /// <seealso cref="RegionEntry.Statistics" />
+ public ref class CacheStatistics sealed
+ {
+ public:
+
+ /// <summary>
+ /// For an entry, returns the time that the entry's value was last modified.
+ /// For a region, returns the last time any of the region's entries' values or
+ /// the values in subregions' entries were modified.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The modification may have been initiated locally, or it may have been
+ /// an update distributed from another cache. It may also have been a new
+ /// value provided by a loader. The modification time on a region is
+ /// propagated upward to parent regions, transitively, to the root region.
+ /// </para><para>
+ /// The number is expressed as the number of milliseconds since January 1, 1970.
+ /// The granularity may be as coarse as 100ms, so the accuracy may be off by
+ /// up to 50ms.
+ /// </para><para>
+ /// Entry and subregion creation will update the modification time on a
+ /// region, but <c>Region.Destroy</c>, <c>Region.DestroyRegion</c>,
+ /// <c>Region.Invalidate</c>, and <c>Region.InvalidateRegion</c>
+ /// do not update the modification time.
+ /// </para>
+ /// </remarks>
+ /// <returns>
+ /// the last modification time of the region or the entry;
+ /// returns 0 if the entry is invalid or the modification time is uninitialized.
+ /// </returns>
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.CreateSubRegion" />
+ property System::UInt32 LastModifiedTime
+ {
+ /// <summary>
+ /// Get the last modified time of an entry or a region.
+ /// </summary>
+ /// <returns>
+ /// the last accessed time expressed as the number of milliseconds since
+ /// January 1, 1970.
+ /// </returns>
+ System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// For an entry, returns the last time it was accessed via <c>Region.Get</c>.
+ /// For a region, returns the last time any of its entries or the entries of
+ /// its subregions were accessed with <c>Region.Get</c>.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Any modifications will also update the <c>LastAccessedTime</c>,
+ /// so <c>LastAccessedTime</c> is always greater than or equal to
+ /// <c>LastModifiedTime</c>. The <c>LastAccessedTime</c> on a region is
+ /// propagated upward to parent regions, transitively, to the the root region.
+ /// </para><para>
+ /// The number is expressed as the number of milliseconds since
+ /// January 1, 1970. The granularity may be as coarse as 100ms, so
+ /// the accuracy may be off by up to 50ms.
+ /// </para>
+ /// </remarks>
+ /// <returns>
+ /// the last access time of the region or the entry's value;
+ /// returns 0 if entry is invalid or access time is uninitialized.
+ /// </returns>
+ /// <seealso cref="Region.Get" />
+ /// <seealso cref="LastModifiedTime" />
+ property System::UInt32 LastAccessedTime
+ {
+ /// <summary>
+ /// Get the last accessed time of an entry or a region.
+ /// </summary>
+ /// <returns>
+ /// the last accessed time expressed as the number of milliseconds since
+ /// January 1, 1970.
+ /// </returns>
+ System::UInt32 get( );
+ }
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static CacheStatistics^ Create( apache::geode::client::CacheStatisticsPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CacheStatistics( nativeptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheStatistics( apache::geode::client::CacheStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CacheStatistics>(nativeptr);
+ }
+ native_shared_ptr<native::CacheStatistics>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheTransactionManager.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheTransactionManager.cpp b/clicache/src/CacheTransactionManager.cpp
new file mode 100644
index 0000000..68c1ddb
--- /dev/null
+++ b/clicache/src/CacheTransactionManager.cpp
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+#include "impl/SafeConvert.hpp"
+#include "impl/ManagedTransactionListener.hpp"
+#include "impl/ManagedTransactionWriter.hpp"
+#include "CacheTransactionManager.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void CacheTransactionManager::Begin( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->begin( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Prepare( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->prepare( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Commit( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+ try
+ {
+ m_nativeptr->get()->commit( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void CacheTransactionManager::Rollback( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+ try
+ {
+ m_nativeptr->get()->rollback( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ bool CacheTransactionManager::Exists( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->exists( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ Apache::Geode::Client::TransactionId^ CacheTransactionManager::Suspend( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return Apache::Geode::Client::TransactionId::Create( m_nativeptr->get()->suspend() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ Apache::Geode::Client::TransactionId^ CacheTransactionManager::TransactionId::get( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return Apache::Geode::Client::TransactionId::Create( m_nativeptr->get()->getTransactionId() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ void CacheTransactionManager::Resume(Apache::Geode::Client::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->resume(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::IsSuspended(Apache::Geode::Client::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->isSuspended(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::TryResume(Apache::Geode::Client::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->tryResume(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::TryResume(Apache::Geode::Client::TransactionId^ transactionId, System::Int32 waitTimeInMilliSec)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->tryResume(transactionId->GetNative(), waitTimeInMilliSec);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ bool CacheTransactionManager::Exists(Apache::Geode::Client::TransactionId^ transactionId)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return m_nativeptr->get()->exists(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+#ifdef CSTX_COMMENTED
+ generic<class TKey, class TValue>
+ ITransactionWriter<TKey, TValue>^ CacheTransactionManager::GetWriter( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ // Conver the unmanaged object to managed generic object
+ apache::geode::client::TransactionWriterPtr& writerPtr( m_nativeptr->getGCKeepAlive()->getWriter( ) );
+ apache::geode::client::ManagedTransactionWriterGeneric* twg =
+ dynamic_cast<apache::geode::client::ManagedTransactionWriterGeneric*>( writerPtr.get() );
+
+ if (twg != nullptr)
+ {
+ return (ITransactionWriter<TKey, TValue>^)twg->userptr( );
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ return nullptr;
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::SetWriter(ITransactionWriter<TKey, TValue>^ transactionWriter)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create a unmanaged object using the ManagedTransactionWriterGeneric.
+ // Set the generic object inside the TransactionWriterGeneric that is a non generic object
+ apache::geode::client::TransactionWriterPtr writerPtr;
+ if ( transactionWriter != nullptr )
+ {
+ TransactionWriterGeneric<TKey, TValue>^ twg = gcnew TransactionWriterGeneric<TKey, TValue> ();
+ twg->SetTransactionWriter(transactionWriter);
+ writerPtr = new apache::geode::client::ManagedTransactionWriterGeneric( transactionWriter );
+ ((apache::geode::client::ManagedTransactionWriterGeneric*)writerPtr.get())->setptr(twg);
+ }
+ m_nativeptr->getGCKeepAlive()->setWriter( writerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::AddListener(ITransactionListener<TKey, TValue>^ transactionListener)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create a unmanaged object using the ManagedTransactionListenerGeneric.
+ // Set the generic object inside the TransactionListenerGeneric that is a non generic object
+ apache::geode::client::TransactionListenerPtr listenerPtr;
+ if ( transactionListener != nullptr )
+ {
+ TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
+ twg->SetTransactionListener(transactionListener);
+ listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
+ ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
+ }
+ m_nativeptr->getGCKeepAlive()->addListener( listenerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ void CacheTransactionManager::RemoveListener(ITransactionListener<TKey, TValue>^ transactionListener)
+ {
+ _GF_MG_EXCEPTION_TRY2
+ // Create an unmanaged non generic object using the managed generic object
+ // use this to call the remove listener
+ apache::geode::client::TransactionListenerPtr listenerPtr;
+ if ( transactionListener != nullptr )
+ {
+ TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
+ twg->SetTransactionListener(transactionListener);
+ listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
+ ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
+ }
+ m_nativeptr->getGCKeepAlive()->removeListener( listenerPtr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+#endif
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheTransactionManager.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheTransactionManager.hpp b/clicache/src/CacheTransactionManager.hpp
new file mode 100644
index 0000000..07f6954
--- /dev/null
+++ b/clicache/src/CacheTransactionManager.hpp
@@ -0,0 +1,228 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheTransactionManager.hpp>
+#include <geode/InternalCacheTransactionManager2PC.hpp>
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
+#include "TransactionId.hpp"
+
+using namespace System;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+ /// <summary>
+ /// CacheTransactionManager encapsulates the transactions for a cache
+ /// </summary>
+ public ref class CacheTransactionManager sealed
+ {
+ public:
+ /// <summary>
+ /// Creates a new transaction and associates it with the current thread.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// Throws exception if the thread is already associated with a transaction
+ /// </exception>
+ void Begin();
+
+ /// <summary>
+ /// Prepare the first message of two-phase-commit transaction associated
+ /// with the current thread.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ /// <exception cref="CommitConflictException">
+ /// if the commit operation fails due to a write conflict.
+ /// </exception>
+ void Prepare();
+
+ /// <summary>
+ /// Commit the transaction associated with the current thread. If
+ /// the commit operation fails due to a conflict it will destroy
+ /// the transaction state and throw a <c>CommitConflictException</c>.
+ /// If the commit operation succeeds,it returns after the transaction
+ /// state has been merged with committed state. When this method
+ /// completes, the thread is no longer associated with a transaction.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ /// <exception cref="CommitConflictException">
+ /// if the commit operation fails due to a write conflict.
+ /// </exception>
+ void Commit();
+
+ /// <summary>
+ /// Roll back the transaction associated with the current thread. When
+ /// this method completes, the thread is no longer associated with a
+ /// transaction and the transaction context is destroyed.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// if the thread is not associated with a transaction
+ /// </exception>
+ void Rollback();
+
+ /// <summary>
+ /// Reports the existence of a Transaction for this thread
+ /// </summary>
+ /// <returns>true if a transaction exists, false otherwise</returns>
+ bool Exists();
+
+ /// <summary>
+ /// Suspends the transaction on the current thread. All subsequent operations
+ /// performed by this thread will be non-transactional. The suspended
+ /// transaction can be resumed by calling <see cref="TransactionId"/>
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <returns>the transaction identifier of the suspended transaction or null if
+ /// the thread was not associated with a transaction</returns>
+ Apache::Geode::Client::TransactionId^ Suspend();
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <exception cref="IllegalStateException">if the thread is associated with a transaction or if
+ /// would return false for the given transactionId</exception>
+ /// <see cref="TransactionId"/>
+ void Resume(Apache::Geode::Client::TransactionId^ transactionId);
+
+ /// <summary>
+ /// This method can be used to determine if a transaction with the given
+ /// transaction identifier is currently suspended locally. This method does not
+ /// check other members for transaction status.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId"></param>
+ /// <returns>true if the transaction is in suspended state, false otherwise</returns>
+ /// <see cref="TransactionId"/>
+ bool IsSuspended(Apache::Geode::Client::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>.
+ /// This method is equivalent to
+ /// <code>
+ /// if (isSuspended(txId)) {
+ /// resume(txId);
+ /// }
+ /// </code>
+ /// except that this action is performed atomically
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <returns>true if the transaction was resumed, false otherwise</returns>
+ bool TryResume(Apache::Geode::Client::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// On the current thread, resumes a transaction that was previously suspended
+ /// using <see cref="suspend"/>, or waits for the specified timeout interval if
+ /// the transaction has not been suspended. This method will return if:
+ /// <para>
+ /// Another thread suspends the transaction
+ /// </para>
+ /// <para>
+ /// Another thread calls commit/rollback on the transaction
+ /// </para>
+ /// <para>
+ /// This thread has waited for the specified timeout
+ /// </para>
+ /// This method returns immediately if <see cref="TransactionId"/> returns false.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the transaction to resume</param>
+ /// <param name="waitTimeInMilliSec">the maximum milliseconds to wait </param>
+ /// <returns>true if the transaction was resumed, false otherwise</returns>
+ bool TryResume(Apache::Geode::Client::TransactionId^ transactionId, System::Int32 waitTimeInMilliSec);
+
+
+
+ /// <summary>
+ /// Reports the existence of a transaction for the given transactionId. This
+ /// method can be used to determine if a transaction with the given transaction
+ /// identifier is currently in progress locally.
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <param name="transactionId">the given transaction identifier</param>
+ /// <returns>true if the transaction is in progress, false otherwise.</returns>
+ /// <see cref="isSuspended"/>
+ bool Exists(Apache::Geode::Client::TransactionId^ transactionId);
+
+
+ /// <summary>
+ /// Returns the transaction identifier for the current thread
+ /// <para>
+ /// Since 3.6.2
+ /// </para>
+ /// </summary>
+ /// <returns>the transaction identifier or null if no transaction exists</returns>
+ property Apache::Geode::Client::TransactionId^ TransactionId
+ {
+ //TODO::split
+ Apache::Geode::Client::TransactionId^ get( );
+ }
+
+ internal:
+
+ inline static CacheTransactionManager^ Create( native::InternalCacheTransactionManager2PCPtr nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew CacheTransactionManager( nativeptr ) : nullptr );
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheTransactionManager( native::InternalCacheTransactionManager2PCPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::InternalCacheTransactionManager2PC>(nativeptr);
+ }
+
+ native_shared_ptr<native::InternalCacheTransactionManager2PC>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheWriterAdapter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheWriterAdapter.hpp b/clicache/src/CacheWriterAdapter.hpp
new file mode 100644
index 0000000..47cb717
--- /dev/null
+++ b/clicache/src/CacheWriterAdapter.hpp
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ICacheWriter.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ICacheWriter</c>
+ /// with empty implementations. Applications can subclass this class
+ /// and only override the methods for the events of interest.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class CacheWriterAdapter
+ : public ICacheWriter<TKey, TValue>
+ {
+ public:
+ virtual bool BeforeUpdate(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeCreate(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeDestroy(EntryEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeRegionDestroy(RegionEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual bool BeforeRegionClear(RegionEvent<TKey, TValue>^ ev)
+ {
+ return true;
+ }
+
+ virtual void Close(IRegion<TKey, TValue>^ region)
+ {
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableArrayList.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableArrayList.hpp b/clicache/src/CacheableArrayList.hpp
new file mode 100644
index 0000000..adc26a3
--- /dev/null
+++ b/clicache/src/CacheableArrayList.hpp
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "CacheableVector.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>IGeodeSerializable</c> vector wrapper that can serve as
+ /// a distributable object for caching. This class extends .NET generic
+ /// <c>List</c> class.
+ /// </summary>
+ ref class CacheableArrayList
+ : public CacheableVector
+ {
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableArrayList(System::Collections::IList^ list)
+ : CacheableVector(list)
+ { }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableArrayList^ Create()
+ {
+ return gcnew CacheableArrayList(gcnew System::Collections::Generic::List<Object^>());
+ }
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableArrayList^ Create(System::Collections::IList^ list)
+ {
+ return gcnew CacheableArrayList(list);
+ }
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return GeodeClassIds::CacheableArrayList;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableArrayList(gcnew System::Collections::Generic::List<Object^>());
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableBuiltins.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableBuiltins.hpp b/clicache/src/CacheableBuiltins.hpp
new file mode 100644
index 0000000..ce96b61
--- /dev/null
+++ b/clicache/src/CacheableBuiltins.hpp
@@ -0,0 +1,603 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
+#include "CacheableKey.hpp"
+#include "Serializable.hpp"
+#include "ExceptionTypes.hpp"
+#include "GeodeClassIds.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+
+ /// <summary>
+ /// An immutable template wrapper for C++ <c>CacheableKey</c>s that can
+ /// serve as a distributable key object for caching.
+ /// </summary>
+ template <typename TNative, typename TManaged, System::UInt32 TYPEID>
+ ref class CacheableBuiltinKey
+ : public CacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new instance
+ /// </summary>
+ CacheableBuiltinKey()
+ {
+ auto nativeptr = TNative::create();
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
+ }
+
+ /// <summary>
+ /// Allocates a new instance with the given value.
+ /// </summary>
+ /// <param name="value">the value of the new instance</param>
+ CacheableBuiltinKey(TManaged value)
+ {
+ auto nativeptr = TNative::create(value);
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return TYPEID;
+ }
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// This returns the string for the <c>Value</c> property.
+ /// </summary>
+ virtual String^ ToString() override
+ {
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->value().ToString();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// native object.
+ /// </summary>
+ virtual bool Equals(CacheableBuiltinKey^ other) override
+ {
+ if (other == nullptr)
+ {
+ return false;
+ }
+
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->operator==(
+ *static_cast<TNative*>(other->m_nativeptr->get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(other->m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// It invokes the '==' operator of the underlying
+ /// native object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override
+ {
+ return Equals(dynamic_cast<CacheableBuiltinKey^>(obj));
+ }
+
+ /// <summary>
+ /// Comparison operator against another value.
+ /// </summary>
+ bool operator == (TManaged other)
+ {
+ try
+ {
+ return (static_cast<TNative*>(m_nativeptr->get())->value() == other);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+ /// <summary>
+ /// Gets the value.
+ /// </summary>
+ property TManaged Value
+ {
+ inline TManaged get()
+ {
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->value();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+ }
+
+ protected:
+
+ /// <summary>
+ /// Protected constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableBuiltinKey(native::SerializablePtr nativeptr)
+ : CacheableKey(nativeptr) { }
+ };
+
+
+ /// <summary>
+ /// An immutable template array wrapper that can serve as a
+ /// distributable object for caching.
+ /// </summary>
+ template <typename TNative, typename TNativePtr, typename TManaged,
+ System::UInt32 TYPEID>
+ ref class CacheableBuiltinArray
+ : public Serializable
+ {
+ public:
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get() override
+ {
+ return TYPEID;
+ }
+ }
+
+ virtual void ToData(DataOutput^ output) override
+ {
+ output->WriteObject(m_value);
+ }
+
+ virtual IGeodeSerializable^ FromData(DataInput^ input) override
+ {
+ input->ReadObject(m_value);
+ return this;
+ }
+
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get() override
+ {
+ return (System::UInt32)(m_value->Length) * sizeof(TManaged);
+ }
+ }
+ /// <summary>
+ /// Returns a copy of the underlying array.
+ /// </summary>
+ property array<TManaged>^ Value
+ {
+ inline array<TManaged>^ get()
+ {
+ return m_value;
+ }
+ }
+
+ /// <summary>
+ /// Returns the size of this array.
+ /// </summary>
+ property System::Int32 Length
+ {
+ inline System::Int32 get()
+ {
+ return m_value->Length;
+ }
+ }
+
+ virtual String^ ToString() override
+ {
+ return m_value->ToString();
+ }
+
+ /// <summary>
+ /// Returns the value at the given index.
+ /// </summary>
+ property TManaged GFINDEXER(System::Int32)
+ {
+ inline TManaged get(System::Int32 index)
+ {
+ return m_value[index];
+ }
+ }
+
+
+ protected:
+
+ array<TManaged>^ m_value;
+ /// <summary>
+ /// Protected constructor
+ /// </summary>
+ inline CacheableBuiltinArray()
+ {
+ //TODO:
+ //native::Serializable* sp = TNative::createDeserializable();
+ //SetSP(sp);
+ }
+
+ /// <summary>
+ /// Protected constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline CacheableBuiltinArray(native::SerializablePtr nptr)
+ : Serializable(nptr)
+ {
+ auto nativeptr = std::static_pointer_cast<TNative>(nptr);
+ System::Int32 len = nativeptr->length();
+ if (len > 0)
+ {
+ array<TManaged>^ buffer = gcnew array<TManaged>(len);
+ pin_ptr<TManaged> pin_buffer = &buffer[0];
+
+ memcpy((void*)pin_buffer, nativeptr->value(),
+ len * sizeof(TManaged));
+ m_value = buffer;
+ }
+ }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given array.
+ /// </summary>
+ /// <remarks>
+ /// This method performs no argument checking which is the
+ /// responsibility of the caller.
+ /// </remarks>
+ /// <param name="buffer">the array to copy from</param>
+ CacheableBuiltinArray(array<TManaged>^ buffer)
+ {
+ m_value = buffer;
+ //setting local value as well
+ //m_value = gcnew array<TManaged>(buffer->Length);
+ //System::Array::Copy(buffer, 0, m_value,0, buffer->Length);
+ }
+
+ /// <summary>
+ /// Allocates a new instance copying given length from the
+ /// start of given array.
+ /// </summary>
+ /// <remarks>
+ /// This method performs no argument checking which is the
+ /// responsibility of the caller.
+ /// </remarks>
+ /// <param name="buffer">the array to copy from</param>
+ /// <param name="length">length of array from start to copy</param>
+ CacheableBuiltinArray(array<TManaged>^ buffer, System::Int32 length)
+ {
+ //TODO:
+ if (length > buffer->Length) {
+ length = buffer->Length;
+ }
+ //setting local value as well
+ m_value = gcnew array<TManaged>(length);
+ System::Array::Copy(buffer, 0, m_value, 0, length);
+ }
+ };
+
+
+
+
+ //n = native type
+ //m = CacheableInt(managed cacheable)
+ //mt = managed type(bool, int)
+#define _GFCLI_CACHEABLE_KEY_DEF_NEW(n, m, mt) \
+ ref class m : public CacheableBuiltinKey<n, mt, \
+ GeodeClassIds::m> \
+ { \
+ public: \
+ /** <summary>
+ * Allocates a new instance with the given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline m() \
+ : CacheableBuiltinKey() { } \
+ /** <summary>
+ * Allocates a new instance with the given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline m(mt value) \
+ : CacheableBuiltinKey(value) { } \
+ /** <summary>
+ * Static function to create a new instance given value.
+ * </summary>
+ * <param name="value">the value of the new instance</param>
+ */ \
+ inline static m^ Create(mt value) \
+ { \
+ return gcnew m(value); \
+ } \
+ /** <summary>
+ * Explicit conversion operator to contained value type.
+ * </summary>
+ */ \
+ inline static explicit operator mt (m^ value) \
+ { \
+ return value->Value; \
+ } \
+ \
+ /** <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGeodeSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGeodeSerializable^ Create(native::SerializablePtr obj) \
+ { \
+ return (obj != nullptr ? gcnew m(obj) : nullptr); \
+ } \
+ \
+ private: \
+ inline m(native::SerializablePtr nativeptr) \
+ : CacheableBuiltinKey(nativeptr) { } \
+ };
+
+
+#define _GFCLI_CACHEABLE_ARRAY_DEF_NEW(m, mt) \
+ ref class m : public CacheableBuiltinArray< \
+ native::m, native::m##Ptr, mt, GeodeClassIds::m> \
+ { \
+ public: \
+ /** <summary>
+ * Static function to create a new instance copying
+ * from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline static m^ Create(array<mt>^ value) \
+ { \
+ return (value != nullptr /*&& value->Length > 0*/ ? \
+ gcnew m(value) : nullptr); \
+ } \
+ /** <summary>
+ * Static function to create a new instance copying
+ * from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline static m^ Create(array<mt>^ value, System::Int32 length) \
+ { \
+ return (value != nullptr && value->Length > 0 ? \
+ gcnew m(value, length) : nullptr); \
+ } \
+ /** <summary>
+ * Explicit conversion operator to contained array type.
+ * </summary>
+ */ \
+ inline static explicit operator array<mt> ^ (m^ value) \
+ { \
+ return (value != nullptr ? value->Value : nullptr); \
+ } \
+ \
+ /** <summary>
+ * Factory function to register this class.
+ * </summary>
+ */ \
+ static IGeodeSerializable^ CreateDeserializable() \
+ { \
+ return gcnew m(); \
+ } \
+ \
+ internal: \
+ static IGeodeSerializable^ Create(native::SerializablePtr obj) \
+ { \
+ return (obj != nullptr ? gcnew m(obj) : nullptr); \
+ } \
+ \
+ private: \
+ /** <summary>
+ * Allocates a new instance
+ * </summary>
+ */ \
+ inline m() \
+ : CacheableBuiltinArray() { } \
+ /** <summary>
+ * Allocates a new instance copying from the given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline m(array<mt>^ value) \
+ : CacheableBuiltinArray(value) { } \
+ /** <summary>
+ * Allocates a new instance copying given length from the
+ * start of given array.
+ * </summary>
+ * <remarks>
+ * Providing a null or zero size array will return a null object.
+ * </remarks>
+ * <param name="value">the array to create the new instance</param>
+ */ \
+ inline m(array<mt>^ value, System::Int32 length) \
+ : CacheableBuiltinArray(value, length) { } \
+ inline m(native::SerializablePtr nativeptr) \
+ : CacheableBuiltinArray(nativeptr) { } \
+ };
+
+
+ // Built-in CacheableKeys
+
+ /// <summary>
+ /// An immutable wrapper for booleans that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableBoolean,
+ CacheableBoolean, bool);
+
+ /// <summary>
+ /// An immutable wrapper for bytes that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableByte,
+ CacheableByte, Byte);
+
+ /// <summary>
+ /// An immutable wrapper for 16-bit characters that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableWideChar,
+ CacheableCharacter, Char);
+
+ /// <summary>
+ /// An immutable wrapper for doubles that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableDouble,
+ CacheableDouble, Double);
+
+ /// <summary>
+ /// An immutable wrapper for floats that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableFloat,
+ CacheableFloat, Single);
+
+ /// <summary>
+ /// An immutable wrapper for 16-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt16,
+ CacheableInt16, System::Int16);
+
+ /// <summary>
+ /// An immutable wrapper for 32-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt32,
+ CacheableInt32, System::Int32);
+
+ /// <summary>
+ /// An immutable wrapper for 64-bit integers that can serve
+ /// as a distributable key object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt64,
+ CacheableInt64, System::Int64);
+
+
+ // Built-in Cacheable array types
+
+ /// <summary>
+ /// An immutable wrapper for byte arrays that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableBytes, Byte);
+
+ /// <summary>
+ /// An immutable wrapper for array of doubles that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableDoubleArray, Double);
+
+ /// <summary>
+ /// An immutable wrapper for array of floats that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableFloatArray, Single);
+
+ /// <summary>
+ /// An immutable wrapper for array of 16-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt16Array, System::Int16);
+
+ /// <summary>
+ /// An immutable wrapper for array of 32-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt32Array, System::Int32);
+
+ /// <summary>
+ /// An immutable wrapper for array of 64-bit integers that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CacheableInt64Array, System::Int64);
+
+ /// <summary>
+ /// An immutable wrapper for array of booleans that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(BooleanArray, bool);
+
+ /// <summary>
+ /// An immutable wrapper for array of 16-bit characters that can serve
+ /// as a distributable object for caching.
+ /// </summary>
+ _GFCLI_CACHEABLE_ARRAY_DEF_NEW(CharArray, Char);
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableDate.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableDate.cpp b/clicache/src/CacheableDate.cpp
new file mode 100644
index 0000000..824b16c
--- /dev/null
+++ b/clicache/src/CacheableDate.cpp
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+#include "CacheableDate.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+#include "Log.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ CacheableDate::CacheableDate(DateTime dateTime)
+ : m_dateTime(dateTime), m_hashcode(0)
+ {
+
+ // Round off dateTime to the nearest millisecond.
+ System::Int64 ticksToAdd = m_dateTime.Ticks % TimeSpan::TicksPerMillisecond;
+ ticksToAdd = (ticksToAdd >= (TimeSpan::TicksPerMillisecond / 2) ?
+ (TimeSpan::TicksPerMillisecond - ticksToAdd) : -ticksToAdd);
+ m_dateTime = m_dateTime.AddTicks(ticksToAdd);
+
+ }
+
+ void CacheableDate::ToData(DataOutput^ output)
+ {
+ //put as universal time
+ TimeSpan epochSpan = m_dateTime.ToUniversalTime() - EpochTime;
+ System::Int64 millisSinceEpoch =
+ epochSpan.Ticks / TimeSpan::TicksPerMillisecond;
+ output->WriteInt64(millisSinceEpoch);
+
+ //Log::Fine("CacheableDate::Todata time " + m_dateTime.Ticks);
+ }
+
+ IGeodeSerializable^ CacheableDate::FromData(DataInput^ input)
+ {
+ DateTime epochTime = EpochTime;
+ System::Int64 millisSinceEpoch = input->ReadInt64();
+ m_dateTime = epochTime.AddTicks(
+ millisSinceEpoch * TimeSpan::TicksPerMillisecond);
+ m_dateTime = m_dateTime.ToLocalTime();
+ //Log::Fine("CacheableDate::Fromadata time " + m_dateTime.Ticks);
+ return this;
+ }
+
+ System::UInt32 CacheableDate::ObjectSize::get()
+ {
+ return (System::UInt32)sizeof(DateTime);
+ }
+
+ System::UInt32 CacheableDate::ClassId::get()
+ {
+ return GeodeClassIds::CacheableDate;
+ }
+
+ String^ CacheableDate::ToString()
+ {
+ return m_dateTime.ToString(
+ System::Globalization::CultureInfo::CurrentCulture);
+ }
+
+ System::Int32 CacheableDate::GetHashCode()
+ {
+ if (m_hashcode == 0) {
+ TimeSpan epochSpan = m_dateTime - EpochTime;
+ System::Int64 millitime =
+ epochSpan.Ticks / TimeSpan::TicksPerMillisecond;
+ m_hashcode = (int)millitime ^ (int)((System::Int64)millitime >> 32);
+ }
+ return m_hashcode;
+ }
+
+ bool CacheableDate::Equals(ICacheableKey^ other)
+ {
+ if (other == nullptr ||
+ other->ClassId != GeodeClassIds::CacheableDate) {
+ return false;
+ }
+ return m_dateTime.Equals(static_cast<CacheableDate^>(
+ other)->m_dateTime);
+ }
+
+ bool CacheableDate::Equals(Object^ obj)
+ {
+ CacheableDate^ otherDate =
+ dynamic_cast<CacheableDate^>(obj);
+
+ if (otherDate != nullptr) {
+ return (m_dateTime == otherDate->m_dateTime);
+ }
+ return false;
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+} //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableDate.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableDate.hpp b/clicache/src/CacheableDate.hpp
new file mode 100644
index 0000000..9530ef2
--- /dev/null
+++ b/clicache/src/CacheableDate.hpp
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ICacheableKey.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An immutable date wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ public ref class CacheableDate
+ : public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Allocates a new default instance.
+ /// </summary>
+ inline CacheableDate()
+ { }
+
+ /// <summary>
+ /// Initializes a new instance of the <c>CacheableDate</c> to the
+ /// given <c>System.DateTime</c> value.
+ /// </summary>
+ /// <param name="dateTime">
+ /// A <c>System.DateTime</c> value to initialize this instance.
+ /// </param>
+ CacheableDate(DateTime dateTime);
+
+ /// <summary>
+ /// Static function that returns a new default instance.
+ /// </summary>
+ inline static CacheableDate^ Create()
+ {
+ return gcnew CacheableDate();
+ }
+
+ /// <summary>
+ /// Static function that returns a new instance initialized to the
+ /// given <c>System.DateTime</c> value.
+ /// </summary>
+ inline static CacheableDate^ Create(DateTime dateTime)
+ {
+ return gcnew CacheableDate(dateTime);
+ }
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// </summary>
+ virtual String^ ToString() override;
+
+ // End Region: IGeodeSerializable Members
+
+
+ // Region: ICacheableKey Members
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // End Region: ICacheableKey Members
+
+ /// <summary>
+ /// Gets the <c>System.DateTime</c> value.
+ /// </summary>
+ property DateTime Value
+ {
+ inline DateTime get()
+ {
+ return m_dateTime;
+ }
+ }
+
+ /// <summary>
+ /// <c>DataTime</c> value since 1/1/1970
+ /// </summary>
+ static initonly DateTime EpochTime = DateTime(1970, 1, 1,
+ 0, 0, 0, DateTimeKind::Utc);
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableDate();
+ }
+
+ private:
+ DateTime m_dateTime;
+ int m_hashcode;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableFileName.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableFileName.cpp b/clicache/src/CacheableFileName.cpp
new file mode 100644
index 0000000..fb3cb10
--- /dev/null
+++ b/clicache/src/CacheableFileName.cpp
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+
+
+
+//#include "geode_includes.hpp"
+#include "CacheableFileName.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "GeodeClassIds.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void CacheableFileName::ToData(DataOutput^ output)
+ {
+ if (m_str->Length <= 0xFFFF) {
+ output->WriteByte(apache::geode::client::GeodeTypeIds::CacheableString);
+ output->WriteUTF(m_str);
+ }
+ else {
+ output->WriteByte(apache::geode::client::GeodeTypeIds::CacheableStringHuge);
+ output->WriteUTFHuge(m_str);
+ }
+ }
+
+ IGeodeSerializable^ CacheableFileName::FromData(DataInput^ input)
+ {
+ unsigned char filetype = input->ReadByte();
+ if (filetype == apache::geode::client::GeodeTypeIds::CacheableString) {
+ m_str = input->ReadUTF();
+ }
+ else {
+ m_str = input->ReadUTFHuge();
+ }
+ return this;
+ }
+
+ System::UInt32 CacheableFileName::ClassId::get()
+ {
+ return GeodeClassIds::CacheableFileName;
+ }
+
+ System::UInt32 CacheableFileName::ObjectSize::get()
+ {
+ return (System::UInt32)(m_str->Length * sizeof(char));
+ }
+
+ System::Int32 CacheableFileName::GetHashCode()
+ {
+ if (m_str->IsNullOrEmpty(m_str)) {
+ return 0;
+ }
+ if (m_hashcode == 0) {
+ int localHashcode = 0;
+ System::UInt32 prime = 31;
+
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(m_str);
+ for (System::Int32 i = 0; i < m_str->Length; i++) {
+ localHashcode = prime*localHashcode + Char::ToLower(pin_value[i]);
+ }
+ m_hashcode = localHashcode ^ 1234321;
+ }
+ return m_hashcode;
+ }
+
+ bool CacheableFileName::Equals(ICacheableKey^ other)
+ {
+ if (other == nullptr ||
+ other->ClassId != GeodeClassIds::CacheableFileName) {
+ return false;
+ }
+ return (m_str == static_cast<CacheableFileName^>(other)->m_str);
+ }
+
+ bool CacheableFileName::Equals(Object^ obj)
+ {
+ CacheableFileName^ otherFileName =
+ dynamic_cast<CacheableFileName^>(obj);
+
+ if (otherFileName != nullptr) {
+ return (m_str == otherFileName->m_str);
+ }
+ return false;
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+} //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableFileName.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableFileName.hpp b/clicache/src/CacheableFileName.hpp
new file mode 100644
index 0000000..bb1279e
--- /dev/null
+++ b/clicache/src/CacheableFileName.hpp
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "ICacheableKey.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An immutable filename wrapper that can serve as a distributable
+ /// key object for caching as well as being a string value.
+ /// </summary>
+ public ref class CacheableFileName
+ : public ICacheableKey
+ {
+ public:
+ /// <summary>
+ /// Static function to create a new instance from the given string.
+ /// </summary>
+ inline static CacheableFileName^ Create(String^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableFileName(value) : nullptr);
+ }
+
+ /// <summary>
+ /// Static function to create a new instance from the
+ /// given character array.
+ /// </summary>
+ inline static CacheableFileName^ Create(array<Char>^ value)
+ {
+ return (value != nullptr && value->Length > 0 ?
+ gcnew CacheableFileName(value) : nullptr);
+ }
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Return a string representation of the object.
+ /// This returns the same string as <c>Value</c> property.
+ /// </summary>
+ virtual String^ ToString() override
+ {
+ return m_str;
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ // Region: ICacheableKey Members
+
+ /// <summary>
+ /// Return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 GetHashCode() override;
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(ICacheableKey^ other);
+
+ /// <summary>
+ /// Return true if this key matches other object.
+ /// </summary>
+ virtual bool Equals(Object^ obj) override;
+
+ // End Region: ICacheableKey Members
+
+ /// <summary>
+ /// Gets the string value.
+ /// </summary>
+ property String^ Value
+ {
+ inline String^ get()
+ {
+ return m_str;
+ }
+ }
+
+ internal:
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableFileName((String^)nullptr);
+ }
+
+ private:
+ /// <summary>
+ /// Allocates a new instance from the given string.
+ /// </summary>
+ inline CacheableFileName(String^ value)
+ : m_str(value == nullptr ? String::Empty : value),m_hashcode(0) { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given character array.
+ /// </summary>
+ inline CacheableFileName(array<Char>^ value)
+ : m_str(gcnew String(value)),m_hashcode(0) { }
+
+ String^ m_str;
+ int m_hashcode;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableHashMap.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableHashMap.cpp b/clicache/src/CacheableHashMap.cpp
new file mode 100644
index 0000000..a4c96e0
--- /dev/null
+++ b/clicache/src/CacheableHashMap.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "CacheableHashMap.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // Region: IGeodeSerializable Members
+
+ void Client::CacheableHashMap::ToData(DataOutput^ output)
+ {
+ output->WriteDictionary((System::Collections::IDictionary^)m_dictionary);
+ }
+
+ IGeodeSerializable^ Client::CacheableHashMap::FromData(DataInput^ input)
+ {
+ m_dictionary = input->ReadDictionary();
+ return this;
+ }
+
+ System::UInt32 Client::CacheableHashMap::ObjectSize::get()
+ {
+ return ((System::Collections::IDictionary^)m_dictionary)->Count;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/CacheableHashMap.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/CacheableHashMap.hpp b/clicache/src/CacheableHashMap.hpp
new file mode 100644
index 0000000..6d64461
--- /dev/null
+++ b/clicache/src/CacheableHashMap.hpp
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IGeodeSerializable.hpp"
+#include "ICacheableKey.hpp"
+#include "GeodeClassIds.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// A mutable <c>ICacheableKey</c> to <c>IGeodeSerializable</c> hash map
+ /// that can serve as a distributable object for caching. This class
+ /// extends .NET generic <c>Dictionary</c> class.
+ /// </summary>
+ ref class CacheableHashMap
+ : public IGeodeSerializable
+ {
+ protected:
+ Object^ m_dictionary;
+ public:
+ /// <summary>
+ /// Allocates a new empty instance.
+ /// </summary>
+ inline CacheableHashMap()
+ { }
+
+ /// <summary>
+ /// Allocates a new instance copying from the given dictionary.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary whose elements are copied to this HashMap.
+ /// </param>
+ inline CacheableHashMap(Object^ dictionary)
+ {
+ m_dictionary = dictionary;
+ }
+
+
+ /// <summary>
+ /// Static function to create a new empty instance.
+ /// </summary>
+ inline static CacheableHashMap^ Create()
+ {
+ return gcnew CacheableHashMap();
+ }
+
+ /// <summary>
+ /// Static function to create a new instance copying from the
+ /// given dictionary.
+ /// </summary>
+ inline static CacheableHashMap^ Create(Object^ dictionary)
+ {
+ return gcnew CacheableHashMap(dictionary);
+ }
+
+
+ // Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Serializes this object.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput object to use for serializing the object
+ /// </param>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading the object data
+ /// </param>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ /// <returns>the classId</returns>
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ return GeodeClassIds::CacheableHashMap;
+ }
+ }
+
+ property Object^ Value
+ {
+ Object^ get()
+ {
+ return m_dictionary;
+ }
+ }
+
+ // End Region: IGeodeSerializable Members
+
+ /// <summary>
+ /// Factory function to register this class.
+ /// </summary>
+ static IGeodeSerializable^ CreateDeserializable()
+ {
+ return gcnew CacheableHashMap();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[26/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfig_SG.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfig_SG.xml b/clicache/integration-test/regionquery_diffconfig_SG.xml
new file mode 100644
index 0000000..0f1595d
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfig_SG.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1">
+ <group>ServerGroup1</group>
+ </cache-server>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/remotequery.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/remotequery.xml b/clicache/integration-test/remotequery.xml
new file mode 100644
index 0000000..c1bb4ca
--- /dev/null
+++ b/clicache/integration-test/remotequery.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1" />
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+
+ <!-- making sub-regions -->
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ </region>
+ </region>
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/remotequery2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/remotequery2.xml b/clicache/integration-test/remotequery2.xml
new file mode 100644
index 0000000..cd9090c
--- /dev/null
+++ b/clicache/integration-test/remotequery2.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24681" /-->
+ <cache-server port="HOST_PORT2" />
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+
+ <!-- making sub-regions -->
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ </region>
+ </region>
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/remotequeryN.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/remotequeryN.xml b/clicache/integration-test/remotequeryN.xml
new file mode 100644
index 0000000..c44bd2c
--- /dev/null
+++ b/clicache/integration-test/remotequeryN.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1" />
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+
+ <!-- making sub-regions -->
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ </region>
+ </region>
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/serverDurableClient.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/serverDurableClient.xml b/clicache/integration-test/serverDurableClient.xml
new file mode 100644
index 0000000..709209f
--- /dev/null
+++ b/clicache/integration-test/serverDurableClient.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- serverDurableClient.xml
+ Configures a server to for clients at port 40404.
+-->
+
+<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 port="40404"/>
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/system.properties
----------------------------------------------------------------------
diff --git a/clicache/integration-test/system.properties b/clicache/integration-test/system.properties
new file mode 100644
index 0000000..0ffddef
--- /dev/null
+++ b/clicache/integration-test/system.properties
@@ -0,0 +1,33 @@
+# 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.
+# All the configurable parameters.
+statistic-sample-rate=700
+statistic-sampling-enabled=false
+statistic-archive-file=stats.gfs
+log-file=gfcpp.log
+log-level=debug
+name=system
+cache-xml-file=cache.xml
+log-file-size-limit=1024000000
+archive-file-size-limit=1024000000
+ping-interval=123
+connect-timeout=345
+redundancy-monitor-interval=456
+heap-lru-limit=123
+heap-lru-delta=45
+notify-ack-interval=1234
+notify-dupcheck-life=5678
+on-client-disconnect-clear-pdxType-Ids=true
+read-timeout-unit-in-millis=true
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/test.bat.in
----------------------------------------------------------------------
diff --git a/clicache/integration-test/test.bat.in b/clicache/integration-test/test.bat.in
new file mode 100644
index 0000000..e306603
--- /dev/null
+++ b/clicache/integration-test/test.bat.in
@@ -0,0 +1,65 @@
+@echo off
+
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+setlocal
+
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:Apache.Geode>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:framework>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:testobject>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:SqLiteImpl>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:cryptoImpl>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:DHImpl>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:securityImpl>>;%PATH%
+set PATH=$<SHELL_PATH:$<TARGET_LINKER_FILE_DIR:PkcsWrapper>>;%PATH%
+set PATH=$<JOIN:$<SHELL_PATH:${PATH}>,;>;%PATH%
+
+set PATH=c:\Program Files (x86)\Nunit 2.6.4\bin;%PATH%
+
+set TEST_DIR="$<SHELL_PATH:${TEST_DIR}>"
+set GFCPP="%TEST_DIR%"
+
+set TESTSRC=$<SHELL_PATH:${CMAKE_CURRENT_SOURCE_DIR}>
+set GF_JAVA=$<SHELL_PATH:${Java_JAVA_EXECUTABLE}>
+set GFJAVA=$<SHELL_PATH:${Geode_PATH}>
+set GFE_LOGLEVEL=config
+set GFE_SECLOGLEVEL=config
+set GFE_DIR=$<SHELL_PATH:${Geode_PATH}>
+set MCAST_ADDR=224.10.13.63
+set MCAST_PORT=${PORT}
+set TIMEBOMB=3600
+set GF_CLASSPATH=%GF_CLASSPATH%;$<SHELL_PATH:${CMAKE_BINARY_DIR}>\tests\javaobject\javaobject.jar
+set PROFILERCMD=
+set BUG481=
+set TESTNAME=${TEST}
+set LOG=${TEST}.log
+
+rmdir /q /s "%TEST_DIR%" 2>nul
+mkdir "%TEST_DIR%"
+if %errorlevel% neq 0 exit /b %errorlevel%
+pushd "%TEST_DIR%"
+if %errorlevel% neq 0 exit /b %errorlevel%
+
+rem In Windows, pipes to tee return tee's exit code instead of executable's
+rem exit code. As a workaround we write exit codes to files.
+
+(${NUNIT_CONSOLE} /run:${NAMESPACE}.${TESTCLASS} ..\..\$<CONFIG>\UnitTests.dll 2>&1 && echo 0 >${TEST}.errorlevel || echo 1 >${TEST}.errorlevel) | tee %LOG%
+
+set /p errorlevel= <${TEST}.errorlevel
+if %errorlevel% neq 0 exit /b %errorlevel%
+
+popd
+exit /b
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_cache.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_cache.xml b/clicache/integration-test/valid_cache.xml
new file mode 100644
index 0000000..7680c10
--- /dev/null
+++ b/clicache/integration-test/valid_cache.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+
+
+ <region name="SubRegion1">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52">
+ </region-attributes>
+ </region>
+
+ </root-region>
+
+
+ <root-region name= "Root2">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16" >
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </region-idle-time>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+
+ <region name="SubRegion21">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+ </region>
+
+ <region name="SubRegion22">
+ <region name="SubSubRegion221">
+ </region>
+ </region>
+
+ </root-region>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_cache_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_cache_pool.xml b/clicache/integration-test/valid_cache_pool.xml
new file mode 100644
index 0000000..ae84754
--- /dev/null
+++ b/clicache/integration-test/valid_cache_pool.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+ <pdx ignore-unread-fields="true" />
+ <root-region name = "Root1" >
+ <region-attributes caching-enabled="true" pool-name="test_pool_1" />
+
+ <region name="SubRegion1">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </region>
+
+ </root-region>
+
+ <root-region name= "Root2">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </root-region>
+
+ <pool
+ free-connection-timeout = "12345"
+ idle-timeout = "5555"
+ load-conditioning-interval = "23456"
+ max-connections = "7"
+ min-connections = "3"
+ name = "test_pool_1"
+ ping-interval = "12345"
+ update-locator-list-interval="250001"
+ read-timeout = "23456"
+ retry-attempts = "3"
+ server-group = "ServerGroup1"
+ socket-buffer-size = "32768"
+ statistic-interval = "10123"
+ subscription-ack-interval = "567"
+ subscription-enabled = "true"
+ subscription-message-tracking-timeout = "900123"
+ subscription-redundancy = "0"
+ thread-local-connections = "5"
+ pr-single-hop-enabled="true"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ <!--locator host="localhost" port="34757" /-->
+ </pool>
+
+ <pool
+ free-connection-timeout = "23456"
+ idle-timeout = "6666"
+ load-conditioning-interval = "34567"
+ max-connections = "8"
+ min-connections = "2"
+ name = "test_pool_2"
+ ping-interval = "23456"
+ read-timeout = "34567"
+ retry-attempts = "5"
+ server-group = "ServerGroup2"
+ socket-buffer-size = "65536"
+ statistic-interval = "20345"
+ subscription-ack-interval = "678"
+ subscription-enabled = "false"
+ subscription-message-tracking-timeout = "800222"
+ subscription-redundancy = "1"
+ thread-local-connections = "3"
+ pr-single-hop-enabled="false"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ </pool>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_cache_refid.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_cache_refid.xml b/clicache/integration-test/valid_cache_refid.xml
new file mode 100644
index 0000000..e9bc134
--- /dev/null
+++ b/clicache/integration-test/valid_cache_refid.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes id="root1" scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+
+
+ <region name="SubRegion1">
+ <region-attributes id="sub1" scope="local" caching-enabled="true" initial-capacity="23" load-factor=".89" concurrency-level="52">
+ </region-attributes>
+
+ <region name="SubRegion11">
+ <region-attributes id="sub11" refid="sub1" initial-capacity="10" />
+ </region>
+ </region>
+
+ <region name="SubRegion2">
+ <region-attributes refid="sub11" />
+ </region>
+
+ </root-region>
+
+
+ <root-region name= "Root2">
+ <region-attributes refid="root1" concurrency-level="16" >
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </region-idle-time>
+ </region-attributes>
+
+ <region name="SubRegion21">
+ <region-attributes refid="sub11">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+ </region>
+
+ </root-region>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_cache_region_refid.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_cache_region_refid.xml b/clicache/integration-test/valid_cache_region_refid.xml
new file mode 100644
index 0000000..74a0cfe
--- /dev/null
+++ b/clicache/integration-test/valid_cache_region_refid.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes id="root1" scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+
+
+ <region name="SubRegion1">
+ <region-attributes id="sub1" scope="local" caching-enabled="true" initial-capacity="23" load-factor=".89" concurrency-level="52">
+ </region-attributes>
+
+ <region name="SubRegion11" refid="sub1">
+ <region-attributes id="sub11" initial-capacity="10" />
+ </region>
+ </region>
+
+ <region name="SubRegion2" refid="sub11">
+ </region>
+
+ </root-region>
+
+
+ <root-region name= "Root2" refid="root1">
+ <region-attributes concurrency-level="16" >
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </region-idle-time>
+ </region-attributes>
+
+ <region name="SubRegion21" refid="sub1">
+ <region-attributes refid="sub11">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+ </region>
+ </root-region>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_declarative_cache_creation.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_declarative_cache_creation.xml b/clicache/integration-test/valid_declarative_cache_creation.xml
new file mode 100644
index 0000000..0f239f1
--- /dev/null
+++ b/clicache/integration-test/valid_declarative_cache_creation.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+<!-- xml with region-attribute having only child elements no attributes. refer to Ticket #775 -->
+ <root-region name= "Root1">
+ <region-attributes >
+ <cache-loader library-name="unit_test_callbacks" library-function-name="createCacheLoader" />
+ <cache-listener library-name="unit_test_callbacks" library-function-name="createCacheListener" />
+ <cache-writer library-name="unit_test_callbacks" library-function-name="createCacheWriter" />
+ </region-attributes >
+ </root-region>
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_lruExpiration.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_lruExpiration.xml b/clicache/integration-test/valid_lruExpiration.xml
new file mode 100644
index 0000000..dae8aad
--- /dev/null
+++ b/clicache/integration-test/valid_lruExpiration.xml
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+<root-region name = "R1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "0">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R2" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="2" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="4" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R20" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "0">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="2" action="local-invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="4" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R21" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R4" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R40" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="5" action="local-invalidate"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R5" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R8" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="10" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R12" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R13" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R15" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R16" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "5">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="5" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ </region-attributes>
+ </root-region>
+<root-region name = "R18" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "4" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="4" action="local-invalidate"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxFileSize" value="32500"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+ </root-region>
+<root-region name = "R19" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "4" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="4" action="destroy"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxFileSize" value="32500"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+ </root-region>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/valid_overflowAttr.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/valid_overflowAttr.xml b/clicache/integration-test/valid_overflowAttr.xml
new file mode 100644
index 0000000..0f40e2e
--- /dev/null
+++ b/clicache/integration-test/valid_overflowAttr.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion11">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ <region name="SubRegion12">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ </root-region>
+
+
+ <root-region name= "Root2">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16" lru-entries-limit = "35" disk-policy="overflows" >
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </region-time-to-live>
+ <region-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </region-idle-time>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="destroy"/>
+ </entry-time-to-live>
+ <entry-idle-time>
+ <expiration-attributes timeout="0" action="invalidate"/>
+ </entry-idle-time>
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteRoot"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion21">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="16" load-factor="0.75" concurrency-level="16">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ </region-attributes>
+ </region>
+
+ <region name="SubRegion22">
+ <region-attributes scope="local" caching-enabled="true">
+ </region-attributes>
+ <region name="SubSubRegion221">
+ <region-attributes scope="local" caching-enabled="true">
+ </region-attributes>
+ </region>
+ </region>
+
+ </root-region>
+
+ <root-region name = "Root3" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ <region-idle-time>
+ <expiration-attributes timeout="20" action="destroy"/>
+ </region-idle-time>
+ <entry-idle-time>
+ <expiration-attributes timeout="10" action="invalidate"/>
+ </entry-idle-time>
+ <region-time-to-live>
+ <expiration-attributes timeout="0" action="local-destroy"/>
+ </region-time-to-live>
+ <entry-time-to-live>
+ <expiration-attributes timeout="0" action="local-invalidate"/>
+ </entry-time-to-live>
+ <persistence-manager library-name="Apache.Geode.Plugins.SqLite" library-function-name="Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+
+ <properties>
+ <property name="PersistenceDirectory" value="SqLite"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ <region name="SubRegion31">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="Apache.Geode.Plugins.SqLite" library-function-name="Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ <region name="SubRegion32">
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="23" load-factor="0.89" concurrency-level="52" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="Apache.Geode.Plugins.SqLite" library-function-name="Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object, System.Object>.Create" >
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteSubRegion"/>
+ <property name="MaxPageCount" value="1073741823"/>
+ <property name="PageSize" value="65536"/>
+ </properties>
+ </persistence-manager>
+ </region-attributes>
+
+ </region>
+
+ </root-region>
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Apache.Geode.rc
----------------------------------------------------------------------
diff --git a/clicache/src/Apache.Geode.rc b/clicache/src/Apache.Geode.rc
new file mode 100644
index 0000000..a23e7a9
--- /dev/null
+++ b/clicache/src/Apache.Geode.rc
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+#include <verrsrc.h>
+
+#include "config.h"
+#include "version.h"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION PRODUCT_VERSION_RC
+PRODUCTVERSION PRODUCT_VERSION_RC
+FILEOS VOS_NT_WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", PRODUCT_VENDOR_NAME
+ VALUE "FileDescription", PRODUCT_NAME " .NET Library"
+ VALUE "FileVersion", PRODUCT_VERSION
+ VALUE "InternalName", PRODUCT_DLL_NAME
+ VALUE "LegalCopyright", "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."
+ VALUE "OriginalFilename", PRODUCT_DLL_NAME".dll"
+ VALUE "ProductName", PRODUCT_NAME
+ VALUE "ProductVersion", PRODUCT_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/AttributesFactory.cpp b/clicache/src/AttributesFactory.cpp
new file mode 100644
index 0000000..33f84ea
--- /dev/null
+++ b/clicache/src/AttributesFactory.cpp
@@ -0,0 +1,484 @@
+/*
+ * 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.
+ */
+
+#include "AttributesFactory.hpp"
+#include "Region.hpp"
+#include "impl/ManagedCacheLoader.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+#include "impl/ManagedCacheWriter.hpp"
+#include "impl/ManagedCacheListener.hpp"
+#include "impl/ManagedPartitionResolver.hpp"
+#include "impl/ManagedFixedPartitionResolver.hpp"
+#include "impl/CacheLoader.hpp"
+#include "impl/CacheWriter.hpp"
+#include "impl/CacheListener.hpp"
+#include "impl/PartitionResolver.hpp"
+#include "impl/PersistenceManagerProxy.hpp"
+#include "RegionAttributes.hpp"
+#include "ICacheLoader.hpp"
+#include "IPersistenceManager.hpp"
+#include "ICacheWriter.hpp"
+#include "IPartitionResolver.hpp"
+#include "IFixedPartitionResolver.hpp"
+#include "impl/SafeConvert.hpp"
+#include "ExceptionTypes.hpp"
+
+#include "begin_native.hpp"
+#include <memory>
+#include "end_native.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ using namespace System;
+ using namespace System::Collections::Generic;
+
+ namespace native = apache::geode::client;
+
+ generic<class TKey, class TValue>
+ AttributesFactory<TKey, TValue>::AttributesFactory( Apache::Geode::Client::RegionAttributes<TKey, TValue>^ regionAttributes )
+ {
+ auto attribptr = regionAttributes->GetNative();
+ m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>(attribptr));
+ }
+
+ // CALLBACKS
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
+ {
+ native::CacheLoaderPtr loaderptr;
+ if ( cacheLoader != nullptr ) {
+ CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ clg->SetCacheLoader(cacheLoader);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>(new native::ManagedCacheLoaderGeneric(cacheLoader));
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
+ {
+ native::CacheWriterPtr writerptr;
+ if ( cacheWriter != nullptr ) {
+ CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ cwg->SetCacheWriter(cacheWriter);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>(new native::ManagedCacheWriterGeneric(cacheWriter));
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
+ {
+ native::CacheListenerPtr listenerptr;
+ if ( cacheListener != nullptr ) {
+ CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ clg->SetCacheListener(cacheListener);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>(new native::ManagedCacheListenerGeneric(cacheListener));
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver )
+ {
+ native::PartitionResolverPtr resolverptr;
+ if ( partitionresolver != nullptr ) {
+ Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
+ if (resolver != nullptr) {
+ FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ else {
+ PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
+ prg->SetPartitionResolver(partitionresolver);
+ resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( resolverptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheWriter( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCacheListener( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setCacheListener( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPartitionResolver( String^ libPath, String^ factoryFunctionName )
+ {
+ throw gcnew System::NotSupportedException;
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ // EXPIRATION ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryIdleTimeout(static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setEntryTimeToLive( static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionIdleTimeout( static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
+ {
+ try
+ {
+ m_nativeptr->get()->setRegionTimeToLive( static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ // PERSISTENCE
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config )
+ {
+ native::PersistenceManagerPtr persistenceManagerptr;
+ if ( persistenceManager != nullptr ) {
+ PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
+ clg->SetPersistenceManager(persistenceManager);
+ persistenceManagerptr = std::shared_ptr<native::ManagedPersistenceManagerGeneric>(new native::ManagedPersistenceManagerGeneric(persistenceManager));
+ ((native::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( persistenceManagerptr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager )
+ {
+ SetPersistenceManager(persistenceManager, nullptr);
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName )
+ {
+ SetPersistenceManager( libPath, factoryFunctionName, nullptr );
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPersistenceManager( String^ libPath,
+ String^ factoryFunctionName, Properties<String^, String^>^ config )
+ {
+ ManagedString mg_libpath( libPath );
+ ManagedString mg_factoryFunctionName( factoryFunctionName );
+
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager(mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr, config->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ }
+
+ // STORAGE ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetPoolName( String^ poolName )
+ {
+ ManagedString mg_poolName( poolName );
+
+ try
+ {
+ m_nativeptr->get()->setPoolName( mg_poolName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ // MAP ATTRIBUTES
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetInitialCapacity( System::Int32 initialCapacity )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setInitialCapacity( initialCapacity );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetLoadFactor( Single loadFactor )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setLoadFactor( loadFactor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetConcurrencyLevel( System::Int32 concurrencyLevel )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ m_nativeptr->get()->setConcurrencyLevel( concurrencyLevel );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
+ {
+ try
+ {
+ m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetDiskPolicy( DiskPolicyType diskPolicy )
+ {
+ try
+ {
+ m_nativeptr->get()->setDiskPolicy(static_cast<native::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCachingEnabled( bool cachingEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCachingEnabled( cachingEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetCloningEnabled( bool cloningEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setCloningEnabled( cloningEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TKey, class TValue>
+ void AttributesFactory<TKey, TValue>::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
+ {
+ try
+ {
+ m_nativeptr->get()->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ // FACTORY METHOD
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::RegionAttributes<TKey, TValue>^ AttributesFactory<TKey, TValue>::CreateRegionAttributes()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ native::RegionAttributesPtr nativeptr = m_nativeptr->get()->createRegionAttributes();
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[28/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled1.xml b/clicache/integration-test/cacheserver_concurrency_enabled1.xml
new file mode 100644
index 0000000..071afb8
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled1.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT1">
+ <group>A</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate" concurrency-checks-enabled="true"></region-attributes>
+ </region>
+</cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled2.xml b/clicache/integration-test/cacheserver_concurrency_enabled2.xml
new file mode 100644
index 0000000..d22a2c5
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT2">
+ <group>B</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate" concurrency-checks-enabled="true"></region-attributes>
+ </region>
+</cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled_disk1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled_disk1.xml b/clicache/integration-test/cacheserver_concurrency_enabled_disk1.xml
new file mode 100644
index 0000000..d81681b
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled_disk1.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT1">
+ <group>A</group>
+ </cache-server>
+ <disk-store name="DEFAULT" auto-compact="true" max-oplog-size="20">
+ <disk-dirs>
+ <disk-dir>../backupDirectory3</disk-dir>
+ </disk-dirs>
+ </disk-store>
+
+ <region name="DistRegionAck" refid="PARTITION_PERSISTENT"/>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled_disk2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled_disk2.xml b/clicache/integration-test/cacheserver_concurrency_enabled_disk2.xml
new file mode 100644
index 0000000..b70fa54
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled_disk2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT2">
+ <group>B</group>
+ </cache-server>
+ <disk-store name="DEFAULT" auto-compact="true" max-oplog-size="20">
+ <disk-dirs>
+ <disk-dir>../backupDirectory4</disk-dir>
+ </disk-dirs>
+ </disk-store>
+
+ <region name="DistRegionAck" refid="PARTITION_PERSISTENT"/>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate1.xml b/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate1.xml
new file mode 100644
index 0000000..00f309f
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate1.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT1">
+ <group>A</group>
+ </cache-server>
+ <disk-store name="DEFAULT" auto-compact="true" max-oplog-size="20">
+ <disk-dirs>
+ <disk-dir>../backupDirectory1</disk-dir>
+ </disk-dirs>
+ </disk-store>
+
+ <region name="DistRegionAck" refid="REPLICATE_PERSISTENT"/>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate2.xml b/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate2.xml
new file mode 100644
index 0000000..a96bdc1
--- /dev/null
+++ b/clicache/integration-test/cacheserver_concurrency_enabled_disk_replicate2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="HOST_PORT2">
+ <group>B</group>
+ </cache-server>
+ <disk-store name="DEFAULT" auto-compact="true" max-oplog-size="20">
+ <disk-dirs>
+ <disk-dir>../backupDirectory2</disk-dir>
+ </disk-dirs>
+ </disk-store>
+
+ <region name="DistRegionAck" refid="REPLICATE_PERSISTENT"/>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_conflation.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_conflation.xml b/clicache/integration-test/cacheserver_conflation.xml
new file mode 100644
index 0000000..f01538e
--- /dev/null
+++ b/clicache/integration-test/cacheserver_conflation.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+ <region name="ConflatedRegion">
+ <region-attributes scope="distributed-ack" data-policy="replicate" enable-subscription-conflation="true"/>
+ </region>
+ <region name="NonConflatedRegion">
+ <region-attributes scope="distributed-ack" data-policy="replicate" enable-subscription-conflation="false"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_hashcode.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_hashcode.xml b/clicache/integration-test/cacheserver_hashcode.xml
new file mode 100644
index 0000000..9f8f525
--- /dev/null
+++ b/clicache/integration-test/cacheserver_hashcode.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes data-policy="partition">
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes data-policy="partition">
+ <cache-writer>
+ <class-name>javaobject.CacheWriterForSingleHop</class-name>
+ </cache-writer>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_interest_notify.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_interest_notify.xml b/clicache/integration-test/cacheserver_interest_notify.xml
new file mode 100644
index 0000000..ee86380
--- /dev/null
+++ b/clicache/integration-test/cacheserver_interest_notify.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+ <region name="RegionTrue">
+ <region-attributes scope="distributed-ack" data-policy="replicate" />
+ </region>
+ <region name="RegionFalse">
+ <region-attributes scope="distributed-ack" data-policy="replicate" />
+ </region>
+ <region name="RegionOther">
+ <region-attributes scope="distributed-ack" data-policy="replicate" />
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_loader.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_loader.xml b/clicache/integration-test/cacheserver_loader.xml
new file mode 100644
index 0000000..03cf4a4
--- /dev/null
+++ b/clicache/integration-test/cacheserver_loader.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- cacheserverLoader.xml
+ Configures a server to for clients at port 40404.
+ The example region also is configured with a loader.
+-->
+
+
+<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 port="40404"/>
+ <region name="root">
+ <region-attributes/>
+ <region name="exampleRegion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription.xml b/clicache/integration-test/cacheserver_notify_subscription.xml
new file mode 100644
index 0000000..f4c3dcd
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.ExampleFunction</class-name>
+ <parameter name="id"><string>securityTest</string></parameter>
+ <parameter name="haveResults"><string>true</string></parameter>
+ </function>
+ <function>
+ <class-name>javaobject.FireNForget</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.executeFunction_SendException</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription2.xml b/clicache/integration-test/cacheserver_notify_subscription2.xml
new file mode 100644
index 0000000..fcfa37f
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription2.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.ExampleFunction</class-name>
+ <parameter name="id"><string>securityTest</string></parameter>
+ <parameter name="haveResults"><string>true</string></parameter>
+ </function>
+ <function>
+ <class-name>javaobject.FireNForget</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.executeFunction_SendException</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription3.xml b/clicache/integration-test/cacheserver_notify_subscription3.xml
new file mode 100644
index 0000000..437dd57
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription3.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription4.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription4.xml b/clicache/integration-test/cacheserver_notify_subscription4.xml
new file mode 100644
index 0000000..989d999
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription4.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT4"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription5.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription5.xml b/clicache/integration-test/cacheserver_notify_subscription5.xml
new file mode 100644
index 0000000..46d9657
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription5.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+
+
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+
+
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription5N.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription5N.xml b/clicache/integration-test/cacheserver_notify_subscription5N.xml
new file mode 100644
index 0000000..485dc07
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription5N.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+
+
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+
+
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription6.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription6.xml b/clicache/integration-test/cacheserver_notify_subscription6.xml
new file mode 100644
index 0000000..9918e03
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription6.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key>
+ <string>DefaultCacheable-1</string>
+ </key>
+ <value>
+ <declarable>
+ <class-name>javaobject.DefaultCacheable</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscriptionBug849.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscriptionBug849.xml b/clicache/integration-test/cacheserver_notify_subscriptionBug849.xml
new file mode 100644
index 0000000..a7337b3
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscriptionBug849.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="ExampleRegion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making sub-regions -->
+ <region name="SubRegion1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="SubRegion2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription_PutAllTimeout.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription_PutAllTimeout.xml b/clicache/integration-test/cacheserver_notify_subscription_PutAllTimeout.xml
new file mode 100644
index 0000000..f836e46
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription_PutAllTimeout.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PutAllTimeout</class-name>
+ </cache-listener>
+ </region-attributes>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ <region name="AuthSubregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_notify_subscription_forDoc.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_notify_subscription_forDoc.xml b/clicache/integration-test/cacheserver_notify_subscription_forDoc.xml
new file mode 100644
index 0000000..bd08706
--- /dev/null
+++ b/clicache/integration-test/cacheserver_notify_subscription_forDoc.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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 port="40404"/>
+ <region name="exampleRegion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+
+ <region name="BankAccounts">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key>
+ <string>new-bankaccount</string>
+ </key>
+ <value>
+ <declarable>
+ <class-name>javaobject.BankAccount</class-name>
+ <parameter name="customerId">
+ <string>100</string>
+ </parameter>
+ <parameter name="accountId">
+ <string>1000</string>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+
+ <region name="root">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <region name="listenerWriterLoader">
+ <region-attributes scope="distributed-ack">
+ <!--cache-loader>
+ <class-name>cacheRunner.StringLoader</class-name>
+ </cache-loader-->
+ </region-attributes>
+ <entry>
+ <key><string>entry1</string></key>
+ <value><string>1.0</string></value>
+ </entry>
+ <region name="sub1">
+ <region-attributes scope="local">
+ </region-attributes>
+ </region>
+ </region>
+ </region>
+
+ <region name="exampleRegion0">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+
+ <region name="exampleRegion1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="exampleputgetregion">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="tradeOrder">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key>
+ <string>new-trade</string>
+ </key>
+ <value>
+ <declarable>
+ <class-name>javaobject.TradeOrder</class-name>
+ <parameter name="price">
+ <string>200</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="partition_region">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.MultiGetFunctionI</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_pdxinstance_hashcode.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_pdxinstance_hashcode.xml b/clicache/integration-test/cacheserver_pdxinstance_hashcode.xml
new file mode 100644
index 0000000..aaf2643
--- /dev/null
+++ b/clicache/integration-test/cacheserver_pdxinstance_hashcode.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+ <pdx read-serialized="true" />
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxinstanceHashcodeListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxinstanceHashcodeListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+ <region name="testregion">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate">
+ <cache-listener>
+ <class-name>javaobject.PdxinstanceHashcodeListener</class-name>
+ </cache-listener>
+ </region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_pool_client.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_pool_client.xml b/clicache/integration-test/cacheserver_pool_client.xml
new file mode 100644
index 0000000..08e6776
--- /dev/null
+++ b/clicache/integration-test/cacheserver_pool_client.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<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">
+
+ <pool
+ name="clientPool"
+ subscription-enabled="true"
+ free-connection-timeout="10000"
+ load-conditioning-interval="1"
+ min-connections="2"
+ max-connections="5"
+ retry-attempts="5"
+ idle-timeout="5"
+ ping-interval="1"
+ read-timeout="10"
+ server-group ="ServerGroup1"
+ socket-buffer-size ="1024"
+ subscription-message-tracking-timeout="5"
+ subscription-ack-interval="1"
+ subscription-redundancy="1"
+ statistic-interval="1"
+ update-locator-list-interval="25000"
+ pr-single-hop-enabled="false"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ </pool>
+
+ <pool
+ name="clientPoolMultiUser"
+ multiuser-authentication="true"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ </pool>
+
+ <region name='PoolRegion1'>
+ <region-attributes pool-name="clientPool" />
+ </region>
+
+</cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_remoteoql.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_remoteoql.xml b/clicache/integration-test/cacheserver_remoteoql.xml
new file mode 100644
index 0000000..0806ef5
--- /dev/null
+++ b/clicache/integration-test/cacheserver_remoteoql.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_remoteoql2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_remoteoql2.xml b/clicache/integration-test/cacheserver_remoteoql2.xml
new file mode 100644
index 0000000..e5f7f1b
--- /dev/null
+++ b/clicache/integration-test/cacheserver_remoteoql2.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_remoteoql2N.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_remoteoql2N.xml b/clicache/integration-test/cacheserver_remoteoql2N.xml
new file mode 100644
index 0000000..9c6679b
--- /dev/null
+++ b/clicache/integration-test/cacheserver_remoteoql2N.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_remoteoqlN.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_remoteoqlN.xml b/clicache/integration-test/cacheserver_remoteoqlN.xml
new file mode 100644
index 0000000..05367fd
--- /dev/null
+++ b/clicache/integration-test/cacheserver_remoteoqlN.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_servergroup.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_servergroup.xml b/clicache/integration-test/cacheserver_servergroup.xml
new file mode 100644
index 0000000..114e148
--- /dev/null
+++ b/clicache/integration-test/cacheserver_servergroup.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1">
+ <group>group1</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_servergroup2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_servergroup2.xml b/clicache/integration-test/cacheserver_servergroup2.xml
new file mode 100644
index 0000000..0b014a4
--- /dev/null
+++ b/clicache/integration-test/cacheserver_servergroup2.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2">
+ <group>group2</group>
+ </cache-server>
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_with_delta.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_with_delta.xml b/clicache/integration-test/cacheserver_with_delta.xml
new file mode 100644
index 0000000..fa09e95
--- /dev/null
+++ b/clicache/integration-test/cacheserver_with_delta.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key><string>delta1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.DeltaEx</class-name>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+
+
+ <region name="DistRegionAck1">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key><string>delta1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.DeltaEx</class-name>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+
+ <region name="DistRegionAck2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_with_deltaAD.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_with_deltaAD.xml b/clicache/integration-test/cacheserver_with_deltaAD.xml
new file mode 100644
index 0000000..4614f1e
--- /dev/null
+++ b/clicache/integration-test/cacheserver_with_deltaAD.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key><string>delta1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.DeltaTest</class-name>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+
+
+
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cacheserver_with_delta_test_impl.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cacheserver_with_delta_test_impl.xml b/clicache/integration-test/cacheserver_with_delta_test_impl.xml
new file mode 100644
index 0000000..db653fb
--- /dev/null
+++ b/clicache/integration-test/cacheserver_with_delta_test_impl.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="24680"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ <entry>
+ <key><string>delta1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.DeltaTestImpl</class-name>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+</cache>
[46/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/CacheServPoolRedun3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheServPoolRedun3.xml b/clicache/integration-test/CacheServPoolRedun3.xml
new file mode 100644
index 0000000..e62a640
--- /dev/null
+++ b/clicache/integration-test/CacheServPoolRedun3.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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-native/blob/6cbd424f/clicache/integration-test/CacheServerMsgs.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheServerMsgs.cs b/clicache/integration-test/CacheServerMsgs.cs
new file mode 100644
index 0000000..076e59a
--- /dev/null
+++ b/clicache/integration-test/CacheServerMsgs.cs
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.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-native/blob/6cbd424f/clicache/integration-test/CacheableWrapper.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheableWrapper.cs b/clicache/integration-test/CacheableWrapper.cs
new file mode 100644
index 0000000..f8acd21
--- /dev/null
+++ b/clicache/integration-test/CacheableWrapper.cs
@@ -0,0 +1,208 @@
+/*
+ * 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.Collections.Generic;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Interface class for wrappers of geode 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 IGeodeSerializable m_cacheableObject = null;
+ protected uint m_typeId;
+
+ #endregion
+
+ public virtual IGeodeSerializable 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(IGeodeSerializable cacheableObject);
+
+ public virtual uint GetChecksum()
+ {
+ return GetChecksum(m_cacheableObject);
+ }
+ }
+
+ /// <summary>
+ /// Interface class for wrappers of geode 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 IGeodeSerializable 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-native/blob/6cbd424f/clicache/integration-test/CacheableWrapperN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CacheableWrapperN.cs b/clicache/integration-test/CacheableWrapperN.cs
new file mode 100644
index 0000000..6a79f46
--- /dev/null
+++ b/clicache/integration-test/CacheableWrapperN.cs
@@ -0,0 +1,269 @@
+/*
+ * 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.Collections.Generic;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace Apache.Geode.Client.UnitTests
+{
+
+ using NUnit.Framework;
+ using Apache.Geode.Client;
+ /// <summary>
+ /// Interface class for wrappers of geode 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 geode 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-native/blob/6cbd424f/clicache/integration-test/CachelessTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/CachelessTestsN.cs b/clicache/integration-test/CachelessTestsN.cs
new file mode 100644
index 0000000..15abf94
--- /dev/null
+++ b/clicache/integration-test/CachelessTestsN.cs
@@ -0,0 +1,157 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [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-native/blob/6cbd424f/clicache/integration-test/DataIOTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DataIOTests.cs b/clicache/integration-test/DataIOTests.cs
new file mode 100644
index 0000000..d4488e5
--- /dev/null
+++ b/clicache/integration-test/DataIOTests.cs
@@ -0,0 +1,241 @@
+/*
+ * 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.Collections.Generic;
+using System.Reflection;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.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-native/blob/6cbd424f/clicache/integration-test/DataOutputTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DataOutputTests.cs b/clicache/integration-test/DataOutputTests.cs
new file mode 100755
index 0000000..5c253ee
--- /dev/null
+++ b/clicache/integration-test/DataOutputTests.cs
@@ -0,0 +1,61 @@
+/*
+ * 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.Collections.Generic;
+using System.Reflection;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("unicast_only")]
+ public class DataOutputTests : UnitTests
+ {
+ XmlNodeReaderWriter settings = Util.DefaultSettings;
+
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [Test]
+ public void StringExcedesBufferCapacity()
+ {
+
+ CacheHelper.InitConfig((String) null);
+
+ DataOutput dataOutput = CacheHelper.DCache.CreateDataOutput();
+
+ // 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.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DefaultCacheableN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DefaultCacheableN.cs b/clicache/integration-test/DefaultCacheableN.cs
new file mode 100644
index 0000000..c9b8145
--- /dev/null
+++ b/clicache/integration-test/DefaultCacheableN.cs
@@ -0,0 +1,261 @@
+/*
+ * 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.Collections.Generic;
+using System.Text;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using Apache.Geode.Client;
+
+ [Serializable]
+ class CustomSerializableObject
+ {
+ public String key;
+ public String value;
+
+ public CustomSerializableObject()
+ {
+ key = "key";
+ value = "value";
+ }
+ }
+
+ // VJR: TODO: IGeodeSerializable should be replaced by IPdxSerializable when ready
+ class DefaultType : IGeodeSerializable
+ {
+ 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 = "geode.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 IGeodeSerializable Members
+
+ public uint ClassId
+ {
+ get { return 0x04; }
+ }
+
+ public IGeodeSerializable 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 IGeodeSerializable CreateDeserializable()
+ {
+ return new DefaultType();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DistGetTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DistGetTests.cs b/clicache/integration-test/DistGetTests.cs
new file mode 100644
index 0000000..ce680bb
--- /dev/null
+++ b/clicache/integration-test/DistGetTests.cs
@@ -0,0 +1,191 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.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);
+ }
+ }
+}
[16/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IRegion.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IRegion.hpp b/clicache/src/IRegion.hpp
new file mode 100644
index 0000000..cbbf2eb
--- /dev/null
+++ b/clicache/src/IRegion.hpp
@@ -0,0 +1,2077 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ISubscriptionService.hpp"
+#include "begin_native.hpp"
+#include <geode/DataOutput.hpp>
+#include "end_native.hpp"
+
+//#include "ExceptionTypes.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+
+/*
+using namespace Apache::Geode::Client;
+using namespace Apache::Geode::Client;
+*/
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class Cache;
+ ref class CacheStatistics;
+ //interface class IGeodeSerializable;
+ interface class IRegionService;
+
+ generic<class TResult>
+ interface class ISelectResults;
+
+ generic<class TKey, class TValue>
+ ref class RegionEntry;
+
+ generic<class TKey, class TValue>
+ ref class RegionAttributes;
+
+ generic<class TKey, class TValue>
+ ref class AttributesMutator;
+
+ /// <summary>
+ /// Encapsulates a concrete region of cached data.
+ /// Implements generic IDictionary<TKey, TValue> interface class.
+ /// </summary>
+ /// <remarks>
+ /// This class manages subregions and cached data. Each region
+ /// can contain multiple subregions and entries for data.
+ /// Regions provide a hierachical name space
+ /// within the cache. Also, a region can be used to group cached
+ /// objects for management purposes.
+ ///
+ /// Entries managed by the region are key-value pairs. A set of region attributes
+ /// is associated with the region when it is created.
+ ///
+ /// The IRegion interface basically contains two set of APIs: Region management
+ /// APIs and (potentially) distributed operations on entries. Non-distributed
+ /// operations on entries are provided by <c>RegionEntry</c>.
+ ///
+ /// Each <c>Cache</c> defines regions called the root regions.
+ /// User applications can use the root regions to create subregions
+ /// for isolated name spaces and object grouping.
+ ///
+ /// A region's name can be any string, except that it must not contain
+ /// the region name separator, a forward slash (/).
+ ///
+ /// <c>Regions</c> can be referenced by a relative path name from any region
+ /// higher in the hierarchy in <see cref="IRegion.GetSubRegion" />. You can get the relative
+ /// path from the root region with <see cref="IRegion.FullPath" />. The name separator
+ /// is used to concatenate all the region names together from the root, starting
+ /// with the root's subregions.
+ /// </remarks>
+ /// <see cref="RegionAttributes" />
+
+ generic<class TKey, class TValue>
+ public interface class IRegion : public System::Collections::Generic::IDictionary<TKey, TValue>
+ {
+ public:
+
+ /// <summary>
+ /// Gets or sets the element with the specified key.
+ /// </summary>
+ /// <remarks>
+ /// This property provides the ability to access a specific element in the collection
+ /// by using the following syntax: myCollection[key].
+ /// You can also use the Item property to add new elements by setting the value of a key
+ /// that does not exist in the dictionary; for example, myCollection["myNonexistentKey"] = myValue
+ /// However, if the specified key already exists in the dictionary,
+ /// setting the Item property overwrites the old value. In contrast,
+ /// the Add method does not modify existing elements.
+ /// This property is applicable to local as well as distributed region.
+ /// For local region instance - Puts/Gets a new value into an entry in this region in the local cache only.
+ /// For distributed region instance - Puts/Gets a new value into an entry in this region
+ /// and this operation is propogated to the Geode cache server to which it is connected with.
+ /// </remarks>
+ /// <param name="key">
+ /// The key of the element to get or set.
+ /// </param>
+ /// <param name ="Property Value">
+ /// The element with the specified key.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="KeyNotFoundException">
+ /// If given key was not present in the region and if region is not in secure mode, or if Pool
+ /// attached with Region is not in multiusersecure mode.
+ /// </exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if given key's value is null.
+ /// </exception>
+ /// <exception cref="CacheWriterException">
+ /// if CacheWriter aborts the operation
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the value
+ /// </exception>
+ /// <exception cref="CacheLoaderException">
+ /// if CacheLoader throws an exception
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ virtual property TValue default[TKey]
+ {
+ TValue get(TKey key);
+ void set(TKey key, TValue value);
+ }
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection of the region entries.
+ /// This operation is performed entirely in local cache.
+ /// </summary>
+ /// <remarks>
+ /// The foreach statement of the C# language (for each in C++)hides the
+ /// complexity of the enumerators. Therefore, using foreach is recommended,
+ /// instead of directly manipulating the enumerator.
+ /// Enumerators can be used to read the data in the collection,
+ /// but they cannot be used to modify the underlying collection.
+ /// Initially, the enumerator is positioned before the first element in the collection.
+ /// At this position, Current is undefined. Therefore, you must call MoveNext to advance
+ /// the enumerator to the first element of the collection before reading the value of Current.
+ /// Current returns the same object until MoveNext is called. MoveNext sets Current to the next element.
+ /// If MoveNext passes the end of the collection, the enumerator is positioned after the last element
+ /// in the collection and MoveNext returns false. When the enumerator is at this position, subsequent
+ /// calls to MoveNext also return false. If the last call to MoveNext returned false, Current is
+ /// undefined. You cannot set Current to the first element of the collection again; you must create
+ /// a new enumerator instance instead.
+ /// The enumerator does not have exclusive access to the collection; therefore, enumerating through a
+ /// collection is intrinsically not a thread-safe procedure. To guarantee thread safety during
+ /// enumeration, you can lock the collection during the entire enumeration. To allow the collection
+ /// to be accessed by multiple threads for reading and writing, you must implement your own
+ /// synchronization.
+ /// Default implementations of collections in the System.Collections.Generic namespace are not
+ /// synchronized.
+ /// For both local & distributed region instances, this operation is restricted to local cache only.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">
+ /// if enumerator is before or after the collection and Current method is called on it.
+ /// </exception>
+ /// <returns>
+ /// Type: System.Collections.Generic.IEnumerator<T>. A IEnumerator<T> that
+ /// can be used to iterate through the collection.
+ /// </returns>
+ virtual System::Collections::Generic::IEnumerator<KeyValuePair<TKey,TValue>>^ GetEnumerator();
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the collection of the region entries.
+ /// This operation is performed entirely in local cache.
+ /// </summary>
+ /// <remarks>
+ /// The foreach statement of the C# language (for each in C++)hides the
+ /// complexity of the enumerators. Therefore, using foreach is recommended,
+ /// instead of directly manipulating the enumerator.
+ /// Enumerators can be used to read the data in the collection,
+ /// but they cannot be used to modify the underlying collection.
+ /// Initially, the enumerator is positioned before the first element in the collection.
+ /// At this position, Current is undefined. Therefore, you must call MoveNext to advance
+ /// the enumerator to the first element of the collection before reading the value of Current.
+ /// Current returns the same object until MoveNext is called. MoveNext sets Current to the next element.
+ /// If MoveNext passes the end of the collection, the enumerator is positioned after the last element
+ /// in the collection and MoveNext returns false. When the enumerator is at this position, subsequent
+ /// calls to MoveNext also return false. If the last call to MoveNext returned false, Current is
+ /// undefined. You cannot set Current to the first element of the collection again; you must create
+ /// a new enumerator instance instead.
+ /// The enumerator does not have exclusive access to the collection; therefore, enumerating through a
+ /// collection is intrinsically not a thread-safe procedure. To guarantee thread safety during
+ /// enumeration, you can lock the collection during the entire enumeration. To allow the collection
+ /// to be accessed by multiple threads for reading and writing, you must implement your own
+ /// synchronization.
+ /// For both local & distributed region instances, this operation is restricted to local cache only.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">
+ /// if enumerator is before or after the collection and Current method is called on it.
+ /// </exception>
+ /// <returns>
+ /// Type: System.Collections.IEnumerator. An IEnumerator object that can be used to iterate
+ /// through the collection.
+ /// </returns>
+ virtual System::Collections::IEnumerator^ GetEnumeratorOld() =
+ System::Collections::IEnumerable::GetEnumerator;
+
+ /// <summary>
+ /// Determines whether the IDictionary contains an element with the specified key.
+ /// </summary>
+ /// <remarks>
+ /// For local region instance - This only searches in the local cache.
+ /// For distributed region instance - checks to see if the key is present on the server.
+ /// </remarks>
+ /// <param name="key">
+ /// The key to locate in the IDictionary.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// key is a null reference
+ /// </exception>
+ /// <returns>
+ /// true if the IDictionary contains an element with the key; otherwise, false.
+ /// </returns>
+ virtual bool ContainsKey(TKey key);
+
+ /// <summary>
+ /// Adds an element with the provided key and value to the IDictionary.
+ /// </summary>
+ /// <remark>
+ /// You can also use the Item property to add new elements by setting the value of a key
+ /// that does not exist in the dictionary; for example, myCollection["myNonexistentKey"] = myValue
+ /// However, if the specified key already exists in the dictionary, setting the Item property
+ /// overwrites the old value. In contrast, the Add method does not modify existing elements.
+ /// </remark>
+ /// <remarks>
+ /// <para>
+ /// If remote server put fails throwing back a <c>CacheServerException</c>
+ /// or security exception, then local put is tried to rollback. However,
+ /// if the entry has overflowed/evicted/expired then the rollback is
+ /// aborted since it may be due to a more recent notification or update
+ /// by another thread.
+ /// </para>
+ /// <para>
+ /// For local region instance - creates a new entry in this region with the specified keyvaluepair
+ /// in the local cache only.
+ /// For distributed region instance - The new entry is propogated to the java server to which it is
+ /// connected with.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">
+ /// The object to use as the key of the element to add.
+ /// </param>
+ /// <param name="value">
+ /// The object to use as the value of the element to add.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="EntryExistsException">
+ /// if an entry with this key already exists
+ /// </exception>
+ /// <exception cref="CacheWriterException">
+ /// if CacheWriter aborts the operation
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to a Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the new entry
+ /// </exception>
+ virtual void Add(TKey key, TValue value);
+
+ /// <summary>
+ /// Adds an item to the ICollection<T>.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If remote server put fails throwing back a <c>CacheServerException</c>
+ /// or security exception, then local put is tried to rollback. However,
+ /// if the entry has overflowed/evicted/expired then the rollback is
+ /// aborted since it may be due to a more recent notification or update
+ /// by another thread.
+ /// </para>
+ /// <para>
+ /// For local region instance - creates a new entry in this region with the specified keyvaluepair
+ /// in the local cache only.
+ /// For distributed region instance - The new entry is propogated to the java server to which it is
+ /// connected with.
+ /// </para>
+ /// </remarks>
+ /// <param name="keyValuePair">
+ /// Type: KeyValuePair<TKey, TValue> The object to add to the ICollection<T>.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="EntryExistsException">
+ /// if an entry with this key already exists
+ /// </exception>
+ /// <exception cref="CacheWriterException">
+ /// if CacheWriter aborts the operation
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to a Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the new entry
+ /// </exception>
+ virtual void Add(KeyValuePair<TKey, TValue> keyValuePair);
+
+ /// <summary>
+ /// Creates a new entry in this region with the specified key and value,
+ /// passing the callback argument to any cache writers and cache listeners
+ /// that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" /> and
+ /// <see cref="CacheStatistics.LastModifiedTime" /> for this region
+ /// and the entry.
+ /// </para>
+ /// <para>
+ /// For local region instance - creates a new entry in this region with the specified key and value
+ /// in the local cache only.
+ /// For distributed region instance - The new entry is propogated to the java server to which it is
+ /// connected with.
+ /// </para><para>
+ /// If remote server put fails throwing back a <c>CacheServerException</c>
+ /// or security exception, then local put is tried to rollback. However,
+ /// if the entry has overflowed/evicted/expired then the rollback is
+ /// aborted since it may be due to a more recent notification or update
+ /// by another thread.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">
+ /// The key for which to create the entry in this region. The object is
+ /// created before the call, and the caller should not deallocate the object.
+ /// </param>
+ /// <param name="value">
+ /// The value for the new entry, which may be null to indicate that the new
+ /// entry starts as if it had been locally invalidated.
+ /// </param>
+ /// <param name="callbackArg">
+ /// a custome parameter to pass to the cache writer or cache listener
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="EntryExistsException">
+ /// if an entry with this key already exists
+ /// </exception>
+ /// <exception cref="CacheWriterException">
+ /// if CacheWriter aborts the operation
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to a Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the new entry
+ /// </exception>
+ /// <seealso cref="Put" />
+ /// <seealso cref="Get" />
+ void Add(TKey key, TValue value, Object^ callbackArg);
+
+ /// <summary>
+ /// Removes the element with the specified key from the IDictionary.
+ /// </summary>
+ /// <remarks>
+ /// For local region instance - removes the entry with the specified key from the local cache only.
+ /// For distributed region instance - remove is propogated to the Geode cache server.
+ /// </remarks>
+ /// <param name="key">
+ /// The key of the element to remove.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">if key is null</exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if the entry does not exist in this region locally, applicable only for local region instance.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <returns>
+ /// true if the element is successfully removed; otherwise, false.
+ /// This method also returns false if key was not found in the original IDictionary.
+ /// </returns>
+ virtual bool Remove(TKey key);
+
+ /// <summary>
+ /// Removes the entry with the specified key, passing the callback
+ /// argument to any cache writers that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Removes not only the value, but also the key and entry
+ /// from this region.
+ /// </para>
+ /// <para>
+ /// For local region instance - removes the value with the specified key in the local cache only.
+ /// For distributed region instance - destroy is propogated to the Geode cache server
+ /// to which it is connected with.
+ /// </para>
+ /// <para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">the key of the entry to destroy</param>
+ /// <param name="callbackArg">
+ /// a user-defined parameter to pass to cache writers triggered by this method
+ /// </param>
+ /// <exception cref="IllegalArgumentException">if key is null</exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <seealso cref="Invalidate" />
+ /// <seealso cref="ICacheListener.AfterDestroy" />
+ /// <seealso cref="ICacheWriter.BeforeDestroy" />
+ /// <returns>
+ /// true if the element is successfully removed; otherwise, false.
+ /// This method also returns false if key was not found in the original IDictionary.
+ /// </returns>
+ bool Remove( TKey key, Object^ callbackArg );
+
+ /// <summary>
+ /// Gets the value associated with the specified key.
+ /// </summary>
+ /// <remark>
+ /// This method combines the functionality of the ContainsKey method and the Item property.
+ /// If the key is not found, then the value parameter gets the appropriate default value for the value
+ /// type V; for example, zero (0) for integer types, false for Boolean types, and a null reference for
+ /// reference types.
+ /// For local region instance - returns the value with the specified key from the local cache only.
+ /// For distributed region instance - If the value is not present locally then it is requested from
+ /// the java server. If even that is unsuccessful then a local CacheLoader will be invoked
+ /// if there is one.
+ /// </remark>
+ /// <param name="key">
+ /// The key whose value to get.
+ /// </param>
+ /// <param name="value">When this method returns, the value associated with the specified key, if the key is
+ /// found; otherwise, the default value for the type of the value parameter.
+ /// This parameter is passed uninitialized.</param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="CacheLoaderException">
+ /// if CacheLoader throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <returns>
+ /// true if the object that implements IDictionary contains an element with the specified key; otherwise, false.
+ /// </returns>
+ virtual bool TryGetValue(TKey key, TValue %value);
+
+ /// <summary>
+ /// Determines whether the ICollection contains a specific value.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// For local region instance - returns the value with the specified key from the local cache only.
+ /// For distributed region instance - If the value is not present locally then it is requested from
+ /// the java server. If even that is unsuccessful then a local CacheLoader will be invoked
+ /// if there is one.
+ /// </para>
+ /// <para>
+ /// The comparison of the value of the key value pair depends on the Equals function of the TValue class.
+ /// If the Equals function is not overriden in the TValue class the behavior of this function is undefined. Hence, this
+ /// function won't work properly for the .NET types that uses the default implementation of the Equals method, for
+ /// e.g. arrays.
+ /// </para>
+ /// </remarks>
+ /// <param name="keyValuePair">
+ /// The KeyValuePair structure to locate in the ICollection.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="CacheLoaderException">
+ /// if CacheLoader throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <returns>
+ /// true if keyValuePair is found in the ICollection; otherwise, false.
+ /// </returns>
+ virtual bool Contains(KeyValuePair<TKey,TValue> keyValuePair);
+
+ /// <summary>
+ /// Removes all items from the ICollection<T>.
+ /// remove all entries in the region.
+ /// </summary>
+ /// For local region instance - remove all entries in the local region.
+ /// For distributed region instance - remove all entries in the local region,
+ /// and propagate the operation to server.
+ virtual void Clear();
+
+ /// <summary>
+ /// Copies the elements of the ICollection to an Array, starting at a particular Array index.
+ /// This operation copies entries from local region only.
+ /// </summary>
+ /// <param name="toArray">
+ /// The one-dimensional Array that is the destination of the elements copied from ICollection.
+ /// The Array must have zero-based indexing.
+ /// </param>
+ /// <param name="startIdx">
+ /// The zero-based index in array at which copying begins.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// if toArray is a null reference
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// if startIdx is less than 0.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// if toArray is multidimensional or The number of elements in the source ICollection is greater than
+ /// the available space from startIdx to the end of the destination array or startIdx is equal to
+ /// or greater than the length of array.
+ /// </exception>
+ virtual void CopyTo(array<KeyValuePair<TKey,TValue>>^ toArray, int startIdx);
+
+ /// <summary>
+ /// Removes a key and value from the dictionary.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Remove removes not only the value, but also the key and entry
+ /// from this region.
+ /// </para>
+ /// <para>
+ /// The Remove is propogated to the Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// <para>
+ /// The comparison of the value of the key value pair depends on the Equals function of the TValue class.
+ /// If the Equals function is not overriden in the TValue class the behavior of this function is undefined. Hence, this
+ /// function won't work properly for the .NET types that uses the default implementation of the Equals method, for
+ /// e.g. arrays.
+ /// </para>
+ /// </remarks>
+ /// <param name="keyValuePair">The KeyValuePair structure representing
+ /// the key and value to remove from the Dictionary.</param>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <returns>true if the key and value represented by keyValuePair is successfully found and removed;
+ /// otherwise, false. This method returns false if keyValuePair is not found in the ICollection.</returns>
+ /// <returns>true if entry with key and its value are removed otherwise false.</returns>
+ /// <seealso cref="Invalidate" />
+ /// <seealso cref="ICacheListener.AfterDestroy" />
+ /// <seealso cref="ICacheWriter.BeforeDestroy" />
+ virtual bool Remove(KeyValuePair<TKey,TValue> keyValuePair);
+
+ /// <summary>
+ /// Removes the entry with the specified key and value, passing the callback
+ /// argument to any cache writers that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Remove removes not only the value, but also the key and entry
+ /// from this region.
+ /// </para>
+ /// <para>
+ /// The Remove is propogated to the Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">the key of the entry to Remove</param>
+ /// <param name="value">the value of the entry to Remove</param>
+ /// <param name="callbackArg"> the callback for user to pass in, It can also be null</param>.
+ /// <exception cref="IllegalArgumentException">if key is null</exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <returns>true if entry with key and its value are removed otherwise false.</returns>
+ /// <seealso cref="Invalidate" />
+ /// <seealso cref="ICacheListener.AfterDestroy" />
+ /// <seealso cref="ICacheWriter.BeforeDestroy" />
+ virtual bool Remove(TKey key, TValue value, Object^ callbackArg );
+
+ /// <summary>
+ /// Gets the number of elements contained in the ICollection<T>.
+ /// Get the size of region. For native client regions, this will give
+ /// the number of entries in the local cache and not on the servers.
+ /// </summary>
+ /// <returns>number of entries in the region</returns>
+ virtual property int Count
+ {
+ int get();
+ }
+
+ /// <summary>
+ /// This property throws NotImplementedException when called by
+ /// both local and distributed region instances.
+ /// </summary>
+ virtual property bool IsReadOnly
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Gets an ICollection containing the keys of the IDictionary
+ /// Returns all the keys for this region. This includes
+ /// keys for which the entry is invalid.
+ /// For local region instance - gets collection of keys from local cache only.
+ /// For distributed region instance - gets collection of keys from the Geode cache server.
+ /// </summary>
+ /// <returns>collection of keys</returns>
+ /// <remark>
+ /// The order of the keys in the returned ICollection is unspecified,
+ /// but it is guaranteed to be the same order as the corresponding values in the ICollection
+ /// returned by the Values property.
+ /// </remark>
+ /// <exception cref="UnsupportedOperationException">
+ /// if the member type is not <c>Client</c>
+ /// or region is not a Native Client region.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if there is a timeout getting the keys
+ /// </exception>
+ virtual property System::Collections::Generic::ICollection<TKey>^ Keys
+ {
+ System::Collections::Generic::ICollection<TKey>^ get() ;
+ }
+
+ /// <summary>
+ /// Gets an ICollection containing the values in the IDictionary.
+ /// Returns all values in the local process for this region. No value is included
+ /// for entries that are invalidated.
+ /// For both local & distributed region instances, this operation is always local only.
+ /// </summary>
+ /// <returns>collection of values</returns>
+ /// <remark>
+ /// The order of the values in the returned ICollection is unspecified,
+ /// but it is guaranteed to be the same order as the corresponding keys in the ICollection
+ /// returned by the Keys property.
+ /// </remark>
+ virtual property System::Collections::Generic::ICollection<TValue>^ Values
+ {
+ System::Collections::Generic::ICollection<TValue>^ get() ;
+ }
+
+ /// <summary>
+ /// Puts a new value into an entry in this region with the specified key,
+ /// passing the callback argument to any cache writers and cache listeners
+ /// that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If there is already an entry associated with the specified key in
+ /// this region, the entry's previous value is overwritten.
+ /// The new put value is propogated to the java server to which it is connected with.
+ /// Put is intended for very simple caching situations. In general
+ /// it is better to create a <c>ICacheLoader</c> object and allow the
+ /// cache to manage the creation and loading of objects.
+ /// For local region instance - Puts a new value into an entry in this region in the local cache only.
+ /// For distributed region instance - Puts a new value into an entry in this region
+ /// and this operation is propogated to the Geode cache server to which it is connected with.
+ /// </para><para>
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" /> and
+ /// <see cref="CacheStatistics.LastModifiedTime" /> for this region and the entry.
+ /// </para><para>
+ /// If remote server put fails throwing back a <c>CacheServerException</c>
+ /// or security exception, then local put is tried to rollback. However,
+ /// if the entry has overflowed/evicted/expired then the rollback is
+ /// aborted since it may be due to a more recent notification or update
+ /// by another thread.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">
+ /// a key object associated with the value to be put into this region.
+ /// </param>
+ /// <param name="value">the value to be put into this region</param>
+ /// <param name="callbackArg">
+ /// argument that is passed to the callback functions
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="CacheWriterException">
+ /// if CacheWriter aborts the operation
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the value
+ /// </exception>
+ /// <seealso cref="Get" />
+ /// <seealso cref="Add" />
+ void Put(TKey key, TValue value, Object^ callbackArg);
+
+ /// <summary>
+ /// Returns the value for the given key, passing the callback argument
+ /// to any cache loaders or that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// For local region instance - returns the value with the specified key from the local cache only.
+ /// For distributed region instance - If the value is not present locally then it is requested from
+ /// the java server. If even that is unsuccessful then a local CacheLoader will be invoked
+ /// if there is one.
+ /// </para>
+ /// <para>
+ /// The value returned by get is not copied, so multi-threaded applications
+ /// should not modify the value directly, but should use the update methods.
+ /// </para><para>
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// <see cref="CacheStatistics.HitCount" />, <see cref="CacheStatistics.MissCount" />,
+ /// and <see cref="CacheStatistics.LastModifiedTime" /> (if a new value is loaded)
+ /// for this region and the entry.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">
+ /// key whose associated value is to be returned -- the key
+ /// object must implement the Equals and GetHashCode methods.
+ /// </param>
+ /// <param name="callbackArg">
+ /// An argument passed into the CacheLoader if loader is used.
+ /// Has to be Serializable (i.e. implement <c>IGeodeSerializable</c>);
+ /// can be null.
+ /// </param>
+ /// <returns>
+ /// value, or null if the value is not found and can't be loaded
+ /// </returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if key is null
+ /// </exception>
+ /// <exception cref="CacheLoaderException">
+ /// if CacheLoader throws an exception
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="MessageException">
+ /// If the message received from server could not be handled. This will
+ /// be the case when an unregistered typeId is received in the reply or
+ /// reply is not well formed. More information can be found in the log.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <seealso cref="Put" />
+ TValue Get(TKey key, Object^ callbackArg);
+
+ /// <summary>
+ /// Invalidates this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The invalidation will cascade to all the subregions and cached
+ /// entries. The region
+ /// and the entries in it will still exist.
+ /// For local region instance - invalidates this region without distributing to other caches.
+ /// For distributed region instance - Invalidates this region and this
+ /// operation is propogated to the Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// To remove all the
+ /// entries and the region, use <see cref="DestroyRegion" />.
+ /// </para><para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception; if this occurs some
+ /// subregions may have already been successfully invalidated
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <seealso cref="DestroyRegion" />
+ /// <seealso cref="ICacheListener.AfterRegionInvalidate" />
+ void InvalidateRegion();
+
+ /// <summary>
+ /// Invalidates this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The invalidation will cascade to all the subregions and cached
+ /// entries. The region
+ /// and the entries in it will still exist.
+ /// For local region instance - invalidates this region without distributing to other caches.
+ /// For distributed region instance - Invalidates this region and this
+ /// operation is propogated to the Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// To remove all the
+ /// entries and the region, use <see cref="DestroyRegion" />.
+ /// </para><para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="callbackArg">
+ /// user-defined parameter to pass to callback events triggered by this method
+ /// </param>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if this region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception; if this occurs some
+ /// subregions may have already been successfully invalidated
+ /// </exception>
+ /// <seealso cref="DestroyRegion" />
+ /// <seealso cref="ICacheListener.AfterRegionInvalidate" />
+ void InvalidateRegion(Object^ callbackArg);
+
+ /// <summary>
+ /// Destroys the whole distributed region and provides a user-defined parameter
+ /// object to any <c>ICacheWriter</c> invoked in the process.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Destroy cascades to all entries and subregions. After the destroy,
+ /// this region object can not be used any more. Any attempt to use
+ /// this region object will get a <c>RegionDestroyedException</c>
+ /// The region destroy not only destroys the local region but also destroys the
+ /// server region.
+ /// For local region instance - destroys the whole local region only
+ /// For distributed region instance - destroys the whole local region and this
+ /// operation is also propogated to the Geode cache server to which it is connected with.
+ /// </para><para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CacheWriterException">
+ /// if a CacheWriter aborts the operation; if this occurs some
+ /// subregions may have already been successfully destroyed.
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception; if this occurs some
+ /// subregions may have already been successfully invalidated
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <seealso cref="InvalidateRegion" />
+ void DestroyRegion();
+
+ /// <summary>
+ /// Destroys the whole distributed region and provides a user-defined parameter
+ /// object to any <c>ICacheWriter</c> invoked in the process.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Destroy cascades to all entries and subregions. After the destroy,
+ /// this region object can not be used any more. Any attempt to use
+ /// this region object will get a <c>RegionDestroyedException</c>
+ /// The region destroy not only destroys the local region but also destroys the
+ /// server region.
+ /// For local region instance - destroys the whole local region only
+ /// For distributed region instance - destroys the whole local region and this
+ /// operation is also propogated to the Geode cache server to which it is connected with.
+ /// </para><para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="callbackArg">
+ /// a user-defined parameter to pass to callback events triggered by this call
+ /// </param>
+ /// <exception cref="CacheWriterException">
+ /// if a CacheWriter aborts the operation; if this occurs some
+ /// subregions may have already been successfully destroyed.
+ /// </exception>
+ /// <exception cref="CacheListenerException">
+ /// if CacheListener throws an exception; if this occurs some
+ /// subregions may have already been successfully invalidated
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <seealso cref="InvalidateRegion" />
+ void DestroyRegion(Object^ callbackArg);
+
+ /// <summary>
+ /// Invalidates the entry with the specified key,
+ /// passing the callback argument
+ /// to any cache
+ /// listeners that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Invalidate only removes the value from the entry -- the key is kept intact.
+ /// To completely remove the entry, call <see cref="Destroy" />.
+ /// </para>
+ /// <para>
+ /// For both local & distributed region instaces, invalidate is not propogated to the
+ /// Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">key of the value to be invalidated</param>
+ /// <exception cref="IllegalArgumentException">if key is null</exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if this entry does not exist in this region locally
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if the region is destroyed
+ /// </exception>
+ /// <seealso cref="Destroy" />
+ /// <seealso cref="ICacheListener.AfterInvalidate" />
+ void Invalidate(TKey key);
+
+ /// <summary>
+ /// Invalidates the entry with the specified key,
+ /// passing the callback argument
+ /// to any cache
+ /// listeners that are invoked in the operation.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Invalidate only removes the value from the entry -- the key is kept intact.
+ /// To completely remove the entry, call <see cref="Destroy" />.
+ /// </para>
+ /// <para>
+ /// For both local & distributed region instaces, invalidate is not propogated to the
+ /// Geode cache server to which it is connected with.
+ /// </para>
+ /// <para>
+ /// Does not update any <c>CacheStatistics</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="key">key of the value to be invalidated</param>
+ /// <param name="callbackArg">
+ /// a user-defined parameter to pass to callback events triggered by this method
+ /// </param>
+ /// <exception cref="IllegalArgumentException">if key is null</exception>
+ /// <exception cref="EntryNotFoundException">
+ /// if this entry does not exist in this region locally
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if the region is destroyed
+ /// </exception>
+ /// <seealso cref="Destroy" />
+ /// <seealso cref="ICacheListener.AfterInvalidate" />
+ void Invalidate(TKey key, Object^ callbackArg);
+
+ /// <summary>
+ /// Puts a (IDictionary) generic collection of key/value pairs in this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If there is already an entry associated with any key in the map in
+ /// this region, the entry's previous value is overwritten.
+ /// The new values are propogated to the java server to which it is connected with.
+ /// PutAll is intended for speed up large amount of put operation into
+ /// the same region.
+ /// For local region instance - this method is not applicable.
+ /// </para>
+ /// </remarks>
+ /// <param name="map">
+ /// A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs.
+ /// Value should not be null in any of the entries.
+ /// </param>
+ /// <exception cref="NullPointerException">
+ /// if any value in the map is null
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the value
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Put" />
+ void PutAll(IDictionary<TKey, TValue>^ map);
+
+ /// <summary>
+ /// Puts a (IDictionary) generic collection of key/value pairs in this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If there is already an entry associated with any key in the map in
+ /// this region, the entry's previous value is overwritten.
+ /// The new values are propogated to the java server to which it is connected with.
+ /// PutAll is intended for speed up large amount of put operation into
+ /// the same region.
+ /// For local region instance - this method is not applicable.
+ /// </para>
+ /// </remarks>
+ /// <param name="map">
+ /// A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs.
+ /// Value should not be null in any of the entries.
+ /// </param>
+ /// <param name="timeout">The time (in seconds) to wait for the PutAll
+ /// response. It should be less than or equal to 2^31/1000 i.e. 2147483.
+ /// Optional.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If timeout is more than 2^31/1000 i.e. 2147483.
+ /// </exception>
+ /// <exception cref="NullPointerException">
+ /// if any value in the map is null
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the value
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Put" />
+ void PutAll(IDictionary<TKey, TValue>^ map, int timeout);
+
+ /// <summary>
+ /// Puts a (IDictionary) generic collection of key/value pairs in this region.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If there is already an entry associated with any key in the map in
+ /// this region, the entry's previous value is overwritten.
+ /// The new values are propogated to the java server to which it is connected with.
+ /// PutAll is intended for speed up large amount of put operation into
+ /// the same region.
+ /// For local region instance - this method is not applicable.
+ /// </para>
+ /// </remarks>
+ /// <param name="map">
+ /// A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs.
+ /// Value should not be null in any of the entries.
+ /// </param>
+ /// <param name="timeout">The time (in seconds) to wait for the PutAll
+ /// response. It should be less than or equal to 2^31/1000 i.e. 2147483.
+ /// Optional.
+ /// </param>
+ /// <param name="callbackArg">
+ /// a user-defined parameter to pass to callback events triggered by this method
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If timeout is more than 2^31/1000 i.e. 2147483.
+ /// </exception>
+ /// <exception cref="NullPointerException">
+ /// if any value in the map is null
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// if region has been destroyed
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server.
+ /// Only for Native Client regions.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if not connected to the Geode system because the client cannot
+ /// establish usable connections to any of the servers given to it.
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if the operation timed out
+ /// </exception>
+ /// <exception cref="OutOfMemoryException">
+ /// if there is not enough memory for the value
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Put" />
+ void PutAll(IDictionary<TKey, TValue>^ map, int timeout, Object^ callbackArg);
+
+ /// <summary>
+ /// Removes all of the entries for the specified keys from this region.
+ /// The effect of this call is equivalent to that of calling {@link #destroy(Object)} on
+ /// this region once for each key in the specified collection.
+ /// If an entry does not exist that key is skipped;
+ /// EntryNotFoundException is not thrown.
+ /// For local region instance - this method is not applicable.
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// and <see cref="CacheStatistics.HitCount" /> and
+ /// <see cref="CacheStatistics.MissCount" /> for this region and the entry.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is null or empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server while
+ /// processing the request.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if region is not connected to the cache because the client
+ /// cannot establish usable connections to any of the given servers
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if operation timed out.
+ /// </exception>
+ /// <exception cref="UnknownException">
+ /// For other exceptions.
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Get"/>
+ void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys);
+
+ /// <summary>
+ /// Removes all of the entries for the specified keys from this region.
+ /// The effect of this call is equivalent to that of calling {@link #remove(Object)} on
+ /// this region once for each key in the specified collection.
+ /// If an entry does not exist that key is skipped;
+ /// EntryNotFoundException is not thrown.
+ /// For local region instance - this method is not applicable.
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// and <see cref="CacheStatistics.HitCount" /> and
+ /// <see cref="CacheStatistics.MissCount" /> for this region and the entry.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <param name="callbackArg">an argument that is passed to the callback functions.
+ /// Optional.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is null or empty.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server while
+ /// processing the request.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if region is not connected to the cache because the client
+ /// cannot establish usable connections to any of the given servers
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if operation timed out.
+ /// </exception>
+ /// <exception cref="UnknownException">
+ /// For other exceptions.
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Remove"/>
+ void RemoveAll(System::Collections::Generic::ICollection<TKey>^ keys, Object^ callbackArg);
+
+ /// <summary>
+ /// Gets values for collection of keys from the local cache or server.
+ /// If value for a key is not present locally then it is requested from the
+ /// java server. The value returned is not copied, so multi-threaded
+ /// applications should not modify the value directly,
+ /// but should use the update methods.
+ /// For local region instance - this method is not applicable.
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// and <see cref="CacheStatistics.HitCount" /> and
+ /// <see cref="CacheStatistics.MissCount" /> for this region and the entry.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <param name="values">
+ /// output parameter that provides the map of keys to
+ /// respective values; when this is NULL then an
+ /// <c>IllegalArgumentException</c> is thrown.
+ /// </param>
+ /// <param name="exceptions">
+ /// output parameter that provides the map of keys
+ /// to any exceptions while obtaining the key; ignored if this is NULL
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is null or empty,
+ /// or <c>values</c> argument is null.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server while
+ /// processing the request.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if region is not connected to the cache because the client
+ /// cannot establish usable connections to any of the given servers
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if operation timed out.
+ /// </exception>
+ /// <exception cref="UnknownException">
+ /// For other exceptions.
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Get"/>
+ void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions);
+
+ /// <summary>
+ /// Gets values for collection of keys from the local cache or server.
+ /// If value for a key is not present locally then it is requested from the
+ /// java server. The value returned is not copied, so multi-threaded
+ /// applications should not modify the value directly,
+ /// but should use the update methods.
+ /// For local region instance - this method is not applicable.
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// and <see cref="CacheStatistics.HitCount" /> and
+ /// <see cref="CacheStatistics.MissCount" /> for this region and the entry.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <param name="values">
+ /// output parameter that provides the map of keys to
+ /// respective values; ignored if NULL; when this is NULL then at least
+ /// the <c>addToLocalCache</c> parameter should be true and caching
+ /// should be enabled for the region to get values into the region
+ /// otherwise an <c>IllegalArgumentException</c> is thrown.
+ /// </param>
+ /// <param name="exceptions">
+ /// output parameter that provides the map of keys
+ /// to any exceptions while obtaining the key; ignored if this is NULL
+ /// </param>
+ /// <param name="addToLocalCache">
+ /// true if the obtained values have also to be added to the local cache
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is null or empty. Other invalid case is when
+ /// the <c>values</c> parameter is NULL, and either
+ /// <c>addToLocalCache</c> is false or caching is disabled
+ /// for this region.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server while
+ /// processing the request.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if region is not connected to the cache because the client
+ /// cannot establish usable connections to any of the given servers
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if operation timed out.
+ /// </exception>
+ /// <exception cref="UnknownException">
+ /// For other exceptions.
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Get"/>
+ void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache);
+
+ /// <summary>
+ /// Gets values for collection of keys from the local cache or server.
+ /// If value for a key is not present locally then it is requested from the
+ /// java server. The value returned is not copied, so multi-threaded
+ /// applications should not modify the value directly,
+ /// but should use the update methods.
+ /// For local region instance - this method is not applicable.
+ /// Updates the <see cref="CacheStatistics.LastAccessedTime" />
+ /// and <see cref="CacheStatistics.HitCount" /> and
+ /// <see cref="CacheStatistics.MissCount" /> for this region and the entry.
+ /// </summary>
+ /// <param name="keys">the collection of keys</param>
+ /// <param name="values">
+ /// output parameter that provides the map of keys to
+ /// respective values; ignored if NULL; when this is NULL then at least
+ /// the <c>addToLocalCache</c> parameter should be true and caching
+ /// should be enabled for the region to get values into the region
+ /// otherwise an <c>IllegalArgumentException</c> is thrown.
+ /// </param>
+ /// <param name="exceptions">
+ /// output parameter that provides the map of keys
+ /// to any exceptions while obtaining the key; ignored if this is NULL
+ /// </param>
+ /// <param name="addToLocalCache">
+ /// true if the obtained values have also to be added to the local cache
+ /// </param>
+ /// <param name="callbackArg">
+ /// a user-defined parameter to pass to callback events triggered by this method
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the collection of keys is null or empty. Other invalid case is when
+ /// the <c>values</c> parameter is NULL, and either
+ /// <c>addToLocalCache</c> is false or caching is disabled
+ /// for this region.
+ /// </exception>
+ /// <exception cref="CacheServerException">
+ /// If an exception is received from the Java cache server while
+ /// processing the request.
+ /// </exception>
+ /// <exception cref="NotConnectedException">
+ /// if region is not connected to the cache because the client
+ /// cannot establish usable connections to any of the given servers
+ /// For pools configured with locators, if no locators are available, innerException
+ /// of NotConnectedException is set to NoAvailableLocatorsException.
+ /// </exception>
+ /// <exception cref="RegionDestroyedException">
+ /// If region destroy is pending.
+ /// </exception>
+ /// <exception cref="TimeoutException">
+ /// if operation timed out.
+ /// </exception>
+ /// <exception cref="UnknownException">
+ /// For other exceptions.
+ /// </exception>
+ /// <exception cref="NotSupportedException">
+ /// if it is called by local region instance <see cref="Region.GetLocalView" />
+ /// </exception>
+ /// <seealso cref="Get"/>
+ void GetAll(System::Collections::Generic::ICollection<TKey>^ keys,
+ System::Collections::Generic::IDictionary<TKey, TValue>^ values,
+ System::Collections::Generic::IDictionary<TKey, System::Exception^>^ exceptions,
+ bool addToLocalCache, Object^ callbackArg);
+
+ /// <summary>
+ /// Gets the region name.
+ /// </summary>
+ /// <returns>
+ /// region's name
+ /// </returns>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Gets the region's full path, which can be used to get this region object
+ /// with <see cref="Cache.GetRegion" />.
+ /// </summary>
+ /// <returns>
+ /// region's pathname
+ /// </returns>
+ property String^ FullPath
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Gets the parent region.
+ /// </summary>
+ /// <returns>
+ /// region's parent, if any, or null if this is a root region
+ /// </returns>
+ /// <exception cref="RegionDestroyedException">
+ /// if the region has been destroyed
+ /// </exception>
+ property IRegion<TKey, TValue>^ ParentRegion
+ {
+ IRegion<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Returns the attributes for this region, which can be used to create a new
+ /// region with <see cref="Cache.CreateRegion" />.
+ /// </summary>
+ /// <returns>
+ /// region's attributes
+ /// </returns>
+ property RegionAttributes<TKey, TValue>^ Attributes
+ {
+ RegionAttributes<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Return a mutator object for changing a subset of the
+ /// region attributes.
+ /// </summary>
+ /// <returns>
+ /// attribute mutator
+ /// </returns>
+ /// <exception cref="RegionDestroyedException">
+ /// if the region has been destroyed
+ /// </exception>
+ property AttributesMutator<TKey, TValue>^ AttributesMutator
+ {
+ Apache::Geode::Client::AttributesMutator<TKey, TValue>^ get();
+ }
+
+ /// <summary>
+ /// Returns the statistics for this region.
+ /// </summary>
+ /// <returns>the <c>CacheStatistics</c> for this region</returns>
+ /// <exception cref="StatisticsDisabledException">
+ /// if statistics have been disabled for this region
+ /// </exception>
+ property CacheStatistics^ Statistics
+ {
+ CacheStatistics^ get();
+ }
+
+ /// <summary>
+ /// Returns the subregion identified by the path, null if no such subregion.
+ /// </summary>
+ /// <param name="path">path</param>
+ /// <returns>subregion, or null if none</returns>
+ /// <seealso cref="FullPath" />
+ /// <seealso cref="SubRegions" />
+ /// <seealso cref="ParentRegion" />
+ IRegion<TKey, TValue>^ GetSubRegion( String^ path );
+
+ /// <summary>
+ /// Creates a subregion with the given name and attributes.
+ /// </summary>
+ /// <param name="subRegionName">new subregion name</param>
+ /// <param name="attributes">subregion attributes</param>
+ /// <returns>new subregion</returns>
+ /// <seealso cref="CreateServerSubRegion" />
+ IRegion<TKey, TValue>^ CreateSubRegion( String^ subRegionName, RegionAttributes<TKey, TValue>^ attributes );
+
+ /// <summary>
+ /// Returns the subregions of this region.
+ /// </summary>
+ /// <param name="recursive">if true, also return all nested subregions</param>
+ /// <returns>collection of regions</returns>
+ /// <exception cref="RegionDestroyedException">
+ /// this region has already been destroyed
+ /// </exception>
+ System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ SubRegions( bool recursive );
+
+ /// <summary>
+ /// Return the meta-object RegionEntry for the given key.
+ /// For both local & distributed region instances, this operation happens in local cache only
<TRUNCATED>
[31/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientSecurityAuthzTestBaseN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientSecurityAuthzTestBaseN.cs b/clicache/integration-test/ThinClientSecurityAuthzTestBaseN.cs
new file mode 100644
index 0000000..a66c41d
--- /dev/null
+++ b/clicache/integration-test/ThinClientSecurityAuthzTestBaseN.cs
@@ -0,0 +1,1061 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+ using AssertionException = Apache.Geode.Client.AssertionException;
+ public abstract class ThinClientSecurityAuthzTestBase : ThinClientRegionSteps
+ {
+ #region Protected members
+
+ protected const string SubregionName = "AuthSubregion";
+ protected const string CacheXml1 = "cacheserver_notify_subscription.xml";
+ protected const string CacheXml2 = "cacheserver_notify_subscription2.xml";
+
+ #endregion
+
+ #region Private methods
+
+ private static string IndicesToString(int[] indices)
+ {
+ string str = string.Empty;
+ if (indices != null && indices.Length > 0)
+ {
+ str += indices[0];
+ for (int index = 1; index < indices.Length; ++index)
+ {
+ str += ',';
+ str += indices[index];
+ }
+ }
+ return str;
+ }
+
+ private IRegion<TKey, TValue> CreateSubregion<TKey, TValue>(IRegion<TKey, TValue> region)
+ {
+ Util.Log("CreateSubregion " + SubregionName);
+ IRegion<TKey, TValue> subregion = region.GetSubRegion(SubregionName);
+ if (subregion == null)
+ {
+ //subregion = region.CreateSubRegion(SubregionName, region.Attributes);
+ subregion = CacheHelper.GetRegion<TKey, TValue>(region.FullPath).CreateSubRegion(SubregionName, region.Attributes);
+ }
+ return subregion;
+ }
+
+ private bool CheckFlags(OpFlags flags, OpFlags checkFlag)
+ {
+ return ((flags & checkFlag) == checkFlag);
+ }
+
+ protected void DoOp(OperationCode op, int[] indices,
+ OpFlags flags, ExpectedResult expectedResult)
+ {
+ DoOp(op, indices, flags, expectedResult, null, false);
+ }
+
+ protected void DoOp(OperationCode op, int[] indices,
+ OpFlags flags, ExpectedResult expectedResult, Properties<string, string> creds, bool isMultiuser)
+ {
+ IRegion<object, object> region;
+ if(isMultiuser)
+ region = CacheHelper.GetRegion<object, object>(RegionName, creds);
+ else
+ region = CacheHelper.GetRegion<object, object>(RegionName);
+
+ if (CheckFlags(flags, OpFlags.UseSubRegion))
+ {
+ IRegion<object, object> subregion = null;
+ if (CheckFlags(flags, OpFlags.NoCreateSubRegion))
+ {
+ subregion = region.GetSubRegion(SubregionName);
+ if (CheckFlags(flags, OpFlags.CheckNoRegion))
+ {
+ Assert.IsNull(subregion);
+ return;
+ }
+ else
+ {
+ Assert.IsNotNull(subregion);
+ }
+ }
+ else
+ {
+ subregion = CreateSubregion(region);
+ if (isMultiuser)
+ subregion = region.GetSubRegion(SubregionName);
+ }
+ Assert.IsNotNull(subregion);
+ region = subregion;
+ }
+ else if (CheckFlags(flags, OpFlags.CheckNoRegion))
+ {
+ Assert.IsNull(region);
+ return;
+ }
+ else
+ {
+ Assert.IsNotNull(region);
+ }
+ string valPrefix;
+ if (CheckFlags(flags, OpFlags.UseNewVal))
+ {
+ valPrefix = NValuePrefix;
+ }
+ else
+ {
+ valPrefix = ValuePrefix;
+ }
+ int numOps = indices.Length;
+ Util.Log("Got DoOp for op: " + op + ", numOps: " + numOps
+ + ", indices: " + IndicesToString(indices));
+ bool exceptionOccured = false;
+ bool breakLoop = false;
+ for (int indexIndex = 0; indexIndex < indices.Length; ++indexIndex)
+ {
+ if (breakLoop)
+ {
+ break;
+ }
+ int index = indices[indexIndex];
+ string key = KeyPrefix + index;
+ string expectedValue = (valPrefix + index);
+ try
+ {
+ switch (op)
+ {
+ case OperationCode.Get:
+ Object value = null;
+ if (CheckFlags(flags, OpFlags.LocalOp))
+ {
+ int sleepMillis = 100;
+ int numTries = 30;
+ bool success = false;
+ while (!success && numTries-- > 0)
+ {
+ if (!isMultiuser && region.ContainsValueForKey(key))
+ {
+ value = region[key];
+ success = expectedValue.Equals(value.ToString());
+ if (CheckFlags(flags, OpFlags.CheckFail))
+ {
+ success = !success;
+ }
+ }
+ else
+ {
+ value = null;
+ success = CheckFlags(flags, OpFlags.CheckFail);
+ }
+ if (!success)
+ {
+ Thread.Sleep(sleepMillis);
+ }
+ }
+ }
+ else
+ {
+ if (!isMultiuser)
+ {
+ if (CheckFlags(flags, OpFlags.CheckNoKey))
+ {
+ Assert.IsFalse(region.GetLocalView().ContainsKey(key));
+ }
+ else
+ {
+ Assert.IsTrue(region.GetLocalView().ContainsKey(key));
+ region.GetLocalView().Invalidate(key);
+ }
+ }
+ try
+ {
+ value = region[key];
+ }
+ catch (Client.KeyNotFoundException )
+ {
+ Util.Log("KeyNotFoundException while getting key. should be ok as we are just testing auth");
+ }
+ }
+ if (!isMultiuser && value != null)
+ {
+ if (CheckFlags(flags, OpFlags.CheckFail))
+ {
+ Assert.AreNotEqual(expectedValue, value.ToString());
+ }
+ else
+ {
+ Assert.AreEqual(expectedValue, value.ToString());
+ }
+ }
+ break;
+ case OperationCode.Put:
+ region[key] = expectedValue;
+ break;
+ case OperationCode.Destroy:
+ if (!isMultiuser && !region.GetLocalView().ContainsKey(key))
+ {
+ // Since DESTROY will fail unless the value is present
+ // in the local cache, this is a workaround for two cases:
+ // 1. When the operation is supposed to succeed then in
+ // the current AuthzCredentialGenerators the clients having
+ // DESTROY permission also has CREATE/UPDATE permission
+ // so that calling region.Put() will work for that case.
+ // 2. When the operation is supposed to fail with
+ // NotAuthorizedException then in the current
+ // AuthzCredentialGenerators the clients not
+ // having DESTROY permission are those with reader role that have
+ // GET permission.
+ //
+ // If either of these assumptions fails, then this has to be
+ // adjusted or reworked accordingly.
+ if (CheckFlags(flags, OpFlags.CheckNotAuthz))
+ {
+ value = region[key];
+ Assert.AreEqual(expectedValue, value.ToString());
+ }
+ else
+ {
+ region[key] = expectedValue;
+ }
+ }
+ if ( !isMultiuser && CheckFlags(flags, OpFlags.LocalOp))
+ {
+ region.GetLocalView().Remove(key); //Destroyed replaced by Remove() API
+ }
+ else
+ {
+ region.Remove(key); //Destroyed replaced by Remove API
+ }
+ break;
+ //TODO: Need to fix Stack overflow exception..
+ case OperationCode.RegisterInterest:
+ if (CheckFlags(flags, OpFlags.UseList))
+ {
+ breakLoop = true;
+ // Register interest list in this case
+ List<CacheableKey> keyList = new List<CacheableKey>(numOps);
+ for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex)
+ {
+ int keyNum = indices[keyNumIndex];
+ keyList.Add(KeyPrefix + keyNum);
+ }
+ region.GetSubscriptionService().RegisterKeys(keyList.ToArray());
+ }
+ else if (CheckFlags(flags, OpFlags.UseRegex))
+ {
+ breakLoop = true;
+ region.GetSubscriptionService().RegisterRegex(KeyPrefix + "[0-" + (numOps - 1) + ']');
+ }
+ else if (CheckFlags(flags, OpFlags.UseAllKeys))
+ {
+ breakLoop = true;
+ region.GetSubscriptionService().RegisterAllKeys();
+ }
+ break;
+ //TODO: Need to fix Stack overflow exception..
+ case OperationCode.UnregisterInterest:
+ if (CheckFlags(flags, OpFlags.UseList))
+ {
+ breakLoop = true;
+ // Register interest list in this case
+ List<CacheableKey> keyList = new List<CacheableKey>(numOps);
+ for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex)
+ {
+ int keyNum = indices[keyNumIndex];
+ keyList.Add(KeyPrefix + keyNum);
+ }
+ region.GetSubscriptionService().UnregisterKeys(keyList.ToArray());
+ }
+ else if (CheckFlags(flags, OpFlags.UseRegex))
+ {
+ breakLoop = true;
+ region.GetSubscriptionService().UnregisterRegex(KeyPrefix + "[0-" + (numOps - 1) + ']');
+ }
+ else if (CheckFlags(flags, OpFlags.UseAllKeys))
+ {
+ breakLoop = true;
+ region.GetSubscriptionService().UnregisterAllKeys();
+ }
+ break;
+ case OperationCode.Query:
+ breakLoop = true;
+ ISelectResults<object> queryResults;
+
+ if (!isMultiuser)
+ {
+ queryResults = (ResultSet<object>)region.Query<object>(
+ "SELECT DISTINCT * FROM " + region.FullPath);
+ }
+ else
+ {
+ queryResults = CacheHelper.getMultiuserCache(creds).GetQueryService<object, object>().NewQuery("SELECT DISTINCT * FROM " + region.FullPath).Execute();
+ }
+ Assert.IsNotNull(queryResults);
+ if (!CheckFlags(flags, OpFlags.CheckFail))
+ {
+ Assert.AreEqual(numOps, queryResults.Size);
+ }
+ //CacheableHashSet querySet = new CacheableHashSet(queryResults.Size);
+ List<string> querySet = new List<string>(queryResults.Size);
+ ResultSet<object> rs = queryResults as ResultSet<object>;
+ foreach ( object result in rs)
+ {
+ querySet.Add(result.ToString());
+ }
+ for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex)
+ {
+ int keyNum = indices[keyNumIndex];
+ string expectedVal = valPrefix + keyNumIndex;
+ if (CheckFlags(flags, OpFlags.CheckFail))
+ {
+ Assert.IsFalse(querySet.Contains(expectedVal));
+ }
+ else
+ {
+ Assert.IsTrue(querySet.Contains(expectedVal));
+ }
+ }
+ break;
+ case OperationCode.RegionDestroy:
+ breakLoop = true;
+ if ( !isMultiuser && CheckFlags(flags, OpFlags.LocalOp))
+ {
+ region.GetLocalView().DestroyRegion();
+ }
+ else
+ {
+ region.DestroyRegion();
+ }
+ break;
+
+ case OperationCode.GetServerKeys:
+ breakLoop = true;
+ ICollection<object> serverKeys = region.Keys;
+ break;
+
+ //TODO: Need to fix System.ArgumentOutOfRangeException: Index was out of range. Know issue with GetAll()
+ case OperationCode.GetAll:
+ //ICacheableKey[] keymap = new ICacheableKey[5];
+ List<object> keymap = new List<object>();
+ for (int i = 0; i < 5; i++)
+ {
+ keymap.Add(i);
+ //CacheableInt32 item = CacheableInt32.Create(i);
+ //Int32 item = i;
+ // NOTE: GetAll should operate right after PutAll
+ //keymap[i] = item;
+ }
+ Dictionary<Object, Object> entrymap = new Dictionary<Object, Object>();
+ //CacheableHashMap entrymap = CacheableHashMap.Create();
+ region.GetAll(keymap, entrymap, null, false);
+ if (entrymap.Count < 5)
+ {
+ Assert.Fail("DoOp: Got fewer entries for op " + op);
+ }
+ break;
+ case OperationCode.PutAll:
+ // NOTE: PutAll should operate right before GetAll
+ //CacheableHashMap entrymap2 = CacheableHashMap.Create();
+ Dictionary<Object, Object> entrymap2 = new Dictionary<object, object>();
+ for (int i = 0; i < 5; i++)
+ {
+ //CacheableInt32 item = CacheableInt32.Create(i);
+ Int32 item = i;
+ entrymap2.Add(item, item);
+ }
+ region.PutAll(entrymap2);
+ break;
+ case OperationCode.RemoveAll:
+ Dictionary<Object, Object> entrymap3 = new Dictionary<object, object>();
+ for (int i = 0; i < 5; i++)
+ {
+ //CacheableInt32 item = CacheableInt32.Create(i);
+ Int32 item = i;
+ entrymap3.Add(item, item);
+ }
+ region.PutAll(entrymap3);
+ ICollection<object> keys = new LinkedList<object>();
+ for (int i = 0; i < 5; i++)
+ {
+ Int32 item = i;
+ keys.Add(item);
+ }
+ region.RemoveAll(keys);
+ break;
+ case OperationCode.ExecuteCQ:
+ Pool/*<object, object>*/ pool = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_");
+ QueryService<object, object> qs;
+ if (pool != null)
+ {
+ qs = pool.GetQueryService<object, object>();
+ }
+ else
+ {
+ //qs = CacheHelper.DCache.GetQueryService<object, object>();
+ qs = null;
+
+ }
+ CqAttributesFactory<object, object> cqattrsfact = new CqAttributesFactory<object, object>();
+ CqAttributes<object, object> cqattrs = cqattrsfact.Create();
+ CqQuery<object, object> cq = qs.NewCq("cq_security", "SELECT * FROM /" + region.Name, cqattrs, false);
+ qs.ExecuteCqs();
+ qs.StopCqs();
+ qs.CloseCqs();
+ break;
+
+ case OperationCode.ExecuteFunction:
+ if (!isMultiuser)
+ {
+ Pool/*<object, object>*/ pool2 = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_");
+ if (pool2 != null)
+ {
+ Client.FunctionService<object>.OnServer(pool2).Execute("securityTest");
+ Client.FunctionService<object>.OnRegion<object, object>(region).Execute("FireNForget");
+ }
+ else
+ {
+ expectedResult = ExpectedResult.Success;
+ }
+ }
+ else
+ {
+ //FunctionService fs = CacheHelper.getMultiuserCache(creds).GetFunctionService();
+ //Execution exe = fs.OnServer();
+ IRegionService userCache = CacheHelper.getMultiuserCache(creds);
+ Apache.Geode.Client.Execution<object> exe = Client.FunctionService<object>.OnServer(userCache);
+ exe.Execute("securityTest");
+ exe = Client.FunctionService<object>.OnServers(userCache);
+ Client.FunctionService<object>.OnRegion<object, object>(region);
+ Client.FunctionService<object>.OnRegion<object, object>(userCache.GetRegion<object, object>(region.Name)).Execute("FireNForget");
+ }
+ break;
+ default:
+ Assert.Fail("DoOp: Unhandled operation " + op);
+ break;
+ }
+
+ if (expectedResult != ExpectedResult.Success)
+ {
+ Assert.Fail("Expected an exception while performing operation");
+ }
+ }
+ catch (AssertionException ex)
+ {
+ Util.Log("DoOp: failed assertion: {0}", ex);
+ throw;
+ }
+ catch (NotAuthorizedException ex)
+ {
+ exceptionOccured = true;
+ if (expectedResult == ExpectedResult.NotAuthorizedException)
+ {
+ Util.Log(
+ "DoOp: Got expected NotAuthorizedException when doing operation ["
+ + op + "] with flags [" + flags + "]: " + ex.Message);
+ continue;
+ }
+ else
+ {
+ Assert.Fail("DoOp: Got unexpected NotAuthorizedException when " +
+ "doing operation: " + ex.Message);
+ }
+ }
+ catch (Exception ex)
+ {
+ exceptionOccured = true;
+ if (expectedResult == ExpectedResult.OtherException)
+ {
+ Util.Log("DoOp: Got expected exception when doing operation: " +
+ ex.GetType() + "::" + ex.Message);
+ continue;
+ }
+ else
+ {
+ Assert.Fail("DoOp: Got unexpected exception when doing operation: " + ex);
+ }
+ }
+ }
+
+ if (!exceptionOccured
+ && expectedResult != ExpectedResult.Success)
+ {
+ Assert.Fail("Expected an exception while performing operation");
+ }
+ Util.Log(" doop done");
+ }
+
+ protected void ExecuteOpBlock(List<OperationWithAction> opBlock,
+ string authInit, Properties<string, string> extraAuthProps, Properties<string, string> extraAuthzProps,
+ TestCredentialGenerator gen, Random rnd, bool isMultiuser, bool ssl,bool withPassword)
+ {
+ foreach (OperationWithAction currentOp in opBlock)
+ {
+ // Start client with valid credentials as specified in
+ // OperationWithAction
+ OperationCode opCode = currentOp.OpCode;
+ OpFlags opFlags = currentOp.Flags;
+ int clientNum = currentOp.ClientNum;
+ if (clientNum > m_clients.Length)
+ {
+ Assert.Fail("ExecuteOpBlock: Unknown client number " + clientNum);
+ }
+ ClientBase client = m_clients[clientNum - 1];
+ Util.Log("ExecuteOpBlock: performing operation number [" +
+ currentOp.OpNum + "]: " + currentOp);
+ Properties<string, string> clientProps = null;
+ if (!CheckFlags(opFlags, OpFlags.UseOldConn))
+ {
+ Properties<string, string> opCredentials;
+ int newRnd = rnd.Next(100) + 1;
+ string currentRegionName = '/' + RegionName;
+ if (CheckFlags(opFlags, OpFlags.UseSubRegion))
+ {
+ currentRegionName += ('/' + SubregionName);
+ }
+ string credentialsTypeStr;
+ OperationCode authOpCode = currentOp.AuthzOperationCode;
+ int[] indices = currentOp.Indices;
+ CredentialGenerator cGen = gen.GetCredentialGenerator();
+ Properties<string, string> javaProps = null;
+ if (CheckFlags(opFlags, OpFlags.CheckNotAuthz) ||
+ CheckFlags(opFlags, OpFlags.UseNotAuthz))
+ {
+ opCredentials = gen.GetDisallowedCredentials(
+ new OperationCode[] { authOpCode },
+ new string[] { currentRegionName }, indices, newRnd);
+ credentialsTypeStr = " unauthorized " + authOpCode;
+ }
+ else
+ {
+ opCredentials = gen.GetAllowedCredentials(new OperationCode[] {
+ opCode, authOpCode }, new string[] { currentRegionName },
+ indices, newRnd);
+ credentialsTypeStr = " authorized " + authOpCode;
+ }
+ if (cGen != null)
+ {
+ javaProps = cGen.JavaProperties;
+ }
+ clientProps = SecurityTestUtil.ConcatProperties(
+ opCredentials, extraAuthProps, extraAuthzProps);
+ // Start the client with valid credentials but allowed or disallowed to
+ // perform an operation
+ Util.Log("ExecuteOpBlock: For client" + clientNum +
+ credentialsTypeStr + " credentials: " + opCredentials);
+
+ if(!isMultiuser)
+ client.Call(SecurityTestUtil.CreateClientSSL, RegionName,
+ CacheHelper.Locators, authInit, clientProps, ssl, withPassword);
+ else
+ client.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+ }
+ ExpectedResult expectedResult;
+ if (CheckFlags(opFlags, OpFlags.CheckNotAuthz))
+ {
+ expectedResult = ExpectedResult.NotAuthorizedException;
+ }
+ else if (CheckFlags(opFlags, OpFlags.CheckException))
+ {
+ expectedResult = ExpectedResult.OtherException;
+ }
+ else
+ {
+ expectedResult = ExpectedResult.Success;
+ }
+
+ // Perform the operation from selected client
+ if (!isMultiuser)
+ client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult);
+ else
+ client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult, clientProps, true);
+ }
+ }
+
+ protected List<AuthzCredentialGenerator> GetAllGeneratorCombos(bool isMultiUser)
+ {
+ List<AuthzCredentialGenerator> generators =
+ new List<AuthzCredentialGenerator>();
+ foreach (AuthzCredentialGenerator.ClassCode authzClassCode in
+ Enum.GetValues(typeof(AuthzCredentialGenerator.ClassCode)))
+ {
+ List<CredentialGenerator> cGenerators =
+ SecurityTestUtil.getAllGenerators(isMultiUser);
+ foreach (CredentialGenerator cGen in cGenerators)
+ {
+ AuthzCredentialGenerator authzGen = AuthzCredentialGenerator
+ .Create(authzClassCode);
+ if (authzGen != null)
+ {
+ if (authzGen.Init(cGen))
+ {
+ generators.Add(authzGen);
+ }
+ }
+ }
+ }
+ return generators;
+ }
+
+ protected void RunOpsWithFailoverSSL(OperationWithAction[] opCodes,
+ string testName, bool withPassword)
+ {
+ RunOpsWithFailover(opCodes, testName, false, true,withPassword);
+ }
+
+ protected void RunOpsWithFailover(OperationWithAction[] opCodes,
+ string testName)
+ {
+ RunOpsWithFailover(opCodes, testName, false);
+ }
+
+ protected void RunOpsWithFailover(OperationWithAction[] opCodes,
+ string testName, bool isMultiUser)
+ {
+ RunOpsWithFailover(opCodes, testName, isMultiUser, false, false);
+ }
+
+ protected void RunOpsWithFailover(OperationWithAction[] opCodes,
+ string testName, bool isMultiUser, bool ssl, bool withPassword)
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC", null, ssl);
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(isMultiUser))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+ TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(authzGen);
+
+ Util.Log(testName + ": Using authinit: " + authInit);
+ Util.Log(testName + ": Using authenticator: " + authenticator);
+ Util.Log(testName + ": Using accessor: " + accessor);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Perform all the ops on the clients
+ List<OperationWithAction> opBlock = new List<OperationWithAction>();
+ Random rnd = new Random();
+ for (int opNum = 0; opNum < opCodes.Length; ++opNum)
+ {
+ // Start client with valid credentials as specified in
+ // OperationWithAction
+ OperationWithAction currentOp = opCodes[opNum];
+ if (currentOp == OperationWithAction.OpBlockEnd ||
+ currentOp == OperationWithAction.OpBlockNoFailover)
+ {
+ // End of current operation block; execute all the operations
+ // on the servers with/without failover
+ if (opBlock.Count > 0)
+ {
+ // Start the first server and execute the operation block
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs, ssl);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StopJavaServer(2, false);
+ ExecuteOpBlock(opBlock, authInit, extraAuthProps,
+ extraAuthzProps, tgen, rnd, isMultiUser, ssl, withPassword);
+ if (currentOp == OperationWithAction.OpBlockNoFailover)
+ {
+ CacheHelper.StopJavaServer(1);
+ }
+ else
+ {
+ // Failover to the second server and run the block again
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs, ssl);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StopJavaServer(1);
+ ExecuteOpBlock(opBlock, authInit, extraAuthProps,
+ extraAuthzProps, tgen, rnd, isMultiUser, ssl, withPassword);
+ }
+ opBlock.Clear();
+ }
+ }
+ else
+ {
+ currentOp.OpNum = opNum;
+ opBlock.Add(currentOp);
+ }
+ }
+ // Close all clients here since we run multiple iterations for pool and non pool configs
+ foreach (ClientBase client in m_clients)
+ {
+ client.Call(Close);
+ }
+ }
+ CacheHelper.StopJavaLocator(1, true, ssl);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #endregion
+
+ /// <summary>
+ /// This class specifies flags that can be used to alter the behaviour of
+ /// operations being performed by the <see cref="DoOp"/> method.
+ /// </summary>
+ [Flags]
+ public enum OpFlags
+ {
+ /// <summary>
+ /// Default behaviour.
+ /// </summary>
+ None = 0x0,
+
+ /// <summary>
+ /// Check that the operation should fail.
+ /// </summary>
+ CheckFail = 0x1,
+
+ /// <summary>
+ /// Check that the operation should throw <c>NotAuthorizedException</c>.
+ /// </summary>
+ CheckNotAuthz = 0x2,
+
+ /// <summary>
+ /// Do the connection with unauthorized credentials but do not check that the
+ /// operation throws <c>NotAuthorizedException</c>.
+ /// </summary>
+ UseNotAuthz = 0x4,
+
+ /// <summary>
+ /// Check that the region should not be available.
+ /// </summary>
+ CheckNoRegion = 0x8,
+
+ /// <summary>
+ /// Check that the operation should throw an exception other than the
+ /// <c>NotAuthorizedException</c>.
+ /// </summary>
+ CheckException = 0x10,
+
+ /// <summary>
+ /// Check for values starting with <c>NValuePrefix</c> instead of
+ /// <c>ValuePrefix</c>.
+ /// </summary>
+ UseNewVal = 0x20,
+
+ /// <summary>
+ /// Register a regular expression.
+ /// </summary>
+ UseRegex = 0x40,
+
+ /// <summary>
+ /// Register a list of keys.
+ /// </summary>
+ UseList = 0x80,
+
+ /// <summary>
+ /// Register all keys.
+ /// </summary>
+ UseAllKeys = 0x100,
+
+ /// <summary>
+ /// Perform the local version of the operation (if applicable).
+ /// </summary>
+ LocalOp = 0x200,
+
+ /// <summary>
+ /// Check that the key for the operation should not be present.
+ /// </summary>
+ CheckNoKey = 0x400,
+
+ /// <summary>
+ /// Use the sub-region for performing the operation.
+ /// </summary>
+ UseSubRegion = 0x800,
+
+ /// <summary>
+ /// Do not try to create the sub-region.
+ /// </summary>
+ NoCreateSubRegion = 0x1000,
+
+ /// <summary>
+ /// Do not re-connect using new credentials rather use the previous
+ /// connection.
+ /// </summary>
+ UseOldConn = 0x2000,
+ }
+
+ /// <summary>
+ /// This class encapsulates an <see cref="OperationCode"/> with associated flags, the
+ /// client to perform the operation, and the number of operations to perform.
+ /// </summary>
+ public class OperationWithAction
+ {
+ /// <summary>
+ /// The operation to be performed.
+ /// </summary>
+ private OperationCode m_opCode;
+
+ /// <summary>
+ /// The operation for which authorized or unauthorized credentials have to be
+ /// generated. This is the same as {@link #opCode} when not specified.
+ /// </summary>
+ private OperationCode m_authzOpCode;
+
+ /// <summary>
+ /// The client number on which the operation has to be performed.
+ /// </summary>
+ private int m_clientNum;
+
+ /// <summary>
+ /// Bitwise or'd <see cref="OpFlags"/> to change/specify the behaviour of
+ /// the operations.
+ /// </summary>
+ private OpFlags m_flags;
+
+ /// <summary>
+ /// Indices of the keys array to be used for operations. The keys used
+ /// will be concatenation of <c>KeyPrefix</c> and <c>index</c> integer.
+ /// </summary>
+ private int[] m_indices;
+
+ /// <summary>
+ /// An index for the operation used for logging.
+ /// </summary>
+ private int m_opNum;
+
+ /// <summary>
+ /// Indicates end of an operation block which can be used for testing with
+ /// failover.
+ /// </summary>
+ public static readonly OperationWithAction OpBlockEnd = new OperationWithAction(
+ OperationCode.Get, 4);
+
+ /// <summary>
+ /// Indicates end of an operation block which should not be used for testing
+ /// with failover.
+ /// </summary>
+ public static readonly OperationWithAction OpBlockNoFailover =
+ new OperationWithAction(OperationCode.Get, 5);
+
+ private void SetIndices(int numOps)
+ {
+ this.m_indices = new int[numOps];
+ for (int index = 0; index < numOps; ++index)
+ {
+ this.m_indices[index] = index;
+ }
+ }
+
+ public OperationWithAction(OperationCode opCode)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = opCode;
+ this.m_clientNum = 1;
+ this.m_flags = OpFlags.None;
+ SetIndices(4);
+ this.m_opNum = 0;
+ }
+
+ public OperationWithAction(OperationCode opCode, int clientNum)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = opCode;
+ this.m_clientNum = clientNum;
+ this.m_flags = OpFlags.None;
+ SetIndices(4);
+ this.m_opNum = 0;
+ }
+
+ public OperationWithAction(OperationCode opCode, int clientNum, OpFlags flags,
+ int numOps)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = opCode;
+ this.m_clientNum = clientNum;
+ this.m_flags = flags;
+ SetIndices(numOps);
+ this.m_opNum = 0;
+ }
+
+ public OperationWithAction(OperationCode opCode,
+ OperationCode deniedOpCode, int clientNum, OpFlags flags, int numOps)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = deniedOpCode;
+ this.m_clientNum = clientNum;
+ this.m_flags = flags;
+ SetIndices(numOps);
+ this.m_opNum = 0;
+ }
+
+ public OperationWithAction(OperationCode opCode, int clientNum,
+ OpFlags flags, int[] indices)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = opCode;
+ this.m_clientNum = clientNum;
+ this.m_flags = flags;
+ this.m_indices = indices;
+ this.m_opNum = 0;
+ }
+
+ public OperationWithAction(OperationCode opCode, OperationCode authzOpCode,
+ int clientNum, OpFlags flags, int[] indices)
+ {
+ this.m_opCode = opCode;
+ this.m_authzOpCode = authzOpCode;
+ this.m_clientNum = clientNum;
+ this.m_flags = flags;
+ this.m_indices = indices;
+ this.m_opNum = 0;
+ }
+
+ public OperationCode OpCode
+ {
+ get
+ {
+ return this.m_opCode;
+ }
+ }
+
+ public OperationCode AuthzOperationCode
+ {
+ get
+ {
+ return this.m_authzOpCode;
+ }
+ }
+
+ public int ClientNum
+ {
+ get
+ {
+ return this.m_clientNum;
+ }
+ }
+
+ public OpFlags Flags
+ {
+ get
+ {
+ return this.m_flags;
+ }
+ }
+
+ public int[] Indices
+ {
+ get
+ {
+ return this.m_indices;
+ }
+ }
+
+ public int OpNum
+ {
+ get
+ {
+ return this.m_opNum;
+ }
+ set
+ {
+ this.m_opNum = value;
+ }
+ }
+
+ public override string ToString()
+ {
+ return "opCode:" + this.m_opCode + ",authOpCode:" + this.m_authzOpCode
+ + ",clientNum:" + this.m_clientNum + ",flags:" + this.m_flags
+ + ",numOps:" + this.m_indices.Length + ",indices:"
+ + IndicesToString(this.m_indices);
+ }
+ }
+
+ /// <summary>
+ /// Simple interface to generate credentials with authorization based on key
+ /// indices also. This is utilized by the post-operation authorization tests
+ /// <c>ThinClientAuthzObjectModTests</c> where authorization depends on
+ /// the actual keys being used for the operation.
+ /// </summary>
+ public interface TestCredentialGenerator
+ {
+ /// <summary>
+ /// Get allowed credentials for the given set of operations in the given
+ /// regions and indices of keys.
+ /// </summary>
+ Properties<string, string> GetAllowedCredentials(OperationCode[] opCodes,
+ string[] regionNames, int[] keyIndices, int num);
+
+ /// <summary>
+ /// Get disallowed credentials for the given set of operations in the given
+ /// regions and indices of keys.
+ /// </summary>
+ Properties<string, string> GetDisallowedCredentials(OperationCode[] opCodes,
+ string[] regionNames, int[] keyIndices, int num);
+
+ /// <summary>
+ /// Get the <see cref="CredentialGenerator"/> if any.
+ /// </summary>
+ /// <returns></returns>
+ CredentialGenerator GetCredentialGenerator();
+ }
+
+ /// <summary>
+ /// Contains a <c>AuthzCredentialGenerator</c> and implements the
+ /// <c>TestCredentialGenerator</c> interface.
+ /// </summary>
+ protected class TestAuthzCredentialGenerator : TestCredentialGenerator
+ {
+ private AuthzCredentialGenerator authzGen;
+
+ public TestAuthzCredentialGenerator(AuthzCredentialGenerator authzGen)
+ {
+ this.authzGen = authzGen;
+ }
+
+ public Properties<string, string> GetAllowedCredentials(OperationCode[] opCodes,
+ string[] regionNames, int[] keyIndices, int num)
+ {
+
+ return this.authzGen.GetAllowedCredentials(opCodes, regionNames, num);
+ }
+
+ public Properties<string, string> GetDisallowedCredentials(OperationCode[] opCodes,
+ string[] regionNames, int[] keyIndices, int num)
+ {
+
+ return this.authzGen.GetDisallowedCredentials(opCodes, regionNames, num);
+ }
+
+ public CredentialGenerator GetCredentialGenerator()
+ {
+
+ return authzGen.GetCredentialGenerator();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs b/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
new file mode 100644
index 0000000..3d697bb
--- /dev/null
+++ b/clicache/integration-test/ThinClientSecurityAuthzTestsMUN.cs
@@ -0,0 +1,1051 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+ public class MyCqListener2<TKey, TResult> : ICqListener<TKey, TResult>
+ {
+ private int m_create = 0;
+ private int m_update = 0;
+ private int m_id = 0;
+
+ public MyCqListener2(int id)
+ {
+ this.m_id = id;
+ }
+
+ public int Creates
+ {
+ get { return m_create; }
+ }
+
+ public int Updates
+ {
+ get { return m_update; }
+ }
+
+ #region ICqListener Members
+
+ void ICqListener<TKey, TResult>.Close()
+ {
+ Util.Log("CqListener closed with ID = " + m_id);
+ }
+
+ void ICqListener<TKey, TResult>.OnError(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("CqListener OnError called ");
+ }
+
+ void ICqListener<TKey, TResult>.OnEvent(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("CqListener OnEvent ops = " + ev.getBaseOperation());
+ if (ev.getBaseOperation() == CqOperationType.OP_TYPE_CREATE)
+ m_create++;
+ else if (ev.getBaseOperation() == CqOperationType.OP_TYPE_UPDATE)
+ m_update++;
+ }
+
+ #endregion
+ }
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientSecurityAuthzTestsMU : ThinClientSecurityAuthzTestBase
+ {
+ #region Private members
+ IRegion<object, object> region;
+ IRegion<object, object> region1;
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private UnitProcess m_client3;
+ private TallyListener<object, object> m_listener;
+ private TallyWriter<object, object> m_writer;
+ private string/*<object>*/ keys = "Key";
+ private string value = "Value";
+
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ public void CreateRegion(string locators, bool caching,
+ bool listener, bool writer)
+ {
+ Util.Log(" in CreateRegion " + listener + " : " + writer);
+ 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);
+
+ if (writer)
+ {
+ m_writer = new TallyWriter<object, object>();
+ }
+ else
+ {
+ m_writer = null;
+ }
+ Util.Log("region created ");
+ AttributesMutator<object, object> at = region.AttributesMutator;
+ at.SetCacheWriter(m_writer);
+ }
+
+ public void DoPut()
+ {
+ region = CacheHelper.GetRegion<object, object>(RegionName);
+ region[keys.ToString()] = value;
+ }
+
+ public void CheckAssert()
+ {
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer Should be invoked");
+ Assert.AreEqual(false, m_listener.IsListenerInvoked, "Listener Should not be invoked");
+ Assert.IsFalse(region.ContainsKey(keys.ToString()), "Key should have been found in the region");
+ }
+
+ public void DoLocalPut()
+ {
+ region1 = CacheHelper.GetRegion<object, object>(RegionName);
+ region1.GetLocalView()[m_keys[2]] = m_vals[2];
+ //this check is no loger valid as ContainsKey goes on server
+ //Assert.IsTrue(region1.ContainsKey(m_keys[2]), "Key should have been found in the region");
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer Should be invoked");
+ Assert.AreEqual(true, m_listener.IsListenerInvoked, "Listener Should be invoked");
+
+ //try Update
+ try
+ {
+ Util.Log("Trying UpdateEntry");
+ m_listener.ResetListenerInvokation();
+ UpdateEntry(RegionName, m_keys[2], m_nvals[2], false);
+ Assert.Fail("Should have got NotAuthorizedException during updateEntry");
+ }
+ catch (NotAuthorizedException)
+ {
+ Util.Log("NotAuthorizedException Caught");
+ Util.Log("Success");
+ }
+ catch (Exception other)
+ {
+ Util.Log("Stack trace: {0} ", other.StackTrace);
+ Util.Log("Got exception : {0}", other.Message);
+ }
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer should be invoked");
+ Assert.AreEqual(false, m_listener.IsListenerInvoked, "Listener should not be invoked");
+ //Assert.IsTrue(region1.ContainsKey(m_keys[2]), "Key should have been found in the region");
+ VerifyEntry(RegionName, m_keys[2], m_vals[2]);
+ m_writer.SetWriterFailed();
+
+ //test CacheWriter
+ try
+ {
+ Util.Log("Testing CacheWriterException");
+ UpdateEntry(RegionName, m_keys[2], m_nvals[2], false);
+ Assert.Fail("Should have got NotAuthorizedException during updateEntry");
+ }
+ catch (CacheWriterException)
+ {
+ Util.Log("CacheWriterException Caught");
+ Util.Log("Success");
+ }
+
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ if (m_clients != null)
+ {
+ foreach (ClientBase client in m_clients)
+ {
+ client.Call(CacheHelper.Close);
+ }
+ }
+ CacheHelper.Close();
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ protected const string RegionName_CQ = "Portfolios";
+ static QueryService<object, object> gQueryService = null;
+
+ static string [] QueryStrings = {
+ "select * from /Portfolios p where p.ID < 1",
+ "select * from /Portfolios p where p.ID < 2",
+ "select * from /Portfolios p where p.ID = 2",
+ "select * from /Portfolios p where p.ID >= 3",//this should pass
+ "select * from /Portfolios p where p.ID = 4",//this should pass
+ "select * from /Portfolios p where p.ID = 5",
+ "select * from /Portfolios p where p.ID = 6",
+ "select * from /Portfolios p where p.ID = 7"
+ };
+
+ public void registerCQ(Properties<string, string> credentials, bool durableCQ)
+ {
+ Util.Log("registerCQ");
+
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ Util.Log("registerCQ portfolio registered");
+ }
+ catch (IllegalStateException)
+ {
+ Util.Log("registerCQ portfolio NOT registered");
+ // ignore since we run multiple iterations for pool and non pool configs
+ }
+
+ // VJR: TODO fix cache.GetQueryService to also be generic
+ gQueryService = CacheHelper.getMultiuserCache(credentials).GetQueryService<object, object>();
+
+ for (int i = 0; i < QueryStrings.Length; i++)
+ {
+ CqAttributesFactory<object, object> cqAttrFact = new CqAttributesFactory<object, object>();
+ cqAttrFact.AddCqListener(new MyCqListener2<object, object>(i));
+ CqQuery<object, object> cq = gQueryService.NewCq("cq_" + i, QueryStrings[i], cqAttrFact.Create(), durableCQ);
+ cq.Execute();
+ }
+ Util.Log("registerCQ Done.");
+ }
+
+ public void doCQPut(Properties<string, string> credentials)
+ {
+ Util.Log("doCQPut");
+
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ Util.Log("doCQPut portfolio registered");
+ }
+ catch (IllegalStateException)
+ {
+ Util.Log("doCQPut portfolio NOT registered");
+ // ignore since we run multiple iterations for pool and non pool configs
+ }
+ //IRegion<object, object> region = CacheHelper.GetVerifyRegion(RegionName_CQ, credentials);
+
+ IRegionService userRegionService = CacheHelper.getMultiuserCache(credentials);
+ IRegion<object, object>[] regions = userRegionService.RootRegions<object, object>();
+
+ IRegion<object, object> region = null;
+
+ Console.Out.WriteLine("Number of regions " + regions.Length);
+ for (int i = 0; i < regions.Length; i++)
+ {
+ if (regions[i].Name.Equals(RegionName_CQ))
+ {
+ region = regions[i];
+ break;
+ }
+ }
+
+ for (int i = 0; i < QueryStrings.Length; i++)
+ {
+ string key = "port1-" + i;
+
+ Portfolio p = new Portfolio(i);
+
+ region[key] = p;
+ }
+
+ IRegionService rgServ = region.RegionService;
+
+ Cache cache = rgServ as Cache;
+
+ Assert.IsNull(cache);
+
+ Thread.Sleep(20000);
+ Util.Log("doCQPut Done.");
+ }
+
+ public void verifyCQEvents(bool whetherResult, CqOperationType opType )
+ {
+ Util.Log("verifyCQEvents " + gQueryService);
+ Assert.IsNotNull(gQueryService);
+
+ CqQuery<object, object> cq = gQueryService.GetCq("cq_" + 3);
+ ICqListener<object, object>[] cqL = cq.GetCqAttributes().getCqListeners();
+ MyCqListener2<object, object> mcqL = (MyCqListener2<object, object>)cqL[0];
+
+ Util.Log("got result for cq listener3 " + cq.Name + " : " + mcqL.Creates);
+
+ if (opType == CqOperationType.OP_TYPE_CREATE)
+ {
+ if (whetherResult)
+ Assert.AreEqual(1, mcqL.Creates, "CQ listener 3 should get one create event ");
+ else
+ Assert.AreEqual(0, mcqL.Creates, "CQ listener 3 should not get any create event ");
+ }
+ else if (opType == CqOperationType.OP_TYPE_UPDATE)
+ {
+ if (whetherResult)
+ Assert.AreEqual(1, mcqL.Updates, "CQ listener 3 should get one update event ");
+ else
+ Assert.AreEqual(0, mcqL.Updates, "CQ listener 3 should not get any update event ");
+ }
+
+ cq = gQueryService.GetCq("cq_" + 4);
+ cqL = cq.GetCqAttributes().getCqListeners();
+ mcqL = (MyCqListener2<object, object>)cqL[0];
+
+ Util.Log("got result for cq listener4 " + cq.Name + " : " + mcqL.Creates);
+
+ if (opType == CqOperationType.OP_TYPE_CREATE)
+ {
+ if (whetherResult)
+ Assert.AreEqual(1, mcqL.Creates, "CQ listener 4 should get one create event ");
+ else
+ Assert.AreEqual(0, mcqL.Creates, "CQ listener 4 should not get any create event ");
+ }
+ else if (opType == CqOperationType.OP_TYPE_UPDATE)
+ {
+ if (whetherResult)
+ Assert.AreEqual(1, mcqL.Updates, "CQ listener 4 should get one update event ");
+ else
+ Assert.AreEqual(0, mcqL.Updates, "CQ listener 4 should not get any update event ");
+ }
+
+ cq = gQueryService.GetCq("cq_" + 0);
+ cqL = cq.GetCqAttributes().getCqListeners();
+ mcqL = (MyCqListener2<object, object>)cqL[0];
+
+ Util.Log("got result for cq listener0 " + cq.Name + " : " + mcqL.Creates);
+
+ Assert.AreEqual(0, mcqL.Creates, "CQ listener 0 should get one create event ");
+
+
+ // CacheHelper.getMultiuserCache(null).Close();
+
+ gQueryService = null;
+
+ }
+
+ void runCQTest()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ DummyAuthorization3 da = new DummyAuthorization3();
+
+ string authenticator = da.Authenticator;
+ string authInit = da.AuthInit;
+ string accessorPP = da.AuthenticatorPP;
+
+ Util.Log("testAllowPutsGets: Using authinit: " + authInit);
+ Util.Log("testAllowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("testAllowPutsGets: Using accessorPP: " + accessorPP);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ null, accessorPP, null, null);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials, this index will be used to authorzie the user
+ Properties<string, string> createCredentials = da.GetValidCredentials(4);
+
+ Util.Log("runCQTest: ");
+ m_client1.Call(SecurityTestUtil.CreateClientMU2, RegionName_CQ,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true, true);
+
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName_CQ,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(registerCQ, createCredentials, false);
+
+ // Verify that the gets succeed
+ m_client2.Call(doCQPut, createCredentials);
+
+ m_client1.Call(verifyCQEvents, true, CqOperationType.OP_TYPE_CREATE);
+
+ m_client1.Call(CloseUserCache, false);
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ // CacheHelper.StopJavaServer(2);
+
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void CloseUserCache(bool keepAlive)
+ {
+ Util.Log("CloseUserCache keepAlive: " + keepAlive);
+ CacheHelper.CloseUserCache(keepAlive);
+ }
+
+ private static string DurableClientId1 = "DurableClientId1";
+ //private static string DurableClientId2 = "DurableClientId2";
+
+ void runDurableCQTest(bool logicalCacheClose, bool durableCQ, bool whetherResult)
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ DummyAuthorization3 da = new DummyAuthorization3();
+
+ string authenticator = da.Authenticator;
+ string authInit = da.AuthInit;
+ string accessorPP = da.AuthenticatorPP;
+
+ Util.Log("testAllowPutsGets: Using authinit: " + authInit);
+ Util.Log("testAllowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("testAllowPutsGets: Using accessorPP: " + accessorPP);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ null, accessorPP, null, null);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials, this index will be used to authorzie the user
+ Properties<string, string> createCredentials = da.GetValidCredentials(4);
+
+ Util.Log("runCQTest: ");
+ /*
+ regionName, string endpoints, string locators,
+ authInit, Properties credentials, bool pool, bool locator, bool isMultiuser, bool notificationEnabled, string durableClientId)
+ */
+ m_client1.Call(SecurityTestUtil.CreateMUDurableClient, RegionName_CQ,
+ CacheHelper.Locators, authInit, DurableClientId1, true, true );
+
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName_CQ,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ m_client1.Call(ReadyForEvents2);
+
+ // Perform some put operations from client1
+ m_client1.Call(registerCQ, createCredentials, durableCQ);
+
+
+ Properties<string, string> createCredentials2 = da.GetValidCredentials(3);
+ // Verify that the gets succeed
+ m_client2.Call(doCQPut, createCredentials2);
+
+ //close cache client-1
+ m_client1.Call(verifyCQEvents, true, CqOperationType.OP_TYPE_CREATE);
+
+ Thread.Sleep(10000);
+
+ Util.Log("Before calling CloseUserCache: " + logicalCacheClose);
+ if (logicalCacheClose)
+ m_client1.Call(CloseUserCache, logicalCacheClose);
+
+ m_client1.Call(CloseKeepAlive);
+ //put again from other client
+ m_client2.Call(doCQPut, createCredentials2);
+
+ //client-1 will up again
+ m_client1.Call(SecurityTestUtil.CreateMUDurableClient, RegionName_CQ,
+ CacheHelper.Locators, authInit, DurableClientId1, true, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(registerCQ, createCredentials, durableCQ);
+
+ m_client1.Call(ReadyForEvents2);
+ Thread.Sleep(20000);
+ m_client1.Call(verifyCQEvents, whetherResult, CqOperationType.OP_TYPE_UPDATE);
+
+
+ m_client1.Call(Close);
+
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ // CacheHelper.StopJavaServer(2);
+
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runAllowPutsGets()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(true))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("testAllowPutsGets: Using authinit: " + authInit);
+ Util.Log("testAllowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("testAllowPutsGets: Using accessor: " + accessor);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("AllowPutsGets: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Start client2 with valid GET credentials
+ Properties<string, string> getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ javaProps = cGen.JavaProperties;
+ Util.Log("AllowPutsGets: For second client GET credentials: " +
+ getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 10 , createCredentials, true);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGetsMU, 10, getCredentials, true);
+
+ m_client1.Call(DoPutsTx, 10, true, ExpectedResult.Success, getCredentials, true);
+
+ m_client2.Call(DoGets, 10, true, ExpectedResult.Success, getCredentials, true);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runDisallowPutsGets()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(true))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("DisallowPutsGets: Using authinit: " + authInit);
+ Util.Log("DisallowPutsGets: Using authenticator: " + authenticator);
+ Util.Log("DisallowPutsGets: Using accessor: " + accessor);
+
+ // Check that we indeed can obtain valid credentials not allowed to do
+ // gets
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ Properties<string, string> createJavaProps = cGen.JavaProperties;
+ Properties<string, string> getCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ Properties<string, string> getJavaProps = cGen.JavaProperties;
+ if (getCredentials == null || getCredentials.Size == 0)
+ {
+ Util.Log("DisallowPutsGets: Unable to obtain valid credentials " +
+ "with no GET permission; skipping this combination.");
+ continue;
+ }
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the two servers.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+
+ // Start client1 with valid CREATE credentials
+ createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Start client2 with invalid GET credentials
+ getCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 2);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For second client invalid GET " +
+ "credentials: " + getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Perform some put operations from client1
+ m_client1.Call(DoPutsMU, 10, createCredentials, true);
+
+ // Verify that the gets throw exception
+ m_client2.Call(DoGetsMU, 10, getCredentials, true, ExpectedResult.NotAuthorizedException);
+
+ // Try to connect client2 with reader credentials
+ getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 5);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPutsGets: For second client valid GET " +
+ "credentials: " + getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGetsMU, 10, getCredentials, true);
+
+ // Verify that the puts throw exception
+ m_client2.Call(DoPutsMU, 10, getCredentials, true, ExpectedResult.NotAuthorizedException);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runInvalidAccessor()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1, CacheXml2);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(true))
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ Util.Log("NIl:792:Current credential is = {0}", cGen);
+
+ //if (cGen.GetClassCode() == CredentialGenerator.ClassCode.LDAP)
+ // continue;
+
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("InvalidAccessor: Using authinit: " + authInit);
+ Util.Log("InvalidAccessor: Using authenticator: " + authenticator);
+
+ // Start server1 with invalid accessor
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ "com.gemstone.none", null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+
+ // Client creation should throw exceptions
+ Properties<string, string> createCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 3);
+ javaProps = cGen.JavaProperties;
+ Util.Log("InvalidAccessor: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Now perform some put operations from client1
+ m_client1.Call(DoPutsMU, 10, createCredentials, true, ExpectedResult.OtherException);
+
+ Properties<string, string> getCredentials = authzGen.GetAllowedCredentials(
+ new OperationCode[] { OperationCode.Get },
+ new string[] { RegionName }, 7);
+ javaProps = cGen.JavaProperties;
+ Util.Log("InvalidAccessor: For second client GET credentials: " +
+ getCredentials);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Now perform some put operations from client1
+ m_client2.Call(DoGetsMU, 10, getCredentials, true, ExpectedResult.OtherException);
+
+ // Now start server2 that has valid accessor
+ Util.Log("InvalidAccessor: Using accessor: " + accessor);
+ serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, serverArgs);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StopJavaServer(1);
+
+ // Client creation should be successful now
+ m_client1.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+ m_client2.Call(SecurityTestUtil.CreateClientMU, RegionName,
+ CacheHelper.Locators, authInit, (Properties<string, string>)null, true);
+
+ // Now perform some put operations from client1
+ m_client1.Call(DoPutsMU, 10, createCredentials, true);
+
+ // Verify that the gets succeed
+ m_client2.Call(DoGetsMU, 10, getCredentials, true);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ }
+
+ CacheHelper.StopJavaLocator(1);
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runAllOpsWithFailover()
+ {
+ OperationWithAction[] allOps = {
+ // Test CREATE and verify with a GET
+ new OperationWithAction(OperationCode.Put, 3, OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 3, OpFlags.CheckNoKey
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.CheckNoKey, 4),
+ // OPBLOCK_END indicates end of an operation block; the above block of
+ // three operations will be first executed on server1 and then on
+ // server2 after failover
+
+ OperationWithAction.OpBlockEnd,
+
+ // Test GetServerKeys (KEY_SET) operation.
+ new OperationWithAction(OperationCode.GetServerKeys),
+ new OperationWithAction(OperationCode.GetServerKeys, 3, OpFlags.CheckNotAuthz, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Test UPDATE and verify with a GET
+ new OperationWithAction(OperationCode.Put, 3, OpFlags.UseNewVal
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Test DESTROY and verify with a GET and that key should not exist
+ new OperationWithAction(OperationCode.Destroy, 3, OpFlags.UseNewVal
+ | OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Destroy),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.CheckFail, 4),
+ // Repopulate the region
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseNewVal, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Check QUERY
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Query, 3,
+ OpFlags.CheckNotAuthz, 4),
+ new OperationWithAction(OperationCode.Query),
+
+ OperationWithAction.OpBlockEnd,
+
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+ OperationWithAction.OpBlockEnd,
+
+ /// PutAll, GetAll, ExecuteCQ and ExecuteFunction ops
+ new OperationWithAction(OperationCode.PutAll),
+ // NOTE: GetAll depends on previous PutAll so it should happen right after.
+ new OperationWithAction(OperationCode.GetAll),
+ new OperationWithAction(OperationCode.RemoveAll),
+ //new OperationWithAction(OperationCode.ExecuteCQ),
+ new OperationWithAction(OperationCode.ExecuteFunction),
+
+ OperationWithAction.OpBlockEnd,
+
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put, 2),
+ new OperationWithAction(OperationCode.Get, 1, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 2, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 1, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // UPDATE and test with GET
+ new OperationWithAction(OperationCode.Put),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ // UPDATE and test with GET for no updates
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseOldConn
+ | OpFlags.UseNewVal, 4),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.LocalOp, 4),
+
+ OperationWithAction.OpBlockEnd,
+
+ // Do REGION_DESTROY of the sub-region and check with GET
+ new OperationWithAction(OperationCode.Put, 1, OpFlags.UseSubRegion,
+ 8),
+ new OperationWithAction(OperationCode.RegionDestroy, 3,
+ OpFlags.UseSubRegion | OpFlags.CheckNotAuthz, 1),
+ new OperationWithAction(OperationCode.RegionDestroy, 1,
+ OpFlags.UseSubRegion, 1),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseSubRegion
+ | OpFlags.CheckNoKey | OpFlags.CheckException, 8),
+
+ // Do REGION_DESTROY of the region and check with GET
+ new OperationWithAction(OperationCode.RegionDestroy, 3,
+ OpFlags.CheckNotAuthz, 1),
+ new OperationWithAction(OperationCode.RegionDestroy, 1, OpFlags.None,
+ 1),
+ new OperationWithAction(OperationCode.Get, 2, OpFlags.UseOldConn
+ | OpFlags.CheckNoKey | OpFlags.CheckException, 8),
+
+ // Skip failover for region destroy since it shall fail
+ // without restarting the server
+ OperationWithAction.OpBlockNoFailover
+ };
+ RunOpsWithFailover(allOps, "AllOpsWithFailover", true);
+ }
+
+ void runThinClientWriterExceptionTest()
+ {
+ CacheHelper.SetupJavaServers(true, CacheXml1);
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ foreach (AuthzCredentialGenerator authzGen in GetAllGeneratorCombos(true))
+ {
+ for (int i = 1; i <= 2; ++i)
+ {
+ CredentialGenerator cGen = authzGen.GetCredentialGenerator();
+ //TODO: its not working for multiuser mode.. need to fix later
+ if (cGen.GetClassCode() == CredentialGenerator.ClassCode.PKCS)
+ continue;
+ Properties<string, string> extraAuthProps = cGen.SystemProperties;
+ Properties<string, string> javaProps = cGen.JavaProperties;
+ Properties<string, string> extraAuthzProps = authzGen.SystemProperties;
+ string authenticator = cGen.Authenticator;
+ string authInit = cGen.AuthInit;
+ string accessor = authzGen.AccessControl;
+
+ Util.Log("ThinClientWriterException: Using authinit: " + authInit);
+ Util.Log("ThinClientWriterException: Using authenticator: " + authenticator);
+ Util.Log("ThinClientWriterException: Using accessor: " + accessor);
+
+ // Start servers with all required properties
+ string serverArgs = SecurityTestUtil.GetServerArgs(authenticator,
+ accessor, null, SecurityTestUtil.ConcatProperties(extraAuthProps,
+ extraAuthzProps), javaProps);
+
+ // Start the server.
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, serverArgs);
+ Util.Log("Cacheserver 1 started.");
+
+ // Start client1 with valid CREATE credentials
+ Properties<string, string> createCredentials = authzGen.GetDisallowedCredentials(
+ new OperationCode[] { OperationCode.Put },
+ new string[] { RegionName }, 1);
+ javaProps = cGen.JavaProperties;
+ Util.Log("DisallowPuts: For first client PUT credentials: " +
+ createCredentials);
+ m_client1.Call(SecurityTestUtil.CreateClientR0, RegionName,
+ CacheHelper.Locators, authInit, createCredentials);
+
+ Util.Log("Creating region in client1 , no-ack, no-cache, with listener and writer");
+ m_client1.Call(CreateRegion, CacheHelper.Locators,
+ true, true, true);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+
+ try
+ {
+ Util.Log("Trying put Operation");
+ m_client1.Call(DoPut);
+ Util.Log(" Put Operation Successful");
+ Assert.Fail("Should have got NotAuthorizedException during put");
+ }
+ catch (NotAuthorizedException)
+ {
+ Util.Log("NotAuthorizedException Caught");
+ Util.Log("Success");
+ }
+ catch (Exception other)
+ {
+ Util.Log("Stack trace: {0} ", other.StackTrace);
+ Util.Log("Got exception : {0}",
+ other.Message);
+ }
+ m_client1.Call(CheckAssert);
+ // Do LocalPut
+ m_client1.Call(DoLocalPut);
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ }
+ }
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ #region Tests
+
+ [Test]
+ public void TestCQ()
+ {
+ runCQTest();
+ }
+
+ [Test]
+ public void TestDurableCQ()
+ {
+ //for all run real cache will be true
+ //logical cache true/false and durable cq true/false combination....
+ //result..whether events should be there or not
+ runDurableCQTest(false, true, true);//no usercache close as it will close user's durable cq
+ runDurableCQTest(true, false, false);
+ runDurableCQTest(false, true, true);
+ runDurableCQTest(false, false, false);
+ }
+
+ [Test]
+ public void AllowPutsGets()
+ {
+ runAllowPutsGets();
+ }
+
+ [Test]
+ public void DisallowPutsGets()
+ {
+ runDisallowPutsGets();
+ }
+
+ [Test]
+ public void AllOpsWithFailover()
+ {
+ runAllOpsWithFailover();
+ }
+
+ [Test]
+ public void ThinClientWriterExceptionTest()
+ {
+ runThinClientWriterExceptionTest();
+ }
+ #endregion
+ }
+}
[38/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientHARegionTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientHARegionTestsN.cs b/clicache/integration-test/ThinClientHARegionTestsN.cs
new file mode 100644
index 0000000..5a00367
--- /dev/null
+++ b/clicache/integration-test/ThinClientHARegionTestsN.cs
@@ -0,0 +1,991 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientHARegionTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2, m_client3;
+ private string[] m_regexes = { "Key.*1", "Key.*2", "Key.*3", "Key.*4" };
+
+ private static string QueryRegionName = "Portfolios";
+
+ #endregion
+
+ protected override string ExtraPropertiesFile
+ {
+ get
+ {
+ return "geode.properties.mixed";
+ }
+ }
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ m_client3.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ #region Various steps for HA tests
+
+ public void InitClient_Pool(string locators, int redundancyLevel)
+ {
+ CacheHelper.CreatePool<object, object>("__TESTPOOL1_", locators, null, redundancyLevel, true);
+ }
+
+ public void InitClientForEventId_Pool(string locators, bool notification,
+ int redundancyLevel, int ackInterval, int dupCheckLife)
+ {
+ CacheHelper.Init();
+ CacheHelper.CreatePool<object, object>("__TESTPOOL1_", locators, null,
+ redundancyLevel, notification, ackInterval, dupCheckLife);
+ }
+
+ public void InitClientXml(string cacheXml)
+ {
+ CacheHelper.InitConfig(cacheXml);
+ }
+
+ public void InitClientXml(string cacheXml, int serverport1, int serverport2)
+ {
+ CacheHelper.HOST_PORT_1 = serverport1;
+ CacheHelper.HOST_PORT_2 = serverport2;
+ CacheHelper.InitConfig(cacheXml);
+ }
+
+ public void CreateEntriesForEventId(int sleep)
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ for (int value = 1; value <= 100; value++)
+ {
+ region1[m_keys[0]] = value;
+ Thread.Sleep(sleep);
+ region1[m_keys[1]] = value;
+ Thread.Sleep(sleep);
+ region1[m_keys[2]] = value;
+ Thread.Sleep(sleep);
+ region1[m_keys[3]] = value;
+ Thread.Sleep(sleep);
+ region2[m_keys[0]] = value;
+ Thread.Sleep(sleep);
+ region2[m_keys[1]] = value;
+ Thread.Sleep(sleep);
+ region2[m_keys[2]] = value;
+ Thread.Sleep(sleep);
+ region2[m_keys[3]] = value;
+ Thread.Sleep(sleep);
+ }
+ }
+
+ public void CheckClientForEventId()
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ DupListener<object, object> checker1 = region1.Attributes.CacheListener as DupListener<object, object>;
+ DupListener<object, object> checker2 = region2.Attributes.CacheListener as DupListener<object, object>;
+
+ Util.Log("Validating checker1 cachelistener");
+ checker1.validate();
+ Util.Log("Validating checker2 cachelistener");
+ checker2.validate();
+ }
+
+ public void InitDupListeners()
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ region1.AttributesMutator.SetCacheListener(DupListener<object, object>.Create());
+ region2.AttributesMutator.SetCacheListener(DupListener<object, object>.Create());
+
+ Thread.Sleep(5000);
+
+ region1.GetSubscriptionService().RegisterAllKeys();
+ region2.GetSubscriptionService().RegisterAllKeys();
+ }
+
+ public void CreateHATCRegions(string[] regionNames, bool useList,
+ string locators, bool clientNotification, bool create)
+ {
+ if (create)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", clientNotification);
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionNames[1], false, true,
+ null, locators, "__TESTPOOL1_", clientNotification);
+ }
+ m_regionNames = regionNames;
+ }
+
+ /*
+ public void CreateCPPRegion(string regionName)
+ {
+ CacheHelper.CreateTCRegion(regionName, true, true,
+ null, "none", false);
+ }
+ * */
+
+ public void CreateMixedEntry(string regionName, string key, string val)
+ {
+ CreateEntry(regionName, key, val);
+ }
+
+ public void DoNetsearchMixed(string regionName, string key, string val, bool checkNoKey)
+ {
+ DoNetsearch(regionName, key, val, checkNoKey);
+ }
+
+ public void UpdateEntryMixed(string regionName, string key, string val, bool checkVal)
+ {
+ UpdateEntry(regionName, key, val, checkVal);
+ }
+
+ public void LocalDestroyEntry(string regionName, string key)
+ {
+ Util.Log("Locally Destroying entry -- key: {0} in region {1}",
+ key, regionName);
+
+ // Destroy entry, verify entry is destroyed
+ Region region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ Assert.IsTrue(region.ContainsKey(key), "Key should have been found in region.");
+ region.GetLocalView().Remove(key);
+ VerifyDestroyed(regionName, key);
+ }
+
+ public void Create2Vals(bool even)
+ {
+ if (even)
+ {
+ CreateEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ CreateEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ }
+ else
+ {
+ CreateEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ CreateEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+ }
+
+ public void CreateVals()
+ {
+ Create2Vals(true);
+ Create2Vals(false);
+ }
+
+ public void VerifyValCreations(bool even)
+ {
+ if (even)
+ {
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[1], m_keys[2]);
+ }
+ else
+ {
+ VerifyCreated(m_regionNames[0], m_keys[1]);
+ VerifyCreated(m_regionNames[1], m_keys[3]);
+ }
+ }
+
+ public void VerifyTallies()
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+
+ TallyLoader<object, object> loader1 = (TallyLoader<object, object>)region1.Attributes.CacheLoader;
+ TallyListener<object, object> listener1 = (TallyListener<object, object>) region1.Attributes.CacheListener;
+ TallyWriter<object, object> writer1 = (TallyWriter<object, object>)region1.Attributes.CacheWriter;
+ TallyResolver<object, object> resolver1 = (TallyResolver<object, object>) region1.Attributes.PartitionResolver;
+
+ TallyLoader<object, object> loader2 = (TallyLoader<object, object>)region2.Attributes.CacheLoader;
+ TallyListener<object, object> listener2 = (TallyListener<object, object>)region2.Attributes.CacheListener;
+ TallyWriter<object, object> writer2 = (TallyWriter<object, object>)region2.Attributes.CacheWriter;
+ TallyResolver<object, object> resolver2 = (TallyResolver<object, object>)region2.Attributes.PartitionResolver;
+
+ loader1.ShowTallies();
+ writer1.ShowTallies();
+ listener1.ShowTallies();
+ resolver1.ShowTallies();
+
+ loader2.ShowTallies();
+ writer2.ShowTallies();
+ listener2.ShowTallies();
+ resolver2.ShowTallies();
+
+ // We don't assert for partition resolver because client metadata service may
+ // not have fetched PR single hop info to trigger the resolver.
+
+ Assert.AreEqual(1, loader1.ExpectLoads(1));
+ //Assert.AreEqual(1, resolver1.ExpectLoads(1));
+ Assert.AreEqual(1, writer1.ExpectCreates(1));
+ Assert.AreEqual(0, writer1.ExpectUpdates(0));
+ Assert.AreEqual(2, listener1.ExpectCreates(2));
+ Assert.AreEqual(1, listener1.ExpectUpdates(1));
+
+ Assert.AreEqual(1, loader2.ExpectLoads(1));
+ //Assert.AreEqual(1, resolver2.ExpectLoads(1));
+ Assert.AreEqual(1, writer2.ExpectCreates(1));
+ Assert.AreEqual(0, writer2.ExpectUpdates(0));
+ Assert.AreEqual(2, listener2.ExpectCreates(2));
+ Assert.AreEqual(1, listener2.ExpectUpdates(1));
+ }
+
+ public void UpdateVals()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_vals[0], true);
+ UpdateEntry(m_regionNames[0], m_keys[1], m_vals[1], true);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_vals[2], true);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_vals[3], true);
+ }
+
+ public void Update2NVals(bool even, bool checkVal)
+ {
+ if (even)
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], checkVal);
+ }
+ else
+ {
+ UpdateEntry(m_regionNames[0], m_keys[1], m_nvals[1], checkVal);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], checkVal);
+ }
+ }
+
+ public void UpdateNVals(bool checkVal)
+ {
+ Update2NVals(true, checkVal);
+ Update2NVals(false, checkVal);
+ }
+
+ public void Verify2Vals(bool even)
+ {
+ if (even)
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ }
+ else
+ {
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+ }
+
+ public void VerifyVals()
+ {
+ Verify2Vals(true);
+ Verify2Vals(false);
+ }
+
+ public void Verify2NVals(bool even)
+ {
+ if (even)
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ }
+ else
+ {
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3]);
+ }
+ }
+
+ public void DoNetsearch2Vals(bool even)
+ {
+ if (even)
+ {
+ DoNetsearch(m_regionNames[0], m_keys[0], m_vals[0], true);
+ DoNetsearch(m_regionNames[1], m_keys[2], m_vals[2], true);
+ }
+ else
+ {
+ DoNetsearch(m_regionNames[0], m_keys[1], m_vals[1], true);
+ DoNetsearch(m_regionNames[1], m_keys[3], m_vals[3], true);
+ }
+ }
+
+ public void DoCacheLoad2Vals(bool even)
+ {
+ if (even)
+ {
+ DoCacheLoad(m_regionNames[0], m_keys[0], m_vals[0], true);
+ DoCacheLoad(m_regionNames[1], m_keys[2], m_vals[2], true);
+ }
+ else
+ {
+ DoCacheLoad(m_regionNames[0], m_keys[1], m_vals[1], true);
+ DoCacheLoad(m_regionNames[1], m_keys[3], m_vals[3], true);
+ }
+ }
+
+ public void DoNetsearchVals()
+ {
+ DoNetsearch2Vals(true);
+ DoNetsearch2Vals(false);
+ }
+
+ public void VerifyNVals()
+ {
+ Verify2NVals(true);
+ Verify2NVals(false);
+ }
+
+ public void VerifyNValsVals()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], true);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1], true);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2], true);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3], true);
+ }
+
+ public void VerifyNValVals()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], true);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1], true);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2], true);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3], true);
+ }
+
+ public void VerifyValsNVals()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0], true);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1], true);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2], true);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3], true);
+ }
+
+ public void VerifyMixedNVals()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0], true);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1], true);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2], true);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_nvals[3], true);
+ }
+
+ public void RegisterKeysException(string key0, string key1)
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ Region region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ if (key0 != null)
+ {
+ region0.GetSubscriptionService().RegisterKeys(new string[] {key0 });
+ }
+ if (key1 != null)
+ {
+ region1.GetSubscriptionService().RegisterKeys(new string[] {key1 });
+ }
+ }
+
+ public void RegisterRegexesException(string regex0, string regex1)
+ {
+ if (regex0 != null)
+ {
+ Region region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterRegex(regex0);
+ }
+ if (regex1 != null)
+ {
+ Region region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region1.GetSubscriptionService().RegisterRegex(regex1);
+ }
+ }
+
+ public void DistOpsCommonSteps(bool clientNotification)
+ {
+ DistOpsCommonSteps(clientNotification, true);
+ }
+
+ public void DistOpsCommonSteps(bool clientNotification, bool createRegions)
+ {
+ m_client1.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, clientNotification, createRegions);
+ m_client1.Call(Create2Vals, true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateHATCRegions, RegionNames, false,
+ CacheHelper.Locators, !clientNotification, createRegions);
+ m_client2.Call(Create2Vals, false);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(DoNetsearch2Vals, false);
+ m_client1.Call(RegisterKeys, m_keys[1], m_keys[3]);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(CheckServerKeys);
+ m_client2.Call(DoNetsearch2Vals, true);
+ m_client2.Call(RegisterKeys, m_keys[0], m_keys[2]);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(Update2NVals, true, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(Verify2NVals, true);
+ m_client2.Call(Update2NVals, false, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Verify2NVals, false);
+ Util.Log("StepSeven complete.");
+ }
+
+ public void FailoverCommonSteps(int redundancyLevel, bool useRegexes)
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml",
+ "cacheserver_notify_subscription3.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(InitClient_Pool, CacheHelper.Locators, redundancyLevel);
+ m_client1.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, useRegexes, true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(InitClient_Pool, CacheHelper.Locators, redundancyLevel);
+ m_client2.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, !useRegexes, true);
+ Util.Log("StepTwo complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ if (redundancyLevel > 1)
+ {
+ if (useRegexes)
+ {
+ m_client2.Call(RegisterRegexesException, m_regexes[0], m_regexes[2]);
+ }
+ else
+ {
+ m_client2.Call(RegisterKeysException, m_keys[0], m_keys[2]);
+ }
+ }
+ else
+ {
+ if (useRegexes)
+ {
+ m_client2.Call(RegisterRegexes, m_regexes[0], m_regexes[2]);
+ }
+ else
+ {
+ m_client2.Call(RegisterKeys, m_keys[0], m_keys[2]);
+ }
+ }
+ Util.Log("RegisterKeys done.");
+
+ m_client1.Call(CreateVals);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(VerifyValCreations, true);
+ m_client2.Call(Verify2Vals, true);
+ m_client2.Call(DoNetsearch2Vals, false);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ //For Failover to complete.
+ Thread.Sleep(5000);
+
+ m_client1.Call(CheckServerKeys);
+ m_client1.Call(UpdateNVals, true);
+ Thread.Sleep(1000);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(VerifyNValsVals);
+ Util.Log("StepSix complete.");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ //For Failover to complete.
+ Thread.Sleep(5000);
+
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(UpdateVals);
+ Thread.Sleep(1000);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(VerifyVals);
+ if (useRegexes)
+ {
+ m_client2.Call(UnregisterRegexes, (string)null, m_regexes[2]);
+ }
+ else
+ {
+ m_client2.Call(UnregisterKeys, (string)null, m_keys[2]);
+ }
+ Util.Log("StepEight complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ m_client1.Call(UpdateNVals, true);
+ Thread.Sleep(1000);
+ Util.Log("StepNine complete.");
+
+ m_client2.Call(VerifyNValVals);
+ Util.Log("StepTen complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ //For Failover to complete.
+ Thread.Sleep(5000);
+
+ m_client1.Call(UpdateVals);
+ Thread.Sleep(1000);
+ Util.Log("StepEleven complete.");
+
+ m_client2.Call(VerifyVals);
+ Util.Log("StepTwelve complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void KillServer()
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ public delegate void KillServerDelegate();
+
+ public void StepOneFailover()
+ {
+ // This is here so that Client1 registers information of the cacheserver
+ // that has been already started
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_remoteoqlN.xml",
+ "cacheserver_remoteoql2N.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ //CacheHelper.StartJavaServer(1, "GFECS1");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ignored since we run multiple iterations for pool and non pool configs
+ }
+
+ InitClient_Pool(CacheHelper.Locators, 1);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionName, true, true,
+ null, null, "__TESTPOOL1_", true);
+
+ Region region = CacheHelper.GetVerifyRegion<object, object>(QueryRegionName);
+ Portfolio port1 = new Portfolio(1, 100);
+ Portfolio port2 = new Portfolio(2, 200);
+ Portfolio port3 = new Portfolio(3, 300);
+ Portfolio port4 = new Portfolio(4, 400);
+
+ region["1"] = port1;
+ region["2"] = port2;
+ region["3"] = port3;
+ region["4"] = port4;
+ }
+
+ public void StepTwoFailover()
+ {
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ IAsyncResult killRes = null;
+ KillServerDelegate ksd = new KillServerDelegate(KillServer);
+
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ for (int i = 0; i < 10000; i++)
+ {
+ Query<object> qry = qs.NewQuery("select distinct * from /" + QueryRegionName);
+
+ ISelectResults<object> results = qry.Execute();
+
+ if (i == 10)
+ {
+ Util.Log("Starting the kill server thread.");
+ killRes = ksd.BeginInvoke(null, null);
+ }
+
+ Int32 resultSize = results.Size;
+
+ if (i % 100 == 0)
+ {
+ Util.Log("Iteration upto {0} done, result size is {1}", i, resultSize);
+ }
+
+ Assert.AreEqual(4, resultSize, "Result size is not 4!");
+ }
+
+ killRes.AsyncWaitHandle.WaitOne();
+ ksd.EndInvoke(killRes);
+ }
+
+ #endregion
+
+ void runDistOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(InitClient_Pool, CacheHelper.Locators, 1);
+ m_client2.Call(InitClient_Pool, CacheHelper.Locators, 1);
+ m_client1.Call(CreateNonExistentRegion, CacheHelper.Locators);
+
+ DistOpsCommonSteps(true);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+ }
+
+ void runDistOpsXml()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(InitClientXml, "client_pool.xml", CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2);
+ m_client2.Call(InitClientXml, "client_pool.xml", CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2);
+
+ DistOpsCommonSteps(false);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ }
+
+ void runGenericsXmlPlugins()
+ {
+ Util.Log("runGenericsXmlPlugins: pool with endpoints in client XML.");
+
+ CacheHelper.SetupJavaServers(false, "cacheserver1_partitioned.xml",
+ "cacheserver2_partitioned.xml");
+
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.StartJavaServer(2, "GFECS2");
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(InitClientXml, "client_pool.xml", CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2);
+ m_client2.Call(InitClientXml, "client_generics_plugins.xml", CacheHelper.HOST_PORT_1, CacheHelper.HOST_PORT_2);
+
+ m_client1.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, false, false);
+ m_client2.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, false, false);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(RegisterKeys, m_keys[0], m_keys[2]);
+
+ m_client1.Call(Create2Vals, true);
+
+ m_client2.Call(DoCacheLoad2Vals, false);
+
+ m_client1.Call(Update2NVals, true, true);
+
+ m_client2.Call(Create2Vals, false);
+
+ m_client2.Call(VerifyTallies);
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ }
+
+ void runQueryFailover()
+ {
+ try
+ {
+ m_client1.Call(StepOneFailover);
+ Util.Log("StepOneFailover complete.");
+
+ m_client1.Call(StepTwoFailover);
+ Util.Log("StepTwoFailover complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client closed");
+ }
+ finally
+ {
+ m_client1.Call(CacheHelper.StopJavaServers);
+ m_client1.Call(CacheHelper.StopJavaLocator, 1);
+ Util.Log("Locator stopped");
+ }
+ }
+
+ void runPeriodicAck()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(InitClientForEventId_Pool, CacheHelper.Locators, false, 1, 10, 30);
+
+ m_client1.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, false, true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(InitClientForEventId_Pool, CacheHelper.Locators, true, 1, 10, 30);
+ m_client2.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, true, true);
+ m_client2.Call(InitDupListeners);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(CreateEntriesForEventId, 50);
+ Util.Log("CreateEntries complete.");
+
+ Thread.Sleep(30000);
+
+ m_client2.Call(CheckClientForEventId);
+ Util.Log("CheckClient complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runEventIDMap()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(InitClientForEventId_Pool, CacheHelper.Locators, false, 1, 3600, 3600);
+ m_client1.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, false, true);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(InitClientForEventId_Pool, CacheHelper.Locators, true, 1, 3600, 3600);
+ m_client2.Call(CreateHATCRegions, RegionNames, false,
+ (string)null, true, true);
+ m_client2.Call(InitDupListeners);
+ Util.Log("StepTwo complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(CreateEntriesForEventId, 10);
+ Util.Log("CreateEntries complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ Thread.Sleep(30000);
+
+ m_client2.Call(CheckClientForEventId);
+ Util.Log("CheckClient complete.");
+
+ m_client1.Call(Close);
+ m_client2.Call(Close);
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ [Test]
+ public void DistOps()
+ {
+ runDistOps();
+ }
+
+ [Test]
+ public void DistOpsXml()
+ {
+ runDistOpsXml();
+ }
+
+ [Test]
+ public void GenericsXmlPlugins()
+ {
+ runGenericsXmlPlugins();
+ }
+
+ [Test]
+ public void FailoverR1()
+ {
+ FailoverCommonSteps(1, false);
+ }
+
+ [Test]
+ public void FailoverR3()
+ {
+ FailoverCommonSteps(3, false);
+ }
+
+ [Test]
+ public void FailoverRegexR1()
+ {
+ FailoverCommonSteps(1, true);
+ }
+
+ [Test]
+ public void FailoverRegexR3()
+ {
+ FailoverCommonSteps(3, true);
+ }
+
+ [Test]
+ public void QueryFailover()
+ {
+ runQueryFailover();
+ }
+
+ [Test]
+ public void PeriodicAck()
+ {
+ runPeriodicAck();
+ }
+
+ [Test]
+ public void EventIDMap()
+ {
+ runEventIDMap();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientListenerWriterN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientListenerWriterN.cs b/clicache/integration-test/ThinClientListenerWriterN.cs
new file mode 100644
index 0000000..2a7ccfc
--- /dev/null
+++ b/clicache/integration-test/ThinClientListenerWriterN.cs
@@ -0,0 +1,287 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Apache.Geode.Client.UnitTests;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientListenerWriter : ThinClientRegionSteps
+ {
+ private TallyWriter<object, object> m_writer;
+ private TallyListener<object, object> m_listener;
+ RegionOperation o_region;
+
+ private UnitProcess m_client1, m_client2, m_client3;
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ public void CreateRegion(string locators,
+ bool caching, bool listener, bool writer)
+ {
+ if (listener)
+ {
+ m_listener = new TallyListener<object, object>();
+ }
+ else
+ {
+ m_listener = null;
+ }
+ Region region = null;
+ region = CacheHelper.CreateTCRegion_Pool<object, object>(RegionName, true, caching,
+ m_listener, locators, "__TESTPOOL1_", true);
+
+ if (writer)
+ {
+ m_writer = new TallyWriter<object, object>();
+ AttributesMutator<object, object> at = region.AttributesMutator;
+ at.SetCacheWriter(m_writer);
+ }
+
+ }
+
+ public void ValidateEvents()
+ {
+ Thread.Sleep(5000);
+ m_listener.ShowTallies();
+ m_writer.ShowTallies();
+ Assert.AreEqual(0, m_listener.Creates, "Should be 0 creates");
+ Assert.AreEqual(0, m_listener.Updates, "Should be 0 updates");
+ Assert.AreEqual(20, m_listener.Invalidates, "Should be 20 invalidates");
+ Assert.AreEqual(5, m_listener.Destroys, "Should be 5 destroys");
+ Assert.AreEqual(false, m_writer.IsWriterInvoked, "Writer Should not be invoked");
+ }
+
+ public void ValidateGetEvents(int creates, int updates)
+ {
+ Thread.Sleep(1000);
+ m_listener.ShowTallies();
+ Assert.AreEqual(creates, m_listener.Creates, "Incorrect creates");
+ Assert.AreEqual(updates, m_listener.Updates, "Incorrect updates");
+ }
+
+ public void ValidateListenerWriterWithNBSTrue()
+ {
+ Thread.Sleep(5000);
+ m_listener.ShowTallies();
+
+ Assert.AreEqual(10, m_listener.Creates, "Should be 10 creates");
+ Assert.AreEqual(10, m_listener.Updates, "Should be 10 updates");
+ Assert.AreEqual(0, m_listener.Invalidates, "Should be 0 invalidates");
+ Assert.AreEqual(5, m_listener.Destroys, "Should be 5 destroys");
+ Assert.AreEqual(false, m_writer.IsWriterInvoked, "Writer should not be invoked");
+ }
+
+ public void RegisterAllKeysRN()
+ {
+ Region region = CacheHelper.GetVerifyRegion<object, object>(RegionName);
+ region.GetSubscriptionService().RegisterAllKeys(false, null, false, false);
+ }
+
+ public void CallOp()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.PutOp(5, null);
+ Thread.Sleep(1000); // let the events reach at other end.
+ o_region.PutOp(5, null);
+ Thread.Sleep(1000);
+ o_region.InvalidateOp(5, null);
+ Thread.Sleep(1000);
+ o_region.DestroyOp(5, null);
+ Thread.Sleep(1000);
+ }
+
+ public void PutOp(string key, string value)
+ {
+ Util.Log("PutOp started");
+ o_region = new RegionOperation(RegionName);
+ Region r = o_region.Region;
+ r[key] = value;
+ Thread.Sleep(1000); // let the events reach at other end.
+ Util.Log("PutOp finished");
+ }
+
+ public void InvalidateOp(string key)
+ {
+ Util.Log("InvalidateOp started");
+ o_region = new RegionOperation(RegionName);
+ Region r = o_region.Region;
+ r.GetLocalView().Invalidate(key);
+ Thread.Sleep(1000); // let the events reach at other end.
+ Util.Log("InvalidateOp finished");
+ }
+
+ public void GetOp(string key)
+ {
+ Util.Log("GetOp started");
+ o_region = new RegionOperation(RegionName);
+ Region r = o_region.Region;
+ Object val = r[key];
+ Thread.Sleep(1000); // let the events reach at other end.
+ Util.Log("GetOp finished");
+ }
+
+ public void registerPdxType8()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ }
+ void runThinClientListenerWriterTest()
+ {
+ 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.");
+
+ m_client1.Call(CacheHelper.InitClient);
+ Util.Log("Creating region in client1, no-ack, no-cache, no-listener and no-writer");
+ m_client1.Call(CreateRegion, CacheHelper.Locators,
+ false, false, false);
+
+ m_client2.Call(CacheHelper.InitClient);
+ Util.Log("Creating region in client2 , no-ack, no-cache, with listener and writer");
+ m_client2.Call(CreateRegion, CacheHelper.Locators,
+ false, true, true);
+
+ m_client1.Call(registerPdxType8);
+ m_client2.Call(registerPdxType8);
+
+ m_client2.Call(RegisterAllKeys, new string[] { RegionName });
+
+ m_client1.Call(CallOp);
+
+ m_client2.Call(ValidateListenerWriterWithNBSTrue);
+
+ m_client1.Call(CacheHelper.CloseCache);
+
+ m_client2.Call(CacheHelper.CloseCache);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, no-cache, no-listener and no-writer");
+ m_client1.Call(CreateRegion, CacheHelper.Locators,
+ false, false, false);
+
+ Util.Log("Creating region in client2 , no-ack, no-cache, with listener and writer");
+ m_client2.Call(CreateRegion, CacheHelper.Locators,
+ false, true, true);
+
+ m_client3.Call(CacheHelper.InitClient);
+ Util.Log("Creating region in client2 , no-ack, no-cache, with listener and writer");
+ m_client3.Call(CreateRegion, CacheHelper.Locators,
+ false, true, true);
+
+ m_client1.Call(registerPdxType8);
+ m_client2.Call(registerPdxType8);
+
+ m_client2.Call(RegisterAllKeysRN);
+
+ m_client3.Call(RegisterAllKeysRN);
+
+ m_client1.Call(CallOp);
+
+ m_client2.Call(ValidateEvents);
+
+ m_client3.Call(ValidateEvents);
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ m_client3.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ /* Bug #381 */
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, no-cache, no-listener and no-writer");
+ m_client1.Call(CreateRegion,CacheHelper.Locators,
+ false, false, false);
+
+ Util.Log("Creating region in client2 , with listener and writer");
+ m_client2.Call(CreateRegion, CacheHelper.Locators,
+ true, true, true);
+
+ m_client3.Call(CacheHelper.InitClient);
+ Util.Log("Creating region in client3 , with listener and writer");
+ m_client3.Call(CreateRegion, CacheHelper.Locators,
+ true, true, true);
+
+ m_client2.Call(RegisterAllKeysRN);
+ m_client1.Call(PutOp, "Key-1", "Value-1");
+ m_client2.Call(GetOp, "Key-1");
+ m_client2.Call(ValidateGetEvents, 0, 1);
+ Util.Log("ValidateGetEvents 1 done. ");
+
+ m_client3.Call(RegisterAllKeysRN);
+ m_client3.Call(GetOp, "Key-1");
+ m_client3.Call(ValidateGetEvents, 1, 0);
+ Util.Log("ValidateGetEvents 2 done. ");
+
+ m_client2.Call(PutOp, "Key-2", "Value-2");
+ m_client2.Call(InvalidateOp, "Key-2");
+ m_client2.Call(GetOp, "Key-2");
+ m_client2.Call(ValidateGetEvents, 1, 2);
+ Util.Log("ValidateGetEvents 3 done. ");
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ m_client3.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ base.EndTest();
+ }
+
+ [Test]
+ public void ThinClientListenerWriterTest()
+ {
+ runThinClientListenerWriterTest();
+ }
+ }
+}
[51/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
GEODE-3165: Reogranized sources relative to the root for better CMake IDE integration.
- Moved src/docs to docs/api.
- Moved src/* to root.
- Fixup paths in CMake files.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/6cbd424f
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/6cbd424f
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/6cbd424f
Branch: refs/heads/develop
Commit: 6cbd424fe39bc907025460c555768552430c0c5d
Parents: da38979
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Fri Aug 11 08:30:49 2017 -0700
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Fri Aug 11 08:59:17 2017 -0700
----------------------------------------------------------------------
CMakeLists.txt | 263 +
FindNativeClient.cmake | 277 +
FindNativeClientCPPCache.cmake | 68 +
clicache/.clang-format | 5 +
clicache/CMakeLists.txt | 20 +
clicache/include/gfcli/Utils.hpp | 88 +
clicache/integration-test/AckMixTests.cs | 264 +
clicache/integration-test/AssemblyInfo.cs | 49 +
.../integration-test/AttributesFactoryTestsN.cs | 108 +
.../integration-test/AttributesMutatorTestsN.cs | 329 +
.../BuiltinCacheableWrappersN.cs | 2782 ++++++++
clicache/integration-test/CMakeLists.txt | 120 +
clicache/integration-test/CacheHelperN.cs | 2460 +++++++
.../integration-test/CacheServPoolRedun1.xml | 41 +
.../integration-test/CacheServPoolRedun2.xml | 40 +
.../integration-test/CacheServPoolRedun3.xml | 39 +
clicache/integration-test/CacheServerMsgs.cs | 58 +
clicache/integration-test/CacheableWrapper.cs | 208 +
clicache/integration-test/CacheableWrapperN.cs | 269 +
clicache/integration-test/CachelessTestsN.cs | 157 +
clicache/integration-test/DataIOTests.cs | 241 +
clicache/integration-test/DataOutputTests.cs | 61 +
clicache/integration-test/DefaultCacheableN.cs | 261 +
clicache/integration-test/DistGetTests.cs | 191 +
clicache/integration-test/DistOpsStepsN.cs | 2372 +++++++
clicache/integration-test/DistOpsTests.cs | 85 +
.../integration-test/DistributedSystemTests.cs | 136 +
clicache/integration-test/DupListenerN.cs | 117 +
clicache/integration-test/DurableListenerN.cs | 199 +
clicache/integration-test/ExpirationTestsN.cs | 339 +
clicache/integration-test/LogTests.cs | 182 +
clicache/integration-test/NetTests.cs | 173 +
clicache/integration-test/OverflowTestsN.cs | 664 ++
clicache/integration-test/PutGetPerfTests.cs | 333 +
clicache/integration-test/PutGetTestsN.cs | 536 ++
clicache/integration-test/RegionEntryTests.cs | 105 +
clicache/integration-test/RegionOperationN.cs | 97 +
clicache/integration-test/RegionWrapperN.cs | 243 +
clicache/integration-test/SecurityTestUtilN.cs | 267 +
.../integration-test/SerializationTestsN.cs | 1280 ++++
clicache/integration-test/Settings.xml | 51 +
clicache/integration-test/TallyListener.cs | 300 +
clicache/integration-test/TallyListenerN.cs | 333 +
clicache/integration-test/TallyLoaderN.cs | 104 +
clicache/integration-test/TallyResolverN.cs | 97 +
clicache/integration-test/TallyWriter.cs | 222 +
clicache/integration-test/TallyWriterN.cs | 240 +
...ThinClientAppDomainFunctionExecutionTests.cs | 282 +
.../ThinClientAppDomainQueryTests.cs | 280 +
clicache/integration-test/ThinClientCSTXN.cs | 827 +++
.../integration-test/ThinClientCallbackArgN.cs | 726 ++
.../ThinClientConflationTestsN.cs | 354 +
.../integration-test/ThinClientCqIRTestsN.cs | 250 +
clicache/integration-test/ThinClientCqTestsN.cs | 1025 +++
.../integration-test/ThinClientDeltaTestN.cs | 914 +++
.../ThinClientDurableCqTestsN.cs | 325 +
.../integration-test/ThinClientDurableTestsN.cs | 982 +++
.../ThinClientFunctionExecutionTestsN.cs | 1843 +++++
.../ThinClientHARegionTestsN.cs | 991 +++
.../ThinClientListenerWriterN.cs | 287 +
clicache/integration-test/ThinClientPdxTests.cs | 6638 ++++++++++++++++++
.../integration-test/ThinClientPoolTestsN.cs | 901 +++
.../integration-test/ThinClientQueryTestsN.cs | 1981 ++++++
.../ThinClientRegionInterestTestsN.cs | 1216 ++++
.../integration-test/ThinClientRegionStepsN.cs | 705 ++
.../integration-test/ThinClientRegionTestsN.cs | 2397 +++++++
.../ThinClientSecurityAuthTestsMUN.cs | 716 ++
.../ThinClientSecurityAuthTestsN.cs | 731 ++
.../ThinClientSecurityAuthzTestBaseN.cs | 1061 +++
.../ThinClientSecurityAuthzTestsMUN.cs | 1051 +++
.../ThinClientSecurityAuthzTestsN.cs | 710 ++
.../ThinClientStatisticTestsN.cs | 255 +
.../ThinClientStringArrayTestsN.cs | 232 +
clicache/integration-test/Timeouts.xml | 42 +
clicache/integration-test/UnitTests.csproj.in | 627 ++
clicache/integration-test/UnitTestsN.cs | 180 +
clicache/integration-test/cache.xml | 27 +
.../cacheServer_pdxreadserialized.xml | 38 +
clicache/integration-test/cache_redundancy.xml | 30 +
clicache/integration-test/cacheserver.xml | 41 +
.../integration-test/cacheserver1_TradeKey.xml | 66 +
.../integration-test/cacheserver1_expiry.xml | 43 +
clicache/integration-test/cacheserver1_fpr.xml | 72 +
.../cacheserver1_partitioned.xml | 50 +
.../cacheserver1_partitioned_R1.xml | 52 +
.../cacheserver1_partitioned_servergroup.xml | 49 +
clicache/integration-test/cacheserver1_pool.xml | 33 +
clicache/integration-test/cacheserver1_pr.xml | 41 +
.../integration-test/cacheserver1_pr_putall.xml | 52 +
clicache/integration-test/cacheserver2.xml | 35 +
.../integration-test/cacheserver2_TradeKey.xml | 66 +
clicache/integration-test/cacheserver2_fpr.xml | 73 +
.../cacheserver2_partitioned.xml | 49 +
.../cacheserver2_partitioned_R1.xml | 51 +
.../cacheserver2_partitioned_servergroup.xml | 48 +
clicache/integration-test/cacheserver2_pool.xml | 33 +
clicache/integration-test/cacheserver2_pr.xml | 42 +
.../integration-test/cacheserver2_pr_putall.xml | 51 +
clicache/integration-test/cacheserver3.xml | 35 +
.../integration-test/cacheserver3_TradeKey.xml | 66 +
clicache/integration-test/cacheserver3_fpr.xml | 72 +
.../cacheserver3_partitioned.xml | 50 +
.../cacheserver3_partitioned_servergroup.xml | 49 +
clicache/integration-test/cacheserver3_pool.xml | 34 +
clicache/integration-test/cacheserver3_pr.xml | 54 +
.../integration-test/cacheserver3_pr_putall.xml | 52 +
clicache/integration-test/cacheserver4.xml | 47 +
.../integration-test/cacheserver4_pr_putall.xml | 52 +
.../integration-test/cacheserverDurableCqs.xml | 28 +
clicache/integration-test/cacheserverForPdx.xml | 50 +
.../cacheserverForPdxWithAuto.xml | 50 +
clicache/integration-test/cacheserverMDS1.xml | 33 +
clicache/integration-test/cacheserverMDS2.xml | 32 +
clicache/integration-test/cacheserverPdx.xml | 50 +
clicache/integration-test/cacheserverPdx2.xml | 50 +
.../cacheserverPdxSerializer.xml | 38 +
.../cacheserver_concurrency_enabled1.xml | 32 +
.../cacheserver_concurrency_enabled2.xml | 32 +
.../cacheserver_concurrency_enabled_disk1.xml | 35 +
.../cacheserver_concurrency_enabled_disk2.xml | 35 +
...rver_concurrency_enabled_disk_replicate1.xml | 35 +
...rver_concurrency_enabled_disk_replicate2.xml | 35 +
.../integration-test/cacheserver_conflation.xml | 33 +
.../integration-test/cacheserver_hashcode.xml | 43 +
.../cacheserver_interest_notify.xml | 36 +
.../integration-test/cacheserver_loader.xml | 38 +
.../cacheserver_notify_subscription.xml | 53 +
.../cacheserver_notify_subscription2.xml | 53 +
.../cacheserver_notify_subscription3.xml | 40 +
.../cacheserver_notify_subscription4.xml | 40 +
.../cacheserver_notify_subscription5.xml | 154 +
.../cacheserver_notify_subscription5N.xml | 154 +
.../cacheserver_notify_subscription6.xml | 62 +
.../cacheserver_notify_subscriptionBug849.xml | 50 +
...server_notify_subscription_PutAllTimeout.xml | 44 +
.../cacheserver_notify_subscription_forDoc.xml | 106 +
.../cacheserver_pdxinstance_hashcode.xml | 50 +
.../cacheserver_pool_client.xml | 62 +
.../integration-test/cacheserver_remoteoql.xml | 93 +
.../integration-test/cacheserver_remoteoql2.xml | 93 +
.../cacheserver_remoteoql2N.xml | 93 +
.../integration-test/cacheserver_remoteoqlN.xml | 93 +
.../cacheserver_servergroup.xml | 35 +
.../cacheserver_servergroup2.xml | 35 +
.../integration-test/cacheserver_with_delta.xml | 58 +
.../cacheserver_with_deltaAD.xml | 43 +
.../cacheserver_with_delta_test_impl.xml | 39 +
clicache/integration-test/client_Loader.xml | 36 +
.../client_generics_plugins.xml | 60 +
clicache/integration-test/client_pdx.xml | 48 +
clicache/integration-test/client_pool.xml | 50 +
.../client_server_persistent_transactions.xml | 31 +
.../client_server_transactions.xml | 37 +
clicache/integration-test/cqqueryfailover.xml | 109 +
.../integration-test/func_cacheserver1_pool.xml | 94 +
.../integration-test/func_cacheserver2_pool.xml | 94 +
.../integration-test/func_cacheserver3_pool.xml | 86 +
clicache/integration-test/gateway1.xml | 44 +
clicache/integration-test/gateway2.xml | 49 +
.../integration-test/geode.properties.mixed | 16 +
.../geode.properties.nativeclient | 16 +
clicache/integration-test/invalid_cache1.xml | 34 +
clicache/integration-test/invalid_cache2.xml | 34 +
clicache/integration-test/invalid_cache3.xml | 35 +
.../integration-test/invalid_cache_pool.xml | 88 +
.../integration-test/invalid_cache_pool2.xml | 89 +
.../integration-test/invalid_cache_pool3.xml | 89 +
.../integration-test/invalid_cache_pool4.xml | 91 +
.../integration-test/invalid_overflowAttr1.xml | 34 +
.../integration-test/invalid_overflowAttr2.xml | 39 +
.../integration-test/invalid_overflowAttr3.xml | 42 +
.../multi_get_function_server.xml | 47 +
.../integration-test/regionquery_diffconfig.xml | 94 +
.../regionquery_diffconfig2.xml | 94 +
.../regionquery_diffconfig2N.xml | 94 +
.../regionquery_diffconfig2_SG.xml | 96 +
.../regionquery_diffconfigN.xml | 94 +
.../regionquery_diffconfig_SG.xml | 96 +
clicache/integration-test/remotequery.xml | 112 +
clicache/integration-test/remotequery2.xml | 112 +
clicache/integration-test/remotequeryN.xml | 109 +
.../integration-test/serverDurableClient.xml | 33 +
clicache/integration-test/system.properties | 33 +
clicache/integration-test/test.bat.in | 65 +
clicache/integration-test/valid_cache.xml | 88 +
clicache/integration-test/valid_cache_pool.xml | 91 +
clicache/integration-test/valid_cache_refid.xml | 85 +
.../valid_cache_region_refid.xml | 83 +
.../valid_declarative_cache_creation.xml | 36 +
.../integration-test/valid_lruExpiration.xml | 266 +
.../integration-test/valid_overflowAttr.xml | 177 +
clicache/src/Apache.Geode.rc | 48 +
clicache/src/AttributesFactory.cpp | 484 ++
clicache/src/AttributesFactory.hpp | 513 ++
clicache/src/AttributesMutator.cpp | 251 +
clicache/src/AttributesMutator.hpp | 271 +
clicache/src/CMakeLists.txt | 73 +
clicache/src/Cache.cpp | 382 +
clicache/src/Cache.hpp | 302 +
clicache/src/CacheFactory.cpp | 193 +
clicache/src/CacheFactory.hpp | 177 +
clicache/src/CacheListenerAdapter.hpp | 83 +
clicache/src/CacheStatistics.cpp | 55 +
clicache/src/CacheStatistics.hpp | 159 +
clicache/src/CacheTransactionManager.cpp | 295 +
clicache/src/CacheTransactionManager.hpp | 228 +
clicache/src/CacheWriterAdapter.hpp | 73 +
clicache/src/CacheableArrayList.hpp | 97 +
clicache/src/CacheableBuiltins.hpp | 603 ++
clicache/src/CacheableDate.cpp | 118 +
clicache/src/CacheableDate.hpp | 174 +
clicache/src/CacheableFileName.cpp | 110 +
clicache/src/CacheableFileName.hpp | 172 +
clicache/src/CacheableHashMap.cpp | 54 +
clicache/src/CacheableHashMap.hpp | 147 +
clicache/src/CacheableHashSet.hpp | 683 ++
clicache/src/CacheableHashTable.hpp | 117 +
clicache/src/CacheableIdentityHashMap.hpp | 128 +
clicache/src/CacheableKey.cpp | 127 +
clicache/src/CacheableKey.hpp | 141 +
clicache/src/CacheableLinkedList.hpp | 152 +
clicache/src/CacheableObject.cpp | 82 +
clicache/src/CacheableObject.hpp | 156 +
clicache/src/CacheableObjectArray.cpp | 108 +
clicache/src/CacheableObjectArray.hpp | 153 +
clicache/src/CacheableObjectXml.cpp | 111 +
clicache/src/CacheableObjectXml.hpp | 157 +
clicache/src/CacheableStack.cpp | 91 +
clicache/src/CacheableStack.hpp | 130 +
clicache/src/CacheableString.cpp | 212 +
clicache/src/CacheableString.hpp | 326 +
clicache/src/CacheableStringArray.cpp | 96 +
clicache/src/CacheableStringArray.hpp | 193 +
clicache/src/CacheableUndefined.cpp | 53 +
clicache/src/CacheableUndefined.hpp | 109 +
clicache/src/CacheableVector.cpp | 78 +
clicache/src/CacheableVector.hpp | 136 +
clicache/src/CqAttributes.cpp | 74 +
clicache/src/CqAttributes.hpp | 91 +
clicache/src/CqAttributesFactory.cpp | 160 +
clicache/src/CqAttributesFactory.hpp | 92 +
clicache/src/CqAttributesMutator.cpp | 196 +
clicache/src/CqAttributesMutator.hpp | 117 +
clicache/src/CqEvent.cpp | 75 +
clicache/src/CqEvent.hpp | 105 +
clicache/src/CqOperation.hpp | 96 +
clicache/src/CqQuery.cpp | 286 +
clicache/src/CqQuery.hpp | 195 +
clicache/src/CqServiceStatistics.cpp | 86 +
clicache/src/CqServiceStatistics.hpp | 102 +
clicache/src/CqState.cpp | 92 +
clicache/src/CqState.hpp | 104 +
clicache/src/CqStatistics.cpp | 76 +
clicache/src/CqStatistics.hpp | 96 +
clicache/src/DataInput.cpp | 1165 +++
clicache/src/DataInput.hpp | 711 ++
clicache/src/DataOutput.cpp | 921 +++
clicache/src/DataOutput.hpp | 656 ++
clicache/src/DiskPolicyType.hpp | 89 +
clicache/src/DistributedSystem.cpp | 574 ++
clicache/src/DistributedSystem.hpp | 213 +
clicache/src/EntryEvent.cpp | 74 +
clicache/src/EntryEvent.hpp | 123 +
clicache/src/ExceptionTypes.cpp | 159 +
clicache/src/ExceptionTypes.hpp | 686 ++
clicache/src/Execution.cpp | 135 +
clicache/src/Execution.hpp | 116 +
clicache/src/ExpirationAction.hpp | 138 +
clicache/src/FunctionService.cpp | 115 +
clicache/src/FunctionService.hpp | 96 +
clicache/src/GeodeClassIds.hpp | 372 +
clicache/src/IAuthInitialize.hpp | 85 +
clicache/src/ICacheListener.hpp | 210 +
clicache/src/ICacheLoader.hpp | 118 +
clicache/src/ICacheWriter.hpp | 172 +
clicache/src/ICacheableKey.hpp | 67 +
clicache/src/ICqAttributes.hpp | 116 +
clicache/src/ICqEvent.hpp | 120 +
clicache/src/ICqListener.hpp | 120 +
clicache/src/ICqResults.hpp | 52 +
clicache/src/ICqStatusListener.hpp | 57 +
clicache/src/IFixedPartitionResolver.hpp | 96 +
clicache/src/IGeodeCache.hpp | 110 +
clicache/src/IGeodeDelta.hpp | 78 +
clicache/src/IGeodeSerializable.hpp | 105 +
clicache/src/IPartitionResolver.hpp | 108 +
clicache/src/IPdxInstance.hpp | 185 +
clicache/src/IPdxInstanceFactory.hpp | 346 +
clicache/src/IPdxReader.hpp | 211 +
clicache/src/IPdxSerializable.hpp | 67 +
clicache/src/IPdxSerializer.hpp | 68 +
clicache/src/IPdxTypeMapper.hpp | 52 +
clicache/src/IPdxUnreadFields.hpp | 40 +
clicache/src/IPdxWriter.hpp | 247 +
clicache/src/IPersistenceManager.hpp | 106 +
clicache/src/IRegion.hpp | 2077 ++++++
clicache/src/IRegionService.hpp | 128 +
clicache/src/IResultCollector.hpp | 80 +
clicache/src/ISelectResults.hpp | 81 +
clicache/src/ISubscriptionService.hpp | 627 ++
clicache/src/ITransactionListener.hpp | 83 +
clicache/src/ITransactionWriter.hpp | 61 +
clicache/src/IWritablePdxInstance.hpp | 53 +
clicache/src/LocalRegion.cpp | 1005 +++
clicache/src/LocalRegion.hpp | 263 +
clicache/src/Log.cpp | 124 +
clicache/src/Log.hpp | 330 +
clicache/src/PdxIdentityFieldAttribute.hpp | 50 +
clicache/src/Pool.cpp | 463 ++
clicache/src/Pool.hpp | 353 +
clicache/src/PoolFactory.cpp | 452 ++
clicache/src/PoolFactory.hpp | 427 ++
clicache/src/PoolManager.cpp | 77 +
clicache/src/PoolManager.hpp | 102 +
clicache/src/Properties.cpp | 356 +
clicache/src/Properties.hpp | 305 +
clicache/src/Query.cpp | 154 +
clicache/src/Query.hpp | 219 +
clicache/src/QueryService.cpp | 233 +
clicache/src/QueryService.hpp | 162 +
clicache/src/ReflectionBasedAutoSerializer.cpp | 565 ++
clicache/src/ReflectionBasedAutoSerializer.hpp | 225 +
clicache/src/Region.cpp | 1538 ++++
clicache/src/Region.hpp | 307 +
clicache/src/RegionAttributes.cpp | 605 ++
clicache/src/RegionAttributes.hpp | 511 ++
clicache/src/RegionEntry.cpp | 101 +
clicache/src/RegionEntry.hpp | 188 +
clicache/src/RegionEvent.cpp | 53 +
clicache/src/RegionEvent.hpp | 98 +
clicache/src/RegionFactory.cpp | 481 ++
clicache/src/RegionFactory.hpp | 458 ++
clicache/src/RegionShortcut.hpp | 76 +
clicache/src/ResultCollector.cpp | 115 +
clicache/src/ResultCollector.hpp | 94 +
clicache/src/ResultSet.cpp | 100 +
clicache/src/ResultSet.hpp | 130 +
clicache/src/SelectResultsIterator.cpp | 95 +
clicache/src/SelectResultsIterator.hpp | 137 +
clicache/src/Serializable.cpp | 1480 ++++
clicache/src/Serializable.hpp | 696 ++
clicache/src/StatisticDescriptor.cpp | 62 +
clicache/src/StatisticDescriptor.hpp | 140 +
clicache/src/Statistics.cpp | 298 +
clicache/src/Statistics.hpp | 541 ++
clicache/src/StatisticsFactory.cpp | 258 +
clicache/src/StatisticsFactory.hpp | 273 +
clicache/src/StatisticsType.cpp | 85 +
clicache/src/StatisticsType.hpp | 144 +
clicache/src/Struct.cpp | 117 +
clicache/src/Struct.hpp | 148 +
clicache/src/StructSet.cpp | 130 +
clicache/src/StructSet.hpp | 171 +
clicache/src/SystemProperties.cpp | 220 +
clicache/src/SystemProperties.hpp | 428 ++
clicache/src/TransactionEvent.cpp | 79 +
clicache/src/TransactionEvent.hpp | 88 +
clicache/src/TransactionId.hpp | 71 +
clicache/src/TransactionListenerAdapter.hpp | 61 +
clicache/src/TransactionWriterAdapte.hpp | 48 +
clicache/src/UserFunctionExecutionException.cpp | 96 +
clicache/src/UserFunctionExecutionException.hpp | 143 +
clicache/src/Utils.cpp | 77 +
clicache/src/begin_native.hpp | 41 +
clicache/src/end_native.hpp | 25 +
clicache/src/geode_defs.hpp | 272 +
clicache/src/geode_includes.hpp | 26 +
clicache/src/geodeclicache.vcxproj.filters | 1075 +++
clicache/src/impl/AppDomainContext.cpp | 33 +
clicache/src/impl/AppDomainContext.hpp | 75 +
clicache/src/impl/AssemblyInfo.cpp.in | 46 +
clicache/src/impl/AuthenticatedCache.cpp | 136 +
clicache/src/impl/AuthenticatedCache.hpp | 171 +
clicache/src/impl/CacheListener.hpp | 113 +
clicache/src/impl/CacheLoader.hpp | 85 +
clicache/src/impl/CacheWriter.hpp | 88 +
clicache/src/impl/CliCallbackDelgate.cpp | 40 +
clicache/src/impl/CliCallbackDelgate.hpp | 55 +
clicache/src/impl/CqListenerProxy.hpp | 69 +
clicache/src/impl/CqStatusListenerProxy.hpp | 77 +
clicache/src/impl/DelegateWrapper.hpp | 110 +
clicache/src/impl/DotNetTypes.hpp | 61 +
clicache/src/impl/EnumInfo.cpp | 61 +
clicache/src/impl/EnumInfo.hpp | 104 +
clicache/src/impl/FixedPartitionResolver.hpp | 102 +
clicache/src/impl/GeodeDataInputStream.hpp | 136 +
clicache/src/impl/GeodeDataOutputStream.hpp | 118 +
clicache/src/impl/GeodeNullStream.hpp | 119 +
clicache/src/impl/ManagedAuthInitialize.cpp | 206 +
clicache/src/impl/ManagedAuthInitialize.hpp | 134 +
clicache/src/impl/ManagedCacheListener.cpp | 362 +
clicache/src/impl/ManagedCacheListener.hpp | 232 +
clicache/src/impl/ManagedCacheLoader.cpp | 252 +
clicache/src/impl/ManagedCacheLoader.hpp | 160 +
clicache/src/impl/ManagedCacheWriter.cpp | 316 +
clicache/src/impl/ManagedCacheWriter.hpp | 191 +
clicache/src/impl/ManagedCacheableDelta.cpp | 282 +
clicache/src/impl/ManagedCacheableDelta.hpp | 189 +
.../src/impl/ManagedCacheableDeltaBytes.cpp | 337 +
.../src/impl/ManagedCacheableDeltaBytes.hpp | 218 +
clicache/src/impl/ManagedCacheableKey.cpp | 230 +
clicache/src/impl/ManagedCacheableKey.hpp | 173 +
clicache/src/impl/ManagedCacheableKeyBytes.cpp | 288 +
clicache/src/impl/ManagedCacheableKeyBytes.hpp | 208 +
clicache/src/impl/ManagedCqListener.cpp | 189 +
clicache/src/impl/ManagedCqListener.hpp | 147 +
clicache/src/impl/ManagedCqStatusListener.cpp | 220 +
clicache/src/impl/ManagedCqStatusListener.hpp | 142 +
.../src/impl/ManagedFixedPartitionResolver.cpp | 262 +
.../src/impl/ManagedFixedPartitionResolver.hpp | 147 +
clicache/src/impl/ManagedPartitionResolver.cpp | 252 +
clicache/src/impl/ManagedPartitionResolver.hpp | 137 +
clicache/src/impl/ManagedPersistenceManager.cpp | 247 +
clicache/src/impl/ManagedPersistenceManager.hpp | 86 +
clicache/src/impl/ManagedResultCollector.cpp | 227 +
clicache/src/impl/ManagedResultCollector.hpp | 105 +
clicache/src/impl/ManagedString.hpp | 104 +
.../src/impl/ManagedTransactionListener.cpp | 263 +
.../src/impl/ManagedTransactionListener.hpp | 93 +
clicache/src/impl/ManagedTransactionWriter.cpp | 222 +
clicache/src/impl/ManagedTransactionWriter.hpp | 96 +
clicache/src/impl/ManagedVisitor.cpp | 52 +
clicache/src/impl/ManagedVisitor.hpp | 84 +
clicache/src/impl/MemoryPressureHandler.cpp | 75 +
clicache/src/impl/MemoryPressureHandler.hpp | 44 +
clicache/src/impl/PartitionResolver.hpp | 74 +
clicache/src/impl/PdxFieldType.cpp | 194 +
clicache/src/impl/PdxFieldType.hpp | 150 +
clicache/src/impl/PdxHelper.cpp | 451 ++
clicache/src/impl/PdxHelper.hpp | 79 +
clicache/src/impl/PdxInstanceFactoryImpl.cpp | 359 +
clicache/src/impl/PdxInstanceFactoryImpl.hpp | 402 ++
clicache/src/impl/PdxInstanceImpl.cpp | 1432 ++++
clicache/src/impl/PdxInstanceImpl.hpp | 298 +
clicache/src/impl/PdxLocalReader.cpp | 422 ++
clicache/src/impl/PdxLocalReader.hpp | 311 +
clicache/src/impl/PdxLocalWriter.cpp | 490 ++
clicache/src/impl/PdxLocalWriter.hpp | 369 +
clicache/src/impl/PdxManagedCacheableKey.cpp | 307 +
clicache/src/impl/PdxManagedCacheableKey.hpp | 197 +
.../src/impl/PdxManagedCacheableKeyBytes.cpp | 290 +
.../src/impl/PdxManagedCacheableKeyBytes.hpp | 247 +
.../src/impl/PdxReaderWithTypeCollector.cpp | 549 ++
.../src/impl/PdxReaderWithTypeCollector.hpp | 268 +
clicache/src/impl/PdxRemotePreservedData.hpp | 119 +
clicache/src/impl/PdxRemoteReader.cpp | 847 +++
clicache/src/impl/PdxRemoteReader.hpp | 265 +
clicache/src/impl/PdxRemoteWriter.cpp | 334 +
clicache/src/impl/PdxRemoteWriter.hpp | 338 +
clicache/src/impl/PdxType.cpp | 553 ++
clicache/src/impl/PdxType.hpp | 201 +
clicache/src/impl/PdxTypeRegistry.cpp | 317 +
clicache/src/impl/PdxTypeRegistry.hpp | 117 +
clicache/src/impl/PdxWrapper.hpp | 83 +
.../src/impl/PdxWriterWithTypeCollector.cpp | 362 +
.../src/impl/PdxWriterWithTypeCollector.hpp | 328 +
clicache/src/impl/PersistenceManagerProxy.hpp | 98 +
clicache/src/impl/RegionImpl.cpp | 18 +
clicache/src/impl/RegionImpl.hpp | 32 +
clicache/src/impl/ResultCollectorProxy.hpp | 76 +
clicache/src/impl/SafeConvert.hpp | 383 +
clicache/src/impl/TransactionListener.hpp | 83 +
clicache/src/impl/TransactionWriter.hpp | 66 +
clicache/src/impl/WeakhashMap.hpp | 258 +
clicache/src/native_conditional_unique_ptr.hpp | 61 +
clicache/src/native_shared_ptr.hpp | 41 +
clicache/src/native_unique_ptr.hpp | 54 +
clicache/src/templates/CMakeLists.txt | 30 +
clicache/src/templates/Templates.csproj.in | 127 +
clicache/test/AssemblyInfo.cpp.in | 32 +
clicache/test/CMakeLists.txt | 72 +
clicache/test/Utils.hpp | 14 +
.../test/native_conditional_unqiue_ptrTests.cpp | 248 +
clicache/test/native_shared_ptrTests.cpp | Bin 0 -> 12434 bytes
clicache/test/native_unique_ptrTests.cpp | 197 +
cppcache/CMakeLists.txt | 20 +
cppcache/CPPCacheConfig.cmake | 48 +
cppcache/FindCPPCache.cmake | 48 +
cppcache/include/geode/Assert.hpp | 100 +
cppcache/include/geode/AttributesFactory.hpp | 382 +
cppcache/include/geode/AttributesMutator.hpp | 193 +
cppcache/include/geode/AuthInitialize.hpp | 67 +
cppcache/include/geode/Cache.hpp | 272 +
cppcache/include/geode/CacheAttributes.hpp | 108 +
cppcache/include/geode/CacheFactory.hpp | 154 +
cppcache/include/geode/CacheListener.hpp | 213 +
cppcache/include/geode/CacheLoader.hpp | 105 +
cppcache/include/geode/CacheStatistics.hpp | 116 +
.../include/geode/CacheTransactionManager.hpp | 204 +
cppcache/include/geode/CacheWriter.hpp | 188 +
cppcache/include/geode/Cacheable.hpp | 46 +
cppcache/include/geode/Cacheable.inl | 55 +
cppcache/include/geode/CacheableBuiltins.hpp | 651 ++
cppcache/include/geode/CacheableDate.hpp | 190 +
cppcache/include/geode/CacheableEnum.hpp | 147 +
cppcache/include/geode/CacheableFileName.hpp | 123 +
cppcache/include/geode/CacheableKey.hpp | 136 +
cppcache/include/geode/CacheableKey.inl | 55 +
cppcache/include/geode/CacheableKeys.hpp | 99 +
cppcache/include/geode/CacheableObjectArray.hpp | 107 +
cppcache/include/geode/CacheableString.hpp | 322 +
cppcache/include/geode/CacheableUndefined.hpp | 100 +
cppcache/include/geode/CqAttributes.hpp | 66 +
cppcache/include/geode/CqAttributesFactory.hpp | 106 +
cppcache/include/geode/CqAttributesMutator.hpp | 78 +
cppcache/include/geode/CqEvent.hpp | 111 +
cppcache/include/geode/CqListener.hpp | 99 +
cppcache/include/geode/CqOperation.hpp | 54 +
cppcache/include/geode/CqQuery.hpp | 184 +
cppcache/include/geode/CqResults.hpp | 48 +
cppcache/include/geode/CqServiceStatistics.hpp | 79 +
cppcache/include/geode/CqState.hpp | 84 +
cppcache/include/geode/CqStatistics.hpp | 75 +
cppcache/include/geode/CqStatusListener.hpp | 53 +
cppcache/include/geode/DataInput.hpp | 1096 +++
cppcache/include/geode/DataOutput.hpp | 828 +++
cppcache/include/geode/Delta.hpp | 103 +
cppcache/include/geode/DiskPolicyType.hpp | 76 +
cppcache/include/geode/DistributedSystem.hpp | 136 +
cppcache/include/geode/EntryEvent.hpp | 96 +
cppcache/include/geode/Exception.hpp | 128 +
cppcache/include/geode/ExceptionTypes.hpp | 413 ++
cppcache/include/geode/Execution.hpp | 116 +
cppcache/include/geode/ExpirationAction.hpp | 117 +
cppcache/include/geode/ExpirationAttributes.hpp | 103 +
.../include/geode/FixedPartitionResolver.hpp | 96 +
cppcache/include/geode/FunctionService.hpp | 147 +
cppcache/include/geode/GeodeCache.hpp | 88 +
cppcache/include/geode/GeodeCppCache.hpp | 87 +
cppcache/include/geode/GeodeCppCache.inl | 27 +
cppcache/include/geode/GeodeTypeIds.hpp | 88 +
cppcache/include/geode/HashFunction.hpp | 81 +
cppcache/include/geode/HashMapT.hpp | 53 +
cppcache/include/geode/HashSetT.hpp | 44 +
.../InternalCacheTransactionManager2PC.hpp | 75 +
cppcache/include/geode/Log.hpp | 674 ++
cppcache/include/geode/PartitionResolver.hpp | 110 +
cppcache/include/geode/PdxFieldTypes.hpp | 58 +
cppcache/include/geode/PdxInstance.hpp | 618 ++
cppcache/include/geode/PdxInstanceFactory.hpp | 476 ++
cppcache/include/geode/PdxReader.hpp | 420 ++
cppcache/include/geode/PdxSerializable.hpp | 108 +
cppcache/include/geode/PdxSerializer.hpp | 92 +
cppcache/include/geode/PdxUnreadFields.hpp | 52 +
cppcache/include/geode/PdxWrapper.hpp | 136 +
cppcache/include/geode/PdxWriter.hpp | 451 ++
cppcache/include/geode/PersistenceManager.hpp | 140 +
cppcache/include/geode/Pool.hpp | 288 +
cppcache/include/geode/PoolFactory.hpp | 540 ++
cppcache/include/geode/PoolManager.hpp | 123 +
cppcache/include/geode/Properties.hpp | 164 +
cppcache/include/geode/Query.hpp | 124 +
cppcache/include/geode/QueryService.hpp | 179 +
cppcache/include/geode/Region.hpp | 1457 ++++
cppcache/include/geode/RegionAttributes.hpp | 406 ++
cppcache/include/geode/RegionEntry.hpp | 113 +
cppcache/include/geode/RegionEvent.hpp | 77 +
cppcache/include/geode/RegionFactory.hpp | 274 +
cppcache/include/geode/RegionService.hpp | 124 +
cppcache/include/geode/RegionShortcut.hpp | 79 +
cppcache/include/geode/ResultCollector.hpp | 114 +
cppcache/include/geode/ResultSet.hpp | 87 +
cppcache/include/geode/SelectResults.hpp | 90 +
.../include/geode/SelectResultsIterator.hpp | 104 +
cppcache/include/geode/Serializable.hpp | 145 +
cppcache/include/geode/Serializer.hpp | 432 ++
cppcache/include/geode/Struct.hpp | 169 +
cppcache/include/geode/StructSet.hpp | 106 +
cppcache/include/geode/SystemProperties.hpp | 512 ++
cppcache/include/geode/TransactionId.hpp | 46 +
cppcache/include/geode/TypeRegistry.hpp | 69 +
cppcache/include/geode/UserData.hpp | 40 +
.../geode/UserFunctionExecutionException.hpp | 125 +
cppcache/include/geode/VectorT.hpp | 47 +
cppcache/include/geode/WritablePdxInstance.hpp | 541 ++
cppcache/include/geode/geode_base.hpp | 323 +
cppcache/include/geode/geode_globals.hpp | 128 +
cppcache/include/geode/geode_types.hpp | 112 +
.../geode/statistics/StatisticDescriptor.hpp | 93 +
.../include/geode/statistics/Statistics.hpp | 532 ++
.../geode/statistics/StatisticsFactory.hpp | 217 +
.../include/geode/statistics/StatisticsType.hpp | 99 +
cppcache/include/geode/utils.hpp | 77 +
cppcache/integration-test/BBNamingContext.cpp | 289 +
cppcache/integration-test/BBNamingContext.hpp | 50 +
.../BuiltinCacheableWrappers.hpp | 1313 ++++
cppcache/integration-test/CMakeLists.txt | 225 +
cppcache/integration-test/CTestCustom.cmake.in | 17 +
cppcache/integration-test/CacheHelper.cpp | 1913 +++++
cppcache/integration-test/CacheHelper.hpp | 346 +
cppcache/integration-test/CacheImplHelper.hpp | 69 +
.../integration-test/CacheServPoolRedun1.xml | 40 +
.../integration-test/CacheServPoolRedun2.xml | 39 +
.../integration-test/CacheServPoolRedun3.xml | 38 +
cppcache/integration-test/CacheableWrapper.hpp | 135 +
cppcache/integration-test/DeltaEx.hpp | 153 +
cppcache/integration-test/InitSmartHeap.cpp | 27 +
cppcache/integration-test/LibraryCallbacks.cpp | 61 +
cppcache/integration-test/LocatorHelper.hpp | 151 +
cppcache/integration-test/QueryHelper.hpp | 385 +
cppcache/integration-test/QueryStrings.hpp | 738 ++
cppcache/integration-test/TallyListener.hpp | 225 +
cppcache/integration-test/TallyLoader.hpp | 75 +
cppcache/integration-test/TallyWriter.hpp | 156 +
cppcache/integration-test/ThinClientCQ.hpp | 64 +
.../integration-test/ThinClientCallbackArg.hpp | 197 +
cppcache/integration-test/ThinClientDistOps.hpp | 914 +++
.../integration-test/ThinClientDistOps2.hpp | 386 +
cppcache/integration-test/ThinClientDurable.hpp | 494 ++
.../ThinClientDurableConnect.hpp | 354 +
.../ThinClientDurableFailover.hpp | 411 ++
.../integration-test/ThinClientDurableInit.hpp | 113 +
.../ThinClientDurableInterest.hpp | 363 +
.../ThinClientDurableReconnect.hpp | 172 +
.../integration-test/ThinClientFailover.hpp | 427 ++
.../integration-test/ThinClientFailover2.hpp | 551 ++
.../integration-test/ThinClientFailover3.hpp | 376 +
.../ThinClientFailoverInterest.hpp | 431 ++
.../ThinClientFailoverInterest2.hpp | 460 ++
.../ThinClientFailoverInterestAllWithCache.hpp | 527 ++
.../ThinClientFailoverRegex.hpp | 510 ++
.../integration-test/ThinClientGatewayTest.hpp | 193 +
cppcache/integration-test/ThinClientHeapLRU.hpp | 261 +
cppcache/integration-test/ThinClientHelper.hpp | 707 ++
.../integration-test/ThinClientInterest1.hpp | 110 +
.../integration-test/ThinClientInterest2.hpp | 101 +
.../integration-test/ThinClientInterest3.hpp | 180 +
.../ThinClientInterest3Cacheless.hpp | 153 +
.../integration-test/ThinClientInterestList.hpp | 424 ++
.../ThinClientInterestList2.hpp | 410 ++
.../integration-test/ThinClientListenerInit.hpp | 256 +
.../ThinClientListenerWriter.hpp | 505 ++
.../ThinClientLocalCacheLoader.hpp | 266 +
.../ThinClientMultipleCaches.hpp | 104 +
.../integration-test/ThinClientNotification.hpp | 497 ++
.../ThinClientPdxSerializer.hpp | 401 ++
.../ThinClientPdxSerializers.hpp | 310 +
cppcache/integration-test/ThinClientPutAll.hpp | 848 +++
.../ThinClientPutAllTimeout.hpp | 250 +
.../ThinClientPutAllWithCallBack.hpp | 808 +++
.../integration-test/ThinClientPutGetAll.hpp | 630 ++
.../ThinClientRIwithlocalRegionDestroy.hpp | 503 ++
cppcache/integration-test/ThinClientRegex.hpp | 429 ++
cppcache/integration-test/ThinClientRegex2.hpp | 466 ++
cppcache/integration-test/ThinClientRegex3.hpp | 417 ++
.../integration-test/ThinClientRemoveAll.hpp | 427 ++
cppcache/integration-test/ThinClientSSL.hpp | 509 ++
.../ThinClientSSLWithPassword.hpp | 523 ++
.../integration-test/ThinClientSecurity.hpp | 82 +
.../ThinClientSecurityHelper.hpp | 265 +
.../integration-test/ThinClientTXFailover.hpp | 433 ++
.../integration-test/ThinClientTasks_C2S2.hpp | 96 +
.../integration-test/ThinClientTransactions.hpp | 1122 +++
.../ThinClientTransactionsXA.hpp | 1177 ++++
.../integration-test/ThinClientVersionedOps.hpp | 591 ++
cppcache/integration-test/TimeBomb.hpp | 114 +
cppcache/integration-test/cache.xml | 27 +
.../cacheServer_pdxreadserialized.xml | 37 +
cppcache/integration-test/cache_redundancy.xml | 29 +
cppcache/integration-test/cacheserver.xml | 40 +
.../integration-test/cacheserver1_TradeKey.xml | 62 +
.../integration-test/cacheserver1_expiry.xml | 38 +
cppcache/integration-test/cacheserver1_fpr.xml | 72 +
.../cacheserver1_partitioned.xml | 50 +
.../cacheserver1_partitioned_R1.xml | 52 +
.../cacheserver1_partitioned_servergroup.xml | 49 +
cppcache/integration-test/cacheserver1_pool.xml | 32 +
cppcache/integration-test/cacheserver1_pr.xml | 41 +
.../integration-test/cacheserver1_pr_putall.xml | 52 +
cppcache/integration-test/cacheserver2.xml | 34 +
.../integration-test/cacheserver2_TradeKey.xml | 62 +
cppcache/integration-test/cacheserver2_fpr.xml | 72 +
.../cacheserver2_partitioned.xml | 48 +
.../cacheserver2_partitioned_R1.xml | 50 +
.../cacheserver2_partitioned_servergroup.xml | 47 +
cppcache/integration-test/cacheserver2_pool.xml | 32 +
cppcache/integration-test/cacheserver2_pr.xml | 41 +
.../integration-test/cacheserver2_pr_putall.xml | 50 +
cppcache/integration-test/cacheserver3.xml | 34 +
.../integration-test/cacheserver3_TradeKey.xml | 62 +
cppcache/integration-test/cacheserver3_fpr.xml | 72 +
.../cacheserver3_partitioned.xml | 50 +
.../cacheserver3_partitioned_servergroup.xml | 49 +
cppcache/integration-test/cacheserver3_pool.xml | 33 +
cppcache/integration-test/cacheserver3_pr.xml | 54 +
.../integration-test/cacheserver3_pr_putall.xml | 52 +
cppcache/integration-test/cacheserver4.xml | 46 +
.../integration-test/cacheserver4_pr_putall.xml | 52 +
.../integration-test/cacheserverDurableCqs.xml | 28 +
cppcache/integration-test/cacheserverForPdx.xml | 49 +
.../cacheserverForPdxWithAuto.xml | 49 +
cppcache/integration-test/cacheserverMDS1.xml | 32 +
cppcache/integration-test/cacheserverMDS2.xml | 31 +
cppcache/integration-test/cacheserverPdx.xml | 49 +
cppcache/integration-test/cacheserverPdx2.xml | 49 +
.../cacheserverPdxSerializer.xml | 37 +
.../cacheserver_concurrency_enabled1.xml | 32 +
.../cacheserver_concurrency_enabled2.xml | 32 +
.../cacheserver_concurrency_enabled_disk1.xml | 35 +
.../cacheserver_concurrency_enabled_disk2.xml | 35 +
...rver_concurrency_enabled_disk_replicate1.xml | 35 +
...rver_concurrency_enabled_disk_replicate2.xml | 35 +
.../integration-test/cacheserver_conflation.xml | 33 +
.../integration-test/cacheserver_hashcode.xml | 42 +
.../cacheserver_interest_notify.xml | 36 +
.../integration-test/cacheserver_loader.xml | 32 +
.../cacheserver_notify_subscription.xml | 53 +
.../cacheserver_notify_subscription2.xml | 53 +
.../cacheserver_notify_subscription3.xml | 40 +
.../cacheserver_notify_subscription4.xml | 40 +
.../cacheserver_notify_subscription5.xml | 154 +
.../cacheserver_notify_subscription5N.xml | 154 +
.../cacheserver_notify_subscription6.xml | 62 +
.../cacheserver_notify_subscriptionBug849.xml | 50 +
...server_notify_subscription_PutAllTimeout.xml | 44 +
.../cacheserver_pdxinstance_hashcode.xml | 49 +
.../cacheserver_pool_client.xml | 61 +
.../integration-test/cacheserver_remoteoql.xml | 92 +
.../integration-test/cacheserver_remoteoql2.xml | 92 +
.../cacheserver_remoteoql2N.xml | 92 +
.../integration-test/cacheserver_remoteoqlN.xml | 92 +
.../cacheserver_servergroup.xml | 35 +
.../cacheserver_servergroup2.xml | 35 +
.../integration-test/cacheserver_with_delta.xml | 57 +
.../cacheserver_with_deltaAD.xml | 42 +
.../cacheserver_with_delta_test_impl.xml | 39 +
cppcache/integration-test/client_Loader.xml | 36 +
.../client_generics_plugins.xml | 60 +
cppcache/integration-test/client_pdx.xml | 48 +
cppcache/integration-test/client_pool.xml | 50 +
.../client_server_persistent_transactions.xml | 31 +
.../client_server_transactions.xml | 37 +
cppcache/integration-test/comparePerf.pl | 102 +
cppcache/integration-test/cqqueryfailover.xml | 108 +
.../deprecated_xml_instructions.txt | 72 +
.../integration-test/func_cacheserver1_pool.xml | 96 +
.../integration-test/func_cacheserver2_pool.xml | 97 +
.../integration-test/func_cacheserver3_pool.xml | 89 +
cppcache/integration-test/fw_dunit.cpp | 1193 ++++
cppcache/integration-test/fw_dunit.hpp | 366 +
cppcache/integration-test/fw_helper.hpp | 232 +
cppcache/integration-test/fw_perf.hpp | 248 +
cppcache/integration-test/fw_spawn.hpp | 129 +
cppcache/integration-test/gateway1.xml | 44 +
cppcache/integration-test/gateway2.xml | 41 +
cppcache/integration-test/invalid_cache1.xml | 34 +
cppcache/integration-test/invalid_cache2.xml | 34 +
cppcache/integration-test/invalid_cache3.xml | 35 +
.../integration-test/invalid_cache_pool.xml | 88 +
.../integration-test/invalid_cache_pool2.xml | 89 +
.../integration-test/invalid_cache_pool3.xml | 88 +
.../integration-test/invalid_cache_pool4.xml | 91 +
.../integration-test/invalid_overflowAttr1.xml | 34 +
.../integration-test/invalid_overflowAttr2.xml | 39 +
.../integration-test/invalid_overflowAttr3.xml | 42 +
.../keystore/client_keystore.password.pem | 48 +
.../keystore/client_keystore.pem | 45 +
.../keystore/client_keystore_corrupt.pem | 45 +
.../keystore/client_keystore_untrusted.pem | 30 +
.../keystore/client_truststore.pem | 16 +
cppcache/integration-test/keystore/gemfire.pem | 176 +
.../integration-test/keystore/geode1.keystore | Bin 0 -> 1536 bytes
.../integration-test/keystore/geode11.keystore | Bin 0 -> 1546 bytes
.../integration-test/keystore/geode2.keystore | Bin 0 -> 1536 bytes
.../integration-test/keystore/publickeyfile | Bin 0 -> 4535 bytes
.../keystore/server_keystore.jks | Bin 0 -> 2102 bytes
.../keystore/server_truststore.jks | Bin 0 -> 1596 bytes
.../keystore/untrusted_server_keystore.jks | Bin 0 -> 10764 bytes
.../keystore/untrusted_server_truststore.jks | Bin 0 -> 1448 bytes
cppcache/integration-test/locator_globals.hpp | 29 +
.../multi_get_function_server.xml | 47 +
.../integration-test/regionquery_diffconfig.xml | 93 +
.../regionquery_diffconfig2.xml | 93 +
.../regionquery_diffconfig2N.xml | 93 +
.../regionquery_diffconfig2_SG.xml | 95 +
.../regionquery_diffconfigN.xml | 93 +
.../regionquery_diffconfig_SG.xml | 95 +
cppcache/integration-test/remotequery.xml | 111 +
cppcache/integration-test/remotequery2.xml | 111 +
cppcache/integration-test/remotequeryN.xml | 108 +
.../integration-test/serverDurableClient.xml | 33 +
cppcache/integration-test/system.properties | 38 +
cppcache/integration-test/test.bat.in | 59 +
cppcache/integration-test/test.sh.in | 64 +
.../integration-test/testAttributesFactory.cpp | 101 +
.../integration-test/testAttributesMutator.cpp | 82 +
cppcache/integration-test/testCache.cpp | 188 +
cppcache/integration-test/testCacheless.cpp | 286 +
cppcache/integration-test/testConnect.cpp | 49 +
.../testCreateAndDestroyPool.cpp | 74 +
cppcache/integration-test/testDataOutput.cpp | 302 +
cppcache/integration-test/testDunit.cpp | 85 +
cppcache/integration-test/testExpiration.cpp | 408 ++
cppcache/integration-test/testFWHelper.cpp | 36 +
cppcache/integration-test/testFwPerf.cpp | 66 +
cppcache/integration-test/testLRUList.cpp | 194 +
cppcache/integration-test/testLinkage.cpp | 95 +
cppcache/integration-test/testLogger.cpp | 335 +
.../testOverflowPutGetSqLite.cpp | 721 ++
.../testRegionAccessThreadSafe.cpp | 142 +
cppcache/integration-test/testRegionMap.cpp | 222 +
.../integration-test/testRegionTemplateArgs.cpp | 1153 +++
cppcache/integration-test/testSerialization.cpp | 220 +
cppcache/integration-test/testSpinLock.cpp | 157 +
.../integration-test/testSystemProperties.cpp | 162 +
.../testThinClientAfterRegionLive.cpp | 239 +
.../integration-test/testThinClientBigValue.cpp | 406 ++
.../testThinClientCacheableStringArray.cpp | 176 +
.../testThinClientCacheables.cpp | 306 +
.../testThinClientCacheablesLimits.cpp | 206 +
.../testThinClientCallbackArg.cpp | 21 +
.../testThinClientClearRegion.cpp | 162 +
.../testThinClientConflation.cpp | 300 +
.../testThinClientContainsKeyOnServer.cpp | 98 +
cppcache/integration-test/testThinClientCq.cpp | 1267 ++++
.../integration-test/testThinClientCqDelta.cpp | 313 +
.../testThinClientCqDurable.cpp | 1041 +++
.../testThinClientCqFailover.cpp | 457 ++
.../testThinClientCqHAFailover.cpp | 490 ++
.../integration-test/testThinClientCqIR.cpp | 359 +
.../testThinClientDeltaWithNotification.cpp | 396 ++
.../testThinClientDisconnectionListioner.cpp | 96 +
.../integration-test/testThinClientDistOps2.cpp | 42 +
...stThinClientDistOpsDontUpdateLocatorList.cpp | 21 +
.../testThinClientDistOpsNotSticky.cpp | 21 +
.../testThinClientDistOpsSticky.cpp | 21 +
.../testThinClientDistOpsUpdateLocatorList.cpp | 21 +
.../testThinClientDurableConnect.cpp | 26 +
.../testThinClientDurableCrashNormal.cpp | 56 +
.../testThinClientDurableCrashTimeout.cpp | 55 +
.../testThinClientDurableDisconnectNormal.cpp | 53 +
.../testThinClientDurableDisconnectTimeout.cpp | 53 +
...tDurableFailoverClientClosedNoRedundancy.cpp | 22 +
...entDurableFailoverClientClosedRedundancy.cpp | 22 +
...DurableFailoverClientNotClosedRedundancy.cpp | 22 +
.../testThinClientDurableInterest.cpp | 44 +
...estThinClientDurableKeepAliveFalseNormal.cpp | 55 +
...stThinClientDurableKeepAliveFalseTimeout.cpp | 55 +
...testThinClientDurableKeepAliveTrueNormal.cpp | 55 +
...estThinClientDurableKeepAliveTrueTimeout.cpp | 55 +
.../testThinClientDurableReconnect.cpp | 22 +
.../testThinClientExecuteFunctionPrSHOP.cpp | 647 ++
.../integration-test/testThinClientFailover.cpp | 25 +
.../testThinClientFailover2.cpp | 21 +
.../testThinClientFailover3.cpp | 41 +
.../testThinClientFailoverInterest.cpp | 21 +
.../testThinClientFailoverInterest2.cpp | 21 +
...stThinClientFailoverInterestAllWithCache.cpp | 45 +
.../testThinClientFailoverRegex.cpp | 21 +
.../testThinClientFixedPartitionResolver.cpp | 555 ++
.../testThinClientGatewayTest.cpp | 22 +
.../testThinClientGetInterests.cpp | 132 +
.../testThinClientHADistOps.cpp | 577 ++
.../testThinClientHAEventIDMap.cpp | 578 ++
.../testThinClientHAFailover.cpp | 655 ++
.../testThinClientHAFailoverRegex.cpp | 650 ++
.../testThinClientHAMixedRedundancy.cpp | 570 ++
.../testThinClientHAPeriodicAck.cpp | 577 ++
.../testThinClientHAQueryFailover.cpp | 309 +
.../integration-test/testThinClientHeapLRU.cpp | 134 +
.../testThinClientIntResPolKeysInv.cpp | 462 ++
.../testThinClientInterest1.cpp | 33 +
.../testThinClientInterest1Cacheless.cpp | 141 +
.../testThinClientInterest1_Bug1001.cpp | 310 +
.../testThinClientInterest2Pooled.cpp | 33 +
.../testThinClientInterest3.cpp | 33 +
.../testThinClientInterest3Cacheless.cpp | 33 +
.../testThinClientInterestList.cpp | 39 +
.../testThinClientInterestList2.cpp | 37 +
.../testThinClientInterestNotify.cpp | 543 ++
.../testThinClientLRUExpiration.cpp | 1263 ++++
...testThinClientLargePutAllWithCallBackArg.cpp | 47 +
.../testThinClientListenerCallbackArgTest.cpp | 360 +
.../testThinClientListenerEvents.cpp | 149 +
.../testThinClientListenerInit.cpp | 33 +
...ThinClientListenerWriterWithSubscription.cpp | 37 +
...nClientListenerWriterWithoutSubscription.cpp | 53 +
.../testThinClientLocalCacheLoader.cpp | 22 +
.../integration-test/testThinClientLocator.cpp | 132 +
.../testThinClientLocatorFailover.cpp | 243 +
.../integration-test/testThinClientMultiDS.cpp | 424 ++
.../testThinClientMultipleCaches.cpp | 21 +
.../testThinClientNotification.cpp | 22 +
...nClientNotificationWithDeltaWithoutcache.cpp | 254 +
.../testThinClientPRPutAllFailover.cpp | 615 ++
.../testThinClientPRSingleHop.cpp | 1341 ++++
.../testThinClientPRSingleHopServerGroup.cpp | 681 ++
.../testThinClientPartitionResolver.cpp | 172 +
.../testThinClientPdxDeltaWithNotification.cpp | 393 ++
.../integration-test/testThinClientPdxEnum.cpp | 171 +
.../testThinClientPdxInstance.cpp | 2810 ++++++++
.../testThinClientPdxSerializer.cpp | 41 +
.../testThinClientPdxSerializerForJava.cpp | 36 +
.../integration-test/testThinClientPdxTests.cpp | 4284 +++++++++++
.../testThinClientPoolAttrTest.cpp | 356 +
.../testThinClientPoolExecuteFunction.cpp | 1259 ++++
...ExecuteFunctionDisableChunkHandlerThread.cpp | 425 ++
.../testThinClientPoolExecuteFunctionPrSHOP.cpp | 1196 ++++
...ClientPoolExecuteFunctionThrowsException.cpp | 353 +
.../testThinClientPoolExecuteHAFunction.cpp | 490 ++
...estThinClientPoolExecuteHAFunctionPrSHOP.cpp | 447 ++
.../testThinClientPoolLocator.cpp | 239 +
.../testThinClientPoolRedundancy.cpp | 365 +
.../testThinClientPoolRegInterest.cpp | 107 +
.../testThinClientPoolServer.cpp | 200 +
.../integration-test/testThinClientPutAll.cpp | 30 +
.../testThinClientPutAllPRSingleHop.cpp | 436 ++
.../testThinClientPutAllTimeout.cpp | 33 +
...ientPutAllWithCallBackArgWithConcurrency.cpp | 35 +
...tPutAllWithCallBackArgWithoutConcurrency.cpp | 35 +
.../testThinClientPutGetAll.cpp | 22 +
.../testThinClientPutWithDelta.cpp | 233 +
.../testThinClientRIwithlocalRegionDestroy.cpp | 33 +
.../integration-test/testThinClientRegex.cpp | 41 +
.../integration-test/testThinClientRegex2.cpp | 41 +
.../integration-test/testThinClientRegex3.cpp | 36 +
...nClientRegionQueryDifferentServerConfigs.cpp | 232 +
.../testThinClientRegionQueryExclusiveness.cpp | 172 +
.../testThinClientRemoteQueryFailover.cpp | 246 +
.../testThinClientRemoteQueryFailoverPdx.cpp | 242 +
.../testThinClientRemoteQueryRS.cpp | 602 ++
.../testThinClientRemoteQuerySS.cpp | 633 ++
.../testThinClientRemoteQueryTimeout.cpp | 572 ++
.../testThinClientRemoteRegionQuery.cpp | 517 ++
.../testThinClientRemoveAll.cpp | 37 +
.../testThinClientRemoveAllLocal.cpp | 27 +
.../testThinClientRemoveAllSequence.cpp | 32 +
.../testThinClientRemoveOps.cpp | 1742 +++++
cppcache/integration-test/testThinClientSSL.cpp | 22 +
.../testThinClientSSLAuthCorrupt.cpp | 190 +
.../testThinClientSSLAuthFail.cpp | 190 +
.../testThinClientSSLAuthUntrusted.cpp | 191 +
.../testThinClientSSLWithPassword.cpp | 22 +
.../testThinClientSSLWithSecurityAuthz.cpp | 628 ++
.../testThinClientSecurityAuthentication.cpp | 499 ++
.../testThinClientSecurityAuthenticationMU.cpp | 550 ++
.../testThinClientSecurityAuthorization.cpp | 717 ++
.../testThinClientSecurityAuthorizationMU.cpp | 1084 +++
.../testThinClientSecurityCQAuthorization.cpp | 596 ++
.../testThinClientSecurityCQAuthorizationMU.cpp | 545 ++
.../testThinClientSecurityDH.cpp | 473 ++
.../testThinClientSecurityDH_MU.cpp | 505 ++
...inClientSecurityDurableCQAuthorizationMU.cpp | 669 ++
.../testThinClientSecurityMultiUserTest.cpp | 465 ++
.../testThinClientSecurityPostAuthorization.cpp | 387 +
.../testThinClientStatistics.cpp | 548 ++
.../testThinClientTXFailover.cpp | 25 +
.../testThinClientTicket303.cpp | 122 +
.../testThinClientTicket304.cpp | 211 +
.../testThinClientTicket317.cpp | 133 +
.../integration-test/testThinClientTracking.cpp | 270 +
.../testThinClientTransactionsWithSticky.cpp | 50 +
.../testThinClientTransactionsWithoutSticky.cpp | 50 +
.../testThinClientTransactionsXA.cpp | 34 +
.../testThinClientVersionedOps.cpp | 50 +
...hinClientVersionedOpsPartitionPersistent.cpp | 44 +
.../testThinClientVersionedOpsReplicate.cpp | 44 +
...hinClientVersionedOpsReplicatePersistent.cpp | 44 +
.../testThinClientWriterException.cpp | 252 +
.../integration-test/testTimedSemaphore.cpp | 142 +
cppcache/integration-test/testUtils.hpp | 184 +
.../testXmlCacheCreationWithOverFlow.cpp | 324 +
.../testXmlCacheCreationWithPools.cpp | 579 ++
.../testXmlCacheCreationWithRefid.cpp | 262 +
cppcache/integration-test/valid_cache.xml | 86 +
cppcache/integration-test/valid_cache_pool.xml | 91 +
cppcache/integration-test/valid_cache_refid.xml | 83 +
.../valid_cache_region_refid.xml | 81 +
.../valid_declarative_cache_creation.xml | 36 +
.../integration-test/valid_lruExpiration.xml | 266 +
.../integration-test/valid_overflowAttr.xml | 124 +
cppcache/src/AdminRegion.cpp | 148 +
cppcache/src/AdminRegion.hpp | 83 +
cppcache/src/AppDomainContext.cpp | 29 +
cppcache/src/AppDomainContext.hpp | 42 +
cppcache/src/Assert.cpp | 35 +
cppcache/src/AttributesFactory.cpp | 204 +
cppcache/src/AttributesMutator.cpp | 165 +
cppcache/src/AutoDelete.hpp | 73 +
cppcache/src/BucketServerLocation.hpp | 194 +
cppcache/src/CMakeLists.txt | 145 +
cppcache/src/Cache.cpp | 270 +
cppcache/src/CacheAttributes.cpp | 76 +
cppcache/src/CacheConfig.cpp | 141 +
cppcache/src/CacheConfig.hpp | 82 +
cppcache/src/CacheFactory.cpp | 183 +
cppcache/src/CacheImpl.cpp | 806 +++
cppcache/src/CacheImpl.hpp | 354 +
cppcache/src/CacheListener.cpp | 52 +
cppcache/src/CacheLoader.cpp | 29 +
cppcache/src/CachePerfStats.hpp | 364 +
cppcache/src/CacheRegionHelper.cpp | 48 +
cppcache/src/CacheRegionHelper.hpp | 47 +
cppcache/src/CacheStatistics.cpp | 43 +
cppcache/src/CacheTransactionManager.cpp | 27 +
cppcache/src/CacheTransactionManagerImpl.cpp | 685 ++
cppcache/src/CacheTransactionManagerImpl.hpp | 94 +
cppcache/src/CacheWriter.cpp | 43 +
cppcache/src/CacheXml.cpp | 186 +
cppcache/src/CacheXml.hpp | 220 +
cppcache/src/CacheXmlCreation.cpp | 63 +
cppcache/src/CacheXmlCreation.hpp | 99 +
cppcache/src/CacheXmlParser.cpp | 1687 +++++
cppcache/src/CacheXmlParser.hpp | 161 +
cppcache/src/CacheableBuiltins.cpp | 61 +
cppcache/src/CacheableDate.cpp | 133 +
cppcache/src/CacheableEnum.cpp | 111 +
cppcache/src/CacheableFileName.cpp | 72 +
cppcache/src/CacheableKey.cpp | 35 +
cppcache/src/CacheableObjectArray.cpp | 73 +
cppcache/src/CacheableObjectPartList.cpp | 140 +
cppcache/src/CacheableObjectPartList.hpp | 160 +
cppcache/src/CacheableString.cpp | 337 +
cppcache/src/CacheableToken.cpp | 84 +
cppcache/src/CacheableToken.hpp | 133 +
cppcache/src/CacheableUndefined.cpp | 44 +
cppcache/src/CachedDeserializableHelper.hpp | 106 +
cppcache/src/ClientConnectionRequest.cpp | 48 +
cppcache/src/ClientConnectionRequest.hpp | 72 +
cppcache/src/ClientConnectionResponse.cpp | 36 +
cppcache/src/ClientConnectionResponse.hpp | 55 +
cppcache/src/ClientHealthStats.cpp | 87 +
cppcache/src/ClientHealthStats.hpp | 95 +
cppcache/src/ClientMetadata.cpp | 391 ++
cppcache/src/ClientMetadata.hpp | 112 +
cppcache/src/ClientMetadataService.cpp | 887 +++
cppcache/src/ClientMetadataService.hpp | 238 +
cppcache/src/ClientProxyMembershipID.cpp | 404 ++
cppcache/src/ClientProxyMembershipID.hpp | 135 +
cppcache/src/ClientProxyMembershipIDFactory.cpp | 44 +
cppcache/src/ClientProxyMembershipIDFactory.hpp | 49 +
cppcache/src/ClientReplacementRequest.cpp | 33 +
cppcache/src/ClientReplacementRequest.hpp | 50 +
cppcache/src/ConcurrentEntriesMap.cpp | 241 +
cppcache/src/ConcurrentEntriesMap.hpp | 175 +
cppcache/src/Condition.cpp | 49 +
cppcache/src/Condition.hpp | 80 +
cppcache/src/ConnectCounter.cpp | 29 +
cppcache/src/ConnectCounter.hpp | 42 +
cppcache/src/Connector.hpp | 111 +
cppcache/src/CppCacheLibrary.cpp | 193 +
cppcache/src/CppCacheLibrary.hpp | 57 +
cppcache/src/CqAttributesFactory.cpp | 51 +
cppcache/src/CqAttributesImpl.cpp | 82 +
cppcache/src/CqAttributesImpl.hpp | 76 +
cppcache/src/CqAttributesMutatorImpl.cpp | 37 +
cppcache/src/CqAttributesMutatorImpl.hpp | 85 +
cppcache/src/CqEventImpl.cpp | 105 +
cppcache/src/CqEventImpl.hpp | 108 +
cppcache/src/CqListener.cpp | 24 +
cppcache/src/CqQueryImpl.cpp | 598 ++
cppcache/src/CqQueryImpl.hpp | 282 +
cppcache/src/CqQueryVsdStats.cpp | 88 +
cppcache/src/CqQueryVsdStats.hpp | 88 +
cppcache/src/CqService.cpp | 616 ++
cppcache/src/CqService.hpp | 260 +
cppcache/src/CqServiceVsdStats.cpp | 88 +
cppcache/src/CqServiceVsdStats.hpp | 123 +
cppcache/src/CqState.cpp | 41 +
cppcache/src/CqStatusListener.cpp | 28 +
cppcache/src/DSMemberForVersionStamp.hpp | 49 +
cppcache/src/DataInput.cpp | 39 +
cppcache/src/DataInputInternal.hpp | 43 +
cppcache/src/DataOutput.cpp | 138 +
cppcache/src/DataOutputInternal.hpp | 44 +
cppcache/src/Delta.cpp | 39 +
cppcache/src/DiffieHellman.cpp | 186 +
cppcache/src/DiffieHellman.hpp | 107 +
cppcache/src/DiskPolicyType.cpp | 40 +
cppcache/src/DiskStoreId.cpp | 45 +
cppcache/src/DiskStoreId.hpp | 108 +
cppcache/src/DiskVersionTag.hpp | 84 +
cppcache/src/DistributedSystem.cpp | 285 +
cppcache/src/DistributedSystemImpl.cpp | 112 +
cppcache/src/DistributedSystemImpl.hpp | 144 +
cppcache/src/EntriesMap.hpp | 183 +
cppcache/src/EntriesMapFactory.cpp | 95 +
cppcache/src/EntriesMapFactory.hpp | 48 +
cppcache/src/EntryEvent.cpp | 44 +
cppcache/src/EntryExpiryHandler.cpp | 152 +
cppcache/src/EntryExpiryHandler.hpp | 80 +
cppcache/src/EnumInfo.cpp | 84 +
cppcache/src/EnumInfo.hpp | 69 +
cppcache/src/EventId.cpp | 187 +
cppcache/src/EventId.hpp | 156 +
cppcache/src/EventIdMap.cpp | 200 +
cppcache/src/EventIdMap.hpp | 172 +
cppcache/src/EventSource.cpp | 87 +
cppcache/src/EventSource.hpp | 116 +
cppcache/src/EventType.hpp | 49 +
cppcache/src/EvictionController.cpp | 170 +
cppcache/src/EvictionController.hpp | 124 +
cppcache/src/EvictionThread.cpp | 50 +
cppcache/src/EvictionThread.hpp | 72 +
cppcache/src/Exception.cpp | 156 +
cppcache/src/ExceptionTypes.cpp | 348 +
cppcache/src/ExecutionImpl.cpp | 559 ++
cppcache/src/ExecutionImpl.hpp | 116 +
cppcache/src/ExpMapEntry.cpp | 38 +
cppcache/src/ExpMapEntry.hpp | 100 +
cppcache/src/ExpirationAction.cpp | 49 +
cppcache/src/ExpirationAttributes.cpp | 34 +
cppcache/src/ExpiryHandler_T.hpp | 75 +
cppcache/src/ExpiryTaskManager.cpp | 117 +
cppcache/src/ExpiryTaskManager.hpp | 278 +
cppcache/src/FairQueue.hpp | 179 +
cppcache/src/FarSideEntryOp.cpp | 238 +
cppcache/src/FarSideEntryOp.hpp | 129 +
cppcache/src/FixedPartitionAttributesImpl.hpp | 128 +
cppcache/src/FunctionService.cpp | 154 +
cppcache/src/FunctionServiceImpl.cpp | 31 +
cppcache/src/FunctionServiceImpl.hpp | 71 +
cppcache/src/GatewayEventCallbackArgument.hpp | 72 +
.../src/GatewaySenderEventCallbackArgument.hpp | 76 +
cppcache/src/GeodeTypeIdsImpl.hpp | 85 +
cppcache/src/GetAllServersRequest.cpp | 29 +
cppcache/src/GetAllServersRequest.hpp | 56 +
cppcache/src/GetAllServersResponse.cpp | 39 +
cppcache/src/GetAllServersResponse.hpp | 58 +
cppcache/src/IntQueue.hpp | 123 +
cppcache/src/InterestResultPolicy.cpp | 25 +
cppcache/src/InterestResultPolicy.hpp | 55 +
.../src/InternalCacheTransactionManager2PC.cpp | 27 +
.../InternalCacheTransactionManager2PCImpl.cpp | 217 +
.../InternalCacheTransactionManager2PCImpl.hpp | 59 +
cppcache/src/InternalDataView.cpp | 39 +
cppcache/src/InternalDataView.hpp | 42 +
cppcache/src/LRUAction.cpp | 117 +
cppcache/src/LRUAction.hpp | 185 +
cppcache/src/LRUEntriesMap.cpp | 516 ++
cppcache/src/LRUEntriesMap.hpp | 143 +
cppcache/src/LRUExpMapEntry.cpp | 38 +
cppcache/src/LRUExpMapEntry.hpp | 104 +
cppcache/src/LRUList.cpp | 136 +
cppcache/src/LRUList.hpp | 158 +
cppcache/src/LRULocalDestroyAction.cpp | 36 +
cppcache/src/LRULocalDestroyAction.hpp | 58 +
cppcache/src/LRUMapEntry.cpp | 37 +
cppcache/src/LRUMapEntry.hpp | 125 +
cppcache/src/LocalRegion.cpp | 3178 +++++++++
cppcache/src/LocalRegion.hpp | 511 ++
cppcache/src/LocatorListRequest.cpp | 35 +
cppcache/src/LocatorListRequest.hpp | 46 +
cppcache/src/LocatorListResponse.cpp | 46 +
cppcache/src/LocatorListResponse.hpp | 55 +
cppcache/src/Log.cpp | 846 +++
cppcache/src/MapEntry.cpp | 39 +
cppcache/src/MapEntry.hpp | 292 +
cppcache/src/MapEntryT.hpp | 307 +
cppcache/src/MapSegment.cpp | 776 ++
cppcache/src/MapSegment.hpp | 315 +
cppcache/src/MapWithLock.hpp | 63 +
cppcache/src/MemberListForVersionStamp.cpp | 54 +
cppcache/src/MemberListForVersionStamp.hpp | 65 +
cppcache/src/NoResult.hpp | 69 +
cppcache/src/NonCopyable.hpp | 46 +
cppcache/src/PartitionResolver.cpp | 31 +
cppcache/src/PdxEnumInstantiator.cpp | 54 +
cppcache/src/PdxEnumInstantiator.hpp | 57 +
cppcache/src/PdxFieldType.cpp | 169 +
cppcache/src/PdxFieldType.hpp | 111 +
cppcache/src/PdxHelper.cpp | 442 ++
cppcache/src/PdxHelper.hpp | 90 +
cppcache/src/PdxInstanceFactoryImpl.cpp | 417 ++
cppcache/src/PdxInstanceFactoryImpl.hpp | 469 ++
cppcache/src/PdxInstanceImpl.cpp | 2593 +++++++
cppcache/src/PdxInstanceImpl.hpp | 1193 ++++
cppcache/src/PdxInstantiator.cpp | 58 +
cppcache/src/PdxInstantiator.hpp | 54 +
cppcache/src/PdxLocalReader.cpp | 387 +
cppcache/src/PdxLocalReader.hpp | 227 +
cppcache/src/PdxLocalWriter.cpp | 489 ++
cppcache/src/PdxLocalWriter.hpp | 349 +
cppcache/src/PdxReaderWithTypeCollector.cpp | 642 ++
cppcache/src/PdxReaderWithTypeCollector.hpp | 182 +
cppcache/src/PdxRemotePreservedData.hpp | 117 +
cppcache/src/PdxRemoteReader.cpp | 1062 +++
cppcache/src/PdxRemoteReader.hpp | 218 +
cppcache/src/PdxRemoteWriter.cpp | 318 +
cppcache/src/PdxRemoteWriter.hpp | 242 +
cppcache/src/PdxSerializable.cpp | 66 +
cppcache/src/PdxType.cpp | 604 ++
cppcache/src/PdxType.hpp | 204 +
cppcache/src/PdxTypeRegistry.cpp | 284 +
cppcache/src/PdxTypeRegistry.hpp | 145 +
cppcache/src/PdxTypes.hpp | 46 +
cppcache/src/PdxWrapper.cpp | 176 +
cppcache/src/PdxWriterWithTypeCollector.cpp | 335 +
cppcache/src/PdxWriterWithTypeCollector.hpp | 231 +
cppcache/src/PersistenceManager.cpp | 29 +
cppcache/src/Pool.cpp | 117 +
cppcache/src/PoolAttributes.cpp | 148 +
cppcache/src/PoolAttributes.hpp | 165 +
cppcache/src/PoolFactory.cpp | 204 +
cppcache/src/PoolManager.cpp | 129 +
cppcache/src/PoolStatistics.cpp | 205 +
cppcache/src/PoolStatistics.hpp | 177 +
cppcache/src/PoolXmlCreation.cpp | 48 +
cppcache/src/PoolXmlCreation.hpp | 91 +
cppcache/src/PreservedDataExpiryHandler.cpp | 65 +
cppcache/src/PreservedDataExpiryHandler.hpp | 80 +
cppcache/src/Properties.cpp | 340 +
cppcache/src/ProxyCache.cpp | 178 +
cppcache/src/ProxyCache.hpp | 144 +
cppcache/src/ProxyRegion.cpp | 29 +
cppcache/src/ProxyRegion.hpp | 1524 ++++
cppcache/src/ProxyRemoteQueryService.cpp | 200 +
cppcache/src/ProxyRemoteQueryService.hpp | 76 +
cppcache/src/PutAllPartialResult.cpp | 68 +
cppcache/src/PutAllPartialResult.hpp | 140 +
.../src/PutAllPartialResultServerException.cpp | 103 +
.../src/PutAllPartialResultServerException.hpp | 148 +
cppcache/src/Queue.hpp | 171 +
cppcache/src/QueueConnectionRequest.cpp | 68 +
cppcache/src/QueueConnectionRequest.hpp | 67 +
cppcache/src/QueueConnectionResponse.cpp | 44 +
cppcache/src/QueueConnectionResponse.hpp | 56 +
cppcache/src/ReadWriteLock.cpp | 83 +
cppcache/src/ReadWriteLock.hpp | 95 +
cppcache/src/Region.cpp | 27 +
cppcache/src/RegionAttributes.cpp | 750 ++
cppcache/src/RegionCommit.cpp | 70 +
cppcache/src/RegionCommit.hpp | 66 +
cppcache/src/RegionConfig.cpp | 67 +
cppcache/src/RegionConfig.hpp | 65 +
cppcache/src/RegionEntry.cpp | 48 +
cppcache/src/RegionEvent.cpp | 35 +
cppcache/src/RegionExpiryHandler.cpp | 134 +
cppcache/src/RegionExpiryHandler.hpp | 75 +
cppcache/src/RegionFactory.cpp | 218 +
cppcache/src/RegionGlobalLocks.hpp | 46 +
cppcache/src/RegionInternal.cpp | 259 +
cppcache/src/RegionInternal.hpp | 312 +
cppcache/src/RegionStats.cpp | 206 +
cppcache/src/RegionStats.hpp | 152 +
cppcache/src/RegionXmlCreation.cpp | 70 +
cppcache/src/RegionXmlCreation.hpp | 134 +
cppcache/src/RemoteQuery.cpp | 203 +
cppcache/src/RemoteQuery.hpp | 88 +
cppcache/src/RemoteQueryService.cpp | 306 +
cppcache/src/RemoteQueryService.hpp | 97 +
cppcache/src/ResultCollector.cpp | 44 +
cppcache/src/ResultSetImpl.cpp | 56 +
cppcache/src/ResultSetImpl.hpp | 69 +
cppcache/src/SelectResultsIterator.cpp | 60 +
cppcache/src/Serializable.cpp | 51 +
cppcache/src/SerializationRegistry.cpp | 459 ++
cppcache/src/SerializationRegistry.hpp | 224 +
cppcache/src/ServerLocation.cpp | 33 +
cppcache/src/ServerLocation.hpp | 180 +
cppcache/src/ServerLocationRequest.cpp | 29 +
cppcache/src/ServerLocationRequest.hpp | 41 +
cppcache/src/ServerLocationResponse.hpp | 46 +
cppcache/src/Set.hpp | 131 +
cppcache/src/SslSockStream.cpp | 123 +
cppcache/src/SslSockStream.hpp | 96 +
cppcache/src/StackFrame.cpp | 43 +
cppcache/src/StackFrame.hpp | 150 +
cppcache/src/StackTrace.cpp | 205 +
cppcache/src/StackTrace.hpp | 69 +
cppcache/src/Struct.cpp | 155 +
cppcache/src/StructSetImpl.cpp | 95 +
cppcache/src/StructSetImpl.hpp | 81 +
cppcache/src/SuspendedTxExpiryHandler.cpp | 54 +
cppcache/src/SuspendedTxExpiryHandler.hpp | 70 +
cppcache/src/SystemProperties.cpp | 950 +++
cppcache/src/TSSTXStateWrapper.cpp | 42 +
cppcache/src/TSSTXStateWrapper.hpp | 55 +
cppcache/src/TXCleaner.cpp | 59 +
cppcache/src/TXCleaner.hpp | 57 +
cppcache/src/TXCommitMessage.cpp | 174 +
cppcache/src/TXCommitMessage.hpp | 57 +
cppcache/src/TXEntryState.cpp | 375 +
cppcache/src/TXEntryState.hpp | 90 +
cppcache/src/TXId.cpp | 39 +
cppcache/src/TXId.hpp | 57 +
cppcache/src/TXState.cpp | 140 +
cppcache/src/TXState.hpp | 104 +
cppcache/src/TableOfPrimes.hpp | 94 +
cppcache/src/Task.hpp | 86 +
cppcache/src/TcpConn.cpp | 369 +
cppcache/src/TcpConn.hpp | 141 +
cppcache/src/TcpSslConn.cpp | 213 +
cppcache/src/TcpSslConn.hpp | 101 +
cppcache/src/TcrChunkedContext.hpp | 194 +
cppcache/src/TcrConnection.cpp | 1590 +++++
cppcache/src/TcrConnection.hpp | 419 ++
cppcache/src/TcrConnectionManager.cpp | 611 ++
cppcache/src/TcrConnectionManager.hpp | 218 +
cppcache/src/TcrDistributionManager.cpp | 60 +
cppcache/src/TcrDistributionManager.hpp | 60 +
cppcache/src/TcrEndpoint.cpp | 1359 ++++
cppcache/src/TcrEndpoint.hpp | 268 +
cppcache/src/TcrHADistributionManager.cpp | 97 +
cppcache/src/TcrHADistributionManager.hpp | 100 +
cppcache/src/TcrMessage.cpp | 3077 ++++++++
cppcache/src/TcrMessage.hpp | 1376 ++++
cppcache/src/TcrPoolEndPoint.cpp | 145 +
cppcache/src/TcrPoolEndPoint.hpp | 67 +
cppcache/src/ThinClientBaseDM.cpp | 335 +
cppcache/src/ThinClientBaseDM.hpp | 207 +
.../src/ThinClientCacheDistributionManager.cpp | 199 +
.../src/ThinClientCacheDistributionManager.hpp | 68 +
cppcache/src/ThinClientDistributionManager.cpp | 427 ++
cppcache/src/ThinClientDistributionManager.hpp | 82 +
cppcache/src/ThinClientHARegion.cpp | 188 +
cppcache/src/ThinClientHARegion.hpp | 91 +
cppcache/src/ThinClientLocatorHelper.cpp | 469 ++
cppcache/src/ThinClientLocatorHelper.hpp | 74 +
cppcache/src/ThinClientPoolDM.cpp | 2406 +++++++
cppcache/src/ThinClientPoolDM.hpp | 628 ++
cppcache/src/ThinClientPoolHADM.cpp | 287 +
cppcache/src/ThinClientPoolHADM.hpp | 152 +
cppcache/src/ThinClientPoolRegion.cpp | 62 +
cppcache/src/ThinClientPoolRegion.hpp | 58 +
cppcache/src/ThinClientPoolStickyDM.cpp | 148 +
cppcache/src/ThinClientPoolStickyDM.hpp | 60 +
cppcache/src/ThinClientPoolStickyHADM.hpp | 41 +
cppcache/src/ThinClientRedundancyManager.cpp | 1317 ++++
cppcache/src/ThinClientRedundancyManager.hpp | 150 +
cppcache/src/ThinClientRegion.cpp | 4069 +++++++++++
cppcache/src/ThinClientRegion.hpp | 645 ++
cppcache/src/ThinClientStickyManager.cpp | 218 +
cppcache/src/ThinClientStickyManager.hpp | 63 +
cppcache/src/ThreadPool.cpp | 145 +
cppcache/src/ThreadPool.hpp | 152 +
cppcache/src/TimeoutTimer.hpp | 73 +
cppcache/src/TombstoneExpiryHandler.cpp | 93 +
cppcache/src/TombstoneExpiryHandler.hpp | 79 +
cppcache/src/TombstoneList.cpp | 174 +
cppcache/src/TombstoneList.hpp | 113 +
cppcache/src/TrackedMapEntry.cpp | 48 +
cppcache/src/TrackedMapEntry.hpp | 84 +
cppcache/src/TransactionId.cpp | 39 +
cppcache/src/TransactionSuspender.cpp | 42 +
cppcache/src/TransactionSuspender.hpp | 47 +
cppcache/src/TransactionalOperation.cpp | 135 +
cppcache/src/TransactionalOperation.hpp | 75 +
cppcache/src/TssConnectionWrapper.cpp | 137 +
cppcache/src/TssConnectionWrapper.hpp | 80 +
cppcache/src/TypeRegistry.cpp | 44 +
cppcache/src/UserAttributes.cpp | 155 +
cppcache/src/UserAttributes.hpp | 158 +
cppcache/src/UserFunctionExecutionException.cpp | 55 +
cppcache/src/Utils.cpp | 230 +
cppcache/src/Utils.hpp | 212 +
cppcache/src/Version.cpp | 27 +
cppcache/src/Version.hpp | 43 +
cppcache/src/VersionStamp.cpp | 235 +
cppcache/src/VersionStamp.hpp | 92 +
cppcache/src/VersionTag.cpp | 106 +
cppcache/src/VersionTag.hpp | 95 +
.../src/VersionedCacheableObjectPartList.cpp | 336 +
.../src/VersionedCacheableObjectPartList.hpp | 306 +
cppcache/src/apache-geode.rc | 48 +
cppcache/src/config.h.in | 37 +
cppcache/src/dllmain.cpp | 102 +
cppcache/src/geodeBanner.cpp | 26 +
cppcache/src/geodeBanner.hpp | 35 +
.../src/statistics/AtomicStatisticsImpl.cpp | 544 ++
.../src/statistics/AtomicStatisticsImpl.hpp | 237 +
.../src/statistics/GeodeStatisticsFactory.cpp | 246 +
.../src/statistics/GeodeStatisticsFactory.hpp | 131 +
cppcache/src/statistics/HostStatHelper.cpp | 149 +
cppcache/src/statistics/HostStatHelper.hpp | 86 +
cppcache/src/statistics/HostStatHelperLinux.cpp | 186 +
cppcache/src/statistics/HostStatHelperLinux.hpp | 55 +
cppcache/src/statistics/HostStatHelperNull.cpp | 18 +
cppcache/src/statistics/HostStatHelperNull.hpp | 40 +
.../src/statistics/HostStatHelperSolaris.cpp | 231 +
.../src/statistics/HostStatHelperSolaris.hpp | 71 +
cppcache/src/statistics/HostStatHelperWin.cpp | 794 +++
cppcache/src/statistics/HostStatHelperWin.hpp | 305 +
cppcache/src/statistics/HostStatSampler.cpp | 780 ++
cppcache/src/statistics/HostStatSampler.hpp | 264 +
cppcache/src/statistics/LinuxProcessStats.cpp | 122 +
cppcache/src/statistics/LinuxProcessStats.hpp | 89 +
cppcache/src/statistics/NullProcessStats.cpp | 42 +
cppcache/src/statistics/NullProcessStats.hpp | 60 +
cppcache/src/statistics/OsStatisticsImpl.cpp | 533 ++
cppcache/src/statistics/OsStatisticsImpl.hpp | 263 +
cppcache/src/statistics/PoolStatsSampler.cpp | 140 +
cppcache/src/statistics/PoolStatsSampler.hpp | 73 +
cppcache/src/statistics/ProcessStats.cpp | 28 +
cppcache/src/statistics/ProcessStats.hpp | 83 +
cppcache/src/statistics/SolarisProcessStats.cpp | 130 +
cppcache/src/statistics/SolarisProcessStats.hpp | 89 +
cppcache/src/statistics/StatArchiveWriter.cpp | 626 ++
cppcache/src/statistics/StatArchiveWriter.hpp | 280 +
cppcache/src/statistics/StatSamplerStats.cpp | 92 +
cppcache/src/statistics/StatSamplerStats.hpp | 61 +
.../src/statistics/StatisticDescriptorImpl.cpp | 262 +
.../src/statistics/StatisticDescriptorImpl.hpp | 254 +
cppcache/src/statistics/Statistics.cpp | 146 +
cppcache/src/statistics/StatisticsManager.cpp | 235 +
cppcache/src/statistics/StatisticsManager.hpp | 117 +
cppcache/src/statistics/StatisticsTypeImpl.cpp | 186 +
cppcache/src/statistics/StatisticsTypeImpl.hpp | 105 +
cppcache/src/statistics/StatsDef.hpp | 57 +
cppcache/src/statistics/WindowsProcessStats.cpp | 232 +
cppcache/src/statistics/WindowsProcessStats.hpp | 94 +
cppcache/src/util/concurrent/spinlock_mutex.hpp | 51 +
cppcache/src/version.cmake.in | 56 +
cppcache/src/version.h.in | 22 +
cppcache/test/AutoDeleteTest.cpp | 55 +
cppcache/test/ByteArray.cpp | 126 +
cppcache/test/ByteArray.hpp | 66 +
cppcache/test/ByteArrayFixture.cpp | 59 +
cppcache/test/ByteArrayFixture.hpp | 39 +
cppcache/test/ByteArrayTest.cpp | 115 +
cppcache/test/CMakeLists.txt | 66 +
cppcache/test/CacheXmlParserTest.cpp | 117 +
cppcache/test/CacheableKeysTest.cpp | 84 +
cppcache/test/CacheableStringEqualityTest.cpp | 178 +
.../test/ClientProxyMembershipIDFactoryTest.cpp | 45 +
cppcache/test/DataInputTest.cpp | 923 +++
cppcache/test/DataOutputTest.cpp | 340 +
cppcache/test/DiskPolicyTypeTest.cpp | 72 +
cppcache/test/ExpirationActionTest.cpp | 148 +
cppcache/test/InterestResultPolicyTest.cpp | 34 +
cppcache/test/PdxLocalReaderTest.cpp | 111 +
cppcache/test/StructSetTest.cpp | 91 +
cppcache/test/TcrMessage_unittest.cpp | 707 ++
cppcache/test/apache-geode_unittests.bat.in | 26 +
cppcache/test/apache-geode_unittests.sh.in | 30 +
cppcache/test/geodeBannerTest.cpp | 26 +
cryptoimpl/CMakeLists.txt | 39 +
cryptoimpl/DHImpl.cpp | 729 ++
cryptoimpl/DHImpl.hpp | 100 +
cryptoimpl/SSLImpl.cpp | 131 +
cryptoimpl/SSLImpl.hpp | 62 +
cryptoimpl/Ssl.hpp | 50 +
defaultSystem/geode.properties | 99 +
dependencies/ACE/CMakeLists.txt | 214 +
dependencies/ACE/config.h.in | 24 +
dependencies/ACE/patches | 72 +
dependencies/CMakeLists.txt | 105 +
dependencies/boost/CMakeLists.txt | 76 +
dependencies/doxygen/CMakeLists.txt | 56 +
dependencies/gtest/CMakeLists.txt | 72 +
dependencies/libxml2/CMakeLists.txt | 84 +
dependencies/openssl/CMakeLists.txt | 135 +
dependencies/openssl/patches | 13 +
dependencies/sqlite-netFx/CMakeLists.txt | 40 +
dependencies/sqlite/CMakeLists.txt | 63 +
dependencies/sqlite/CMakeLists.txt.in | 155 +
dependencies/xerces-c/CMakeLists.txt | 88 +
dhimpl/CMakeLists.txt | 26 +
dhimpl/DHImpl.cpp | 618 ++
dhimpl/DHImpl.hpp | 69 +
docs/api/CMakeLists.txt | 33 +
docs/api/DocIndex.css | 1075 +++
docs/api/c-footer.html | 17 +
docs/api/clicache/CMakeLists.txt | 29 +
docs/api/clicache/Doxyfile.in | 109 +
docs/api/clicache/footer.html | 17 +
docs/api/clicache/gemFireDotNETLogo.png | Bin 0 -> 9747 bytes
docs/api/common-Doxyfile | 70 +
docs/api/cppcache/CMakeLists.txt | 29 +
docs/api/cppcache/Doxyfile.in | 106 +
docs/api/cppcache/footer.html | 17 +
docs/api/cppcache/gemFireCPPLogo.png | Bin 0 -> 8415 bytes
docs/api/doclet/package-list | 1 +
docs/api/log4j/package-list | 17 +
docs/api/native_delta_propagation.doc | Bin 0 -> 51200 bytes
docs/api/native_delta_propagation_doc.pdf | Bin 0 -> 107503 bytes
docs/api/unix_index.html | 60 +
docs/api/win_index.html | 66 +
executables/GacInstall/AssemblyInfo.cs | 49 +
executables/GacInstall/Program.cs | 149 +
plugins/SQLiteCLI/AssemblyInfo.cs | 48 +
plugins/SQLiteCLI/CMakeLists.txt | 28 +
plugins/SQLiteCLI/SQLiteCLI.csproj.in | 130 +
plugins/SQLiteCLI/SqLiteImpl.cs | 274 +
quickstart/CPPCacheConfig.cmake | 49 +
quickstart/NativeClientConfig.cmake | 50 +
quickstart/XMLs/clientDelta.xml | 35 +
quickstart/XMLs/clientExceptions.xml | 30 +
quickstart/XMLs/clientHACache.xml | 27 +
quickstart/XMLs/clientInterop.xml | 27 +
quickstart/XMLs/clientInteropJava.xml | 28 +
quickstart/XMLs/clientLoaderListenerWriter.xml | 29 +
quickstart/XMLs/clientPdxAutoSerializer.xml | 33 +
quickstart/XMLs/clientPdxInstance.xml | 33 +
quickstart/XMLs/clientPdxRemoteQuery.xml | 33 +
quickstart/XMLs/clientPdxSerializer.xml | 33 +
quickstart/XMLs/clientPoolCqQuery.xml | 35 +
quickstart/XMLs/clientPoolRemoteQuery.xml | 38 +
quickstart/XMLs/clientRefIDExample.xml | 43 +
quickstart/XMLs/clientRegisterInterest.xml | 32 +
quickstart/XMLs/clientSecurity.xml | 33 +
quickstart/XMLs/serverBasicOperations.xml | 33 +
quickstart/XMLs/serverCqQuery.xml | 177 +
quickstart/XMLs/serverDataExpiration.xml | 34 +
quickstart/XMLs/serverDelta.xml | 41 +
quickstart/XMLs/serverDistributedSystem.xml | 33 +
quickstart/XMLs/serverDistributedSystem2.xml | 33 +
quickstart/XMLs/serverDurableClient.xml | 33 +
quickstart/XMLs/serverExceptions.xml | 36 +
quickstart/XMLs/serverExecuteFunctions.xml | 46 +
quickstart/XMLs/serverExecuteFunctions2.xml | 46 +
quickstart/XMLs/serverHACache.xml | 37 +
quickstart/XMLs/serverHACache2.xml | 37 +
quickstart/XMLs/serverLoaderListenerWriter.xml | 34 +
quickstart/XMLs/serverMultiuserSecurity.xml | 38 +
quickstart/XMLs/serverPdxAutoSerializer.xml | 33 +
quickstart/XMLs/serverPdxInstance.xml | 33 +
quickstart/XMLs/serverPdxRemoteQuery.xml | 33 +
quickstart/XMLs/serverPdxSerializer.xml | 33 +
quickstart/XMLs/serverPoolCqQuery.xml | 178 +
quickstart/XMLs/serverPoolRemoteQuery.xml | 180 +
quickstart/XMLs/serverPoolWithEndpoints.xml | 33 +
.../XMLs/serverPutAllGetAllOperations.xml | 33 +
quickstart/XMLs/serverRefIDExample.xml | 36 +
quickstart/XMLs/serverRegisterInterest.xml | 33 +
quickstart/XMLs/serverRemoteQuery.xml | 178 +
quickstart/XMLs/serverSecurity.xml | 33 +
quickstart/XMLs/serverTransactions.xml | 33 +
quickstart/XMLs/serverTransactionsXA.xml | 33 +
quickstart/cleanup.bat | 24 +
quickstart/cleanup.sh | 28 +
quickstart/cpp/BasicOperations.cpp | 117 +
quickstart/cpp/CMakeLists.txt | 172 +
quickstart/cpp/CqQuery.cpp | 179 +
quickstart/cpp/DataExpiration.cpp | 128 +
quickstart/cpp/Delta.cpp | 109 +
quickstart/cpp/DistributedSystem.cpp | 133 +
quickstart/cpp/DurableClient.cpp | 156 +
quickstart/cpp/Exceptions.cpp | 139 +
quickstart/cpp/ExecuteFunctions.cpp | 191 +
quickstart/cpp/FindCPPCache.cmake | 50 +
quickstart/cpp/HACache.cpp | 120 +
quickstart/cpp/LoaderListenerWriter.cpp | 115 +
quickstart/cpp/MultiuserSecurity.cpp | 200 +
quickstart/cpp/PdxInstance.cpp | 132 +
quickstart/cpp/PdxRemoteQuery.cpp | 145 +
quickstart/cpp/PdxSerializer.cpp | 249 +
quickstart/cpp/PoolCqQuery.cpp | 191 +
quickstart/cpp/PoolRemoteQuery.cpp | 146 +
quickstart/cpp/PoolWithEndpoints.cpp | 118 +
quickstart/cpp/PutAllGetAllOperations.cpp | 96 +
quickstart/cpp/RefIDExample.cpp | 126 +
quickstart/cpp/RegisterInterest.cpp | 131 +
quickstart/cpp/RemoteQuery.cpp | 169 +
quickstart/cpp/Security.cpp | 96 +
quickstart/cpp/Transactions.cpp | 129 +
quickstart/cpp/TransactionsXA.cpp | 141 +
quickstart/cpp/deltaobjects/DeltaExample.hpp | 162 +
quickstart/cpp/plugins/DurableCacheListener.cpp | 33 +
quickstart/cpp/plugins/DurableCacheListener.hpp | 41 +
quickstart/cpp/plugins/SimpleCacheListener.cpp | 46 +
quickstart/cpp/plugins/SimpleCacheListener.hpp | 44 +
quickstart/cpp/plugins/SimpleCacheLoader.cpp | 34 +
quickstart/cpp/plugins/SimpleCacheLoader.hpp | 40 +
quickstart/cpp/plugins/SimpleCacheWriter.cpp | 50 +
quickstart/cpp/plugins/SimpleCacheWriter.hpp | 44 +
quickstart/cpp/queryobjects/Portfolio.cpp | 138 +
quickstart/cpp/queryobjects/Portfolio.hpp | 130 +
quickstart/cpp/queryobjects/PortfolioPdx.cpp | 192 +
quickstart/cpp/queryobjects/PortfolioPdx.hpp | 107 +
.../cpp/queryobjects/PortfolioPdxAuto.cpp | 140 +
.../cpp/queryobjects/PortfolioPdxAuto.hpp | 111 +
quickstart/cpp/queryobjects/Position.cpp | 111 +
quickstart/cpp/queryobjects/Position.hpp | 99 +
quickstart/cpp/queryobjects/PositionPdx.cpp | 177 +
quickstart/cpp/queryobjects/PositionPdx.hpp | 104 +
quickstart/cpp/queryobjects/PositionPdxAuto.cpp | 108 +
quickstart/cpp/queryobjects/PositionPdxAuto.hpp | 105 +
quickstart/csharp/BasicOperations.cs | 127 +
quickstart/csharp/CMakeLists.txt | 53 +
quickstart/csharp/CqQuery.cs | 189 +
quickstart/csharp/DataExpiration.cs | 122 +
quickstart/csharp/Delta.cs | 110 +
quickstart/csharp/DeltaExample.cs | 200 +
quickstart/csharp/DistributedSystem.cs | 130 +
quickstart/csharp/DurableClient.cs | 151 +
quickstart/csharp/Exceptions.cs | 141 +
quickstart/csharp/ExecuteFunctions.cs | 165 +
quickstart/csharp/HACache.cs | 131 +
quickstart/csharp/LoaderListenerWriter.cs | 127 +
quickstart/csharp/MultiuserSecurity.cs | 196 +
quickstart/csharp/PdxInstance.cs | 137 +
quickstart/csharp/PdxRemoteQuery.cs | 142 +
quickstart/csharp/PdxSerializer.cs | 250 +
quickstart/csharp/PoolCqQuery.cs | 191 +
quickstart/csharp/PoolRemoteQuery.cs | 140 +
quickstart/csharp/PoolWithEndpoints.cs | 116 +
quickstart/csharp/PortfolioN.cs | 306 +
quickstart/csharp/PortfolioPdx.cs | 295 +
quickstart/csharp/PositionN.cs | 245 +
quickstart/csharp/PositionPdx.cs | 212 +
quickstart/csharp/PutAllGetAllOperations.cs | 95 +
quickstart/csharp/RefIDExample.cs | 120 +
quickstart/csharp/RegisterInterest.cs | 120 +
quickstart/csharp/RemoteQuery.cs | 159 +
quickstart/csharp/Security.cs | 185 +
quickstart/csharp/Transactions.cs | 134 +
quickstart/csharp/TransactionsXA.cs | 143 +
quickstart/csharp/app.config.in | 33 +
.../csharp/plugins/DurableCacheListener.cs | 83 +
.../csharp/plugins/SimpleCacheListener.cs | 83 +
quickstart/csharp/plugins/SimpleCacheLoader.cs | 43 +
quickstart/csharp/plugins/SimpleCacheWriter.cs | 67 +
.../BasicOperations/BasicOperations.csproj.in | 117 +
.../BasicOperations/Properties/AssemblyInfo.cs | 48 +
.../csharp/vsprojects/CqQuery/CqQuery.csproj.in | 122 +
.../CqQuery/Properties/AssemblyInfo.cs | 48 +
.../DataExpiration/DataExpiration.csproj.in | 119 +
.../DataExpiration/Properties/AssemblyInfo.cs | 48 +
.../csharp/vsprojects/Delta/Delta.csproj.in | 119 +
.../vsprojects/Delta/Properties/AssemblyInfo.cs | 48 +
.../DistributedSystem.csproj.in | 116 +
.../Properties/AssemblyInfo.cs | 48 +
.../DurableClient/DurableClient.csproj.in | 119 +
.../DurableClient/Properties/AssemblyInfo.cs | 48 +
.../vsprojects/Exceptions/Exceptions.csproj.in | 118 +
.../Exceptions/Properties/AssemblyInfo.cs | 48 +
.../ExecuteFunctions/ExecuteFunctions.csproj.in | 116 +
.../ExecuteFunctions/Properties/AssemblyInfo.cs | 48 +
.../csharp/vsprojects/HACache/HACache.csproj.in | 118 +
.../HACache/Properties/AssemblyInfo.cs | 48 +
.../LoaderListenerWriter.csproj.in | 125 +
.../Properties/AssemblyInfo.cs | 48 +
.../MultiuserSecurity.csproj.in | 117 +
.../Properties/AssemblyInfo.cs | 48 +
.../PdxInstance/PdxInstance.csproj.in | 116 +
.../PdxInstance/Properties/AssemblyInfo.cs | 48 +
.../PdxRemoteQuery/PdxRemoteQuery.csproj.in | 122 +
.../PdxRemoteQuery/Properties/AssemblyInfo.cs | 48 +
.../PdxSerializer/PdxSerializer.csproj.in | 116 +
.../PdxSerializer/Properties/AssemblyInfo.cs | 48 +
.../PoolCqQuery/PoolCqQuery.csproj.in | 122 +
.../PoolCqQuery/Properties/AssemblyInfo.cs | 48 +
.../PoolRemoteQuery/PoolRemoteQuery.csproj.in | 122 +
.../PoolRemoteQuery/Properties/AssemblyInfo.cs | 48 +
.../PoolWithEndpoints.csproj.in | 116 +
.../Properties/AssemblyInfo.cs | 48 +
.../Properties/AssemblyInfo.cs | 48 +
.../PutAllGetAllOperations.csproj.in | 117 +
.../RefIDExample/Properties/AssemblyInfo.cs | 48 +
.../RefIDExample/RefIDExample.csproj.in | 112 +
.../RegisterInterest/Properties/AssemblyInfo.cs | 48 +
.../RegisterInterest/RegisterInterest.csproj.in | 116 +
.../RemoteQuery/Properties/AssemblyInfo.cs | 48 +
.../RemoteQuery/RemoteQuery.csproj.in | 122 +
.../Security/Properties/AssemblyInfo.cs | 48 +
.../vsprojects/Security/Security.csproj.in | 117 +
.../SimplePlugins/Properties/AssemblyInfo.cs | 48 +
.../SimplePlugins/SimplePlugins.csproj.in | 119 +
.../Transactions/Properties/AssemblyInfo.cs | 48 +
.../Transactions/Transactions.csproj.in | 116 +
.../TransactionsXA/Properties/AssemblyInfo.cs | 48 +
.../TransactionsXA/TransactionsXA.csproj.in | 116 +
quickstart/overview.gif | Bin 0 -> 10167 bytes
quickstart/runcpp.bat.in | 292 +
quickstart/runcpp.sh.in | 310 +
quickstart/runcs.bat.in | 280 +
sqliteimpl/CMakeLists.txt | 26 +
sqliteimpl/SqLiteHelper.cpp | 192 +
sqliteimpl/SqLiteHelper.hpp | 62 +
sqliteimpl/SqLiteImpl.cpp | 207 +
sqliteimpl/SqLiteImpl.hpp | 144 +
src/CMakeLists.txt | 263 -
src/FindNativeClient.cmake | 277 -
src/FindNativeClientCPPCache.cmake | 68 -
src/clicache/.clang-format | 5 -
src/clicache/CMakeLists.txt | 20 -
src/clicache/include/gfcli/Utils.hpp | 88 -
src/clicache/integration-test/AckMixTests.cs | 264 -
src/clicache/integration-test/AssemblyInfo.cs | 49 -
.../integration-test/AttributesFactoryTestsN.cs | 108 -
.../integration-test/AttributesMutatorTestsN.cs | 329 -
.../BuiltinCacheableWrappersN.cs | 2782 --------
src/clicache/integration-test/CMakeLists.txt | 120 -
src/clicache/integration-test/CacheHelperN.cs | 2460 -------
.../integration-test/CacheServPoolRedun1.xml | 41 -
.../integration-test/CacheServPoolRedun2.xml | 40 -
.../integration-test/CacheServPoolRedun3.xml | 39 -
.../integration-test/CacheServerMsgs.cs | 58 -
.../integration-test/CacheableWrapper.cs | 208 -
.../integration-test/CacheableWrapperN.cs | 269 -
.../integration-test/CachelessTestsN.cs | 157 -
src/clicache/integration-test/DataIOTests.cs | 241 -
.../integration-test/DataOutputTests.cs | 61 -
.../integration-test/DefaultCacheableN.cs | 261 -
src/clicache/integration-test/DistGetTests.cs | 191 -
src/clicache/integration-test/DistOpsStepsN.cs | 2372 -------
src/clicache/integration-test/DistOpsTests.cs | 85 -
.../integration-test/DistributedSystemTests.cs | 136 -
src/clicache/integration-test/DupListenerN.cs | 117 -
.../integration-test/DurableListenerN.cs | 199 -
.../integration-test/ExpirationTestsN.cs | 339 -
src/clicache/integration-test/LogTests.cs | 182 -
src/clicache/integration-test/NetTests.cs | 173 -
src/clicache/integration-test/OverflowTestsN.cs | 664 --
.../integration-test/PutGetPerfTests.cs | 333 -
src/clicache/integration-test/PutGetTestsN.cs | 536 --
.../integration-test/RegionEntryTests.cs | 105 -
.../integration-test/RegionOperationN.cs | 97 -
src/clicache/integration-test/RegionWrapperN.cs | 243 -
.../integration-test/SecurityTestUtilN.cs | 267 -
.../integration-test/SerializationTestsN.cs | 1280 ----
src/clicache/integration-test/Settings.xml | 51 -
src/clicache/integration-test/TallyListener.cs | 300 -
src/clicache/integration-test/TallyListenerN.cs | 333 -
src/clicache/integration-test/TallyLoaderN.cs | 104 -
src/clicache/integration-test/TallyResolverN.cs | 97 -
src/clicache/integration-test/TallyWriter.cs | 222 -
src/clicache/integration-test/TallyWriterN.cs | 240 -
...ThinClientAppDomainFunctionExecutionTests.cs | 282 -
.../ThinClientAppDomainQueryTests.cs | 280 -
.../integration-test/ThinClientCSTXN.cs | 827 ---
.../integration-test/ThinClientCallbackArgN.cs | 726 --
.../ThinClientConflationTestsN.cs | 354 -
.../integration-test/ThinClientCqIRTestsN.cs | 250 -
.../integration-test/ThinClientCqTestsN.cs | 1025 ---
.../integration-test/ThinClientDeltaTestN.cs | 914 ---
.../ThinClientDurableCqTestsN.cs | 325 -
.../integration-test/ThinClientDurableTestsN.cs | 982 ---
.../ThinClientFunctionExecutionTestsN.cs | 1843 -----
.../ThinClientHARegionTestsN.cs | 991 ---
.../ThinClientListenerWriterN.cs | 287 -
.../integration-test/ThinClientPdxTests.cs | 6638 ------------------
.../integration-test/ThinClientPoolTestsN.cs | 901 ---
.../integration-test/ThinClientQueryTestsN.cs | 1981 ------
.../ThinClientRegionInterestTestsN.cs | 1216 ----
.../integration-test/ThinClientRegionStepsN.cs | 705 --
.../integration-test/ThinClientRegionTestsN.cs | 2397 -------
.../ThinClientSecurityAuthTestsMUN.cs | 716 --
.../ThinClientSecurityAuthTestsN.cs | 731 --
.../ThinClientSecurityAuthzTestBaseN.cs | 1061 ---
.../ThinClientSecurityAuthzTestsMUN.cs | 1051 ---
.../ThinClientSecurityAuthzTestsN.cs | 710 --
.../ThinClientStatisticTestsN.cs | 255 -
.../ThinClientStringArrayTestsN.cs | 232 -
src/clicache/integration-test/Timeouts.xml | 42 -
.../integration-test/UnitTests.csproj.in | 627 --
src/clicache/integration-test/UnitTestsN.cs | 180 -
src/clicache/integration-test/cache.xml | 27 -
.../cacheServer_pdxreadserialized.xml | 38 -
.../integration-test/cache_redundancy.xml | 30 -
src/clicache/integration-test/cacheserver.xml | 41 -
.../integration-test/cacheserver1_TradeKey.xml | 66 -
.../integration-test/cacheserver1_expiry.xml | 43 -
.../integration-test/cacheserver1_fpr.xml | 72 -
.../cacheserver1_partitioned.xml | 50 -
.../cacheserver1_partitioned_R1.xml | 52 -
.../cacheserver1_partitioned_servergroup.xml | 49 -
.../integration-test/cacheserver1_pool.xml | 33 -
.../integration-test/cacheserver1_pr.xml | 41 -
.../integration-test/cacheserver1_pr_putall.xml | 52 -
src/clicache/integration-test/cacheserver2.xml | 35 -
.../integration-test/cacheserver2_TradeKey.xml | 66 -
.../integration-test/cacheserver2_fpr.xml | 73 -
.../cacheserver2_partitioned.xml | 49 -
.../cacheserver2_partitioned_R1.xml | 51 -
.../cacheserver2_partitioned_servergroup.xml | 48 -
.../integration-test/cacheserver2_pool.xml | 33 -
.../integration-test/cacheserver2_pr.xml | 42 -
.../integration-test/cacheserver2_pr_putall.xml | 51 -
src/clicache/integration-test/cacheserver3.xml | 35 -
.../integration-test/cacheserver3_TradeKey.xml | 66 -
.../integration-test/cacheserver3_fpr.xml | 72 -
.../cacheserver3_partitioned.xml | 50 -
.../cacheserver3_partitioned_servergroup.xml | 49 -
.../integration-test/cacheserver3_pool.xml | 34 -
.../integration-test/cacheserver3_pr.xml | 54 -
.../integration-test/cacheserver3_pr_putall.xml | 52 -
src/clicache/integration-test/cacheserver4.xml | 47 -
.../integration-test/cacheserver4_pr_putall.xml | 52 -
.../integration-test/cacheserverDurableCqs.xml | 28 -
.../integration-test/cacheserverForPdx.xml | 50 -
.../cacheserverForPdxWithAuto.xml | 50 -
.../integration-test/cacheserverMDS1.xml | 33 -
.../integration-test/cacheserverMDS2.xml | 32 -
.../integration-test/cacheserverPdx.xml | 50 -
.../integration-test/cacheserverPdx2.xml | 50 -
.../cacheserverPdxSerializer.xml | 38 -
.../cacheserver_concurrency_enabled1.xml | 32 -
.../cacheserver_concurrency_enabled2.xml | 32 -
.../cacheserver_concurrency_enabled_disk1.xml | 35 -
.../cacheserver_concurrency_enabled_disk2.xml | 35 -
...rver_concurrency_enabled_disk_replicate1.xml | 35 -
...rver_concurrency_enabled_disk_replicate2.xml | 35 -
.../integration-test/cacheserver_conflation.xml | 33 -
.../integration-test/cacheserver_hashcode.xml | 43 -
.../cacheserver_interest_notify.xml | 36 -
.../integration-test/cacheserver_loader.xml | 38 -
.../cacheserver_notify_subscription.xml | 53 -
.../cacheserver_notify_subscription2.xml | 53 -
.../cacheserver_notify_subscription3.xml | 40 -
.../cacheserver_notify_subscription4.xml | 40 -
.../cacheserver_notify_subscription5.xml | 154 -
.../cacheserver_notify_subscription5N.xml | 154 -
.../cacheserver_notify_subscription6.xml | 62 -
.../cacheserver_notify_subscriptionBug849.xml | 50 -
...server_notify_subscription_PutAllTimeout.xml | 44 -
.../cacheserver_notify_subscription_forDoc.xml | 106 -
.../cacheserver_pdxinstance_hashcode.xml | 50 -
.../cacheserver_pool_client.xml | 62 -
.../integration-test/cacheserver_remoteoql.xml | 93 -
.../integration-test/cacheserver_remoteoql2.xml | 93 -
.../cacheserver_remoteoql2N.xml | 93 -
.../integration-test/cacheserver_remoteoqlN.xml | 93 -
.../cacheserver_servergroup.xml | 35 -
.../cacheserver_servergroup2.xml | 35 -
.../integration-test/cacheserver_with_delta.xml | 58 -
.../cacheserver_with_deltaAD.xml | 43 -
.../cacheserver_with_delta_test_impl.xml | 39 -
src/clicache/integration-test/client_Loader.xml | 36 -
.../client_generics_plugins.xml | 60 -
src/clicache/integration-test/client_pdx.xml | 48 -
src/clicache/integration-test/client_pool.xml | 50 -
.../client_server_persistent_transactions.xml | 31 -
.../client_server_transactions.xml | 37 -
.../integration-test/cqqueryfailover.xml | 109 -
.../integration-test/func_cacheserver1_pool.xml | 94 -
.../integration-test/func_cacheserver2_pool.xml | 94 -
.../integration-test/func_cacheserver3_pool.xml | 86 -
src/clicache/integration-test/gateway1.xml | 44 -
src/clicache/integration-test/gateway2.xml | 49 -
.../integration-test/geode.properties.mixed | 16 -
.../geode.properties.nativeclient | 16 -
.../integration-test/invalid_cache1.xml | 34 -
.../integration-test/invalid_cache2.xml | 34 -
.../integration-test/invalid_cache3.xml | 35 -
.../integration-test/invalid_cache_pool.xml | 88 -
.../integration-test/invalid_cache_pool2.xml | 89 -
.../integration-test/invalid_cache_pool3.xml | 89 -
.../integration-test/invalid_cache_pool4.xml | 91 -
.../integration-test/invalid_overflowAttr1.xml | 34 -
.../integration-test/invalid_overflowAttr2.xml | 39 -
.../integration-test/invalid_overflowAttr3.xml | 42 -
.../multi_get_function_server.xml | 47 -
.../integration-test/regionquery_diffconfig.xml | 94 -
.../regionquery_diffconfig2.xml | 94 -
.../regionquery_diffconfig2N.xml | 94 -
.../regionquery_diffconfig2_SG.xml | 96 -
.../regionquery_diffconfigN.xml | 94 -
.../regionquery_diffconfig_SG.xml | 96 -
src/clicache/integration-test/remotequery.xml | 112 -
src/clicache/integration-test/remotequery2.xml | 112 -
src/clicache/integration-test/remotequeryN.xml | 109 -
.../integration-test/serverDurableClient.xml | 33 -
src/clicache/integration-test/system.properties | 33 -
src/clicache/integration-test/test.bat.in | 65 -
src/clicache/integration-test/valid_cache.xml | 88 -
.../integration-test/valid_cache_pool.xml | 91 -
.../integration-test/valid_cache_refid.xml | 85 -
.../valid_cache_region_refid.xml | 83 -
.../valid_declarative_cache_creation.xml | 36 -
.../integration-test/valid_lruExpiration.xml | 266 -
.../integration-test/valid_overflowAttr.xml | 177 -
src/clicache/src/Apache.Geode.rc | 48 -
src/clicache/src/AttributesFactory.cpp | 484 --
src/clicache/src/AttributesFactory.hpp | 513 --
src/clicache/src/AttributesMutator.cpp | 251 -
src/clicache/src/AttributesMutator.hpp | 271 -
src/clicache/src/CMakeLists.txt | 73 -
src/clicache/src/Cache.cpp | 382 -
src/clicache/src/Cache.hpp | 302 -
src/clicache/src/CacheFactory.cpp | 193 -
src/clicache/src/CacheFactory.hpp | 177 -
src/clicache/src/CacheListenerAdapter.hpp | 83 -
src/clicache/src/CacheStatistics.cpp | 55 -
src/clicache/src/CacheStatistics.hpp | 159 -
src/clicache/src/CacheTransactionManager.cpp | 295 -
src/clicache/src/CacheTransactionManager.hpp | 228 -
src/clicache/src/CacheWriterAdapter.hpp | 73 -
src/clicache/src/CacheableArrayList.hpp | 97 -
src/clicache/src/CacheableBuiltins.hpp | 603 --
src/clicache/src/CacheableDate.cpp | 118 -
src/clicache/src/CacheableDate.hpp | 174 -
src/clicache/src/CacheableFileName.cpp | 110 -
src/clicache/src/CacheableFileName.hpp | 172 -
src/clicache/src/CacheableHashMap.cpp | 54 -
src/clicache/src/CacheableHashMap.hpp | 147 -
src/clicache/src/CacheableHashSet.hpp | 683 --
src/clicache/src/CacheableHashTable.hpp | 117 -
src/clicache/src/CacheableIdentityHashMap.hpp | 128 -
src/clicache/src/CacheableKey.cpp | 127 -
src/clicache/src/CacheableKey.hpp | 141 -
src/clicache/src/CacheableLinkedList.hpp | 152 -
src/clicache/src/CacheableObject.cpp | 82 -
src/clicache/src/CacheableObject.hpp | 156 -
src/clicache/src/CacheableObjectArray.cpp | 108 -
src/clicache/src/CacheableObjectArray.hpp | 153 -
src/clicache/src/CacheableObjectXml.cpp | 111 -
src/clicache/src/CacheableObjectXml.hpp | 157 -
src/clicache/src/CacheableStack.cpp | 91 -
src/clicache/src/CacheableStack.hpp | 130 -
src/clicache/src/CacheableString.cpp | 212 -
src/clicache/src/CacheableString.hpp | 326 -
src/clicache/src/CacheableStringArray.cpp | 96 -
src/clicache/src/CacheableStringArray.hpp | 193 -
src/clicache/src/CacheableUndefined.cpp | 53 -
src/clicache/src/CacheableUndefined.hpp | 109 -
src/clicache/src/CacheableVector.cpp | 78 -
src/clicache/src/CacheableVector.hpp | 136 -
src/clicache/src/CqAttributes.cpp | 74 -
src/clicache/src/CqAttributes.hpp | 91 -
src/clicache/src/CqAttributesFactory.cpp | 160 -
src/clicache/src/CqAttributesFactory.hpp | 92 -
src/clicache/src/CqAttributesMutator.cpp | 196 -
src/clicache/src/CqAttributesMutator.hpp | 117 -
src/clicache/src/CqEvent.cpp | 75 -
src/clicache/src/CqEvent.hpp | 105 -
src/clicache/src/CqOperation.hpp | 96 -
src/clicache/src/CqQuery.cpp | 286 -
src/clicache/src/CqQuery.hpp | 195 -
src/clicache/src/CqServiceStatistics.cpp | 86 -
src/clicache/src/CqServiceStatistics.hpp | 102 -
src/clicache/src/CqState.cpp | 92 -
src/clicache/src/CqState.hpp | 104 -
src/clicache/src/CqStatistics.cpp | 76 -
src/clicache/src/CqStatistics.hpp | 96 -
src/clicache/src/DataInput.cpp | 1165 ---
src/clicache/src/DataInput.hpp | 711 --
src/clicache/src/DataOutput.cpp | 921 ---
src/clicache/src/DataOutput.hpp | 656 --
src/clicache/src/DiskPolicyType.hpp | 89 -
src/clicache/src/DistributedSystem.cpp | 574 --
src/clicache/src/DistributedSystem.hpp | 213 -
src/clicache/src/EntryEvent.cpp | 74 -
src/clicache/src/EntryEvent.hpp | 123 -
src/clicache/src/ExceptionTypes.cpp | 159 -
src/clicache/src/ExceptionTypes.hpp | 686 --
src/clicache/src/Execution.cpp | 135 -
src/clicache/src/Execution.hpp | 116 -
src/clicache/src/ExpirationAction.hpp | 138 -
src/clicache/src/FunctionService.cpp | 115 -
src/clicache/src/FunctionService.hpp | 96 -
src/clicache/src/GeodeClassIds.hpp | 372 -
src/clicache/src/IAuthInitialize.hpp | 85 -
src/clicache/src/ICacheListener.hpp | 210 -
src/clicache/src/ICacheLoader.hpp | 118 -
src/clicache/src/ICacheWriter.hpp | 172 -
src/clicache/src/ICacheableKey.hpp | 67 -
src/clicache/src/ICqAttributes.hpp | 116 -
src/clicache/src/ICqEvent.hpp | 120 -
src/clicache/src/ICqListener.hpp | 120 -
src/clicache/src/ICqResults.hpp | 52 -
src/clicache/src/ICqStatusListener.hpp | 57 -
src/clicache/src/IFixedPartitionResolver.hpp | 96 -
src/clicache/src/IGeodeCache.hpp | 110 -
src/clicache/src/IGeodeDelta.hpp | 78 -
src/clicache/src/IGeodeSerializable.hpp | 105 -
src/clicache/src/IPartitionResolver.hpp | 108 -
src/clicache/src/IPdxInstance.hpp | 185 -
src/clicache/src/IPdxInstanceFactory.hpp | 346 -
src/clicache/src/IPdxReader.hpp | 211 -
src/clicache/src/IPdxSerializable.hpp | 67 -
src/clicache/src/IPdxSerializer.hpp | 68 -
src/clicache/src/IPdxTypeMapper.hpp | 52 -
src/clicache/src/IPdxUnreadFields.hpp | 40 -
src/clicache/src/IPdxWriter.hpp | 247 -
src/clicache/src/IPersistenceManager.hpp | 106 -
src/clicache/src/IRegion.hpp | 2077 ------
src/clicache/src/IRegionService.hpp | 128 -
src/clicache/src/IResultCollector.hpp | 80 -
src/clicache/src/ISelectResults.hpp | 81 -
src/clicache/src/ISubscriptionService.hpp | 627 --
src/clicache/src/ITransactionListener.hpp | 83 -
src/clicache/src/ITransactionWriter.hpp | 61 -
src/clicache/src/IWritablePdxInstance.hpp | 53 -
src/clicache/src/LocalRegion.cpp | 1005 ---
src/clicache/src/LocalRegion.hpp | 263 -
src/clicache/src/Log.cpp | 124 -
src/clicache/src/Log.hpp | 330 -
src/clicache/src/PdxIdentityFieldAttribute.hpp | 50 -
src/clicache/src/Pool.cpp | 463 --
src/clicache/src/Pool.hpp | 353 -
src/clicache/src/PoolFactory.cpp | 452 --
src/clicache/src/PoolFactory.hpp | 427 --
src/clicache/src/PoolManager.cpp | 77 -
src/clicache/src/PoolManager.hpp | 102 -
src/clicache/src/Properties.cpp | 356 -
src/clicache/src/Properties.hpp | 305 -
src/clicache/src/Query.cpp | 154 -
src/clicache/src/Query.hpp | 219 -
src/clicache/src/QueryService.cpp | 233 -
src/clicache/src/QueryService.hpp | 162 -
.../src/ReflectionBasedAutoSerializer.cpp | 565 --
.../src/ReflectionBasedAutoSerializer.hpp | 225 -
src/clicache/src/Region.cpp | 1538 ----
src/clicache/src/Region.hpp | 307 -
src/clicache/src/RegionAttributes.cpp | 605 --
src/clicache/src/RegionAttributes.hpp | 511 --
src/clicache/src/RegionEntry.cpp | 101 -
src/clicache/src/RegionEntry.hpp | 188 -
src/clicache/src/RegionEvent.cpp | 53 -
src/clicache/src/RegionEvent.hpp | 98 -
src/clicache/src/RegionFactory.cpp | 481 --
src/clicache/src/RegionFactory.hpp | 458 --
src/clicache/src/RegionShortcut.hpp | 76 -
src/clicache/src/ResultCollector.cpp | 115 -
src/clicache/src/ResultCollector.hpp | 94 -
src/clicache/src/ResultSet.cpp | 100 -
src/clicache/src/ResultSet.hpp | 130 -
src/clicache/src/SelectResultsIterator.cpp | 95 -
src/clicache/src/SelectResultsIterator.hpp | 137 -
src/clicache/src/Serializable.cpp | 1480 ----
src/clicache/src/Serializable.hpp | 696 --
src/clicache/src/StatisticDescriptor.cpp | 62 -
src/clicache/src/StatisticDescriptor.hpp | 140 -
src/clicache/src/Statistics.cpp | 298 -
src/clicache/src/Statistics.hpp | 541 --
src/clicache/src/StatisticsFactory.cpp | 258 -
src/clicache/src/StatisticsFactory.hpp | 273 -
src/clicache/src/StatisticsType.cpp | 85 -
src/clicache/src/StatisticsType.hpp | 144 -
src/clicache/src/Struct.cpp | 117 -
src/clicache/src/Struct.hpp | 148 -
src/clicache/src/StructSet.cpp | 130 -
src/clicache/src/StructSet.hpp | 171 -
src/clicache/src/SystemProperties.cpp | 220 -
src/clicache/src/SystemProperties.hpp | 428 --
src/clicache/src/TransactionEvent.cpp | 79 -
src/clicache/src/TransactionEvent.hpp | 88 -
src/clicache/src/TransactionId.hpp | 71 -
src/clicache/src/TransactionListenerAdapter.hpp | 61 -
src/clicache/src/TransactionWriterAdapte.hpp | 48 -
.../src/UserFunctionExecutionException.cpp | 96 -
.../src/UserFunctionExecutionException.hpp | 143 -
src/clicache/src/Utils.cpp | 77 -
src/clicache/src/begin_native.hpp | 41 -
src/clicache/src/end_native.hpp | 25 -
src/clicache/src/geode_defs.hpp | 272 -
src/clicache/src/geode_includes.hpp | 26 -
src/clicache/src/geodeclicache.vcxproj.filters | 1075 ---
src/clicache/src/impl/AppDomainContext.cpp | 33 -
src/clicache/src/impl/AppDomainContext.hpp | 75 -
src/clicache/src/impl/AssemblyInfo.cpp.in | 46 -
src/clicache/src/impl/AuthenticatedCache.cpp | 136 -
src/clicache/src/impl/AuthenticatedCache.hpp | 171 -
src/clicache/src/impl/CacheListener.hpp | 113 -
src/clicache/src/impl/CacheLoader.hpp | 85 -
src/clicache/src/impl/CacheWriter.hpp | 88 -
src/clicache/src/impl/CliCallbackDelgate.cpp | 40 -
src/clicache/src/impl/CliCallbackDelgate.hpp | 55 -
src/clicache/src/impl/CqListenerProxy.hpp | 69 -
src/clicache/src/impl/CqStatusListenerProxy.hpp | 77 -
src/clicache/src/impl/DelegateWrapper.hpp | 110 -
src/clicache/src/impl/DotNetTypes.hpp | 61 -
src/clicache/src/impl/EnumInfo.cpp | 61 -
src/clicache/src/impl/EnumInfo.hpp | 104 -
.../src/impl/FixedPartitionResolver.hpp | 102 -
src/clicache/src/impl/GeodeDataInputStream.hpp | 136 -
src/clicache/src/impl/GeodeDataOutputStream.hpp | 118 -
src/clicache/src/impl/GeodeNullStream.hpp | 119 -
src/clicache/src/impl/ManagedAuthInitialize.cpp | 206 -
src/clicache/src/impl/ManagedAuthInitialize.hpp | 134 -
src/clicache/src/impl/ManagedCacheListener.cpp | 362 -
src/clicache/src/impl/ManagedCacheListener.hpp | 232 -
src/clicache/src/impl/ManagedCacheLoader.cpp | 252 -
src/clicache/src/impl/ManagedCacheLoader.hpp | 160 -
src/clicache/src/impl/ManagedCacheWriter.cpp | 316 -
src/clicache/src/impl/ManagedCacheWriter.hpp | 191 -
src/clicache/src/impl/ManagedCacheableDelta.cpp | 282 -
src/clicache/src/impl/ManagedCacheableDelta.hpp | 189 -
.../src/impl/ManagedCacheableDeltaBytes.cpp | 337 -
.../src/impl/ManagedCacheableDeltaBytes.hpp | 218 -
src/clicache/src/impl/ManagedCacheableKey.cpp | 230 -
src/clicache/src/impl/ManagedCacheableKey.hpp | 173 -
.../src/impl/ManagedCacheableKeyBytes.cpp | 288 -
.../src/impl/ManagedCacheableKeyBytes.hpp | 208 -
src/clicache/src/impl/ManagedCqListener.cpp | 189 -
src/clicache/src/impl/ManagedCqListener.hpp | 147 -
.../src/impl/ManagedCqStatusListener.cpp | 220 -
.../src/impl/ManagedCqStatusListener.hpp | 142 -
.../src/impl/ManagedFixedPartitionResolver.cpp | 262 -
.../src/impl/ManagedFixedPartitionResolver.hpp | 147 -
.../src/impl/ManagedPartitionResolver.cpp | 252 -
.../src/impl/ManagedPartitionResolver.hpp | 137 -
.../src/impl/ManagedPersistenceManager.cpp | 247 -
.../src/impl/ManagedPersistenceManager.hpp | 86 -
.../src/impl/ManagedResultCollector.cpp | 227 -
.../src/impl/ManagedResultCollector.hpp | 105 -
src/clicache/src/impl/ManagedString.hpp | 104 -
.../src/impl/ManagedTransactionListener.cpp | 263 -
.../src/impl/ManagedTransactionListener.hpp | 93 -
.../src/impl/ManagedTransactionWriter.cpp | 222 -
.../src/impl/ManagedTransactionWriter.hpp | 96 -
src/clicache/src/impl/ManagedVisitor.cpp | 52 -
src/clicache/src/impl/ManagedVisitor.hpp | 84 -
src/clicache/src/impl/MemoryPressureHandler.cpp | 75 -
src/clicache/src/impl/MemoryPressureHandler.hpp | 44 -
src/clicache/src/impl/PartitionResolver.hpp | 74 -
src/clicache/src/impl/PdxFieldType.cpp | 194 -
src/clicache/src/impl/PdxFieldType.hpp | 150 -
src/clicache/src/impl/PdxHelper.cpp | 451 --
src/clicache/src/impl/PdxHelper.hpp | 79 -
.../src/impl/PdxInstanceFactoryImpl.cpp | 359 -
.../src/impl/PdxInstanceFactoryImpl.hpp | 402 --
src/clicache/src/impl/PdxInstanceImpl.cpp | 1432 ----
src/clicache/src/impl/PdxInstanceImpl.hpp | 298 -
src/clicache/src/impl/PdxLocalReader.cpp | 422 --
src/clicache/src/impl/PdxLocalReader.hpp | 311 -
src/clicache/src/impl/PdxLocalWriter.cpp | 490 --
src/clicache/src/impl/PdxLocalWriter.hpp | 369 -
.../src/impl/PdxManagedCacheableKey.cpp | 307 -
.../src/impl/PdxManagedCacheableKey.hpp | 197 -
.../src/impl/PdxManagedCacheableKeyBytes.cpp | 290 -
.../src/impl/PdxManagedCacheableKeyBytes.hpp | 247 -
.../src/impl/PdxReaderWithTypeCollector.cpp | 549 --
.../src/impl/PdxReaderWithTypeCollector.hpp | 268 -
.../src/impl/PdxRemotePreservedData.hpp | 119 -
src/clicache/src/impl/PdxRemoteReader.cpp | 847 ---
src/clicache/src/impl/PdxRemoteReader.hpp | 265 -
src/clicache/src/impl/PdxRemoteWriter.cpp | 334 -
src/clicache/src/impl/PdxRemoteWriter.hpp | 338 -
src/clicache/src/impl/PdxType.cpp | 553 --
src/clicache/src/impl/PdxType.hpp | 201 -
src/clicache/src/impl/PdxTypeRegistry.cpp | 317 -
src/clicache/src/impl/PdxTypeRegistry.hpp | 117 -
src/clicache/src/impl/PdxWrapper.hpp | 83 -
.../src/impl/PdxWriterWithTypeCollector.cpp | 362 -
.../src/impl/PdxWriterWithTypeCollector.hpp | 328 -
.../src/impl/PersistenceManagerProxy.hpp | 98 -
src/clicache/src/impl/RegionImpl.cpp | 18 -
src/clicache/src/impl/RegionImpl.hpp | 32 -
src/clicache/src/impl/ResultCollectorProxy.hpp | 76 -
src/clicache/src/impl/SafeConvert.hpp | 383 -
src/clicache/src/impl/TransactionListener.hpp | 83 -
src/clicache/src/impl/TransactionWriter.hpp | 66 -
src/clicache/src/impl/WeakhashMap.hpp | 258 -
.../src/native_conditional_unique_ptr.hpp | 61 -
src/clicache/src/native_shared_ptr.hpp | 41 -
src/clicache/src/native_unique_ptr.hpp | 54 -
src/clicache/src/templates/CMakeLists.txt | 30 -
src/clicache/src/templates/Templates.csproj.in | 127 -
src/clicache/test/AssemblyInfo.cpp.in | 32 -
src/clicache/test/CMakeLists.txt | 72 -
src/clicache/test/Utils.hpp | 14 -
.../test/native_conditional_unqiue_ptrTests.cpp | 248 -
src/clicache/test/native_shared_ptrTests.cpp | Bin 12434 -> 0 bytes
src/clicache/test/native_unique_ptrTests.cpp | 197 -
src/cppcache/CMakeLists.txt | 20 -
src/cppcache/CPPCacheConfig.cmake | 48 -
src/cppcache/FindCPPCache.cmake | 48 -
src/cppcache/include/geode/Assert.hpp | 100 -
.../include/geode/AttributesFactory.hpp | 382 -
.../include/geode/AttributesMutator.hpp | 193 -
src/cppcache/include/geode/AuthInitialize.hpp | 67 -
src/cppcache/include/geode/Cache.hpp | 272 -
src/cppcache/include/geode/CacheAttributes.hpp | 108 -
src/cppcache/include/geode/CacheFactory.hpp | 154 -
src/cppcache/include/geode/CacheListener.hpp | 213 -
src/cppcache/include/geode/CacheLoader.hpp | 105 -
src/cppcache/include/geode/CacheStatistics.hpp | 116 -
.../include/geode/CacheTransactionManager.hpp | 204 -
src/cppcache/include/geode/CacheWriter.hpp | 188 -
src/cppcache/include/geode/Cacheable.hpp | 46 -
src/cppcache/include/geode/Cacheable.inl | 55 -
.../include/geode/CacheableBuiltins.hpp | 651 --
src/cppcache/include/geode/CacheableDate.hpp | 190 -
src/cppcache/include/geode/CacheableEnum.hpp | 147 -
.../include/geode/CacheableFileName.hpp | 123 -
src/cppcache/include/geode/CacheableKey.hpp | 136 -
src/cppcache/include/geode/CacheableKey.inl | 55 -
src/cppcache/include/geode/CacheableKeys.hpp | 99 -
.../include/geode/CacheableObjectArray.hpp | 107 -
src/cppcache/include/geode/CacheableString.hpp | 322 -
.../include/geode/CacheableUndefined.hpp | 100 -
src/cppcache/include/geode/CqAttributes.hpp | 66 -
.../include/geode/CqAttributesFactory.hpp | 106 -
.../include/geode/CqAttributesMutator.hpp | 78 -
src/cppcache/include/geode/CqEvent.hpp | 111 -
src/cppcache/include/geode/CqListener.hpp | 99 -
src/cppcache/include/geode/CqOperation.hpp | 54 -
src/cppcache/include/geode/CqQuery.hpp | 184 -
src/cppcache/include/geode/CqResults.hpp | 48 -
.../include/geode/CqServiceStatistics.hpp | 79 -
src/cppcache/include/geode/CqState.hpp | 84 -
src/cppcache/include/geode/CqStatistics.hpp | 75 -
src/cppcache/include/geode/CqStatusListener.hpp | 53 -
src/cppcache/include/geode/DataInput.hpp | 1096 ---
src/cppcache/include/geode/DataOutput.hpp | 828 ---
src/cppcache/include/geode/Delta.hpp | 103 -
src/cppcache/include/geode/DiskPolicyType.hpp | 76 -
.../include/geode/DistributedSystem.hpp | 136 -
src/cppcache/include/geode/EntryEvent.hpp | 96 -
src/cppcache/include/geode/Exception.hpp | 128 -
src/cppcache/include/geode/ExceptionTypes.hpp | 413 --
src/cppcache/include/geode/Execution.hpp | 116 -
src/cppcache/include/geode/ExpirationAction.hpp | 117 -
.../include/geode/ExpirationAttributes.hpp | 103 -
.../include/geode/FixedPartitionResolver.hpp | 96 -
src/cppcache/include/geode/FunctionService.hpp | 147 -
src/cppcache/include/geode/GeodeCache.hpp | 88 -
src/cppcache/include/geode/GeodeCppCache.hpp | 87 -
src/cppcache/include/geode/GeodeCppCache.inl | 27 -
src/cppcache/include/geode/GeodeTypeIds.hpp | 88 -
src/cppcache/include/geode/HashFunction.hpp | 81 -
src/cppcache/include/geode/HashMapT.hpp | 53 -
src/cppcache/include/geode/HashSetT.hpp | 44 -
.../InternalCacheTransactionManager2PC.hpp | 75 -
src/cppcache/include/geode/Log.hpp | 674 --
.../include/geode/PartitionResolver.hpp | 110 -
src/cppcache/include/geode/PdxFieldTypes.hpp | 58 -
src/cppcache/include/geode/PdxInstance.hpp | 618 --
.../include/geode/PdxInstanceFactory.hpp | 476 --
src/cppcache/include/geode/PdxReader.hpp | 420 --
src/cppcache/include/geode/PdxSerializable.hpp | 108 -
src/cppcache/include/geode/PdxSerializer.hpp | 92 -
src/cppcache/include/geode/PdxUnreadFields.hpp | 52 -
src/cppcache/include/geode/PdxWrapper.hpp | 136 -
src/cppcache/include/geode/PdxWriter.hpp | 451 --
.../include/geode/PersistenceManager.hpp | 140 -
src/cppcache/include/geode/Pool.hpp | 288 -
src/cppcache/include/geode/PoolFactory.hpp | 540 --
src/cppcache/include/geode/PoolManager.hpp | 123 -
src/cppcache/include/geode/Properties.hpp | 164 -
src/cppcache/include/geode/Query.hpp | 124 -
src/cppcache/include/geode/QueryService.hpp | 179 -
src/cppcache/include/geode/Region.hpp | 1457 ----
src/cppcache/include/geode/RegionAttributes.hpp | 406 --
src/cppcache/include/geode/RegionEntry.hpp | 113 -
src/cppcache/include/geode/RegionEvent.hpp | 77 -
src/cppcache/include/geode/RegionFactory.hpp | 274 -
src/cppcache/include/geode/RegionService.hpp | 124 -
src/cppcache/include/geode/RegionShortcut.hpp | 79 -
src/cppcache/include/geode/ResultCollector.hpp | 114 -
src/cppcache/include/geode/ResultSet.hpp | 87 -
src/cppcache/include/geode/SelectResults.hpp | 90 -
.../include/geode/SelectResultsIterator.hpp | 104 -
src/cppcache/include/geode/Serializable.hpp | 145 -
src/cppcache/include/geode/Serializer.hpp | 432 --
src/cppcache/include/geode/Struct.hpp | 169 -
src/cppcache/include/geode/StructSet.hpp | 106 -
src/cppcache/include/geode/SystemProperties.hpp | 512 --
src/cppcache/include/geode/TransactionId.hpp | 46 -
src/cppcache/include/geode/TypeRegistry.hpp | 69 -
src/cppcache/include/geode/UserData.hpp | 40 -
.../geode/UserFunctionExecutionException.hpp | 125 -
src/cppcache/include/geode/VectorT.hpp | 47 -
.../include/geode/WritablePdxInstance.hpp | 541 --
src/cppcache/include/geode/geode_base.hpp | 323 -
src/cppcache/include/geode/geode_globals.hpp | 128 -
src/cppcache/include/geode/geode_types.hpp | 112 -
.../geode/statistics/StatisticDescriptor.hpp | 93 -
.../include/geode/statistics/Statistics.hpp | 532 --
.../geode/statistics/StatisticsFactory.hpp | 217 -
.../include/geode/statistics/StatisticsType.hpp | 99 -
src/cppcache/include/geode/utils.hpp | 77 -
.../integration-test/BBNamingContext.cpp | 289 -
.../integration-test/BBNamingContext.hpp | 50 -
.../BuiltinCacheableWrappers.hpp | 1313 ----
src/cppcache/integration-test/CMakeLists.txt | 225 -
.../integration-test/CTestCustom.cmake.in | 17 -
src/cppcache/integration-test/CacheHelper.cpp | 1913 -----
src/cppcache/integration-test/CacheHelper.hpp | 346 -
.../integration-test/CacheImplHelper.hpp | 69 -
.../integration-test/CacheServPoolRedun1.xml | 40 -
.../integration-test/CacheServPoolRedun2.xml | 39 -
.../integration-test/CacheServPoolRedun3.xml | 38 -
.../integration-test/CacheableWrapper.hpp | 135 -
src/cppcache/integration-test/DeltaEx.hpp | 153 -
src/cppcache/integration-test/InitSmartHeap.cpp | 27 -
.../integration-test/LibraryCallbacks.cpp | 61 -
src/cppcache/integration-test/LocatorHelper.hpp | 151 -
src/cppcache/integration-test/QueryHelper.hpp | 385 -
src/cppcache/integration-test/QueryStrings.hpp | 738 --
src/cppcache/integration-test/TallyListener.hpp | 225 -
src/cppcache/integration-test/TallyLoader.hpp | 75 -
src/cppcache/integration-test/TallyWriter.hpp | 156 -
src/cppcache/integration-test/ThinClientCQ.hpp | 64 -
.../integration-test/ThinClientCallbackArg.hpp | 197 -
.../integration-test/ThinClientDistOps.hpp | 914 ---
.../integration-test/ThinClientDistOps2.hpp | 386 -
.../integration-test/ThinClientDurable.hpp | 494 --
.../ThinClientDurableConnect.hpp | 354 -
.../ThinClientDurableFailover.hpp | 411 --
.../integration-test/ThinClientDurableInit.hpp | 113 -
.../ThinClientDurableInterest.hpp | 363 -
.../ThinClientDurableReconnect.hpp | 172 -
.../integration-test/ThinClientFailover.hpp | 427 --
.../integration-test/ThinClientFailover2.hpp | 551 --
.../integration-test/ThinClientFailover3.hpp | 376 -
.../ThinClientFailoverInterest.hpp | 431 --
.../ThinClientFailoverInterest2.hpp | 460 --
.../ThinClientFailoverInterestAllWithCache.hpp | 527 --
.../ThinClientFailoverRegex.hpp | 510 --
.../integration-test/ThinClientGatewayTest.hpp | 193 -
.../integration-test/ThinClientHeapLRU.hpp | 261 -
.../integration-test/ThinClientHelper.hpp | 707 --
.../integration-test/ThinClientInterest1.hpp | 110 -
.../integration-test/ThinClientInterest2.hpp | 101 -
.../integration-test/ThinClientInterest3.hpp | 180 -
.../ThinClientInterest3Cacheless.hpp | 153 -
.../integration-test/ThinClientInterestList.hpp | 424 --
.../ThinClientInterestList2.hpp | 410 --
.../integration-test/ThinClientListenerInit.hpp | 256 -
.../ThinClientListenerWriter.hpp | 505 --
.../ThinClientLocalCacheLoader.hpp | 266 -
.../ThinClientMultipleCaches.hpp | 104 -
.../integration-test/ThinClientNotification.hpp | 497 --
.../ThinClientPdxSerializer.hpp | 401 --
.../ThinClientPdxSerializers.hpp | 310 -
.../integration-test/ThinClientPutAll.hpp | 848 ---
.../ThinClientPutAllTimeout.hpp | 250 -
.../ThinClientPutAllWithCallBack.hpp | 808 ---
.../integration-test/ThinClientPutGetAll.hpp | 630 --
.../ThinClientRIwithlocalRegionDestroy.hpp | 503 --
.../integration-test/ThinClientRegex.hpp | 429 --
.../integration-test/ThinClientRegex2.hpp | 466 --
.../integration-test/ThinClientRegex3.hpp | 417 --
.../integration-test/ThinClientRemoveAll.hpp | 427 --
src/cppcache/integration-test/ThinClientSSL.hpp | 509 --
.../ThinClientSSLWithPassword.hpp | 523 --
.../integration-test/ThinClientSecurity.hpp | 82 -
.../ThinClientSecurityHelper.hpp | 265 -
.../integration-test/ThinClientTXFailover.hpp | 433 --
.../integration-test/ThinClientTasks_C2S2.hpp | 96 -
.../integration-test/ThinClientTransactions.hpp | 1122 ---
.../ThinClientTransactionsXA.hpp | 1177 ----
.../integration-test/ThinClientVersionedOps.hpp | 591 --
src/cppcache/integration-test/TimeBomb.hpp | 114 -
src/cppcache/integration-test/cache.xml | 27 -
.../cacheServer_pdxreadserialized.xml | 37 -
.../integration-test/cache_redundancy.xml | 29 -
src/cppcache/integration-test/cacheserver.xml | 40 -
.../integration-test/cacheserver1_TradeKey.xml | 62 -
.../integration-test/cacheserver1_expiry.xml | 38 -
.../integration-test/cacheserver1_fpr.xml | 72 -
.../cacheserver1_partitioned.xml | 50 -
.../cacheserver1_partitioned_R1.xml | 52 -
.../cacheserver1_partitioned_servergroup.xml | 49 -
.../integration-test/cacheserver1_pool.xml | 32 -
.../integration-test/cacheserver1_pr.xml | 41 -
.../integration-test/cacheserver1_pr_putall.xml | 52 -
src/cppcache/integration-test/cacheserver2.xml | 34 -
.../integration-test/cacheserver2_TradeKey.xml | 62 -
.../integration-test/cacheserver2_fpr.xml | 72 -
.../cacheserver2_partitioned.xml | 48 -
.../cacheserver2_partitioned_R1.xml | 50 -
.../cacheserver2_partitioned_servergroup.xml | 47 -
.../integration-test/cacheserver2_pool.xml | 32 -
.../integration-test/cacheserver2_pr.xml | 41 -
.../integration-test/cacheserver2_pr_putall.xml | 50 -
src/cppcache/integration-test/cacheserver3.xml | 34 -
.../integration-test/cacheserver3_TradeKey.xml | 62 -
.../integration-test/cacheserver3_fpr.xml | 72 -
.../cacheserver3_partitioned.xml | 50 -
.../cacheserver3_partitioned_servergroup.xml | 49 -
.../integration-test/cacheserver3_pool.xml | 33 -
.../integration-test/cacheserver3_pr.xml | 54 -
.../integration-test/cacheserver3_pr_putall.xml | 52 -
src/cppcache/integration-test/cacheserver4.xml | 46 -
.../integration-test/cacheserver4_pr_putall.xml | 52 -
.../integration-test/cacheserverDurableCqs.xml | 28 -
.../integration-test/cacheserverForPdx.xml | 49 -
.../cacheserverForPdxWithAuto.xml | 49 -
.../integration-test/cacheserverMDS1.xml | 32 -
.../integration-test/cacheserverMDS2.xml | 31 -
.../integration-test/cacheserverPdx.xml | 49 -
.../integration-test/cacheserverPdx2.xml | 49 -
.../cacheserverPdxSerializer.xml | 37 -
.../cacheserver_concurrency_enabled1.xml | 32 -
.../cacheserver_concurrency_enabled2.xml | 32 -
.../cacheserver_concurrency_enabled_disk1.xml | 35 -
.../cacheserver_concurrency_enabled_disk2.xml | 35 -
...rver_concurrency_enabled_disk_replicate1.xml | 35 -
...rver_concurrency_enabled_disk_replicate2.xml | 35 -
.../integration-test/cacheserver_conflation.xml | 33 -
.../integration-test/cacheserver_hashcode.xml | 42 -
.../cacheserver_interest_notify.xml | 36 -
.../integration-test/cacheserver_loader.xml | 32 -
.../cacheserver_notify_subscription.xml | 53 -
.../cacheserver_notify_subscription2.xml | 53 -
.../cacheserver_notify_subscription3.xml | 40 -
.../cacheserver_notify_subscription4.xml | 40 -
.../cacheserver_notify_subscription5.xml | 154 -
.../cacheserver_notify_subscription5N.xml | 154 -
.../cacheserver_notify_subscription6.xml | 62 -
.../cacheserver_notify_subscriptionBug849.xml | 50 -
...server_notify_subscription_PutAllTimeout.xml | 44 -
.../cacheserver_pdxinstance_hashcode.xml | 49 -
.../cacheserver_pool_client.xml | 61 -
.../integration-test/cacheserver_remoteoql.xml | 92 -
.../integration-test/cacheserver_remoteoql2.xml | 92 -
.../cacheserver_remoteoql2N.xml | 92 -
.../integration-test/cacheserver_remoteoqlN.xml | 92 -
.../cacheserver_servergroup.xml | 35 -
.../cacheserver_servergroup2.xml | 35 -
.../integration-test/cacheserver_with_delta.xml | 57 -
.../cacheserver_with_deltaAD.xml | 42 -
.../cacheserver_with_delta_test_impl.xml | 39 -
src/cppcache/integration-test/client_Loader.xml | 36 -
.../client_generics_plugins.xml | 60 -
src/cppcache/integration-test/client_pdx.xml | 48 -
src/cppcache/integration-test/client_pool.xml | 50 -
.../client_server_persistent_transactions.xml | 31 -
.../client_server_transactions.xml | 37 -
src/cppcache/integration-test/comparePerf.pl | 102 -
.../integration-test/cqqueryfailover.xml | 108 -
.../deprecated_xml_instructions.txt | 72 -
.../integration-test/func_cacheserver1_pool.xml | 96 -
.../integration-test/func_cacheserver2_pool.xml | 97 -
.../integration-test/func_cacheserver3_pool.xml | 89 -
src/cppcache/integration-test/fw_dunit.cpp | 1193 ----
src/cppcache/integration-test/fw_dunit.hpp | 366 -
src/cppcache/integration-test/fw_helper.hpp | 232 -
src/cppcache/integration-test/fw_perf.hpp | 248 -
src/cppcache/integration-test/fw_spawn.hpp | 129 -
src/cppcache/integration-test/gateway1.xml | 44 -
src/cppcache/integration-test/gateway2.xml | 41 -
.../integration-test/invalid_cache1.xml | 34 -
.../integration-test/invalid_cache2.xml | 34 -
.../integration-test/invalid_cache3.xml | 35 -
.../integration-test/invalid_cache_pool.xml | 88 -
.../integration-test/invalid_cache_pool2.xml | 89 -
.../integration-test/invalid_cache_pool3.xml | 88 -
.../integration-test/invalid_cache_pool4.xml | 91 -
.../integration-test/invalid_overflowAttr1.xml | 34 -
.../integration-test/invalid_overflowAttr2.xml | 39 -
.../integration-test/invalid_overflowAttr3.xml | 42 -
.../keystore/client_keystore.password.pem | 48 -
.../keystore/client_keystore.pem | 45 -
.../keystore/client_keystore_corrupt.pem | 45 -
.../keystore/client_keystore_untrusted.pem | 30 -
.../keystore/client_truststore.pem | 16 -
.../integration-test/keystore/gemfire.pem | 176 -
.../integration-test/keystore/geode1.keystore | Bin 1536 -> 0 bytes
.../integration-test/keystore/geode11.keystore | Bin 1546 -> 0 bytes
.../integration-test/keystore/geode2.keystore | Bin 1536 -> 0 bytes
.../integration-test/keystore/publickeyfile | Bin 4535 -> 0 bytes
.../keystore/server_keystore.jks | Bin 2102 -> 0 bytes
.../keystore/server_truststore.jks | Bin 1596 -> 0 bytes
.../keystore/untrusted_server_keystore.jks | Bin 10764 -> 0 bytes
.../keystore/untrusted_server_truststore.jks | Bin 1448 -> 0 bytes
.../integration-test/locator_globals.hpp | 29 -
.../multi_get_function_server.xml | 47 -
.../integration-test/regionquery_diffconfig.xml | 93 -
.../regionquery_diffconfig2.xml | 93 -
.../regionquery_diffconfig2N.xml | 93 -
.../regionquery_diffconfig2_SG.xml | 95 -
.../regionquery_diffconfigN.xml | 93 -
.../regionquery_diffconfig_SG.xml | 95 -
src/cppcache/integration-test/remotequery.xml | 111 -
src/cppcache/integration-test/remotequery2.xml | 111 -
src/cppcache/integration-test/remotequeryN.xml | 108 -
.../integration-test/serverDurableClient.xml | 33 -
src/cppcache/integration-test/system.properties | 38 -
src/cppcache/integration-test/test.bat.in | 59 -
src/cppcache/integration-test/test.sh.in | 64 -
.../integration-test/testAttributesFactory.cpp | 101 -
.../integration-test/testAttributesMutator.cpp | 82 -
src/cppcache/integration-test/testCache.cpp | 188 -
src/cppcache/integration-test/testCacheless.cpp | 286 -
src/cppcache/integration-test/testConnect.cpp | 49 -
.../testCreateAndDestroyPool.cpp | 74 -
.../integration-test/testDataOutput.cpp | 302 -
src/cppcache/integration-test/testDunit.cpp | 85 -
.../integration-test/testExpiration.cpp | 408 --
src/cppcache/integration-test/testFWHelper.cpp | 36 -
src/cppcache/integration-test/testFwPerf.cpp | 66 -
src/cppcache/integration-test/testLRUList.cpp | 194 -
src/cppcache/integration-test/testLinkage.cpp | 95 -
src/cppcache/integration-test/testLogger.cpp | 335 -
.../testOverflowPutGetSqLite.cpp | 721 --
.../testRegionAccessThreadSafe.cpp | 142 -
src/cppcache/integration-test/testRegionMap.cpp | 222 -
.../integration-test/testRegionTemplateArgs.cpp | 1153 ---
.../integration-test/testSerialization.cpp | 220 -
src/cppcache/integration-test/testSpinLock.cpp | 157 -
.../integration-test/testSystemProperties.cpp | 162 -
.../testThinClientAfterRegionLive.cpp | 239 -
.../integration-test/testThinClientBigValue.cpp | 406 --
.../testThinClientCacheableStringArray.cpp | 176 -
.../testThinClientCacheables.cpp | 306 -
.../testThinClientCacheablesLimits.cpp | 206 -
.../testThinClientCallbackArg.cpp | 21 -
.../testThinClientClearRegion.cpp | 162 -
.../testThinClientConflation.cpp | 300 -
.../testThinClientContainsKeyOnServer.cpp | 98 -
.../integration-test/testThinClientCq.cpp | 1267 ----
.../integration-test/testThinClientCqDelta.cpp | 313 -
.../testThinClientCqDurable.cpp | 1041 ---
.../testThinClientCqFailover.cpp | 457 --
.../testThinClientCqHAFailover.cpp | 490 --
.../integration-test/testThinClientCqIR.cpp | 359 -
.../testThinClientDeltaWithNotification.cpp | 396 --
.../testThinClientDisconnectionListioner.cpp | 96 -
.../integration-test/testThinClientDistOps2.cpp | 42 -
...stThinClientDistOpsDontUpdateLocatorList.cpp | 21 -
.../testThinClientDistOpsNotSticky.cpp | 21 -
.../testThinClientDistOpsSticky.cpp | 21 -
.../testThinClientDistOpsUpdateLocatorList.cpp | 21 -
.../testThinClientDurableConnect.cpp | 26 -
.../testThinClientDurableCrashNormal.cpp | 56 -
.../testThinClientDurableCrashTimeout.cpp | 55 -
.../testThinClientDurableDisconnectNormal.cpp | 53 -
.../testThinClientDurableDisconnectTimeout.cpp | 53 -
...tDurableFailoverClientClosedNoRedundancy.cpp | 22 -
...entDurableFailoverClientClosedRedundancy.cpp | 22 -
...DurableFailoverClientNotClosedRedundancy.cpp | 22 -
.../testThinClientDurableInterest.cpp | 44 -
...estThinClientDurableKeepAliveFalseNormal.cpp | 55 -
...stThinClientDurableKeepAliveFalseTimeout.cpp | 55 -
...testThinClientDurableKeepAliveTrueNormal.cpp | 55 -
...estThinClientDurableKeepAliveTrueTimeout.cpp | 55 -
.../testThinClientDurableReconnect.cpp | 22 -
.../testThinClientExecuteFunctionPrSHOP.cpp | 647 --
.../integration-test/testThinClientFailover.cpp | 25 -
.../testThinClientFailover2.cpp | 21 -
.../testThinClientFailover3.cpp | 41 -
.../testThinClientFailoverInterest.cpp | 21 -
.../testThinClientFailoverInterest2.cpp | 21 -
...stThinClientFailoverInterestAllWithCache.cpp | 45 -
.../testThinClientFailoverRegex.cpp | 21 -
.../testThinClientFixedPartitionResolver.cpp | 555 --
.../testThinClientGatewayTest.cpp | 22 -
.../testThinClientGetInterests.cpp | 132 -
.../testThinClientHADistOps.cpp | 577 --
.../testThinClientHAEventIDMap.cpp | 578 --
.../testThinClientHAFailover.cpp | 655 --
.../testThinClientHAFailoverRegex.cpp | 650 --
.../testThinClientHAMixedRedundancy.cpp | 570 --
.../testThinClientHAPeriodicAck.cpp | 577 --
.../testThinClientHAQueryFailover.cpp | 309 -
.../integration-test/testThinClientHeapLRU.cpp | 134 -
.../testThinClientIntResPolKeysInv.cpp | 462 --
.../testThinClientInterest1.cpp | 33 -
.../testThinClientInterest1Cacheless.cpp | 141 -
.../testThinClientInterest1_Bug1001.cpp | 310 -
.../testThinClientInterest2Pooled.cpp | 33 -
.../testThinClientInterest3.cpp | 33 -
.../testThinClientInterest3Cacheless.cpp | 33 -
.../testThinClientInterestList.cpp | 39 -
.../testThinClientInterestList2.cpp | 37 -
.../testThinClientInterestNotify.cpp | 543 --
.../testThinClientLRUExpiration.cpp | 1263 ----
...testThinClientLargePutAllWithCallBackArg.cpp | 47 -
.../testThinClientListenerCallbackArgTest.cpp | 360 -
.../testThinClientListenerEvents.cpp | 149 -
.../testThinClientListenerInit.cpp | 33 -
...ThinClientListenerWriterWithSubscription.cpp | 37 -
...nClientListenerWriterWithoutSubscription.cpp | 53 -
.../testThinClientLocalCacheLoader.cpp | 22 -
.../integration-test/testThinClientLocator.cpp | 132 -
.../testThinClientLocatorFailover.cpp | 243 -
.../integration-test/testThinClientMultiDS.cpp | 424 --
.../testThinClientMultipleCaches.cpp | 21 -
.../testThinClientNotification.cpp | 22 -
...nClientNotificationWithDeltaWithoutcache.cpp | 254 -
.../testThinClientPRPutAllFailover.cpp | 615 --
.../testThinClientPRSingleHop.cpp | 1341 ----
.../testThinClientPRSingleHopServerGroup.cpp | 681 --
.../testThinClientPartitionResolver.cpp | 172 -
.../testThinClientPdxDeltaWithNotification.cpp | 393 --
.../integration-test/testThinClientPdxEnum.cpp | 171 -
.../testThinClientPdxInstance.cpp | 2810 --------
.../testThinClientPdxSerializer.cpp | 41 -
.../testThinClientPdxSerializerForJava.cpp | 36 -
.../integration-test/testThinClientPdxTests.cpp | 4284 -----------
.../testThinClientPoolAttrTest.cpp | 356 -
.../testThinClientPoolExecuteFunction.cpp | 1259 ----
...ExecuteFunctionDisableChunkHandlerThread.cpp | 425 --
.../testThinClientPoolExecuteFunctionPrSHOP.cpp | 1196 ----
...ClientPoolExecuteFunctionThrowsException.cpp | 353 -
.../testThinClientPoolExecuteHAFunction.cpp | 490 --
...estThinClientPoolExecuteHAFunctionPrSHOP.cpp | 447 --
.../testThinClientPoolLocator.cpp | 239 -
.../testThinClientPoolRedundancy.cpp | 365 -
.../testThinClientPoolRegInterest.cpp | 107 -
.../testThinClientPoolServer.cpp | 200 -
.../integration-test/testThinClientPutAll.cpp | 30 -
.../testThinClientPutAllPRSingleHop.cpp | 436 --
.../testThinClientPutAllTimeout.cpp | 33 -
...ientPutAllWithCallBackArgWithConcurrency.cpp | 35 -
...tPutAllWithCallBackArgWithoutConcurrency.cpp | 35 -
.../testThinClientPutGetAll.cpp | 22 -
.../testThinClientPutWithDelta.cpp | 233 -
.../testThinClientRIwithlocalRegionDestroy.cpp | 33 -
.../integration-test/testThinClientRegex.cpp | 41 -
.../integration-test/testThinClientRegex2.cpp | 41 -
.../integration-test/testThinClientRegex3.cpp | 36 -
...nClientRegionQueryDifferentServerConfigs.cpp | 232 -
.../testThinClientRegionQueryExclusiveness.cpp | 172 -
.../testThinClientRemoteQueryFailover.cpp | 246 -
.../testThinClientRemoteQueryFailoverPdx.cpp | 242 -
.../testThinClientRemoteQueryRS.cpp | 602 --
.../testThinClientRemoteQuerySS.cpp | 633 --
.../testThinClientRemoteQueryTimeout.cpp | 572 --
.../testThinClientRemoteRegionQuery.cpp | 517 --
.../testThinClientRemoveAll.cpp | 37 -
.../testThinClientRemoveAllLocal.cpp | 27 -
.../testThinClientRemoveAllSequence.cpp | 32 -
.../testThinClientRemoveOps.cpp | 1742 -----
.../integration-test/testThinClientSSL.cpp | 22 -
.../testThinClientSSLAuthCorrupt.cpp | 190 -
.../testThinClientSSLAuthFail.cpp | 190 -
.../testThinClientSSLAuthUntrusted.cpp | 191 -
.../testThinClientSSLWithPassword.cpp | 22 -
.../testThinClientSSLWithSecurityAuthz.cpp | 628 --
.../testThinClientSecurityAuthentication.cpp | 499 --
.../testThinClientSecurityAuthenticationMU.cpp | 550 --
.../testThinClientSecurityAuthorization.cpp | 717 --
.../testThinClientSecurityAuthorizationMU.cpp | 1084 ---
.../testThinClientSecurityCQAuthorization.cpp | 596 --
.../testThinClientSecurityCQAuthorizationMU.cpp | 545 --
.../testThinClientSecurityDH.cpp | 473 --
.../testThinClientSecurityDH_MU.cpp | 505 --
...inClientSecurityDurableCQAuthorizationMU.cpp | 669 --
.../testThinClientSecurityMultiUserTest.cpp | 465 --
.../testThinClientSecurityPostAuthorization.cpp | 387 -
.../testThinClientStatistics.cpp | 548 --
.../testThinClientTXFailover.cpp | 25 -
.../testThinClientTicket303.cpp | 122 -
.../testThinClientTicket304.cpp | 211 -
.../testThinClientTicket317.cpp | 133 -
.../integration-test/testThinClientTracking.cpp | 270 -
.../testThinClientTransactionsWithSticky.cpp | 50 -
.../testThinClientTransactionsWithoutSticky.cpp | 50 -
.../testThinClientTransactionsXA.cpp | 34 -
.../testThinClientVersionedOps.cpp | 50 -
...hinClientVersionedOpsPartitionPersistent.cpp | 44 -
.../testThinClientVersionedOpsReplicate.cpp | 44 -
...hinClientVersionedOpsReplicatePersistent.cpp | 44 -
.../testThinClientWriterException.cpp | 252 -
.../integration-test/testTimedSemaphore.cpp | 142 -
src/cppcache/integration-test/testUtils.hpp | 184 -
.../testXmlCacheCreationWithOverFlow.cpp | 324 -
.../testXmlCacheCreationWithPools.cpp | 579 --
.../testXmlCacheCreationWithRefid.cpp | 262 -
src/cppcache/integration-test/valid_cache.xml | 86 -
.../integration-test/valid_cache_pool.xml | 91 -
.../integration-test/valid_cache_refid.xml | 83 -
.../valid_cache_region_refid.xml | 81 -
.../valid_declarative_cache_creation.xml | 36 -
.../integration-test/valid_lruExpiration.xml | 266 -
.../integration-test/valid_overflowAttr.xml | 124 -
src/cppcache/src/AdminRegion.cpp | 148 -
src/cppcache/src/AdminRegion.hpp | 83 -
src/cppcache/src/AppDomainContext.cpp | 29 -
src/cppcache/src/AppDomainContext.hpp | 42 -
src/cppcache/src/Assert.cpp | 35 -
src/cppcache/src/AttributesFactory.cpp | 204 -
src/cppcache/src/AttributesMutator.cpp | 165 -
src/cppcache/src/AutoDelete.hpp | 73 -
src/cppcache/src/BucketServerLocation.hpp | 194 -
src/cppcache/src/CMakeLists.txt | 145 -
src/cppcache/src/Cache.cpp | 270 -
src/cppcache/src/CacheAttributes.cpp | 76 -
src/cppcache/src/CacheConfig.cpp | 141 -
src/cppcache/src/CacheConfig.hpp | 82 -
src/cppcache/src/CacheFactory.cpp | 183 -
src/cppcache/src/CacheImpl.cpp | 806 ---
src/cppcache/src/CacheImpl.hpp | 354 -
src/cppcache/src/CacheListener.cpp | 52 -
src/cppcache/src/CacheLoader.cpp | 29 -
src/cppcache/src/CachePerfStats.hpp | 364 -
src/cppcache/src/CacheRegionHelper.cpp | 48 -
src/cppcache/src/CacheRegionHelper.hpp | 47 -
src/cppcache/src/CacheStatistics.cpp | 43 -
src/cppcache/src/CacheTransactionManager.cpp | 27 -
.../src/CacheTransactionManagerImpl.cpp | 685 --
.../src/CacheTransactionManagerImpl.hpp | 94 -
src/cppcache/src/CacheWriter.cpp | 43 -
src/cppcache/src/CacheXml.cpp | 186 -
src/cppcache/src/CacheXml.hpp | 220 -
src/cppcache/src/CacheXmlCreation.cpp | 63 -
src/cppcache/src/CacheXmlCreation.hpp | 99 -
src/cppcache/src/CacheXmlParser.cpp | 1687 -----
src/cppcache/src/CacheXmlParser.hpp | 161 -
src/cppcache/src/CacheableBuiltins.cpp | 61 -
src/cppcache/src/CacheableDate.cpp | 133 -
src/cppcache/src/CacheableEnum.cpp | 111 -
src/cppcache/src/CacheableFileName.cpp | 72 -
src/cppcache/src/CacheableKey.cpp | 35 -
src/cppcache/src/CacheableObjectArray.cpp | 73 -
src/cppcache/src/CacheableObjectPartList.cpp | 140 -
src/cppcache/src/CacheableObjectPartList.hpp | 160 -
src/cppcache/src/CacheableString.cpp | 337 -
src/cppcache/src/CacheableToken.cpp | 84 -
src/cppcache/src/CacheableToken.hpp | 133 -
src/cppcache/src/CacheableUndefined.cpp | 44 -
src/cppcache/src/CachedDeserializableHelper.hpp | 106 -
src/cppcache/src/ClientConnectionRequest.cpp | 48 -
src/cppcache/src/ClientConnectionRequest.hpp | 72 -
src/cppcache/src/ClientConnectionResponse.cpp | 36 -
src/cppcache/src/ClientConnectionResponse.hpp | 55 -
src/cppcache/src/ClientHealthStats.cpp | 87 -
src/cppcache/src/ClientHealthStats.hpp | 95 -
src/cppcache/src/ClientMetadata.cpp | 391 --
src/cppcache/src/ClientMetadata.hpp | 112 -
src/cppcache/src/ClientMetadataService.cpp | 887 ---
src/cppcache/src/ClientMetadataService.hpp | 238 -
src/cppcache/src/ClientProxyMembershipID.cpp | 404 --
src/cppcache/src/ClientProxyMembershipID.hpp | 135 -
.../src/ClientProxyMembershipIDFactory.cpp | 44 -
.../src/ClientProxyMembershipIDFactory.hpp | 49 -
src/cppcache/src/ClientReplacementRequest.cpp | 33 -
src/cppcache/src/ClientReplacementRequest.hpp | 50 -
src/cppcache/src/ConcurrentEntriesMap.cpp | 241 -
src/cppcache/src/ConcurrentEntriesMap.hpp | 175 -
src/cppcache/src/Condition.cpp | 49 -
src/cppcache/src/Condition.hpp | 80 -
src/cppcache/src/ConnectCounter.cpp | 29 -
src/cppcache/src/ConnectCounter.hpp | 42 -
src/cppcache/src/Connector.hpp | 111 -
src/cppcache/src/CppCacheLibrary.cpp | 193 -
src/cppcache/src/CppCacheLibrary.hpp | 57 -
src/cppcache/src/CqAttributesFactory.cpp | 51 -
src/cppcache/src/CqAttributesImpl.cpp | 82 -
src/cppcache/src/CqAttributesImpl.hpp | 76 -
src/cppcache/src/CqAttributesMutatorImpl.cpp | 37 -
src/cppcache/src/CqAttributesMutatorImpl.hpp | 85 -
src/cppcache/src/CqEventImpl.cpp | 105 -
src/cppcache/src/CqEventImpl.hpp | 108 -
src/cppcache/src/CqListener.cpp | 24 -
src/cppcache/src/CqQueryImpl.cpp | 598 --
src/cppcache/src/CqQueryImpl.hpp | 282 -
src/cppcache/src/CqQueryVsdStats.cpp | 88 -
src/cppcache/src/CqQueryVsdStats.hpp | 88 -
src/cppcache/src/CqService.cpp | 616 --
src/cppcache/src/CqService.hpp | 260 -
src/cppcache/src/CqServiceVsdStats.cpp | 88 -
src/cppcache/src/CqServiceVsdStats.hpp | 123 -
src/cppcache/src/CqState.cpp | 41 -
src/cppcache/src/CqStatusListener.cpp | 28 -
src/cppcache/src/DSMemberForVersionStamp.hpp | 49 -
src/cppcache/src/DataInput.cpp | 39 -
src/cppcache/src/DataInputInternal.hpp | 43 -
src/cppcache/src/DataOutput.cpp | 138 -
src/cppcache/src/DataOutputInternal.hpp | 44 -
src/cppcache/src/Delta.cpp | 39 -
src/cppcache/src/DiffieHellman.cpp | 186 -
src/cppcache/src/DiffieHellman.hpp | 107 -
src/cppcache/src/DiskPolicyType.cpp | 40 -
src/cppcache/src/DiskStoreId.cpp | 45 -
src/cppcache/src/DiskStoreId.hpp | 108 -
src/cppcache/src/DiskVersionTag.hpp | 84 -
src/cppcache/src/DistributedSystem.cpp | 285 -
src/cppcache/src/DistributedSystemImpl.cpp | 112 -
src/cppcache/src/DistributedSystemImpl.hpp | 144 -
src/cppcache/src/EntriesMap.hpp | 183 -
src/cppcache/src/EntriesMapFactory.cpp | 95 -
src/cppcache/src/EntriesMapFactory.hpp | 48 -
src/cppcache/src/EntryEvent.cpp | 44 -
src/cppcache/src/EntryExpiryHandler.cpp | 152 -
src/cppcache/src/EntryExpiryHandler.hpp | 80 -
src/cppcache/src/EnumInfo.cpp | 84 -
src/cppcache/src/EnumInfo.hpp | 69 -
src/cppcache/src/EventId.cpp | 187 -
src/cppcache/src/EventId.hpp | 156 -
src/cppcache/src/EventIdMap.cpp | 200 -
src/cppcache/src/EventIdMap.hpp | 172 -
src/cppcache/src/EventSource.cpp | 87 -
src/cppcache/src/EventSource.hpp | 116 -
src/cppcache/src/EventType.hpp | 49 -
src/cppcache/src/EvictionController.cpp | 170 -
src/cppcache/src/EvictionController.hpp | 124 -
src/cppcache/src/EvictionThread.cpp | 50 -
src/cppcache/src/EvictionThread.hpp | 72 -
src/cppcache/src/Exception.cpp | 156 -
src/cppcache/src/ExceptionTypes.cpp | 348 -
src/cppcache/src/ExecutionImpl.cpp | 559 --
src/cppcache/src/ExecutionImpl.hpp | 116 -
src/cppcache/src/ExpMapEntry.cpp | 38 -
src/cppcache/src/ExpMapEntry.hpp | 100 -
src/cppcache/src/ExpirationAction.cpp | 49 -
src/cppcache/src/ExpirationAttributes.cpp | 34 -
src/cppcache/src/ExpiryHandler_T.hpp | 75 -
src/cppcache/src/ExpiryTaskManager.cpp | 117 -
src/cppcache/src/ExpiryTaskManager.hpp | 278 -
src/cppcache/src/FairQueue.hpp | 179 -
src/cppcache/src/FarSideEntryOp.cpp | 238 -
src/cppcache/src/FarSideEntryOp.hpp | 129 -
.../src/FixedPartitionAttributesImpl.hpp | 128 -
src/cppcache/src/FunctionService.cpp | 154 -
src/cppcache/src/FunctionServiceImpl.cpp | 31 -
src/cppcache/src/FunctionServiceImpl.hpp | 71 -
.../src/GatewayEventCallbackArgument.hpp | 72 -
.../src/GatewaySenderEventCallbackArgument.hpp | 76 -
src/cppcache/src/GeodeTypeIdsImpl.hpp | 85 -
src/cppcache/src/GetAllServersRequest.cpp | 29 -
src/cppcache/src/GetAllServersRequest.hpp | 56 -
src/cppcache/src/GetAllServersResponse.cpp | 39 -
src/cppcache/src/GetAllServersResponse.hpp | 58 -
src/cppcache/src/IntQueue.hpp | 123 -
src/cppcache/src/InterestResultPolicy.cpp | 25 -
src/cppcache/src/InterestResultPolicy.hpp | 55 -
.../src/InternalCacheTransactionManager2PC.cpp | 27 -
.../InternalCacheTransactionManager2PCImpl.cpp | 217 -
.../InternalCacheTransactionManager2PCImpl.hpp | 59 -
src/cppcache/src/InternalDataView.cpp | 39 -
src/cppcache/src/InternalDataView.hpp | 42 -
src/cppcache/src/LRUAction.cpp | 117 -
src/cppcache/src/LRUAction.hpp | 185 -
src/cppcache/src/LRUEntriesMap.cpp | 516 --
src/cppcache/src/LRUEntriesMap.hpp | 143 -
src/cppcache/src/LRUExpMapEntry.cpp | 38 -
src/cppcache/src/LRUExpMapEntry.hpp | 104 -
src/cppcache/src/LRUList.cpp | 136 -
src/cppcache/src/LRUList.hpp | 158 -
src/cppcache/src/LRULocalDestroyAction.cpp | 36 -
src/cppcache/src/LRULocalDestroyAction.hpp | 58 -
src/cppcache/src/LRUMapEntry.cpp | 37 -
src/cppcache/src/LRUMapEntry.hpp | 125 -
src/cppcache/src/LocalRegion.cpp | 3178 ---------
src/cppcache/src/LocalRegion.hpp | 511 --
src/cppcache/src/LocatorListRequest.cpp | 35 -
src/cppcache/src/LocatorListRequest.hpp | 46 -
src/cppcache/src/LocatorListResponse.cpp | 46 -
src/cppcache/src/LocatorListResponse.hpp | 55 -
src/cppcache/src/Log.cpp | 846 ---
src/cppcache/src/MapEntry.cpp | 39 -
src/cppcache/src/MapEntry.hpp | 292 -
src/cppcache/src/MapEntryT.hpp | 307 -
src/cppcache/src/MapSegment.cpp | 776 --
src/cppcache/src/MapSegment.hpp | 315 -
src/cppcache/src/MapWithLock.hpp | 63 -
src/cppcache/src/MemberListForVersionStamp.cpp | 54 -
src/cppcache/src/MemberListForVersionStamp.hpp | 65 -
src/cppcache/src/NoResult.hpp | 69 -
src/cppcache/src/NonCopyable.hpp | 46 -
src/cppcache/src/PartitionResolver.cpp | 31 -
src/cppcache/src/PdxEnumInstantiator.cpp | 54 -
src/cppcache/src/PdxEnumInstantiator.hpp | 57 -
src/cppcache/src/PdxFieldType.cpp | 169 -
src/cppcache/src/PdxFieldType.hpp | 111 -
src/cppcache/src/PdxHelper.cpp | 442 --
src/cppcache/src/PdxHelper.hpp | 90 -
src/cppcache/src/PdxInstanceFactoryImpl.cpp | 417 --
src/cppcache/src/PdxInstanceFactoryImpl.hpp | 469 --
src/cppcache/src/PdxInstanceImpl.cpp | 2593 -------
src/cppcache/src/PdxInstanceImpl.hpp | 1193 ----
src/cppcache/src/PdxInstantiator.cpp | 58 -
src/cppcache/src/PdxInstantiator.hpp | 54 -
src/cppcache/src/PdxLocalReader.cpp | 387 -
src/cppcache/src/PdxLocalReader.hpp | 227 -
src/cppcache/src/PdxLocalWriter.cpp | 489 --
src/cppcache/src/PdxLocalWriter.hpp | 349 -
src/cppcache/src/PdxReaderWithTypeCollector.cpp | 642 --
src/cppcache/src/PdxReaderWithTypeCollector.hpp | 182 -
src/cppcache/src/PdxRemotePreservedData.hpp | 117 -
src/cppcache/src/PdxRemoteReader.cpp | 1062 ---
src/cppcache/src/PdxRemoteReader.hpp | 218 -
src/cppcache/src/PdxRemoteWriter.cpp | 318 -
src/cppcache/src/PdxRemoteWriter.hpp | 242 -
src/cppcache/src/PdxSerializable.cpp | 66 -
src/cppcache/src/PdxType.cpp | 604 --
src/cppcache/src/PdxType.hpp | 204 -
src/cppcache/src/PdxTypeRegistry.cpp | 284 -
src/cppcache/src/PdxTypeRegistry.hpp | 145 -
src/cppcache/src/PdxTypes.hpp | 46 -
src/cppcache/src/PdxWrapper.cpp | 176 -
src/cppcache/src/PdxWriterWithTypeCollector.cpp | 335 -
src/cppcache/src/PdxWriterWithTypeCollector.hpp | 231 -
src/cppcache/src/PersistenceManager.cpp | 29 -
src/cppcache/src/Pool.cpp | 117 -
src/cppcache/src/PoolAttributes.cpp | 148 -
src/cppcache/src/PoolAttributes.hpp | 165 -
src/cppcache/src/PoolFactory.cpp | 204 -
src/cppcache/src/PoolManager.cpp | 129 -
src/cppcache/src/PoolStatistics.cpp | 205 -
src/cppcache/src/PoolStatistics.hpp | 177 -
src/cppcache/src/PoolXmlCreation.cpp | 48 -
src/cppcache/src/PoolXmlCreation.hpp | 91 -
src/cppcache/src/PreservedDataExpiryHandler.cpp | 65 -
src/cppcache/src/PreservedDataExpiryHandler.hpp | 80 -
src/cppcache/src/Properties.cpp | 340 -
src/cppcache/src/ProxyCache.cpp | 178 -
src/cppcache/src/ProxyCache.hpp | 144 -
src/cppcache/src/ProxyRegion.cpp | 29 -
src/cppcache/src/ProxyRegion.hpp | 1524 ----
src/cppcache/src/ProxyRemoteQueryService.cpp | 200 -
src/cppcache/src/ProxyRemoteQueryService.hpp | 76 -
src/cppcache/src/PutAllPartialResult.cpp | 68 -
src/cppcache/src/PutAllPartialResult.hpp | 140 -
.../src/PutAllPartialResultServerException.cpp | 103 -
.../src/PutAllPartialResultServerException.hpp | 148 -
src/cppcache/src/Queue.hpp | 171 -
src/cppcache/src/QueueConnectionRequest.cpp | 68 -
src/cppcache/src/QueueConnectionRequest.hpp | 67 -
src/cppcache/src/QueueConnectionResponse.cpp | 44 -
src/cppcache/src/QueueConnectionResponse.hpp | 56 -
src/cppcache/src/ReadWriteLock.cpp | 83 -
src/cppcache/src/ReadWriteLock.hpp | 95 -
src/cppcache/src/Region.cpp | 27 -
src/cppcache/src/RegionAttributes.cpp | 750 --
src/cppcache/src/RegionCommit.cpp | 70 -
src/cppcache/src/RegionCommit.hpp | 66 -
src/cppcache/src/RegionConfig.cpp | 67 -
src/cppcache/src/RegionConfig.hpp | 65 -
src/cppcache/src/RegionEntry.cpp | 48 -
src/cppcache/src/RegionEvent.cpp | 35 -
src/cppcache/src/RegionExpiryHandler.cpp | 134 -
src/cppcache/src/RegionExpiryHandler.hpp | 75 -
src/cppcache/src/RegionFactory.cpp | 218 -
src/cppcache/src/RegionGlobalLocks.hpp | 46 -
src/cppcache/src/RegionInternal.cpp | 259 -
src/cppcache/src/RegionInternal.hpp | 312 -
src/cppcache/src/RegionStats.cpp | 206 -
src/cppcache/src/RegionStats.hpp | 152 -
src/cppcache/src/RegionXmlCreation.cpp | 70 -
src/cppcache/src/RegionXmlCreation.hpp | 134 -
src/cppcache/src/RemoteQuery.cpp | 203 -
src/cppcache/src/RemoteQuery.hpp | 88 -
src/cppcache/src/RemoteQueryService.cpp | 306 -
src/cppcache/src/RemoteQueryService.hpp | 97 -
src/cppcache/src/ResultCollector.cpp | 44 -
src/cppcache/src/ResultSetImpl.cpp | 56 -
src/cppcache/src/ResultSetImpl.hpp | 69 -
src/cppcache/src/SelectResultsIterator.cpp | 60 -
src/cppcache/src/Serializable.cpp | 51 -
src/cppcache/src/SerializationRegistry.cpp | 459 --
src/cppcache/src/SerializationRegistry.hpp | 224 -
src/cppcache/src/ServerLocation.cpp | 33 -
src/cppcache/src/ServerLocation.hpp | 180 -
src/cppcache/src/ServerLocationRequest.cpp | 29 -
src/cppcache/src/ServerLocationRequest.hpp | 41 -
src/cppcache/src/ServerLocationResponse.hpp | 46 -
src/cppcache/src/Set.hpp | 131 -
src/cppcache/src/SslSockStream.cpp | 123 -
src/cppcache/src/SslSockStream.hpp | 96 -
src/cppcache/src/StackFrame.cpp | 43 -
src/cppcache/src/StackFrame.hpp | 150 -
src/cppcache/src/StackTrace.cpp | 205 -
src/cppcache/src/StackTrace.hpp | 69 -
src/cppcache/src/Struct.cpp | 155 -
src/cppcache/src/StructSetImpl.cpp | 95 -
src/cppcache/src/StructSetImpl.hpp | 81 -
src/cppcache/src/SuspendedTxExpiryHandler.cpp | 54 -
src/cppcache/src/SuspendedTxExpiryHandler.hpp | 70 -
src/cppcache/src/SystemProperties.cpp | 950 ---
src/cppcache/src/TSSTXStateWrapper.cpp | 42 -
src/cppcache/src/TSSTXStateWrapper.hpp | 55 -
src/cppcache/src/TXCleaner.cpp | 59 -
src/cppcache/src/TXCleaner.hpp | 57 -
src/cppcache/src/TXCommitMessage.cpp | 174 -
src/cppcache/src/TXCommitMessage.hpp | 57 -
src/cppcache/src/TXEntryState.cpp | 375 -
src/cppcache/src/TXEntryState.hpp | 90 -
src/cppcache/src/TXId.cpp | 39 -
src/cppcache/src/TXId.hpp | 57 -
src/cppcache/src/TXState.cpp | 140 -
src/cppcache/src/TXState.hpp | 104 -
src/cppcache/src/TableOfPrimes.hpp | 94 -
src/cppcache/src/Task.hpp | 86 -
src/cppcache/src/TcpConn.cpp | 369 -
src/cppcache/src/TcpConn.hpp | 141 -
src/cppcache/src/TcpSslConn.cpp | 213 -
src/cppcache/src/TcpSslConn.hpp | 101 -
src/cppcache/src/TcrChunkedContext.hpp | 194 -
src/cppcache/src/TcrConnection.cpp | 1590 -----
src/cppcache/src/TcrConnection.hpp | 419 --
src/cppcache/src/TcrConnectionManager.cpp | 611 --
src/cppcache/src/TcrConnectionManager.hpp | 218 -
src/cppcache/src/TcrDistributionManager.cpp | 60 -
src/cppcache/src/TcrDistributionManager.hpp | 60 -
src/cppcache/src/TcrEndpoint.cpp | 1359 ----
src/cppcache/src/TcrEndpoint.hpp | 268 -
src/cppcache/src/TcrHADistributionManager.cpp | 97 -
src/cppcache/src/TcrHADistributionManager.hpp | 100 -
src/cppcache/src/TcrMessage.cpp | 3077 --------
src/cppcache/src/TcrMessage.hpp | 1376 ----
src/cppcache/src/TcrPoolEndPoint.cpp | 145 -
src/cppcache/src/TcrPoolEndPoint.hpp | 67 -
src/cppcache/src/ThinClientBaseDM.cpp | 335 -
src/cppcache/src/ThinClientBaseDM.hpp | 207 -
.../src/ThinClientCacheDistributionManager.cpp | 199 -
.../src/ThinClientCacheDistributionManager.hpp | 68 -
.../src/ThinClientDistributionManager.cpp | 427 --
.../src/ThinClientDistributionManager.hpp | 82 -
src/cppcache/src/ThinClientHARegion.cpp | 188 -
src/cppcache/src/ThinClientHARegion.hpp | 91 -
src/cppcache/src/ThinClientLocatorHelper.cpp | 469 --
src/cppcache/src/ThinClientLocatorHelper.hpp | 74 -
src/cppcache/src/ThinClientPoolDM.cpp | 2406 -------
src/cppcache/src/ThinClientPoolDM.hpp | 628 --
src/cppcache/src/ThinClientPoolHADM.cpp | 287 -
src/cppcache/src/ThinClientPoolHADM.hpp | 152 -
src/cppcache/src/ThinClientPoolRegion.cpp | 62 -
src/cppcache/src/ThinClientPoolRegion.hpp | 58 -
src/cppcache/src/ThinClientPoolStickyDM.cpp | 148 -
src/cppcache/src/ThinClientPoolStickyDM.hpp | 60 -
src/cppcache/src/ThinClientPoolStickyHADM.hpp | 41 -
.../src/ThinClientRedundancyManager.cpp | 1317 ----
.../src/ThinClientRedundancyManager.hpp | 150 -
src/cppcache/src/ThinClientRegion.cpp | 4069 -----------
src/cppcache/src/ThinClientRegion.hpp | 645 --
src/cppcache/src/ThinClientStickyManager.cpp | 218 -
src/cppcache/src/ThinClientStickyManager.hpp | 63 -
src/cppcache/src/ThreadPool.cpp | 145 -
src/cppcache/src/ThreadPool.hpp | 152 -
src/cppcache/src/TimeoutTimer.hpp | 73 -
src/cppcache/src/TombstoneExpiryHandler.cpp | 93 -
src/cppcache/src/TombstoneExpiryHandler.hpp | 79 -
src/cppcache/src/TombstoneList.cpp | 174 -
src/cppcache/src/TombstoneList.hpp | 113 -
src/cppcache/src/TrackedMapEntry.cpp | 48 -
src/cppcache/src/TrackedMapEntry.hpp | 84 -
src/cppcache/src/TransactionId.cpp | 39 -
src/cppcache/src/TransactionSuspender.cpp | 42 -
src/cppcache/src/TransactionSuspender.hpp | 47 -
src/cppcache/src/TransactionalOperation.cpp | 135 -
src/cppcache/src/TransactionalOperation.hpp | 75 -
src/cppcache/src/TssConnectionWrapper.cpp | 137 -
src/cppcache/src/TssConnectionWrapper.hpp | 80 -
src/cppcache/src/TypeRegistry.cpp | 44 -
src/cppcache/src/UserAttributes.cpp | 155 -
src/cppcache/src/UserAttributes.hpp | 158 -
.../src/UserFunctionExecutionException.cpp | 55 -
src/cppcache/src/Utils.cpp | 230 -
src/cppcache/src/Utils.hpp | 212 -
src/cppcache/src/Version.cpp | 27 -
src/cppcache/src/Version.hpp | 43 -
src/cppcache/src/VersionStamp.cpp | 235 -
src/cppcache/src/VersionStamp.hpp | 92 -
src/cppcache/src/VersionTag.cpp | 106 -
src/cppcache/src/VersionTag.hpp | 95 -
.../src/VersionedCacheableObjectPartList.cpp | 336 -
.../src/VersionedCacheableObjectPartList.hpp | 306 -
src/cppcache/src/apache-geode.rc | 48 -
src/cppcache/src/config.h.in | 37 -
src/cppcache/src/dllmain.cpp | 102 -
src/cppcache/src/geodeBanner.cpp | 26 -
src/cppcache/src/geodeBanner.hpp | 35 -
.../src/statistics/AtomicStatisticsImpl.cpp | 544 --
.../src/statistics/AtomicStatisticsImpl.hpp | 237 -
.../src/statistics/GeodeStatisticsFactory.cpp | 246 -
.../src/statistics/GeodeStatisticsFactory.hpp | 131 -
src/cppcache/src/statistics/HostStatHelper.cpp | 149 -
src/cppcache/src/statistics/HostStatHelper.hpp | 86 -
.../src/statistics/HostStatHelperLinux.cpp | 186 -
.../src/statistics/HostStatHelperLinux.hpp | 55 -
.../src/statistics/HostStatHelperNull.cpp | 18 -
.../src/statistics/HostStatHelperNull.hpp | 40 -
.../src/statistics/HostStatHelperSolaris.cpp | 231 -
.../src/statistics/HostStatHelperSolaris.hpp | 71 -
.../src/statistics/HostStatHelperWin.cpp | 794 ---
.../src/statistics/HostStatHelperWin.hpp | 305 -
src/cppcache/src/statistics/HostStatSampler.cpp | 780 --
src/cppcache/src/statistics/HostStatSampler.hpp | 264 -
.../src/statistics/LinuxProcessStats.cpp | 122 -
.../src/statistics/LinuxProcessStats.hpp | 89 -
.../src/statistics/NullProcessStats.cpp | 42 -
.../src/statistics/NullProcessStats.hpp | 60 -
.../src/statistics/OsStatisticsImpl.cpp | 533 --
.../src/statistics/OsStatisticsImpl.hpp | 263 -
.../src/statistics/PoolStatsSampler.cpp | 140 -
.../src/statistics/PoolStatsSampler.hpp | 73 -
src/cppcache/src/statistics/ProcessStats.cpp | 28 -
src/cppcache/src/statistics/ProcessStats.hpp | 83 -
.../src/statistics/SolarisProcessStats.cpp | 130 -
.../src/statistics/SolarisProcessStats.hpp | 89 -
.../src/statistics/StatArchiveWriter.cpp | 626 --
.../src/statistics/StatArchiveWriter.hpp | 280 -
.../src/statistics/StatSamplerStats.cpp | 92 -
.../src/statistics/StatSamplerStats.hpp | 61 -
.../src/statistics/StatisticDescriptorImpl.cpp | 262 -
.../src/statistics/StatisticDescriptorImpl.hpp | 254 -
src/cppcache/src/statistics/Statistics.cpp | 146 -
.../src/statistics/StatisticsManager.cpp | 235 -
.../src/statistics/StatisticsManager.hpp | 117 -
.../src/statistics/StatisticsTypeImpl.cpp | 186 -
.../src/statistics/StatisticsTypeImpl.hpp | 105 -
src/cppcache/src/statistics/StatsDef.hpp | 57 -
.../src/statistics/WindowsProcessStats.cpp | 232 -
.../src/statistics/WindowsProcessStats.hpp | 94 -
.../src/util/concurrent/spinlock_mutex.hpp | 51 -
src/cppcache/src/version.cmake.in | 56 -
src/cppcache/src/version.h.in | 22 -
src/cppcache/test/AutoDeleteTest.cpp | 55 -
src/cppcache/test/ByteArray.cpp | 126 -
src/cppcache/test/ByteArray.hpp | 66 -
src/cppcache/test/ByteArrayFixture.cpp | 59 -
src/cppcache/test/ByteArrayFixture.hpp | 39 -
src/cppcache/test/ByteArrayTest.cpp | 115 -
src/cppcache/test/CMakeLists.txt | 66 -
src/cppcache/test/CacheXmlParserTest.cpp | 117 -
src/cppcache/test/CacheableKeysTest.cpp | 84 -
.../test/CacheableStringEqualityTest.cpp | 178 -
.../test/ClientProxyMembershipIDFactoryTest.cpp | 45 -
src/cppcache/test/DataInputTest.cpp | 923 ---
src/cppcache/test/DataOutputTest.cpp | 340 -
src/cppcache/test/DiskPolicyTypeTest.cpp | 72 -
src/cppcache/test/ExpirationActionTest.cpp | 148 -
src/cppcache/test/InterestResultPolicyTest.cpp | 34 -
src/cppcache/test/PdxLocalReaderTest.cpp | 111 -
src/cppcache/test/StructSetTest.cpp | 91 -
src/cppcache/test/TcrMessage_unittest.cpp | 707 --
src/cppcache/test/apache-geode_unittests.bat.in | 26 -
src/cppcache/test/apache-geode_unittests.sh.in | 30 -
src/cppcache/test/geodeBannerTest.cpp | 26 -
src/cryptoimpl/CMakeLists.txt | 39 -
src/cryptoimpl/DHImpl.cpp | 729 --
src/cryptoimpl/DHImpl.hpp | 100 -
src/cryptoimpl/SSLImpl.cpp | 131 -
src/cryptoimpl/SSLImpl.hpp | 62 -
src/cryptoimpl/Ssl.hpp | 50 -
src/defaultSystem/geode.properties | 99 -
src/dependencies/ACE/CMakeLists.txt | 214 -
src/dependencies/ACE/config.h.in | 24 -
src/dependencies/ACE/patches | 72 -
src/dependencies/CMakeLists.txt | 105 -
src/dependencies/boost/CMakeLists.txt | 76 -
src/dependencies/doxygen/CMakeLists.txt | 56 -
src/dependencies/gtest/CMakeLists.txt | 72 -
src/dependencies/libxml2/CMakeLists.txt | 84 -
src/dependencies/openssl/CMakeLists.txt | 135 -
src/dependencies/openssl/patches | 13 -
src/dependencies/sqlite-netFx/CMakeLists.txt | 40 -
src/dependencies/sqlite/CMakeLists.txt | 63 -
src/dependencies/sqlite/CMakeLists.txt.in | 155 -
src/dependencies/xerces-c/CMakeLists.txt | 88 -
src/dhimpl/CMakeLists.txt | 26 -
src/dhimpl/DHImpl.cpp | 618 --
src/dhimpl/DHImpl.hpp | 69 -
src/docs/CMakeLists.txt | 33 -
src/docs/DocIndex.css | 1075 ---
src/docs/c-footer.html | 17 -
src/docs/clicache/CMakeLists.txt | 29 -
src/docs/clicache/Doxyfile.in | 109 -
src/docs/clicache/footer.html | 17 -
src/docs/clicache/gemFireDotNETLogo.png | Bin 9747 -> 0 bytes
src/docs/common-Doxyfile | 70 -
src/docs/cppcache/CMakeLists.txt | 29 -
src/docs/cppcache/Doxyfile.in | 106 -
src/docs/cppcache/footer.html | 17 -
src/docs/cppcache/gemFireCPPLogo.png | Bin 8415 -> 0 bytes
src/docs/doclet/package-list | 1 -
src/docs/log4j/package-list | 17 -
src/docs/native_delta_propagation.doc | Bin 51200 -> 0 bytes
src/docs/native_delta_propagation_doc.pdf | Bin 107503 -> 0 bytes
src/docs/unix_index.html | 60 -
src/docs/win_index.html | 66 -
src/executables/GacInstall/AssemblyInfo.cs | 49 -
src/executables/GacInstall/Program.cs | 149 -
src/plugins/SQLiteCLI/AssemblyInfo.cs | 48 -
src/plugins/SQLiteCLI/CMakeLists.txt | 28 -
src/plugins/SQLiteCLI/SQLiteCLI.csproj.in | 130 -
src/plugins/SQLiteCLI/SqLiteImpl.cs | 274 -
src/quickstart/CPPCacheConfig.cmake | 49 -
src/quickstart/NativeClientConfig.cmake | 50 -
src/quickstart/XMLs/clientDelta.xml | 35 -
src/quickstart/XMLs/clientExceptions.xml | 30 -
src/quickstart/XMLs/clientHACache.xml | 27 -
src/quickstart/XMLs/clientInterop.xml | 27 -
src/quickstart/XMLs/clientInteropJava.xml | 28 -
.../XMLs/clientLoaderListenerWriter.xml | 29 -
src/quickstart/XMLs/clientPdxAutoSerializer.xml | 33 -
src/quickstart/XMLs/clientPdxInstance.xml | 33 -
src/quickstart/XMLs/clientPdxRemoteQuery.xml | 33 -
src/quickstart/XMLs/clientPdxSerializer.xml | 33 -
src/quickstart/XMLs/clientPoolCqQuery.xml | 35 -
src/quickstart/XMLs/clientPoolRemoteQuery.xml | 38 -
src/quickstart/XMLs/clientRefIDExample.xml | 43 -
src/quickstart/XMLs/clientRegisterInterest.xml | 32 -
src/quickstart/XMLs/clientSecurity.xml | 33 -
src/quickstart/XMLs/serverBasicOperations.xml | 33 -
src/quickstart/XMLs/serverCqQuery.xml | 177 -
src/quickstart/XMLs/serverDataExpiration.xml | 34 -
src/quickstart/XMLs/serverDelta.xml | 41 -
src/quickstart/XMLs/serverDistributedSystem.xml | 33 -
.../XMLs/serverDistributedSystem2.xml | 33 -
src/quickstart/XMLs/serverDurableClient.xml | 33 -
src/quickstart/XMLs/serverExceptions.xml | 36 -
src/quickstart/XMLs/serverExecuteFunctions.xml | 46 -
src/quickstart/XMLs/serverExecuteFunctions2.xml | 46 -
src/quickstart/XMLs/serverHACache.xml | 37 -
src/quickstart/XMLs/serverHACache2.xml | 37 -
.../XMLs/serverLoaderListenerWriter.xml | 34 -
src/quickstart/XMLs/serverMultiuserSecurity.xml | 38 -
src/quickstart/XMLs/serverPdxAutoSerializer.xml | 33 -
src/quickstart/XMLs/serverPdxInstance.xml | 33 -
src/quickstart/XMLs/serverPdxRemoteQuery.xml | 33 -
src/quickstart/XMLs/serverPdxSerializer.xml | 33 -
src/quickstart/XMLs/serverPoolCqQuery.xml | 178 -
src/quickstart/XMLs/serverPoolRemoteQuery.xml | 180 -
src/quickstart/XMLs/serverPoolWithEndpoints.xml | 33 -
.../XMLs/serverPutAllGetAllOperations.xml | 33 -
src/quickstart/XMLs/serverRefIDExample.xml | 36 -
src/quickstart/XMLs/serverRegisterInterest.xml | 33 -
src/quickstart/XMLs/serverRemoteQuery.xml | 178 -
src/quickstart/XMLs/serverSecurity.xml | 33 -
src/quickstart/XMLs/serverTransactions.xml | 33 -
src/quickstart/XMLs/serverTransactionsXA.xml | 33 -
src/quickstart/cleanup.bat | 24 -
src/quickstart/cleanup.sh | 28 -
src/quickstart/cpp/BasicOperations.cpp | 117 -
src/quickstart/cpp/CMakeLists.txt | 172 -
src/quickstart/cpp/CqQuery.cpp | 179 -
src/quickstart/cpp/DataExpiration.cpp | 128 -
src/quickstart/cpp/Delta.cpp | 109 -
src/quickstart/cpp/DistributedSystem.cpp | 133 -
src/quickstart/cpp/DurableClient.cpp | 156 -
src/quickstart/cpp/Exceptions.cpp | 139 -
src/quickstart/cpp/ExecuteFunctions.cpp | 191 -
src/quickstart/cpp/FindCPPCache.cmake | 50 -
src/quickstart/cpp/HACache.cpp | 120 -
src/quickstart/cpp/LoaderListenerWriter.cpp | 115 -
src/quickstart/cpp/MultiuserSecurity.cpp | 200 -
src/quickstart/cpp/PdxInstance.cpp | 132 -
src/quickstart/cpp/PdxRemoteQuery.cpp | 145 -
src/quickstart/cpp/PdxSerializer.cpp | 249 -
src/quickstart/cpp/PoolCqQuery.cpp | 191 -
src/quickstart/cpp/PoolRemoteQuery.cpp | 146 -
src/quickstart/cpp/PoolWithEndpoints.cpp | 118 -
src/quickstart/cpp/PutAllGetAllOperations.cpp | 96 -
src/quickstart/cpp/RefIDExample.cpp | 126 -
src/quickstart/cpp/RegisterInterest.cpp | 131 -
src/quickstart/cpp/RemoteQuery.cpp | 169 -
src/quickstart/cpp/Security.cpp | 96 -
src/quickstart/cpp/Transactions.cpp | 129 -
src/quickstart/cpp/TransactionsXA.cpp | 141 -
.../cpp/deltaobjects/DeltaExample.hpp | 162 -
.../cpp/plugins/DurableCacheListener.cpp | 33 -
.../cpp/plugins/DurableCacheListener.hpp | 41 -
.../cpp/plugins/SimpleCacheListener.cpp | 46 -
.../cpp/plugins/SimpleCacheListener.hpp | 44 -
.../cpp/plugins/SimpleCacheLoader.cpp | 34 -
.../cpp/plugins/SimpleCacheLoader.hpp | 40 -
.../cpp/plugins/SimpleCacheWriter.cpp | 50 -
.../cpp/plugins/SimpleCacheWriter.hpp | 44 -
src/quickstart/cpp/queryobjects/Portfolio.cpp | 138 -
src/quickstart/cpp/queryobjects/Portfolio.hpp | 130 -
.../cpp/queryobjects/PortfolioPdx.cpp | 192 -
.../cpp/queryobjects/PortfolioPdx.hpp | 107 -
.../cpp/queryobjects/PortfolioPdxAuto.cpp | 140 -
.../cpp/queryobjects/PortfolioPdxAuto.hpp | 111 -
src/quickstart/cpp/queryobjects/Position.cpp | 111 -
src/quickstart/cpp/queryobjects/Position.hpp | 99 -
src/quickstart/cpp/queryobjects/PositionPdx.cpp | 177 -
src/quickstart/cpp/queryobjects/PositionPdx.hpp | 104 -
.../cpp/queryobjects/PositionPdxAuto.cpp | 108 -
.../cpp/queryobjects/PositionPdxAuto.hpp | 105 -
src/quickstart/csharp/BasicOperations.cs | 127 -
src/quickstart/csharp/CMakeLists.txt | 53 -
src/quickstart/csharp/CqQuery.cs | 189 -
src/quickstart/csharp/DataExpiration.cs | 122 -
src/quickstart/csharp/Delta.cs | 110 -
src/quickstart/csharp/DeltaExample.cs | 200 -
src/quickstart/csharp/DistributedSystem.cs | 130 -
src/quickstart/csharp/DurableClient.cs | 151 -
src/quickstart/csharp/Exceptions.cs | 141 -
src/quickstart/csharp/ExecuteFunctions.cs | 165 -
src/quickstart/csharp/HACache.cs | 131 -
src/quickstart/csharp/LoaderListenerWriter.cs | 127 -
src/quickstart/csharp/MultiuserSecurity.cs | 196 -
src/quickstart/csharp/PdxInstance.cs | 137 -
src/quickstart/csharp/PdxRemoteQuery.cs | 142 -
src/quickstart/csharp/PdxSerializer.cs | 250 -
src/quickstart/csharp/PoolCqQuery.cs | 191 -
src/quickstart/csharp/PoolRemoteQuery.cs | 140 -
src/quickstart/csharp/PoolWithEndpoints.cs | 116 -
src/quickstart/csharp/PortfolioN.cs | 306 -
src/quickstart/csharp/PortfolioPdx.cs | 295 -
src/quickstart/csharp/PositionN.cs | 245 -
src/quickstart/csharp/PositionPdx.cs | 212 -
src/quickstart/csharp/PutAllGetAllOperations.cs | 95 -
src/quickstart/csharp/RefIDExample.cs | 120 -
src/quickstart/csharp/RegisterInterest.cs | 120 -
src/quickstart/csharp/RemoteQuery.cs | 159 -
src/quickstart/csharp/Security.cs | 185 -
src/quickstart/csharp/Transactions.cs | 134 -
src/quickstart/csharp/TransactionsXA.cs | 143 -
src/quickstart/csharp/app.config.in | 33 -
.../csharp/plugins/DurableCacheListener.cs | 83 -
.../csharp/plugins/SimpleCacheListener.cs | 83 -
.../csharp/plugins/SimpleCacheLoader.cs | 43 -
.../csharp/plugins/SimpleCacheWriter.cs | 67 -
.../BasicOperations/BasicOperations.csproj.in | 117 -
.../BasicOperations/Properties/AssemblyInfo.cs | 48 -
.../csharp/vsprojects/CqQuery/CqQuery.csproj.in | 122 -
.../CqQuery/Properties/AssemblyInfo.cs | 48 -
.../DataExpiration/DataExpiration.csproj.in | 119 -
.../DataExpiration/Properties/AssemblyInfo.cs | 48 -
.../csharp/vsprojects/Delta/Delta.csproj.in | 119 -
.../vsprojects/Delta/Properties/AssemblyInfo.cs | 48 -
.../DistributedSystem.csproj.in | 116 -
.../Properties/AssemblyInfo.cs | 48 -
.../DurableClient/DurableClient.csproj.in | 119 -
.../DurableClient/Properties/AssemblyInfo.cs | 48 -
.../vsprojects/Exceptions/Exceptions.csproj.in | 118 -
.../Exceptions/Properties/AssemblyInfo.cs | 48 -
.../ExecuteFunctions/ExecuteFunctions.csproj.in | 116 -
.../ExecuteFunctions/Properties/AssemblyInfo.cs | 48 -
.../csharp/vsprojects/HACache/HACache.csproj.in | 118 -
.../HACache/Properties/AssemblyInfo.cs | 48 -
.../LoaderListenerWriter.csproj.in | 125 -
.../Properties/AssemblyInfo.cs | 48 -
.../MultiuserSecurity.csproj.in | 117 -
.../Properties/AssemblyInfo.cs | 48 -
.../PdxInstance/PdxInstance.csproj.in | 116 -
.../PdxInstance/Properties/AssemblyInfo.cs | 48 -
.../PdxRemoteQuery/PdxRemoteQuery.csproj.in | 122 -
.../PdxRemoteQuery/Properties/AssemblyInfo.cs | 48 -
.../PdxSerializer/PdxSerializer.csproj.in | 116 -
.../PdxSerializer/Properties/AssemblyInfo.cs | 48 -
.../PoolCqQuery/PoolCqQuery.csproj.in | 122 -
.../PoolCqQuery/Properties/AssemblyInfo.cs | 48 -
.../PoolRemoteQuery/PoolRemoteQuery.csproj.in | 122 -
.../PoolRemoteQuery/Properties/AssemblyInfo.cs | 48 -
.../PoolWithEndpoints.csproj.in | 116 -
.../Properties/AssemblyInfo.cs | 48 -
.../Properties/AssemblyInfo.cs | 48 -
.../PutAllGetAllOperations.csproj.in | 117 -
.../RefIDExample/Properties/AssemblyInfo.cs | 48 -
.../RefIDExample/RefIDExample.csproj.in | 112 -
.../RegisterInterest/Properties/AssemblyInfo.cs | 48 -
.../RegisterInterest/RegisterInterest.csproj.in | 116 -
.../RemoteQuery/Properties/AssemblyInfo.cs | 48 -
.../RemoteQuery/RemoteQuery.csproj.in | 122 -
.../Security/Properties/AssemblyInfo.cs | 48 -
.../vsprojects/Security/Security.csproj.in | 117 -
.../SimplePlugins/Properties/AssemblyInfo.cs | 48 -
.../SimplePlugins/SimplePlugins.csproj.in | 119 -
.../Transactions/Properties/AssemblyInfo.cs | 48 -
.../Transactions/Transactions.csproj.in | 116 -
.../TransactionsXA/Properties/AssemblyInfo.cs | 48 -
.../TransactionsXA/TransactionsXA.csproj.in | 116 -
src/quickstart/overview.gif | Bin 10167 -> 0 bytes
src/quickstart/runcpp.bat.in | 292 -
src/quickstart/runcpp.sh.in | 310 -
src/quickstart/runcs.bat.in | 280 -
src/sqliteimpl/CMakeLists.txt | 26 -
src/sqliteimpl/SqLiteHelper.cpp | 192 -
src/sqliteimpl/SqLiteHelper.hpp | 62 -
src/sqliteimpl/SqLiteImpl.cpp | 207 -
src/sqliteimpl/SqLiteImpl.hpp | 144 -
src/templates/CMakeLists.txt | 17 -
src/templates/security/CMakeLists.txt | 26 -
.../security/CMakeLists.txt.forInstall | 46 -
src/templates/security/PkcsAuthInit.cpp | 183 -
src/templates/security/PkcsAuthInit.hpp | 105 -
src/templates/security/UserPasswordAuthInit.cpp | 61 -
src/templates/security/UserPasswordAuthInit.hpp | 85 -
src/templates/security/authz-dummy.xml | 90 -
src/templates/security/authz-ldap.xml | 87 -
src/templates/security/authz-pkcs.xml | 87 -
src/templates/security/authz5_5.dtd | 106 -
src/templates/security/csharp/AssemblyInfo.cs | 48 -
src/templates/security/csharp/CMakeLists.txt | 18 -
.../security/csharp/UserPasswordAuthInit.cs | 100 -
.../security/csharp/securityImpl.csproj.in | 83 -
src/tests/CMakeLists.txt | 23 -
src/tests/cli/.clang-format | 5 -
src/tests/cli/CMakeLists.txt | 54 -
src/tests/cli/DUnitFramework/AssemblyInfo.cs | 49 -
src/tests/cli/DUnitFramework/ClientBase.cs | 394 --
src/tests/cli/DUnitFramework/ClientGroup.cs | 548 --
.../cli/DUnitFramework/DUnitFramework.csproj.in | 165 -
src/tests/cli/DUnitFramework/DUnitTestClass.cs | 285 -
src/tests/cli/DUnitFramework/Exceptions.cs | 276 -
.../cli/DUnitFramework/IClientServerComm.cs | 269 -
src/tests/cli/DUnitFramework/Log.cs | 178 -
.../cli/DUnitFramework/ServerCommunication.cs | 202 -
.../cli/DUnitFramework/ServerConnection.cs | 40 -
src/tests/cli/DUnitFramework/TimeBomb.cs | 237 -
src/tests/cli/DUnitFramework/UnitProcess.cs | 1082 ---
src/tests/cli/DUnitFramework/UnitThread.cs | 273 -
src/tests/cli/DUnitFramework/Util.cs | 1776 -----
.../cli/DUnitFramework/XmlNodeReaderWriter.cs | 650 --
src/tests/cli/FwkClient/App.config | 23 -
src/tests/cli/FwkClient/AssemblyInfo.cs | 49 -
src/tests/cli/FwkClient/ClientComm.cs | 334 -
src/tests/cli/FwkClient/ClientProcess.cs | 264 -
src/tests/cli/FwkClient/FwkClient.csproj.in | 132 -
src/tests/cli/FwkLauncher/AssemblyInfo.cs | 49 -
src/tests/cli/FwkLauncher/FwkLauncher.csproj.in | 132 -
src/tests/cli/FwkLauncher/LauncherComm.cs | 156 -
src/tests/cli/FwkLauncher/LauncherProcess.cs | 202 -
src/tests/cli/FwkUtil/FwkClient.cs | 290 -
src/tests/cli/FwkUtil/FwkData.cs | 760 --
src/tests/cli/FwkUtil/FwkUtil.csproj.in | 141 -
src/tests/cli/NewFwkLib/AssemblyInfo.cs | 49 -
src/tests/cli/NewFwkLib/CacheHelper.cs | 497 --
src/tests/cli/NewFwkLib/CacheServer.cs | 4944 -------------
.../DeltaTest/DeltaClientValidationListener.cs | 190 -
src/tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs | 748 --
.../NewFwkLib/DurableTest/DurableClientTests.cs | 389 -
.../NewFwkLib/DurableTest/DurableListener.cs | 256 -
.../DurableTest/DurablePerfListener.cs | 135 -
.../cli/NewFwkLib/EventTest/ETCacheListener.cs | 83 -
.../cli/NewFwkLib/EventTest/ETCacheLoader.cs | 49 -
.../cli/NewFwkLib/EventTest/ETCacheWriter.cs | 69 -
src/tests/cli/NewFwkLib/EventTest/EventTests.cs | 1774 -----
.../FunctionExecution/FunctionExecution.cs | 1375 ----
.../FunctionExecution/MyResultCollector.cs | 176 -
src/tests/cli/NewFwkLib/FwkTask.cs | 532 --
src/tests/cli/NewFwkLib/FwkTest.cs | 1515 ----
src/tests/cli/NewFwkLib/NewFwkLib.csproj.in | 276 -
src/tests/cli/NewFwkLib/PdxTest/PdxTests.cs | 3653 ----------
src/tests/cli/NewFwkLib/PerfTest/DupChecker.cs | 132 -
.../cli/NewFwkLib/PerfTest/LatencyListener.cs | 134 -
src/tests/cli/NewFwkLib/PerfTest/PerfTasks.cs | 338 -
.../NewFwkLib/PerfTest/PerfTestCacheListener.cs | 216 -
src/tests/cli/NewFwkLib/PerfTest/PerfTests.cs | 1483 ----
src/tests/cli/NewFwkLib/QueryTest/QueryTests.cs | 1941 -----
.../cli/NewFwkLib/ResumableTx/ResumableTx.cs | 1241 ----
src/tests/cli/NewFwkLib/ResumableTx/TxInfo.cs | 168 -
.../cli/NewFwkLib/SecurityTest/Security.cs | 518 --
src/tests/cli/NewFwkLib/Utils.cs | 1457 ----
src/tests/cli/NewTestObject/ArrayOfByte.cs | 161 -
src/tests/cli/NewTestObject/BatchObject.cs | 101 -
src/tests/cli/NewTestObject/DeltaEx.cs | 113 -
.../cli/NewTestObject/DeltaFastAssetAccount.cs | 199 -
src/tests/cli/NewTestObject/DeltaPSTObject.cs | 121 -
src/tests/cli/NewTestObject/DeltaTestImpl.cs | 283 -
src/tests/cli/NewTestObject/EqStruct.cs | 293 -
src/tests/cli/NewTestObject/FastAsset.cs | 117 -
src/tests/cli/NewTestObject/FastAssetAccount.cs | 157 -
src/tests/cli/NewTestObject/NoopAuthInit.cs | 41 -
src/tests/cli/NewTestObject/PSTObject.cs | 102 -
.../cli/NewTestObject/PdxAutoSerializerObj.cs | 530 --
src/tests/cli/NewTestObject/Portfolio.cs | 309 -
src/tests/cli/NewTestObject/PortfolioPdx.cs | 298 -
src/tests/cli/NewTestObject/Position.cs | 245 -
src/tests/cli/NewTestObject/PositionPdx.cs | 240 -
.../cli/NewTestObject/SimpleCacheListener.cs | 91 -
src/tests/cli/NewTestObject/TestObject1.cs | 74 -
src/tests/cli/NewTestObject/TimeStampdObject.cs | 56 -
.../PdxClassLibrary/PdxClassLibrary.csproj.in | 141 -
src/tests/cli/PdxClassLibrary/PdxType.cs | 1125 ---
.../PdxClassLibrary/PdxTypesReflectionTest.cs | 728 --
src/tests/cli/PdxClassLibrary/Person.cs | 27 -
src/tests/cli/PdxClassLibrary/PortfolioPdx.cs | 295 -
src/tests/cli/PdxClassLibrary/PositionPdx.cs | 212 -
.../PdxClassLibrary/Properties/AssemblyInfo.cs | 50 -
.../cli/PdxClassLibrary/VariousPdxTypes.cs | 1629 -----
.../cli/PdxVersion1Lib/PdxVersion1Lib.csproj.in | 130 -
.../PdxVersion1Lib/Properties/AssemblyInfo.cs | 50 -
src/tests/cli/PdxVersion1Lib/Version1.cs | 2039 ------
.../cli/PdxVersion2Lib/PdxVersion2Lib.csproj.in | 127 -
.../PdxVersion2Lib/Properties/AssemblyInfo.cs | 50 -
src/tests/cli/PdxVersion2Lib/Version2.cs | 2121 ------
src/tests/cli/PkcsWrapper/CMakeLists.txt | 42 -
src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp | 57 -
src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp | 66 -
src/tests/cli/QueryHelper/AssemblyInfo.cpp | 54 -
src/tests/cli/QueryHelper/CMakeLists.txt | 50 -
src/tests/cli/QueryHelper/QueryHelperN.cs | 521 --
src/tests/cli/QueryHelper/QueryStringsM.cpp | 295 -
src/tests/cli/QueryHelper/QueryStringsM.hpp | 202 -
.../SecurityUtil/AuthzCredentialGeneratorN.cs | 469 --
.../cli/SecurityUtil/CredentialGeneratorN.cs | 258 -
.../cli/SecurityUtil/DummyAuthorization3N.cs | 79 -
.../SecurityUtil/LdapCredentialGeneratorN.cs | 127 -
.../SecurityUtil/PKCSCredentialGeneratorN.cs | 156 -
.../cli/SecurityUtil/SecurityUtil.csproj.in | 146 -
.../XmlAuthzCredentialGeneratorN.cs | 308 -
src/tests/cpp/CMakeLists.txt | 21 -
src/tests/cpp/fwk/CMakeLists.txt | 32 -
src/tests/cpp/fwk/UdpIpc.cpp | 271 -
src/tests/cpp/fwk/UdpIpc.hpp | 93 -
src/tests/cpp/fwklib/CMakeLists.txt | 35 -
src/tests/cpp/fwklib/ClientTask.hpp | 163 -
src/tests/cpp/fwklib/FrameworkTest.cpp | 547 --
src/tests/cpp/fwklib/FrameworkTest.hpp | 271 -
src/tests/cpp/fwklib/FwkBB.hpp | 235 -
src/tests/cpp/fwklib/FwkBBClient.cpp | 293 -
src/tests/cpp/fwklib/FwkBBClient.hpp | 192 -
src/tests/cpp/fwklib/FwkBBServer.cpp | 521 --
src/tests/cpp/fwklib/FwkBBServer.hpp | 227 -
src/tests/cpp/fwklib/FwkException.hpp | 71 -
src/tests/cpp/fwklib/FwkExport.hpp | 38 -
src/tests/cpp/fwklib/FwkLog.cpp | 87 -
src/tests/cpp/fwklib/FwkLog.hpp | 128 -
src/tests/cpp/fwklib/FwkObjects.cpp | 1033 ---
src/tests/cpp/fwklib/FwkObjects.hpp | 1626 -----
src/tests/cpp/fwklib/FwkStrCvt.cpp | 170 -
src/tests/cpp/fwklib/FwkStrCvt.hpp | 353 -
src/tests/cpp/fwklib/GsRandom.cpp | 85 -
src/tests/cpp/fwklib/GsRandom.hpp | 217 -
src/tests/cpp/fwklib/IpcHandler.cpp | 269 -
src/tests/cpp/fwklib/IpcHandler.hpp | 91 -
src/tests/cpp/fwklib/PaceMeter.hpp | 134 -
src/tests/cpp/fwklib/PerfFwk.cpp | 202 -
src/tests/cpp/fwklib/PerfFwk.hpp | 337 -
src/tests/cpp/fwklib/PoolHelper.hpp | 152 -
src/tests/cpp/fwklib/QueryHelper.hpp | 1097 ---
src/tests/cpp/fwklib/RegionHelper.hpp | 263 -
src/tests/cpp/fwklib/Service.cpp | 66 -
src/tests/cpp/fwklib/Service.hpp | 165 -
src/tests/cpp/fwklib/TaskClient.cpp | 115 -
src/tests/cpp/fwklib/TaskClient.hpp | 187 -
src/tests/cpp/fwklib/TcpIpc.cpp | 216 -
src/tests/cpp/fwklib/TcpIpc.hpp | 79 -
src/tests/cpp/fwklib/TestClient.cpp | 262 -
src/tests/cpp/fwklib/TestClient.hpp | 123 -
src/tests/cpp/fwklib/TimeBomb.cpp | 127 -
src/tests/cpp/fwklib/TimeBomb.hpp | 87 -
src/tests/cpp/fwklib/TimeLimit.hpp | 54 -
src/tests/cpp/fwklib/TimeSync.cpp | 253 -
src/tests/cpp/fwklib/TimeSync.hpp | 96 -
src/tests/cpp/fwklib/Timer.hpp | 180 -
src/tests/cpp/fwklib/UDPIpc.cpp | 368 -
src/tests/cpp/fwklib/UDPIpc.hpp | 298 -
src/tests/cpp/fwklib/testframeworkdox.txt | 25 -
src/tests/cpp/security/CMakeLists.txt | 35 -
src/tests/cpp/security/CredentialGenerator.cpp | 49 -
src/tests/cpp/security/CredentialGenerator.hpp | 276 -
.../cpp/security/DummyCredentialGenerator.hpp | 108 -
.../cpp/security/DummyCredentialGenerator2.hpp | 107 -
.../cpp/security/DummyCredentialGenerator3.hpp | 107 -
.../security/LdapUserCredentialGenerator.hpp | 120 -
.../cpp/security/NoopCredentialGenerator.hpp | 66 -
src/tests/cpp/security/PkcsAuthInit.cpp | 211 -
src/tests/cpp/security/PkcsAuthInit.hpp | 110 -
.../cpp/security/PkcsCredentialGenerator.hpp | 148 -
src/tests/cpp/security/Security.cpp | 1085 ---
src/tests/cpp/security/Security.hpp | 124 -
.../security/XmlAuthzCredentialGenerator.hpp | 317 -
src/tests/cpp/security/typedefs.hpp | 135 -
src/tests/cpp/testobject/ArrayOfByte.hpp | 134 -
src/tests/cpp/testobject/BatchObject.cpp | 56 -
src/tests/cpp/testobject/BatchObject.hpp | 94 -
src/tests/cpp/testobject/CMakeLists.txt | 44 -
.../cpp/testobject/DeltaFastAssetAccount.cpp | 82 -
.../cpp/testobject/DeltaFastAssetAccount.hpp | 153 -
src/tests/cpp/testobject/DeltaPSTObject.cpp | 71 -
src/tests/cpp/testobject/DeltaPSTObject.hpp | 102 -
src/tests/cpp/testobject/DeltaTestImpl.cpp | 144 -
src/tests/cpp/testobject/DeltaTestImpl.hpp | 125 -
src/tests/cpp/testobject/DeltaTestObj.hpp | 101 -
src/tests/cpp/testobject/EqStruct.cpp | 208 -
src/tests/cpp/testobject/EqStruct.hpp | 155 -
src/tests/cpp/testobject/FastAsset.cpp | 39 -
src/tests/cpp/testobject/FastAsset.hpp | 119 -
src/tests/cpp/testobject/FastAssetAccount.cpp | 73 -
src/tests/cpp/testobject/FastAssetAccount.hpp | 126 -
src/tests/cpp/testobject/InvalidPdxUsage.cpp | 875 ---
src/tests/cpp/testobject/InvalidPdxUsage.hpp | 693 --
src/tests/cpp/testobject/NestedPdxObject.cpp | 200 -
src/tests/cpp/testobject/NestedPdxObject.hpp | 344 -
src/tests/cpp/testobject/NonPdxType.cpp | 147 -
src/tests/cpp/testobject/NonPdxType.hpp | 496 --
src/tests/cpp/testobject/NoopAuthInit.cpp | 42 -
src/tests/cpp/testobject/NoopAuthInit.hpp | 89 -
src/tests/cpp/testobject/PSTObject.cpp | 63 -
src/tests/cpp/testobject/PSTObject.hpp | 93 -
src/tests/cpp/testobject/PdxClassV1.cpp | 755 --
src/tests/cpp/testobject/PdxClassV1.hpp | 537 --
src/tests/cpp/testobject/PdxClassV2.cpp | 810 ---
src/tests/cpp/testobject/PdxClassV2.hpp | 578 --
src/tests/cpp/testobject/PdxType.cpp | 363 -
src/tests/cpp/testobject/PdxType.hpp | 803 ---
src/tests/cpp/testobject/PdxVersioned1.cpp | 438 --
src/tests/cpp/testobject/PdxVersioned1.hpp | 260 -
src/tests/cpp/testobject/PdxVersioned2.cpp | 446 --
src/tests/cpp/testobject/PdxVersioned2.hpp | 263 -
src/tests/cpp/testobject/Portfolio.cpp | 137 -
src/tests/cpp/testobject/Portfolio.hpp | 134 -
src/tests/cpp/testobject/PortfolioPdx.cpp | 195 -
src/tests/cpp/testobject/PortfolioPdx.hpp | 111 -
src/tests/cpp/testobject/Position.cpp | 129 -
src/tests/cpp/testobject/Position.hpp | 111 -
src/tests/cpp/testobject/PositionPdx.cpp | 172 -
src/tests/cpp/testobject/PositionPdx.hpp | 107 -
src/tests/cpp/testobject/TestObject1.cpp | 67 -
src/tests/cpp/testobject/TestObject1.hpp | 71 -
src/tests/cpp/testobject/TimestampedObject.hpp | 56 -
src/tests/cpp/testobject/VariousPdxTypes.cpp | 932 ---
src/tests/cpp/testobject/VariousPdxTypes.hpp | 542 --
src/tests/javaobject/BankAccount.java | 104 -
src/tests/javaobject/BatchObject.java | 125 -
.../BridgeClientMembershipListener.java | 70 -
src/tests/javaobject/BridgeEventListener.java | 69 -
src/tests/javaobject/CMakeLists.txt | 27 -
.../javaobject/CacheListenerForConflation.java | 74 -
.../javaobject/CacheListenerForQueryIndex.java | 117 -
.../javaobject/CacheLoaderForSingleHop.java | 103 -
.../javaobject/CacheWriterForSingleHop.java | 170 -
src/tests/javaobject/ComparePdxTypes.java | 229 -
.../CustomFixedPartitionResolver1.java | 83 -
.../CustomFixedPartitionResolver2.java | 77 -
.../CustomFixedPartitionResolver3.java | 71 -
.../javaobject/CustomPartitionResolver.java | 42 -
src/tests/javaobject/DefaultCacheable.java | 236 -
src/tests/javaobject/DeltaEx.java | 80 -
src/tests/javaobject/DeltaExample.java | 135 -
src/tests/javaobject/DeltaFastAssetAccount.java | 250 -
src/tests/javaobject/DeltaPSTObject.java | 130 -
src/tests/javaobject/DeltaTest.java | 75 -
src/tests/javaobject/DeltaTestImpl.java | 415 --
src/tests/javaobject/DummyAuthenticator.java | 86 -
src/tests/javaobject/DummyAuthorization.java | 154 -
src/tests/javaobject/DummyAuthorization2.java | 125 -
src/tests/javaobject/DummyAuthorization3.java | 143 -
src/tests/javaobject/EqStruct.java | 298 -
src/tests/javaobject/ExampleFunction.java | 239 -
src/tests/javaobject/ExampleObject.java | 161 -
.../javaobject/ExceptionHandlingFunction.java | 63 -
src/tests/javaobject/FEOnRegionPrSHOP.java | 48 -
.../FEOnRegionPrSHOP_OptimizeForWrite.java | 82 -
src/tests/javaobject/FastAsset.java | 125 -
src/tests/javaobject/FastAssetAccount.java | 201 -
src/tests/javaobject/FireNForget.java | 68 -
.../javaobject/FunctionExecutionTimeOut.java | 81 -
src/tests/javaobject/GetFunctionExeHA.java | 63 -
src/tests/javaobject/GetKeyFunction.java | 74 -
src/tests/javaobject/InstantiatorTest.java | 236 -
src/tests/javaobject/IterateRegion.java | 57 -
src/tests/javaobject/LatestProp.java | 46 -
src/tests/javaobject/ModPartitionResolver.java | 43 -
src/tests/javaobject/ModRoutingObject.java | 99 -
src/tests/javaobject/MultiGetFunction.java | 61 -
src/tests/javaobject/MultiGetFunction2.java | 65 -
src/tests/javaobject/MultiGetFunctionI.java | 73 -
src/tests/javaobject/MultiPutFunction.java | 64 -
src/tests/javaobject/MultiPutFunctionI.java | 77 -
src/tests/javaobject/NoopAccessor.java | 43 -
src/tests/javaobject/NoopAuthenticator.java | 44 -
src/tests/javaobject/NoopPrincipal.java | 30 -
.../javaobject/OnServerHAExceptionFunction.java | 102 -
.../javaobject/OnServerHAShutdownFunction.java | 102 -
src/tests/javaobject/PSTObject.java | 164 -
src/tests/javaobject/PdxCacheListener.java | 96 -
src/tests/javaobject/PdxDelta.java | 86 -
src/tests/javaobject/PdxFunctionTest.java | 71 -
src/tests/javaobject/PdxTests/Address.java | 74 -
src/tests/javaobject/PdxTests/PdxDeltaEx.java | 82 -
.../javaobject/PdxTests/PdxTestsWithAuto.java | 558 --
src/tests/javaobject/PdxTests/PdxType.java | 555 --
src/tests/javaobject/PdxTests/PdxTypes1.java | 91 -
src/tests/javaobject/PdxTests/PdxTypes10.java | 85 -
src/tests/javaobject/PdxTests/PdxTypes2.java | 83 -
src/tests/javaobject/PdxTests/PdxTypes3.java | 84 -
src/tests/javaobject/PdxTests/PdxTypes4.java | 86 -
src/tests/javaobject/PdxTests/PdxTypes5.java | 89 -
src/tests/javaobject/PdxTests/PdxTypes6.java | 90 -
src/tests/javaobject/PdxTests/PdxTypes7.java | 94 -
src/tests/javaobject/PdxTests/PdxTypes8.java | 98 -
src/tests/javaobject/PdxTests/PdxTypes9.java | 85 -
src/tests/javaobject/PdxTests/PdxVersioned.java | 503 --
src/tests/javaobject/PdxTests/pdxEnumTest.java | 19 -
.../javaobject/PdxinstanceHashcodeListener.java | 93 -
src/tests/javaobject/Portfolio.java | 284 -
src/tests/javaobject/Position.java | 218 -
src/tests/javaobject/PutAllTimeout.java | 108 -
src/tests/javaobject/PutKeyFunction.java | 79 -
.../javaobject/RegionOperationsFunction.java | 263 -
.../RegionOperationsFunctionOptimized.java | 221 -
.../RegionOperationsFunctionOptimizedFalse.java | 217 -
.../javaobject/RegionOperationsFunctionPdx.java | 331 -
.../javaobject/RegionOperationsHAFunction.java | 118 -
.../RegionOperationsHAFunctionPrSHOP.java | 120 -
.../RegionOperationsWithOutResultFunction.java | 238 -
.../javaobject/ServerOperationsFunction.java | 133 -
.../ServerOperationsWithOutResultFunction.java | 130 -
src/tests/javaobject/SimpleCacheListener.java | 132 -
.../javaobject/SimpleCacheListenerWithAuto.java | 95 -
src/tests/javaobject/SingleStrGetFunction.java | 80 -
src/tests/javaobject/TestObject1.java | 77 -
.../ThinClientRegionExceptionTest.java | 50 -
src/tests/javaobject/TradeKey.java | 110 -
src/tests/javaobject/TradeKeyResolver.java | 44 -
src/tests/javaobject/TradeOrder.java | 215 -
src/tests/javaobject/User.java | 98 -
src/tests/javaobject/UserPasswordAuthInit.java | 83 -
src/tests/javaobject/UsernamePrincipal.java | 45 -
.../executeFunction_SendException.java | 76 -
src/tests/javaobject/newapi/Portfolio.java | 284 -
src/tests/javaobject/newapi/Position.java | 218 -
src/xsds/gfcpp-cache-9.0.xsd | 238 -
templates/CMakeLists.txt | 17 +
templates/security/CMakeLists.txt | 26 +
templates/security/CMakeLists.txt.forInstall | 46 +
templates/security/PkcsAuthInit.cpp | 183 +
templates/security/PkcsAuthInit.hpp | 105 +
templates/security/UserPasswordAuthInit.cpp | 61 +
templates/security/UserPasswordAuthInit.hpp | 85 +
templates/security/authz-dummy.xml | 90 +
templates/security/authz-ldap.xml | 87 +
templates/security/authz-pkcs.xml | 87 +
templates/security/authz5_5.dtd | 106 +
templates/security/csharp/AssemblyInfo.cs | 48 +
templates/security/csharp/CMakeLists.txt | 18 +
.../security/csharp/UserPasswordAuthInit.cs | 100 +
.../security/csharp/securityImpl.csproj.in | 83 +
tests/CMakeLists.txt | 23 +
tests/cli/.clang-format | 5 +
tests/cli/CMakeLists.txt | 54 +
tests/cli/DUnitFramework/AssemblyInfo.cs | 49 +
tests/cli/DUnitFramework/ClientBase.cs | 394 ++
tests/cli/DUnitFramework/ClientGroup.cs | 548 ++
.../cli/DUnitFramework/DUnitFramework.csproj.in | 165 +
tests/cli/DUnitFramework/DUnitTestClass.cs | 285 +
tests/cli/DUnitFramework/Exceptions.cs | 276 +
tests/cli/DUnitFramework/IClientServerComm.cs | 269 +
tests/cli/DUnitFramework/Log.cs | 178 +
tests/cli/DUnitFramework/ServerCommunication.cs | 202 +
tests/cli/DUnitFramework/ServerConnection.cs | 40 +
tests/cli/DUnitFramework/TimeBomb.cs | 237 +
tests/cli/DUnitFramework/UnitProcess.cs | 1082 +++
tests/cli/DUnitFramework/UnitThread.cs | 273 +
tests/cli/DUnitFramework/Util.cs | 1776 +++++
tests/cli/DUnitFramework/XmlNodeReaderWriter.cs | 650 ++
tests/cli/FwkClient/App.config | 23 +
tests/cli/FwkClient/AssemblyInfo.cs | 49 +
tests/cli/FwkClient/ClientComm.cs | 334 +
tests/cli/FwkClient/ClientProcess.cs | 264 +
tests/cli/FwkClient/FwkClient.csproj.in | 132 +
tests/cli/FwkLauncher/AssemblyInfo.cs | 49 +
tests/cli/FwkLauncher/FwkLauncher.csproj.in | 132 +
tests/cli/FwkLauncher/LauncherComm.cs | 156 +
tests/cli/FwkLauncher/LauncherProcess.cs | 202 +
tests/cli/FwkUtil/FwkClient.cs | 290 +
tests/cli/FwkUtil/FwkData.cs | 760 ++
tests/cli/FwkUtil/FwkUtil.csproj.in | 141 +
tests/cli/NewFwkLib/AssemblyInfo.cs | 49 +
tests/cli/NewFwkLib/CacheHelper.cs | 497 ++
tests/cli/NewFwkLib/CacheServer.cs | 4944 +++++++++++++
.../DeltaTest/DeltaClientValidationListener.cs | 190 +
tests/cli/NewFwkLib/DeltaTest/DeltaTest.cs | 748 ++
.../NewFwkLib/DurableTest/DurableClientTests.cs | 389 +
.../NewFwkLib/DurableTest/DurableListener.cs | 256 +
.../DurableTest/DurablePerfListener.cs | 135 +
.../cli/NewFwkLib/EventTest/ETCacheListener.cs | 83 +
tests/cli/NewFwkLib/EventTest/ETCacheLoader.cs | 49 +
tests/cli/NewFwkLib/EventTest/ETCacheWriter.cs | 69 +
tests/cli/NewFwkLib/EventTest/EventTests.cs | 1774 +++++
.../FunctionExecution/FunctionExecution.cs | 1375 ++++
.../FunctionExecution/MyResultCollector.cs | 176 +
tests/cli/NewFwkLib/FwkTask.cs | 532 ++
tests/cli/NewFwkLib/FwkTest.cs | 1515 ++++
tests/cli/NewFwkLib/NewFwkLib.csproj.in | 276 +
tests/cli/NewFwkLib/PdxTest/PdxTests.cs | 3653 ++++++++++
tests/cli/NewFwkLib/PerfTest/DupChecker.cs | 132 +
tests/cli/NewFwkLib/PerfTest/LatencyListener.cs | 134 +
tests/cli/NewFwkLib/PerfTest/PerfTasks.cs | 338 +
.../NewFwkLib/PerfTest/PerfTestCacheListener.cs | 216 +
tests/cli/NewFwkLib/PerfTest/PerfTests.cs | 1483 ++++
tests/cli/NewFwkLib/QueryTest/QueryTests.cs | 1941 +++++
tests/cli/NewFwkLib/ResumableTx/ResumableTx.cs | 1241 ++++
tests/cli/NewFwkLib/ResumableTx/TxInfo.cs | 168 +
tests/cli/NewFwkLib/SecurityTest/Security.cs | 518 ++
tests/cli/NewFwkLib/Utils.cs | 1457 ++++
tests/cli/NewTestObject/ArrayOfByte.cs | 161 +
tests/cli/NewTestObject/BatchObject.cs | 101 +
tests/cli/NewTestObject/DeltaEx.cs | 113 +
.../cli/NewTestObject/DeltaFastAssetAccount.cs | 199 +
tests/cli/NewTestObject/DeltaPSTObject.cs | 121 +
tests/cli/NewTestObject/DeltaTestImpl.cs | 283 +
tests/cli/NewTestObject/EqStruct.cs | 293 +
tests/cli/NewTestObject/FastAsset.cs | 117 +
tests/cli/NewTestObject/FastAssetAccount.cs | 157 +
tests/cli/NewTestObject/NoopAuthInit.cs | 41 +
tests/cli/NewTestObject/PSTObject.cs | 102 +
tests/cli/NewTestObject/PdxAutoSerializerObj.cs | 530 ++
tests/cli/NewTestObject/Portfolio.cs | 309 +
tests/cli/NewTestObject/PortfolioPdx.cs | 298 +
tests/cli/NewTestObject/Position.cs | 245 +
tests/cli/NewTestObject/PositionPdx.cs | 240 +
tests/cli/NewTestObject/SimpleCacheListener.cs | 91 +
tests/cli/NewTestObject/TestObject1.cs | 74 +
tests/cli/NewTestObject/TimeStampdObject.cs | 56 +
.../PdxClassLibrary/PdxClassLibrary.csproj.in | 141 +
tests/cli/PdxClassLibrary/PdxType.cs | 1125 +++
.../PdxClassLibrary/PdxTypesReflectionTest.cs | 728 ++
tests/cli/PdxClassLibrary/Person.cs | 27 +
tests/cli/PdxClassLibrary/PortfolioPdx.cs | 295 +
tests/cli/PdxClassLibrary/PositionPdx.cs | 212 +
.../PdxClassLibrary/Properties/AssemblyInfo.cs | 50 +
tests/cli/PdxClassLibrary/VariousPdxTypes.cs | 1629 +++++
.../cli/PdxVersion1Lib/PdxVersion1Lib.csproj.in | 130 +
.../PdxVersion1Lib/Properties/AssemblyInfo.cs | 50 +
tests/cli/PdxVersion1Lib/Version1.cs | 2039 ++++++
.../cli/PdxVersion2Lib/PdxVersion2Lib.csproj.in | 127 +
.../PdxVersion2Lib/Properties/AssemblyInfo.cs | 50 +
tests/cli/PdxVersion2Lib/Version2.cs | 2121 ++++++
tests/cli/PkcsWrapper/CMakeLists.txt | 42 +
tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp | 57 +
tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp | 66 +
tests/cli/QueryHelper/AssemblyInfo.cpp | 54 +
tests/cli/QueryHelper/CMakeLists.txt | 50 +
tests/cli/QueryHelper/QueryHelperN.cs | 521 ++
tests/cli/QueryHelper/QueryStringsM.cpp | 295 +
tests/cli/QueryHelper/QueryStringsM.hpp | 202 +
.../SecurityUtil/AuthzCredentialGeneratorN.cs | 469 ++
tests/cli/SecurityUtil/CredentialGeneratorN.cs | 258 +
tests/cli/SecurityUtil/DummyAuthorization3N.cs | 79 +
.../SecurityUtil/LdapCredentialGeneratorN.cs | 127 +
.../SecurityUtil/PKCSCredentialGeneratorN.cs | 156 +
tests/cli/SecurityUtil/SecurityUtil.csproj.in | 146 +
.../XmlAuthzCredentialGeneratorN.cs | 308 +
tests/cpp/CMakeLists.txt | 21 +
tests/cpp/fwk/CMakeLists.txt | 32 +
tests/cpp/fwk/UdpIpc.cpp | 271 +
tests/cpp/fwk/UdpIpc.hpp | 93 +
tests/cpp/fwklib/CMakeLists.txt | 35 +
tests/cpp/fwklib/ClientTask.hpp | 163 +
tests/cpp/fwklib/FrameworkTest.cpp | 547 ++
tests/cpp/fwklib/FrameworkTest.hpp | 271 +
tests/cpp/fwklib/FwkBB.hpp | 235 +
tests/cpp/fwklib/FwkBBClient.cpp | 293 +
tests/cpp/fwklib/FwkBBClient.hpp | 192 +
tests/cpp/fwklib/FwkBBServer.cpp | 521 ++
tests/cpp/fwklib/FwkBBServer.hpp | 227 +
tests/cpp/fwklib/FwkException.hpp | 71 +
tests/cpp/fwklib/FwkExport.hpp | 38 +
tests/cpp/fwklib/FwkLog.cpp | 87 +
tests/cpp/fwklib/FwkLog.hpp | 128 +
tests/cpp/fwklib/FwkObjects.cpp | 1033 +++
tests/cpp/fwklib/FwkObjects.hpp | 1626 +++++
tests/cpp/fwklib/FwkStrCvt.cpp | 170 +
tests/cpp/fwklib/FwkStrCvt.hpp | 353 +
tests/cpp/fwklib/GsRandom.cpp | 85 +
tests/cpp/fwklib/GsRandom.hpp | 217 +
tests/cpp/fwklib/IpcHandler.cpp | 269 +
tests/cpp/fwklib/IpcHandler.hpp | 91 +
tests/cpp/fwklib/PaceMeter.hpp | 134 +
tests/cpp/fwklib/PerfFwk.cpp | 202 +
tests/cpp/fwklib/PerfFwk.hpp | 337 +
tests/cpp/fwklib/PoolHelper.hpp | 152 +
tests/cpp/fwklib/QueryHelper.hpp | 1097 +++
tests/cpp/fwklib/RegionHelper.hpp | 263 +
tests/cpp/fwklib/Service.cpp | 66 +
tests/cpp/fwklib/Service.hpp | 165 +
tests/cpp/fwklib/TaskClient.cpp | 115 +
tests/cpp/fwklib/TaskClient.hpp | 187 +
tests/cpp/fwklib/TcpIpc.cpp | 216 +
tests/cpp/fwklib/TcpIpc.hpp | 79 +
tests/cpp/fwklib/TestClient.cpp | 262 +
tests/cpp/fwklib/TestClient.hpp | 123 +
tests/cpp/fwklib/TimeBomb.cpp | 127 +
tests/cpp/fwklib/TimeBomb.hpp | 87 +
tests/cpp/fwklib/TimeLimit.hpp | 54 +
tests/cpp/fwklib/TimeSync.cpp | 253 +
tests/cpp/fwklib/TimeSync.hpp | 96 +
tests/cpp/fwklib/Timer.hpp | 180 +
tests/cpp/fwklib/UDPIpc.cpp | 368 +
tests/cpp/fwklib/UDPIpc.hpp | 298 +
tests/cpp/fwklib/testframeworkdox.txt | 25 +
tests/cpp/security/CMakeLists.txt | 35 +
tests/cpp/security/CredentialGenerator.cpp | 49 +
tests/cpp/security/CredentialGenerator.hpp | 276 +
tests/cpp/security/DummyCredentialGenerator.hpp | 108 +
.../cpp/security/DummyCredentialGenerator2.hpp | 107 +
.../cpp/security/DummyCredentialGenerator3.hpp | 107 +
.../security/LdapUserCredentialGenerator.hpp | 120 +
tests/cpp/security/NoopCredentialGenerator.hpp | 66 +
tests/cpp/security/PkcsAuthInit.cpp | 211 +
tests/cpp/security/PkcsAuthInit.hpp | 110 +
tests/cpp/security/PkcsCredentialGenerator.hpp | 148 +
tests/cpp/security/Security.cpp | 1085 +++
tests/cpp/security/Security.hpp | 124 +
.../security/XmlAuthzCredentialGenerator.hpp | 317 +
tests/cpp/security/typedefs.hpp | 135 +
tests/cpp/testobject/ArrayOfByte.hpp | 134 +
tests/cpp/testobject/BatchObject.cpp | 56 +
tests/cpp/testobject/BatchObject.hpp | 94 +
tests/cpp/testobject/CMakeLists.txt | 44 +
tests/cpp/testobject/DeltaFastAssetAccount.cpp | 82 +
tests/cpp/testobject/DeltaFastAssetAccount.hpp | 153 +
tests/cpp/testobject/DeltaPSTObject.cpp | 71 +
tests/cpp/testobject/DeltaPSTObject.hpp | 102 +
tests/cpp/testobject/DeltaTestImpl.cpp | 144 +
tests/cpp/testobject/DeltaTestImpl.hpp | 125 +
tests/cpp/testobject/DeltaTestObj.hpp | 101 +
tests/cpp/testobject/EqStruct.cpp | 208 +
tests/cpp/testobject/EqStruct.hpp | 155 +
tests/cpp/testobject/FastAsset.cpp | 39 +
tests/cpp/testobject/FastAsset.hpp | 119 +
tests/cpp/testobject/FastAssetAccount.cpp | 73 +
tests/cpp/testobject/FastAssetAccount.hpp | 126 +
tests/cpp/testobject/InvalidPdxUsage.cpp | 875 +++
tests/cpp/testobject/InvalidPdxUsage.hpp | 693 ++
tests/cpp/testobject/NestedPdxObject.cpp | 200 +
tests/cpp/testobject/NestedPdxObject.hpp | 344 +
tests/cpp/testobject/NonPdxType.cpp | 147 +
tests/cpp/testobject/NonPdxType.hpp | 496 ++
tests/cpp/testobject/NoopAuthInit.cpp | 42 +
tests/cpp/testobject/NoopAuthInit.hpp | 89 +
tests/cpp/testobject/PSTObject.cpp | 63 +
tests/cpp/testobject/PSTObject.hpp | 93 +
tests/cpp/testobject/PdxClassV1.cpp | 755 ++
tests/cpp/testobject/PdxClassV1.hpp | 537 ++
tests/cpp/testobject/PdxClassV2.cpp | 810 +++
tests/cpp/testobject/PdxClassV2.hpp | 578 ++
tests/cpp/testobject/PdxType.cpp | 363 +
tests/cpp/testobject/PdxType.hpp | 803 +++
tests/cpp/testobject/PdxVersioned1.cpp | 438 ++
tests/cpp/testobject/PdxVersioned1.hpp | 260 +
tests/cpp/testobject/PdxVersioned2.cpp | 446 ++
tests/cpp/testobject/PdxVersioned2.hpp | 263 +
tests/cpp/testobject/Portfolio.cpp | 137 +
tests/cpp/testobject/Portfolio.hpp | 134 +
tests/cpp/testobject/PortfolioPdx.cpp | 195 +
tests/cpp/testobject/PortfolioPdx.hpp | 111 +
tests/cpp/testobject/Position.cpp | 129 +
tests/cpp/testobject/Position.hpp | 111 +
tests/cpp/testobject/PositionPdx.cpp | 172 +
tests/cpp/testobject/PositionPdx.hpp | 107 +
tests/cpp/testobject/TestObject1.cpp | 67 +
tests/cpp/testobject/TestObject1.hpp | 71 +
tests/cpp/testobject/TimestampedObject.hpp | 56 +
tests/cpp/testobject/VariousPdxTypes.cpp | 932 +++
tests/cpp/testobject/VariousPdxTypes.hpp | 542 ++
tests/javaobject/BankAccount.java | 104 +
tests/javaobject/BatchObject.java | 125 +
.../BridgeClientMembershipListener.java | 70 +
tests/javaobject/BridgeEventListener.java | 69 +
tests/javaobject/CMakeLists.txt | 27 +
.../javaobject/CacheListenerForConflation.java | 74 +
.../javaobject/CacheListenerForQueryIndex.java | 117 +
tests/javaobject/CacheLoaderForSingleHop.java | 103 +
tests/javaobject/CacheWriterForSingleHop.java | 170 +
tests/javaobject/ComparePdxTypes.java | 229 +
.../CustomFixedPartitionResolver1.java | 83 +
.../CustomFixedPartitionResolver2.java | 77 +
.../CustomFixedPartitionResolver3.java | 71 +
tests/javaobject/CustomPartitionResolver.java | 42 +
tests/javaobject/DefaultCacheable.java | 236 +
tests/javaobject/DeltaEx.java | 80 +
tests/javaobject/DeltaExample.java | 135 +
tests/javaobject/DeltaFastAssetAccount.java | 250 +
tests/javaobject/DeltaPSTObject.java | 130 +
tests/javaobject/DeltaTest.java | 75 +
tests/javaobject/DeltaTestImpl.java | 415 ++
tests/javaobject/DummyAuthenticator.java | 86 +
tests/javaobject/DummyAuthorization.java | 154 +
tests/javaobject/DummyAuthorization2.java | 125 +
tests/javaobject/DummyAuthorization3.java | 143 +
tests/javaobject/EqStruct.java | 298 +
tests/javaobject/ExampleFunction.java | 239 +
tests/javaobject/ExampleObject.java | 161 +
tests/javaobject/ExceptionHandlingFunction.java | 63 +
tests/javaobject/FEOnRegionPrSHOP.java | 48 +
.../FEOnRegionPrSHOP_OptimizeForWrite.java | 82 +
tests/javaobject/FastAsset.java | 125 +
tests/javaobject/FastAssetAccount.java | 201 +
tests/javaobject/FireNForget.java | 68 +
tests/javaobject/FunctionExecutionTimeOut.java | 81 +
tests/javaobject/GetFunctionExeHA.java | 63 +
tests/javaobject/GetKeyFunction.java | 74 +
tests/javaobject/InstantiatorTest.java | 236 +
tests/javaobject/IterateRegion.java | 57 +
tests/javaobject/LatestProp.java | 46 +
tests/javaobject/ModPartitionResolver.java | 43 +
tests/javaobject/ModRoutingObject.java | 99 +
tests/javaobject/MultiGetFunction.java | 61 +
tests/javaobject/MultiGetFunction2.java | 65 +
tests/javaobject/MultiGetFunctionI.java | 73 +
tests/javaobject/MultiPutFunction.java | 64 +
tests/javaobject/MultiPutFunctionI.java | 77 +
tests/javaobject/NoopAccessor.java | 43 +
tests/javaobject/NoopAuthenticator.java | 44 +
tests/javaobject/NoopPrincipal.java | 30 +
.../javaobject/OnServerHAExceptionFunction.java | 102 +
.../javaobject/OnServerHAShutdownFunction.java | 102 +
tests/javaobject/PSTObject.java | 164 +
tests/javaobject/PdxCacheListener.java | 96 +
tests/javaobject/PdxDelta.java | 86 +
tests/javaobject/PdxFunctionTest.java | 71 +
tests/javaobject/PdxTests/Address.java | 74 +
tests/javaobject/PdxTests/PdxDeltaEx.java | 82 +
tests/javaobject/PdxTests/PdxTestsWithAuto.java | 558 ++
tests/javaobject/PdxTests/PdxType.java | 555 ++
tests/javaobject/PdxTests/PdxTypes1.java | 91 +
tests/javaobject/PdxTests/PdxTypes10.java | 85 +
tests/javaobject/PdxTests/PdxTypes2.java | 83 +
tests/javaobject/PdxTests/PdxTypes3.java | 84 +
tests/javaobject/PdxTests/PdxTypes4.java | 86 +
tests/javaobject/PdxTests/PdxTypes5.java | 89 +
tests/javaobject/PdxTests/PdxTypes6.java | 90 +
tests/javaobject/PdxTests/PdxTypes7.java | 94 +
tests/javaobject/PdxTests/PdxTypes8.java | 98 +
tests/javaobject/PdxTests/PdxTypes9.java | 85 +
tests/javaobject/PdxTests/PdxVersioned.java | 503 ++
tests/javaobject/PdxTests/pdxEnumTest.java | 19 +
.../javaobject/PdxinstanceHashcodeListener.java | 93 +
tests/javaobject/Portfolio.java | 284 +
tests/javaobject/Position.java | 218 +
tests/javaobject/PutAllTimeout.java | 108 +
tests/javaobject/PutKeyFunction.java | 79 +
tests/javaobject/RegionOperationsFunction.java | 263 +
.../RegionOperationsFunctionOptimized.java | 221 +
.../RegionOperationsFunctionOptimizedFalse.java | 217 +
.../javaobject/RegionOperationsFunctionPdx.java | 331 +
.../javaobject/RegionOperationsHAFunction.java | 118 +
.../RegionOperationsHAFunctionPrSHOP.java | 120 +
.../RegionOperationsWithOutResultFunction.java | 238 +
tests/javaobject/ServerOperationsFunction.java | 133 +
.../ServerOperationsWithOutResultFunction.java | 130 +
tests/javaobject/SimpleCacheListener.java | 132 +
.../javaobject/SimpleCacheListenerWithAuto.java | 95 +
tests/javaobject/SingleStrGetFunction.java | 80 +
tests/javaobject/TestObject1.java | 77 +
.../ThinClientRegionExceptionTest.java | 50 +
tests/javaobject/TradeKey.java | 110 +
tests/javaobject/TradeKeyResolver.java | 44 +
tests/javaobject/TradeOrder.java | 215 +
tests/javaobject/User.java | 98 +
tests/javaobject/UserPasswordAuthInit.java | 83 +
tests/javaobject/UsernamePrincipal.java | 45 +
.../executeFunction_SendException.java | 76 +
tests/javaobject/newapi/Portfolio.java | 284 +
tests/javaobject/newapi/Position.java | 218 +
xsds/gfcpp-cache-9.0.xsd | 238 +
3994 files changed, 438577 insertions(+), 438577 deletions(-)
----------------------------------------------------------------------
[07/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/geode_defs.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/geode_defs.hpp b/clicache/src/geode_defs.hpp
new file mode 100644
index 0000000..2424f77
--- /dev/null
+++ b/clicache/src/geode_defs.hpp
@@ -0,0 +1,272 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+// These definitions are to help parsing by Doxygen.
+
+/// @file geode_defs.hpp
+/// API documentation helper file for the Doxygen source-comment-extraction tool.
+
+#define STATICCLASS abstract sealed
+#define GFINDEXER(x) default[ x ]
+
+// Disable XML warnings
+#pragma warning(disable: 4635)
+#pragma warning(disable: 4638)
+#pragma warning(disable: 4641)
+
+// Disable native code generation warning
+#pragma warning(disable: 4793)
+
+// These provide Doxygen with namespace and file descriptions.
+
+/// @namespace Apache::Geode
+/// This namespace contains all the Geode .NET classes and utility classes.
+
+/// @namespace Apache::Geode::Client
+/// This namespace contains all the Geode .NET Generics API classes and enumerations.
+
+/// @namespace Apache::Geode::Client::Internal
+/// This namespace contains internal Geode non-public .NET classes.
+
+/// @namespace Apache::Geode::Client::Template
+/// This namespace contains internal Geode .NET template classes.
+
+/// @file geode_includes.hpp
+/// Provides a commonly-used set of include directives.
+
+/// @file AttributesFactory.hpp
+/// Declares the AttributesFactory class.
+
+/// @file AttributesMutator.hpp
+/// Declares the AttributesMutator class.
+
+/// @file CacheAttributes.hpp
+/// Declares the CacheAttributes class.
+
+/// @file CacheAttributesFactory.hpp
+/// Declares the CacheAttributesFactory class.
+
+/// @file CacheableBuiltins.hpp
+/// Declares the CacheableBuiltinKey and CacheableBuiltinArray
+/// template classes and their instantiations for CacheableBoolean,
+/// CacheableByte, CacheableDouble, CacheableFloat, CacheableInt16,
+/// CacheableInt32, CacheableInt64, CacheableBytes, CacheableDoubleArray,
+/// CacheableFloatArray, CacheableInt16Array, CacheableInt32Array,
+/// CacheableInt64Array, BooleanArray and CharArray
+
+/// @file CacheableBuiltins.hpp
+/// Declared the built-in Geode serializable types.
+
+/// @file CacheableDate.hpp
+/// Declares the CacheableDate class.
+
+/// @file CacheableFileName.hpp
+/// Declares the CacheableFileName class.
+
+/// @file CacheableHashMap.hpp
+/// Declares the CacheableHashMap class.
+
+/// @file CacheableHashSet.hpp
+/// Declares the CacheableHashSet class.
+
+/// @file CacheableKey.hpp
+/// Declares the CacheableKey class.
+
+/// @file CacheableObject.hpp
+/// Declares the CacheableObject class.
+
+/// @file CacheableObjectXml.hpp
+/// Declares the CacheableObjectXml class.
+
+/// @file CacheableString.hpp
+/// Declares the CacheableString class.
+
+/// @file CacheableStringArray.hpp
+/// Declares the CacheableStringArray class.
+
+/// @file CacheableUndefined.hpp
+/// Declares the CacheableUndefined class.
+
+/// @file CacheableVector.hpp
+/// Declares the CacheableVector class.
+
+/// @file CacheFactory.hpp
+/// Declares the CacheFactory class.
+
+/// @file Cache.hpp
+/// Declares the Cache class.
+
+/// @file CacheStatistics.hpp
+/// Declares the CacheStatistics class.
+
+/// @file CacheStatistics.hpp
+/// Declares the CacheStatistics class.
+
+/// @file DataInput.hpp
+/// Declares the DataInput class.
+
+/// @file DataOutput.hpp
+/// Declares the DataOutput class.
+
+/// @file DiskPolicyType.hpp
+/// Declares the DiskPolicyType enumeration and DiskPolicy class.
+
+/// @file DistributedSystem.hpp
+/// Declares the DistributedSystem class.
+
+/// @file EntryEvent.hpp
+/// Declares the EntryEvent class.
+
+/// @file ExceptionTypes.hpp
+/// Declares the Geode exception type classes.
+
+/// @file ExpirationAction.hpp
+/// Declares the ExpirationAction enumeration and Expiration class.
+
+/// @file GeodeClassIds.hpp
+/// Declares the GeodeClassIds class.
+
+/// @file IRegionService.hpp
+/// Declares the IRegionService interface.
+
+/// @file IRegionService.hpp
+/// Declares the IRegionService interface.
+
+/// @file IGeodeCache.hpp
+/// Declares the IGeodeCache interface.
+
+/// @file IGeodeCache.hpp
+/// Declares the IGeodeCache interface.
+
+/// @file ICacheableKey.hpp
+/// Declares the ICacheableKey interface.
+
+/// @file ICacheListener.hpp
+/// Declares the ICacheListener interface.
+
+/// @file ICacheListener.hpp
+/// Declares the ICacheListener interface.
+
+/// @file IPartitionResolver.hpp
+/// Declares the IPartitionResolver interface.
+
+/// @file IFixedPartitionResolver.hpp
+/// Declares the IFixedPartitionResolver interface.
+
+/// @file IPartitionResolver.hpp
+/// Declares the IPartitionResolver interface.
+
+/// @file IFixedPartitionResolver.hpp
+/// Declares the IFixedPartitionResolver interface.
+
+/// @file ICacheLoader.hpp
+/// Declares the ICacheLoader interface.
+
+/// @file ICacheWriter.hpp
+/// Declares the ICacheWriter interface.
+
+/// @file ICacheLoader.hpp
+/// Declares the ICacheLoader interface.
+
+/// @file ICacheWriter.hpp
+/// Declares the ICacheWriter interface.
+
+/// @file IGeodeSerializable.hpp
+/// Declares the IGeodeSerializable interface.
+
+/// @file ISelectResults.hpp
+/// Declares the ISelectResults interface.
+
+/// @file Log.hpp
+/// Declares the Log class.
+
+/// @file Log.hpp
+/// Declares the Log class.
+
+/// @file Properties.hpp
+/// Declares the Properties class.
+
+/// @file RegionShortcut.hpp
+/// Declares the RegionShortcut enum class.
+
+/// @file Query.hpp
+/// Declares the Query class.
+
+/// @file QueryService.hpp
+/// Declares the QueryService class.
+
+/// @file Region.hpp
+/// Declares the Region class.
+
+/// @file Region.hpp
+/// Declares the Region class.
+
+/// @file Region.hpp
+/// Declares the Region class.
+
+/// @file RegionEntry.hpp
+/// Declares the RegionEntry class.
+
+/// @file RegionEntry.hpp
+/// Declares the RegionEntry class.
+
+/// @file RegionEvent.hpp
+/// Declares the RegionEvent class.
+
+/// @file ResultSet.hpp
+/// Declares the ResultSet class.
+
+/// @file ScopeType.hpp
+/// Declares the ScopeType enumeration and Scope class.
+
+/// @file SelectResultsIterator.hpp
+/// Declares the SelectResultsIterator class.
+
+/// @file Serializable.hpp
+/// Declares the Serializable class.
+
+/// @file StructSet.hpp
+/// Declares the StructSet class.
+
+/// @file Struct.hpp
+/// Declares the Struct class.
+
+/// @file SystemProperties.hpp
+/// Declares the SystemProperties class.
+
+/// @file SystemProperties.hpp
+/// Declares the SystemProperties class.
+
+/// @file Utils.hpp
+/// Declares the Utils class.
+
+/// @file UserFunctionExecutionException.hpp
+/// Declares the UserFunctionExecutionException class.
+
+/// @file UserFunctionExecutionException.hpp
+/// Declares the UserFunctionExecutionException class.
+
+/// @file ICqStatusListener.hpp
+/// Declares the ICqStatusListener interface.
+
+/// @file ICqStatusListener.hpp
+/// Declares the ICqStatusListener interface.
+
+/// @file IPersistenceManager.hpp
+/// Declares the generic IPersistenceManager interface.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/geode_includes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/geode_includes.hpp b/clicache/src/geode_includes.hpp
new file mode 100644
index 0000000..7636255
--- /dev/null
+++ b/clicache/src/geode_includes.hpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+// geode_includes.hpp : include file for standard system include files,
+// and all project specific include files.
+
+#pragma once
+
+//#include "impl/ManagedCacheableKeyGCHandle.hpp"
+#include "impl/SafeConvert.hpp"
+
+#include <string>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/geodeclicache.vcxproj.filters
----------------------------------------------------------------------
diff --git a/clicache/src/geodeclicache.vcxproj.filters b/clicache/src/geodeclicache.vcxproj.filters
new file mode 100755
index 0000000..7ef06a8
--- /dev/null
+++ b/clicache/src/geodeclicache.vcxproj.filters
@@ -0,0 +1,1075 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="com\vmware\CacheFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\PoolFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\PoolMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedVisitor.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\MemoryPressureHandler.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\NativeWrapper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\SafeConvert.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedResultCollector.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedString.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCqListener.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedFixedPartitionResolver.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedPartitionResolver.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheableDeltaBytes.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheableKey.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheableKeyBytes.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheableDelta.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheWriter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedAuthInitialize.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheListener.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\ManagedCacheLoader.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\DelegateWrapper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\GeodeDataInputStream.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\GeodeDataOutputStream.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\GeodeNullStream.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="impl\AuthenticatedCacheM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="geode_includes.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="geode_defs.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ResultCollectorProxyMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\SafeConvertN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\TransactionListenerMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\TransactionWriterMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\WeakhashMap.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxWriterWithTypeCollector.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PersistenceManagerProxyMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\RegionImplN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxType.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxTypeRegistry.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxWrapper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxRemotePreservedData.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxRemoteReader.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxRemoteWriter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxManagedCacheableKey.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxManagedCacheableKeyBytes.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxReaderWithTypeCollector.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxLocalReader.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxLocalWriter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxInstanceFactoryImpl.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxInstanceImpl.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PartitionResolverMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxFieldType.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\PdxHelper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedTransactionWriterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedVisitorN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\MemoryPressureHandlerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\NativeWrapperN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedResultCollectorN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedStringN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedTransactionListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedPartitionResolverN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedPersistenceManagerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedFixedPartitionResolverN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCqStatusListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCqListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheableKeyN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheableDeltaN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheableKeyBytesN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheableDeltaBytesN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheWriterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedAuthInitializeN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\ManagedCacheLoaderN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\FixedPartitionResolverMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\GeodeDataInputStreamN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\GeodeDataOutputStreamN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\GeodeNullStreamN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CqStatusListenerProxyMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\DelegateWrapperN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\DotNetTypes.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\EnumInfo.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\AuthenticatedCacheMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CacheListenerMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CacheLoaderMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CacheWriterMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CliCallbackDelgateN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\CqListenerProxyMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\impl\AuthInitializeMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\UtilsN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\TransactionEventMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\TransactionIdMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\TransactionListenerAdapterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\TransactionWriterAdapterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\UserFunctionExecutionExceptionMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StructSetMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\SystemPropertiesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StatisticsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StatisticsTypeMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StructMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\SerializableMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StatisticDescriptorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\StatisticsFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ResultSetMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ScopeTypeMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\SelectResultsIteratorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionShortcutMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ResultCollectorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionAttributesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionEntryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\RegionEventMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\QueryServiceMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ReflectionBasedAutoSerializer.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\QueryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\PoolManagerMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\PropertiesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\PdxIdentityFieldAttribute.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IWritablePdxInstance.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\LocalRegionMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\LogMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IRegionServiceN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IResultCollectorN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ISelectResultsN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ISubscriptionServiceN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ITransactionListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ITransactionWriterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxTypeMapper.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxUnreadFields.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxWriterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPersistenceManagerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IRegionN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxInstance.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxInstanceFactory.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxReaderN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxSerializableN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPdxSerializer.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IFixedPartitionResolverN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IGemFireCacheN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IGeodeDeltaN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IGeodeSerializableN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IPartitionResolverN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICqAttributesN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICqEventN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICqListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICqResultsN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICqStatusListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\GemFireClassIdsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\IAuthInitializeN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICacheableKeyN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICacheListenerN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICacheLoaderN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ICacheWriterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ExecutionMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ExpirationActionMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\FunctionServiceMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\EntryEventMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\ExceptionTypesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\DataOutputMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\DiskPolicyTypeMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\DistributedSystemMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqStatisticsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\DataInputMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqServiceStatisticsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqStateMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqOperationMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqQueryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqAttributesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqAttributesMutatorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqEventMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqListenerMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableUndefinedMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableVectorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CqAttributesFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableStringArrayMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableStringMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableObjectN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableObjectXmlN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableStackMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableKeyMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableLinkedListMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableObjectArrayMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableIdentityHashMapMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableHashTableMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableHashSetMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableHashMapMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableFileNameMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableArrayListMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableBuiltinsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheableDateMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheTransactionManagerMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheWriterAdapterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheListenerAdapterN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheStatisticsMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheAttributesFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\CacheAttributesMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\AttributesFactoryMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="com\vmware\AttributesMutatorMN.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="TransactionWriterAdapter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="UserFunctionExecutionExceptionM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="SystemPropertiesM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="TransactionEventM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="TransactionListenerAdapter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StatisticsM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StatisticsTypeM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StatisticDescriptorM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StatisticsFactoryM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ScopeTypeM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="SerializableM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="RegionShortcutM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="RegionEventM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="PropertiesM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ITransactionListener.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ITransactionWriter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="LogM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IGemFireCache.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IGeodeSerializable.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IPartitionResolver.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IRegionService.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IFixedPartitionResolver.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IGeodeDelta.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="GemFireClassIdsM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IAuthInitialize.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ICacheableKey.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ICacheListener.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ICacheLoader.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ICacheWriter.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ExpirationActionM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="FunctionServiceM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="DistributedSystemM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="EntryEventM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ExceptionTypesM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="DataInputM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="DataOutputM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="DiskPolicyTypeM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableVectorM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableStringArrayM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableStringM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableStackM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableFileNameM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableHashSetM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableHashTableM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableArrayListM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheableBuiltinsM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheStatisticsM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheFactoryM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CacheM.hpp">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="com\vmware\impl\AssemblyInfoN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\PoolFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\PoolMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxWriterWithTypeCollector.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\RegionImplN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxType.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxTypeRegistry.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxRemoteReader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxRemoteWriter.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxManagedCacheableKeyBytes.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxReaderWithTypeCollector.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxLocalReader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxLocalWriter.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxManagedCacheableKey.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxInstanceFactoryImpl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxInstanceImpl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxFieldType.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\PdxHelper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedVisitorN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\MemoryPressureHandlerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedTransactionListenerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedTransactionWriterN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedPartitionResolverN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedPersistenceManagerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedResultCollectorN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedFixedPartitionResolverN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCqStatusListenerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCqListenerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheableDeltaN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheableKeyBytesN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheableKeyN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheableDeltaBytesN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheWriterN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheListenerN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedCacheLoaderN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\ManagedAuthInitializeN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\EnumInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\impl\AuthenticatedCacheMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\UtilsN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\UserFunctionExecutionExceptionMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StructSetMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\SystemPropertiesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\TransactionEventMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StatisticsMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StatisticsTypeMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StructMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\SerializableMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StatisticDescriptorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\StatisticsFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\ResultSetMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\SelectResultsIteratorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\RegionMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\ResultCollectorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\RegionEntryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\RegionEventMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\RegionFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\ReflectionBasedAutoSerializer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\RegionAttributesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="RegionAttributesM.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\QueryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\QueryServiceMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\PoolManagerMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\PropertiesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\LocalRegionMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\LogMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\FunctionServiceMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\ExecutionMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\ExceptionTypesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\DistributedSystemMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\EntryEventMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\DataInputMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\DataOutputMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqServiceStatisticsMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqStateMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqStatisticsMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqQueryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqAttributesMutatorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqEventMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableVectorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqAttributesFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CqAttributesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableStringArrayMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableStringMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableUndefinedMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableObjectN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableObjectXmlN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableStackMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableKeyMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableObjectArrayMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableHashMapMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableFileNameMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheableDateMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheStatisticsMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheTransactionManagerMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheAttributesMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\AttributesFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\AttributesMutatorMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="com\vmware\CacheAttributesFactoryMN.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/AppDomainContext.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/AppDomainContext.cpp b/clicache/src/impl/AppDomainContext.cpp
new file mode 100644
index 0000000..42d7403
--- /dev/null
+++ b/clicache/src/impl/AppDomainContext.cpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#include "AppDomainContext.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+apache::geode::client::AppDomainContext* createAppDomainContext() {
+ return new AppDomainContext();
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/AppDomainContext.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/AppDomainContext.hpp b/clicache/src/impl/AppDomainContext.hpp
new file mode 100644
index 0000000..cd6a00f
--- /dev/null
+++ b/clicache/src/impl/AppDomainContext.hpp
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <functional>
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <AppDomainContext.hpp>
+#include "end_native.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+using namespace System;
+
+/**
+ * Internal managed wrapper for invoking function through to attach
+ * current thread to AppDomain associatd with this instance.
+ */
+ref class AppDomainContextWrapper {
+public:
+ delegate void Delegate(std::function<void()>);
+ typedef void(__stdcall *Function)(std::function<void()>);
+
+ void run(std::function<void()> func) {
+ func();
+ }
+};
+
+/**
+ * Captures the current thread's AppDomain for later use in associating a native
+ * thread with this instanaces AppDomain.
+ */
+class AppDomainContext : public apache::geode::client::AppDomainContext {
+public:
+ AppDomainContext() {
+ functionDelegate = gcnew AppDomainContextWrapper::Delegate(gcnew AppDomainContextWrapper(),
+ &AppDomainContextWrapper::run);
+ functionPointer = (AppDomainContextWrapper::Function)
+ System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(functionDelegate).ToPointer();
+ }
+
+ void run(runnable func) {
+ functionPointer(func);
+ }
+
+private:
+ gcroot<AppDomainContextWrapper::Delegate^> functionDelegate;
+ AppDomainContextWrapper::Function functionPointer;
+};
+
+apache::geode::client::AppDomainContext* createAppDomainContext();
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/AssemblyInfo.cpp.in
----------------------------------------------------------------------
diff --git a/clicache/src/impl/AssemblyInfo.cpp.in b/clicache/src/impl/AssemblyInfo.cpp.in
new file mode 100644
index 0000000..a885a22
--- /dev/null
+++ b/clicache/src/impl/AssemblyInfo.cpp.in
@@ -0,0 +1,46 @@
+/*
+ * 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 namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("GemFire.NETCache")];
+[assembly:AssemblyDescriptionAttribute("GemFire Native Client .NET Cache")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("Pivotal Software, Inc.")];
+[assembly:AssemblyProductAttribute("GemFire.NETCache")];
+[assembly:AssemblyCopyrightAttribute("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.")];
+[assembly:AssemblyTrademarkAttribute("All Rights Reserved")];
+[assembly:AssemblyCultureAttribute("")];
+[assembly:AssemblyVersionAttribute("@PRODUCT_VERSION_DOTTED@")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
+
+[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
+
+[assembly:InternalsVisibleToAttribute("UnitTests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")];
+[assembly:InternalsVisibleToAttribute("cli-unit-tests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")];
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/AuthenticatedCache.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/AuthenticatedCache.cpp b/clicache/src/impl/AuthenticatedCache.cpp
new file mode 100644
index 0000000..acd96c0
--- /dev/null
+++ b/clicache/src/impl/AuthenticatedCache.cpp
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+
+#include "begin_native.hpp"
+#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
+#include "end_native.hpp"
+
+#include "../Cache.hpp"
+#include "../DistributedSystem.hpp"
+#include "../Region.hpp"
+#include "../RegionAttributes.hpp"
+#include "../QueryService.hpp"
+#include "../FunctionService.hpp"
+#include "../Execution.hpp"
+#include "AuthenticatedCache.hpp"
+#include "PdxInstanceFactoryImpl.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ bool AuthenticatedCache::IsClosed::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isClosed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void AuthenticatedCache::Close( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ m_nativeptr->get()->close( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ //TODO::split
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ AuthenticatedCache::GetRegion( String^ path )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ ManagedString mg_path( path );
+ auto nativeptr = m_nativeptr->get()->getRegion( mg_path.CharPtr );
+ return Client::Region<TKey, TValue>::Create( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TResult>
+ Client::QueryService<TKey, TResult>^ AuthenticatedCache::GetQueryService( )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ return Client::QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TKey, class TValue>
+ array<IRegion<TKey, TValue>^>^ AuthenticatedCache::RootRegions( )
+ {
+ apache::geode::client::VectorOfRegion vrr;
+ try
+ {
+ m_nativeptr->get()->rootRegions( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto rootRegions = gcnew array<IRegion<TKey, TValue>^>( static_cast<int>(vrr.size( )) );
+
+ for( System::Int32 index = 0; index < vrr.size( ); index++ )
+ {
+ auto& nativeptr( vrr[ index ] );
+ rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr );
+ }
+ return rootRegions;
+ }
+
+ IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className)
+ {
+ return gcnew Internal::PdxInstanceFactoryImpl(className, native::CacheRegionHelper::getCacheImpl(m_nativeptr->get())->getCache());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/AuthenticatedCache.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/AuthenticatedCache.hpp b/clicache/src/impl/AuthenticatedCache.hpp
new file mode 100644
index 0000000..7f0028f
--- /dev/null
+++ b/clicache/src/impl/AuthenticatedCache.hpp
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionService.hpp>
+#include "end_native.hpp"
+
+#include "../native_shared_ptr.hpp"
+#include "../RegionShortcut.hpp"
+#include "../RegionFactory.hpp"
+#include "../IRegionService.hpp"
+#include "../Region.hpp"
+
+using namespace System;
+using namespace System::Collections::Generic;
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Provides a distributed cache.
+ /// </summary>
+ /// <remarks>
+ /// Caches are obtained from static methods on the
+ /// <see cref="CacheFactory"/> class.
+ /// <para>
+ /// When a cache is created a <see cref="DistributedSystem" />
+ /// must be specified.
+ /// </para><para>
+ /// When a cache will no longer be used, call <see cref="Cache.Close" />.
+ /// Once it <see cref="Cache.IsClosed" /> any attempt to use it
+ /// will cause a <c>CacheClosedException</c> to be thrown.
+ /// </para><para>
+ /// A cache can have multiple root regions, each with a different name.
+ /// </para>
+ /// </remarks>
+ public ref class AuthenticatedCache
+ : public IRegionService
+ {
+ public:
+
+ /// <summary>
+ /// True if this cache has been closed.
+ /// </summary>
+ /// <remarks>
+ /// After a new cache object is created, this method returns false.
+ /// After <see cref="Close" /> is called on this cache object, this method
+ /// returns true.
+ /// </remarks>
+ /// <returns>true if this cache is closed, otherwise false</returns>
+ virtual property bool IsClosed
+ {
+ bool get( );
+ }
+
+ /// <summary>
+ /// Terminates this object cache and releases all the local resources.
+ /// If Cache instance created from Pool(pool is in multiuser mode), then it reset user related security data.
+ /// </summary>
+ /// <remarks>
+ /// After this cache is closed, any further
+ /// method call on this cache or any region object will throw
+ /// <c>CacheClosedException</c>, unless otherwise noted.
+ /// </remarks>
+ /// <exception cref="CacheClosedException">
+ /// if the cache is already closed.
+ /// </exception>
+ virtual void Close( );
+
+ /// <summary>
+ /// Returns an existing region given the full path from root, or null
+ /// if no such region exists.
+ /// </summary>
+ /// <remarks>
+ /// If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance.
+ /// Get logical instance of region Pool->CreateSecureUserCache(<Credential>).getRegion(<name>) to do the operation on Cache.
+ /// </remarks>
+ /// <param name="path">the pathname of the region</param>
+ /// <returns>the region</returns>
+ generic<class TKey, class TValue>
+ virtual IRegion<TKey, TValue>^ GetRegion( String^ path );
+
+ /// <summary>
+ /// Get a query service object to be able to query the cache.
+ /// Supported only when cache is created from Pool(pool is in multiuserSecure mode)
+ /// </summary>
+ /// <remarks>
+ /// Currently only works against the java server in native mode, and
+ /// at least some endpoints must have been defined in some regions
+ /// before actually firing a query.
+ /// </remarks>
+ generic<class TKey, class TResult>
+ virtual QueryService<TKey, TResult>^ GetQueryService();
+
+ /// <summary>
+ /// Returns an array of root regions in the cache. This set is a
+ /// snapshot and is not backed by the cache.
+ /// </summary>
+ /// <remarks>
+ /// It is not supported when Cache is created from Pool.
+ /// </remarks>
+ /// <returns>array of regions</returns>
+ generic<class TKey, class TValue>
+ virtual array<IRegion<TKey, TValue>^>^ RootRegions();
+
+ /// <summary>
+ /// Returns a factory that can create a {@link PdxInstance}.
+ /// @param className the fully qualified class name that the PdxInstance will become
+ /// when it is fully deserialized.
+ /// @return the factory
+ /// </summary>
+ virtual IPdxInstanceFactory^ CreatePdxInstanceFactory(String^ className);
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static AuthenticatedCache^ Create( native::RegionServicePtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew AuthenticatedCache( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionService> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline AuthenticatedCache( native::RegionServicePtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionService>(nativeptr);
+ }
+ native_shared_ptr<native::RegionService>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CacheListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CacheListener.hpp b/clicache/src/impl/CacheListener.hpp
new file mode 100644
index 0000000..a40a705
--- /dev/null
+++ b/clicache/src/impl/CacheListener.hpp
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+//#include "../geode_includes.hpp"
+#include "../ICacheListener.hpp"
+#include "../CacheListenerAdapter.hpp"
+#include "../ICacheListener.hpp"
+#include "../Region.hpp"
+//#include "../../../Region.hpp"
+//#include "../../../Cache.hpp"
+
+using namespace System;
+
+using namespace Apache::Geode::Client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ public ref class CacheListenerGeneric : CacheListenerAdapter<Object^, Object^>
+ {
+ private:
+
+ ICacheListener<TKey, TValue>^ m_listener;
+
+ public:
+
+ void SetCacheListener(ICacheListener<TKey, TValue>^ listener)
+ {
+ m_listener = listener;
+ }
+
+ virtual void AfterUpdate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
+ {
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterUpdate(%gevent);
+ }
+
+ virtual void AfterCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
+ {
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterCreate(%gevent);
+ }
+
+ virtual void AfterInvalidate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
+ {
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterInvalidate(%gevent);
+ }
+
+ virtual void AfterDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
+ {
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterDestroy(%gevent);
+ }
+
+ virtual void AfterRegionLive(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
+ {
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterRegionLive(%gevent);
+ }
+
+ virtual void AfterRegionClear(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
+ {
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterRegionClear(%gevent);
+ }
+
+ virtual void AfterRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
+ {
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterRegionDestroy(%gevent);
+ }
+
+ virtual void AfterRegionInvalidate(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
+ {
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
+ m_listener->AfterRegionInvalidate(%gevent);
+ }
+
+ virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
+ {
+ auto gregion = Region<TKey, TValue>::Create(((Region<Object^, Object^>^)region)->GetNative());
+ m_listener->AfterRegionDisconnected(gregion);
+ }
+
+ virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
+ {
+ auto gregion = Region<TKey, TValue>::Create(((Region<Object^, Object^>^)region)->GetNative());
+ m_listener->Close(gregion);
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CacheLoader.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CacheLoader.hpp b/clicache/src/impl/CacheLoader.hpp
new file mode 100644
index 0000000..c785338
--- /dev/null
+++ b/clicache/src/impl/CacheLoader.hpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+#pragma once
+
+//#include "../geode_includes.hpp"
+//#include "../../../ICacheLoader.hpp"
+#include "../ICacheLoader.hpp"
+//#include "../Serializable.hpp"
+#include "../Region.hpp"
+#include "SafeConvert.hpp"
+//#include "../legacy/impl/SafeConvert.hpp"
+//#include "../../../Region.hpp"
+//#include "../../../Cache.hpp"
+
+using namespace System;
+
+//using namespace Apache::Geode::Client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ public interface class ICacheLoaderProxy
+ {
+ public:
+ apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region,
+ const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper );
+
+ void close( const apache::geode::client::RegionPtr& region );
+ };
+
+ generic<class TKey, class TValue>
+ public ref class CacheLoaderGeneric : ICacheLoaderProxy // : Apache::Geode::Client::ICacheLoader /*<Object^, Object^>*/
+ {
+ private:
+
+ ICacheLoader<TKey, TValue>^ m_loader;
+
+ public:
+
+ void SetCacheLoader(ICacheLoader<TKey, TValue>^ loader)
+ {
+ m_loader = loader;
+ }
+
+ virtual apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region,
+ const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper )
+ {
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region);
+
+ TKey gkey = Serializable::GetManagedValueGeneric<TKey>(key);
+
+ Object^ ghelper = Serializable::GetManagedValueGeneric<Object^>(helper);
+
+ //return SafeMSerializableConvertGeneric(m_loader->Load(gregion, gkey, ghelper));
+ return Serializable::GetUnmanagedValueGeneric<TValue>(m_loader->Load(gregion, gkey, ghelper), nullptr);
+ }
+
+ virtual void close( const apache::geode::client::RegionPtr& region )
+ {
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region);
+ m_loader->Close(gregion);
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CacheWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CacheWriter.hpp b/clicache/src/impl/CacheWriter.hpp
new file mode 100644
index 0000000..e5f238a
--- /dev/null
+++ b/clicache/src/impl/CacheWriter.hpp
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+//#include "../geode_includes.hpp"
+//#include "../../../ICacheWriter.hpp"
+#include "../CacheWriterAdapter.hpp"
+#include "../ICacheWriter.hpp"
+//#include "../Region.hpp"
+//#include "../../../Region.hpp"
+//#include "../../../Cache.hpp"
+
+using namespace System;
+
+using namespace Apache::Geode::Client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ public ref class CacheWriterGeneric : Apache::Geode::Client::CacheWriterAdapter<Object^, Object^>
+ {
+ private:
+
+ ICacheWriter<TKey, TValue>^ m_writer;
+
+ public:
+
+ void SetCacheWriter(ICacheWriter<TKey, TValue>^ writer)
+ {
+ m_writer = writer;
+ }
+
+ virtual bool BeforeUpdate( Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev ) override
+ {
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
+ return m_writer->BeforeUpdate(%gevent);
+ }
+
+ virtual bool BeforeCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
+ {
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
+ return m_writer->BeforeCreate(%gevent);
+ }
+
+ virtual bool BeforeDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
+ {
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
+ return m_writer->BeforeDestroy(%gevent);
+ }
+
+ virtual bool BeforeRegionClear( Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev ) override
+ {
+ RegionEvent<TKey, TValue> gevent(ev->GetNative());
+ return m_writer->BeforeRegionClear(%gevent);
+ }
+
+ virtual bool BeforeRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev) override
+ {
+ RegionEvent<TKey, TValue> gevent(ev->GetNative());
+ return m_writer->BeforeRegionDestroy(%gevent);
+ }
+
+ virtual void Close(Apache::Geode::Client::Region<Object^, Object^>^ region) override
+ {
+ m_writer->Close((IRegion<TKey, TValue>^) region);
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CliCallbackDelgate.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CliCallbackDelgate.cpp b/clicache/src/impl/CliCallbackDelgate.cpp
new file mode 100644
index 0000000..acb0c6c
--- /dev/null
+++ b/clicache/src/impl/CliCallbackDelgate.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#include "CliCallbackDelgate.hpp"
+
+#include "begin_native.hpp"
+#include "CacheRegionHelper.hpp"
+#include "end_native.hpp"
+
+#include "../Cache.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ void CliCallbackDelegate::Callback(apache::geode::client::Cache& cache)
+ {
+ Apache::Geode::Client::Log::Fine("CliCallbackDelgate::Callback( ) ");
+ CacheRegionHelper::getCacheImpl(&cache)->getPdxTypeRegistry()->clear();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CliCallbackDelgate.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CliCallbackDelgate.hpp b/clicache/src/impl/CliCallbackDelgate.hpp
new file mode 100755
index 0000000..4029652
--- /dev/null
+++ b/clicache/src/impl/CliCallbackDelgate.hpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include "../Serializable.hpp"
+#include "ManagedCacheableKey.hpp"
+#include "SafeConvert.hpp"
+#include "../Log.hpp"
+#include "PdxTypeRegistry.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ ref class Cache;
+ /// <summary>
+ /// to get the callback from c++ layer
+ /// </summary>
+ ref class CliCallbackDelegate
+ {
+ public:
+
+ CliCallbackDelegate()
+ {}
+
+ void Callback(apache::geode::client::Cache& cache);
+
+ CliCallbackDelegate(const CliCallbackDelegate^ other){}
+ private:
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/CqListenerProxy.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/CqListenerProxy.hpp b/clicache/src/impl/CqListenerProxy.hpp
new file mode 100644
index 0000000..86ae462
--- /dev/null
+++ b/clicache/src/impl/CqListenerProxy.hpp
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+//#include "../geode_includes.hpp"
+//#include "../../../ICqListener.hpp"
+//#include "../../../CqListener.hpp"
+#include "../ICqListener.hpp"
+#include "SafeConvert.hpp"
+using namespace System;
+
+//using namespace Apache::Geode::Client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TResult>
+ public ref class CqListenerGeneric : Apache::Geode::Client::ICqListener<Object^, Object^>
+ {
+ private:
+
+ ICqListener<TKey, TResult>^ m_listener;
+
+ public:
+
+ virtual void AddCqListener(ICqListener<TKey, TResult>^ listener)
+ {
+ m_listener = listener;
+ }
+
+ virtual void OnEvent( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
+ {
+ //TODO:split---Done
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
+ m_listener->OnEvent(%gevent);
+ }
+
+ virtual void OnError(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
+ {
+ //TODO::split--Done
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
+ m_listener->OnError(%gevent);
+ }
+
+ virtual void Close()
+ {
+ m_listener->Close();
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[19/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExceptionTypes.cpp b/clicache/src/ExceptionTypes.cpp
new file mode 100644
index 0000000..e8eeb0c
--- /dev/null
+++ b/clicache/src/ExceptionTypes.cpp
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+#include "ExceptionTypes.hpp"
+#include <cstdlib>
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+#define _GF_MG_EXCEPTION_ADD3(x) { "apache::geode::client::" #x, gcnew CreateException2( x::Create ) }
+#define _GF_MG_EXCEPTION_ADD4(x,y) { "apache::geode::client::" #y, gcnew CreateException2( x::Create ) }
+
+ Dictionary<String^, CreateException2^>^ GeodeException::Init( )
+ {
+ if (Native2ManagedExMap != nullptr)
+ {
+ return Native2ManagedExMap;
+ }
+ array<NameDelegatePair>^ exNamesDelegates = gcnew array<NameDelegatePair> {
+ _GF_MG_EXCEPTION_ADD3( AssertionException ),
+ _GF_MG_EXCEPTION_ADD3( IllegalArgumentException ),
+ _GF_MG_EXCEPTION_ADD3( IllegalStateException ),
+ _GF_MG_EXCEPTION_ADD3( CacheExistsException ),
+ _GF_MG_EXCEPTION_ADD3( CacheXmlException ),
+ _GF_MG_EXCEPTION_ADD3( TimeoutException ),
+ _GF_MG_EXCEPTION_ADD3( CacheWriterException ),
+ _GF_MG_EXCEPTION_ADD3( CacheListenerException ),
+ _GF_MG_EXCEPTION_ADD3( RegionExistsException ),
+ _GF_MG_EXCEPTION_ADD3( CacheClosedException ),
+ _GF_MG_EXCEPTION_ADD3( LeaseExpiredException ),
+ _GF_MG_EXCEPTION_ADD3( CacheLoaderException ),
+ _GF_MG_EXCEPTION_ADD3( RegionDestroyedException ),
+ _GF_MG_EXCEPTION_ADD3( EntryDestroyedException ),
+ _GF_MG_EXCEPTION_ADD3( NoSystemException ),
+ _GF_MG_EXCEPTION_ADD3( AlreadyConnectedException ),
+ _GF_MG_EXCEPTION_ADD3( FileNotFoundException ),
+ _GF_MG_EXCEPTION_ADD3( InterruptedException ),
+ _GF_MG_EXCEPTION_ADD3( UnsupportedOperationException ),
+ _GF_MG_EXCEPTION_ADD3( StatisticsDisabledException ),
+ _GF_MG_EXCEPTION_ADD3( ConcurrentModificationException ),
+ _GF_MG_EXCEPTION_ADD3( UnknownException ),
+ _GF_MG_EXCEPTION_ADD3( ClassCastException ),
+ _GF_MG_EXCEPTION_ADD3( EntryNotFoundException ),
+ _GF_MG_EXCEPTION_ADD4( GeodeIOException, GeodeIOException ),
+ _GF_MG_EXCEPTION_ADD4( GeodeConfigException, GeodeConfigException ),
+ _GF_MG_EXCEPTION_ADD3( NullPointerException ),
+ _GF_MG_EXCEPTION_ADD3( EntryExistsException ),
+ _GF_MG_EXCEPTION_ADD3( NotConnectedException ),
+ _GF_MG_EXCEPTION_ADD3( CacheProxyException ),
+ _GF_MG_EXCEPTION_ADD3( OutOfMemoryException ),
+ _GF_MG_EXCEPTION_ADD3( NotOwnerException ),
+ _GF_MG_EXCEPTION_ADD3( WrongRegionScopeException ),
+ _GF_MG_EXCEPTION_ADD3( BufferSizeExceededException ),
+ _GF_MG_EXCEPTION_ADD3( RegionCreationFailedException ),
+ _GF_MG_EXCEPTION_ADD3( FatalInternalException ),
+ _GF_MG_EXCEPTION_ADD3( DiskFailureException ),
+ _GF_MG_EXCEPTION_ADD3( DiskCorruptException ),
+ _GF_MG_EXCEPTION_ADD3( InitFailedException ),
+ _GF_MG_EXCEPTION_ADD3( ShutdownFailedException ),
+ _GF_MG_EXCEPTION_ADD3( CacheServerException ),
+ _GF_MG_EXCEPTION_ADD3( OutOfRangeException ),
+ _GF_MG_EXCEPTION_ADD3( QueryException ),
+ _GF_MG_EXCEPTION_ADD3( MessageException ),
+ _GF_MG_EXCEPTION_ADD3( NotAuthorizedException ),
+ _GF_MG_EXCEPTION_ADD3( AuthenticationFailedException ),
+ _GF_MG_EXCEPTION_ADD3( AuthenticationRequiredException ),
+ _GF_MG_EXCEPTION_ADD3( DuplicateDurableClientException ),
+ _GF_MG_EXCEPTION_ADD3( NoAvailableLocatorsException ),
+ _GF_MG_EXCEPTION_ADD3( FunctionExecutionException ),
+ _GF_MG_EXCEPTION_ADD3( CqInvalidException ),
+ _GF_MG_EXCEPTION_ADD3( CqExistsException ),
+ _GF_MG_EXCEPTION_ADD3( CqQueryException ),
+ _GF_MG_EXCEPTION_ADD3( CqClosedException ),
+ _GF_MG_EXCEPTION_ADD3( CqException ),
+ _GF_MG_EXCEPTION_ADD3( AllConnectionsInUseException ),
+ _GF_MG_EXCEPTION_ADD3( InvalidDeltaException ),
+ _GF_MG_EXCEPTION_ADD3( KeyNotFoundException ),
+ _GF_MG_EXCEPTION_ADD3( CommitConflictException ),
+ _GF_MG_EXCEPTION_ADD3( TransactionDataNodeHasDepartedException ),
+ _GF_MG_EXCEPTION_ADD3( TransactionDataRebalancedException )
+ };
+
+ Native2ManagedExMap = gcnew Dictionary<String^, CreateException2^>( );
+ for (System::Int32 index = 0; index < exNamesDelegates->Length; index++)
+ {
+ Native2ManagedExMap[ exNamesDelegates[ index ].m_name ] =
+ exNamesDelegates[ index ].m_delegate;
+ }
+ return Native2ManagedExMap;
+ }
+
+ System::Exception^ GeodeException::Get(const apache::geode::client::Exception& nativeEx)
+ {
+ Exception^ innerException = nullptr;
+ const apache::geode::client::ExceptionPtr& cause = nativeEx.getCause();
+ if (cause != nullptr) {
+ innerException = GeodeException::Get(*cause);
+ }
+ String^ exName = gcnew String( nativeEx.getName( ) );
+ CreateException2^ exDelegate;
+ if (Native2ManagedExMap->TryGetValue(exName, exDelegate)) {
+ return exDelegate(nativeEx, innerException);
+ }
+ String^ exMsg = ManagedString::Get( nativeEx.getMessage( ) );
+ if ( exMsg->StartsWith( GeodeException::MgSysExPrefix ) ) {
+ // Get the exception type
+ String^ mgExStr = exMsg->Substring(
+ GeodeException::MgSysExPrefix->Length );
+ System::Int32 colonIndex = mgExStr->IndexOf( ':' );
+ if ( colonIndex > 0 ) {
+ String^ mgExName = mgExStr->Substring( 0, colonIndex )->Trim( );
+ // Try to load this class by reflection
+ Type^ mgExType = Type::GetType( mgExName, false, true );
+ if ( mgExType != nullptr ) {
+ System::Reflection::ConstructorInfo^ cInfo = mgExType->
+ GetConstructor(gcnew array<Type^>{ String::typeid, Exception::typeid });
+ if ( cInfo != nullptr ) {
+ String^ mgMsg = mgExStr->Substring( colonIndex + 1 );
+ Exception^ mgEx = dynamic_cast<Exception^>(cInfo->Invoke(
+ gcnew array<Object^>{ mgMsg, innerException }));
+ if ( mgEx != nullptr ) {
+ return mgEx;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ }
+ if (innerException == nullptr) {
+ return gcnew GeodeException(exName + ": " + exMsg,
+ gcnew GeodeException(GetStackTrace(nativeEx)));
+ }
+ else {
+ return gcnew GeodeException(exName + ": " + exMsg, innerException);
+ }
+ }
+ } // end namespace generic
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExceptionTypes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExceptionTypes.hpp b/clicache/src/ExceptionTypes.hpp
new file mode 100644
index 0000000..491dfcb
--- /dev/null
+++ b/clicache/src/ExceptionTypes.hpp
@@ -0,0 +1,686 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/ExceptionTypes.hpp>
+#include "end_native.hpp"
+
+#include "impl/ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace System::Runtime::Serialization;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class GeodeException;
+
+ /// <summary>
+ /// Factory delegate to create a managed Geode exception.
+ /// </summary>
+ /// <remarks>
+ /// For each managed exception class, its factory delegate is registered
+ /// and maintained in a static dictionary mapped to its corresponding
+ /// native Geode C++ exception name.
+ /// </remarks>
+ delegate GeodeException^ CreateException2(
+ const apache::geode::client::Exception& nativeEx, System::Exception^ innerException);
+
+ /// <summary>
+ /// The base exception class of all managed Geode exceptions.
+ /// </summary>
+ [Serializable]
+ public ref class GeodeException
+ : public System::Exception
+ {
+ private:
+
+ /// <summary>
+ /// Prefix for distiguishing managed system exceptions
+ /// </summary>
+ literal String^ MgSysExPrefix = "GFCLI_EXCEPTION:";
+
+ /// <summary>
+ /// This contains a mapping of the native Geode exception class
+ /// name to the factory delegate of the corresponding managed Geode
+ /// exception class.
+ /// </summary>
+ static Dictionary<String^, CreateException2^>^ Native2ManagedExMap =
+ Init( );
+
+ /// <summary>
+ /// Name and delegate pair class. The Native2ManagedExMap dictionary
+ /// is populated from a static array of this class.
+ /// </summary>
+ value class NameDelegatePair
+ {
+ public:
+
+ /// <summary>
+ /// The name of the native Geode exception class.
+ /// </summary>
+ String^ m_name;
+
+ /// <summary>
+ /// The factory delegate of the managed Geode exception class
+ /// corresponding to <c>m_name</c>
+ /// </summary>
+ CreateException2^ m_delegate;
+ };
+
+
+ internal:
+
+ /// <summary>
+ /// Static method to associate the native exception names with
+ /// the corresponding managed exception factory delegates.
+ /// </summary>
+ /// <remarks>
+ /// This method is not thread-safe and should be called in a single thread.
+ /// </remarks>
+ static Dictionary<String^, CreateException2^>^ Init( );
+
+ /// <summary>
+ /// Create the managed Geode exception for a given native Geode exception.
+ /// As a special case normal system exceptions are also created when the
+ /// native exception is a wrapper of a managed system exception.
+ /// </summary>
+ /// <remarks>
+ /// Wherever the native Geode C++ code raises a <c>apache::geode::client::Exception</c>,
+ /// the CLI wrapper code should have a catch-all for those and use
+ /// this function to create the corresponding managed Geode exception.
+ /// If no managed Geode exception has been defined (or has not been
+ /// added using _GF_MG_EXCEPTION_ADD3 in ExceptionTypesMN.cpp) then a
+ /// generic <c>GeodeException</c> exception is returned.
+ /// </remarks>
+ /// <param name="nativeEx">The native Geode exception object</param>
+ /// <returns>
+ /// The managed Geode exception object corresponding to the provided
+ /// native Geode exception object.
+ /// </returns>
+ static Exception^ Get(const apache::geode::client::Exception& nativeEx);
+
+ /// <summary>
+ /// Get the stack trace for the given native exception.
+ /// </summary>
+ /// <param name="nativeEx">The native Geode exception object</param>
+ /// <returns>The stack trace of the native exception.</returns>
+ inline static String^ GetStackTrace(
+ const apache::geode::client::Exception& nativeEx )
+ {
+ char nativeExStack[2048] = { '\0' };
+#ifndef _WIN64
+ nativeEx.getStackTrace(nativeExStack, 2047);
+#endif
+ return ManagedString::Get(nativeExStack);
+ }
+
+ /// <summary>
+ /// Gets the C++ native exception object for a given managed exception.
+ /// </summary>
+ /// <remarks>
+ /// This method is to handle conversion of managed exceptions to
+ /// C++ exception for those thrown by managed callbacks.
+ /// For non-Geode .NET exceptions we wrap it inside the generic
+ /// <c>GeodeException</c> with a special prefix in message.
+ /// While converting the exception back from C++ to .NET if the
+ /// prefix is found in the message, then it tries to construct
+ /// the original exception by reflection on the name of exception
+ /// contained in the message. Note that in this process the
+ /// original stacktrace is appended to the message of the exception.
+ /// </remarks>
+ inline static apache::geode::client::ExceptionPtr GetNative(Exception^ ex)
+ {
+ if (ex != nullptr) {
+ GeodeException^ gfEx = dynamic_cast<GeodeException^>(ex);
+ if (gfEx != nullptr) {
+ return gfEx->GetNative();
+ }
+ else {
+ apache::geode::client::ExceptionPtr cause;
+ if (ex->InnerException != nullptr) {
+ cause = GeodeException::GetNative(ex->InnerException);
+ }
+ ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+ return std::make_shared<apache::geode::client::Exception>(
+ mg_exStr.CharPtr, __nullptr, false, cause);
+ }
+ }
+ return nullptr;
+ }
+
+ /// <summary>
+ /// Gets the C++ native exception object for this managed
+ /// <c>GeodeException</c>.
+ /// </summary>
+ virtual apache::geode::client::ExceptionPtr GetNative()
+ {
+ String^ msg = this->Message + ": " + this->StackTrace;
+ ManagedString mg_msg(msg);
+ apache::geode::client::ExceptionPtr cause;
+ if (this->InnerException != nullptr) {
+ cause = GeodeException::GetNative(this->InnerException);
+ }
+ return std::make_shared<apache::geode::client::Exception>(mg_msg.CharPtr,
+ __nullptr, false, cause);
+ }
+
+ /// <summary>
+ /// Throws the C++ native exception object for the given .NET exception.
+ /// </summary>
+ /// <remarks>
+ /// This method is to handle conversion of managed exceptions to
+ /// C++ exception for those thrown by managed callbacks.
+ /// For non-Geode .NET exceptions we wrap it inside the generic
+ /// <c>GeodeException</c> with a special prefix in message.
+ /// While converting the exception back from C++ to .NET if the
+ /// prefix is found in the message, then it tries to construct
+ /// the original exception by reflection on the name of exception
+ /// contained in the message. Note that in this process the
+ /// original stacktrace is appended to the message of the exception.
+ /// </remarks>
+ inline static void ThrowNative(Exception^ ex)
+ {
+ if (ex != nullptr) {
+ apache::geode::client::ExceptionPtr cause;
+ if (ex->InnerException != nullptr) {
+ cause = GeodeException::GetNative(ex->InnerException);
+ }
+ ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
+ throw apache::geode::client::Exception(mg_exStr.CharPtr, NULL, false, cause);
+ }
+ }
+
+ /// <summary>
+ /// Throws the C++ native exception object for this managed
+ /// <c>GeodeException</c>.
+ /// </summary>
+ inline void ThrowNative()
+ {
+ GetNative()->raise();
+ }
+
+
+ public:
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline GeodeException( )
+ : Exception( ) { }
+
+ /// <summary>
+ /// Constructor to create an exception object with the given message.
+ /// </summary>
+ /// <param name="message">The exception message.</param>
+ inline GeodeException( String^ message )
+ : Exception( message ) { }
+
+ /// <summary>
+ /// Constructor to create an exception object with the given message
+ /// and with the given inner exception.
+ /// </summary>
+ /// <param name="message">The exception message.</param>
+ /// <param name="innerException">The inner exception object.</param>
+ inline GeodeException( String^ message, System::Exception^ innerException )
+ : Exception( message, innerException ) { }
+
+ protected:
+
+ /// <summary>
+ /// Initializes a new instance of the <c>GeodeException</c> class with
+ /// serialized data.
+ /// This allows deserialization of this exception in .NET remoting.
+ /// </summary>
+ /// <param name="info">
+ /// holds the serialized object data about
+ /// the exception being thrown
+ /// </param>
+ /// <param name="context">
+ /// contains contextual information about
+ /// the source or destination
+ /// </param>
+ inline GeodeException( SerializationInfo^ info, StreamingContext context )
+ : Exception( info, context ) { }
+ };
+
+/// Handle geode exceptions from native layer and convert to managed
+/// exceptions.
+#define _GF_MG_EXCEPTION_TRY2 \
+ try {
+#define _GF_MG_EXCEPTION_CATCH_ALL2 \
+ } \
+ catch (const apache::geode::client::Exception& ex) { \
+ throw Apache::Geode::Client::GeodeException::Get(ex); \
+ } \
+ catch (System::AccessViolationException^ ex) { \
+ throw ex; \
+ }
+
+
+/// Creates a class <c>x</c> named for each exception <c>y</c>.
+#define _GF_MG_EXCEPTION_DEF4(x,y) \
+ [Serializable] \
+ public ref class x: public GeodeException \
+ { \
+ public: \
+ \
+ /** <summary>Default constructor</summary> */ \
+ x( ) \
+ : GeodeException( ) { } \
+ \
+ /** <summary>
+ * Constructor to create an exception object with the given message.
+ * </summary>
+ * <param name="message">The exception message.</param>
+ */ \
+ x( String^ message ) \
+ : GeodeException( message ) { } \
+ \
+ /** <summary>
+ * Constructor to create an exception object with the given message
+ * and with the given inner exception.
+ * </summary>
+ * <param name="message">The exception message.</param>
+ * <param name="innerException">The inner exception object.</param>
+ */ \
+ x( String^ message, System::Exception^ innerException ) \
+ : GeodeException( message, innerException ) { } \
+ \
+ protected: \
+ \
+ /** <summary>
+ * Initializes a new instance of the class with serialized data.
+ * This allows deserialization of this exception in .NET remoting.
+ * </summary>
+ * <param name="info">
+ * holds the serialized object data about the exception being thrown
+ * </param>
+ * <param name="context">
+ * contains contextual information about the source or destination
+ * </param>
+ */ \
+ x( SerializationInfo^ info, StreamingContext context ) \
+ : GeodeException( info, context ) { } \
+ \
+ internal: \
+ x(const apache::geode::client::y& nativeEx) \
+ : GeodeException(ManagedString::Get(nativeEx.getMessage()), \
+ gcnew GeodeException(GeodeException::GetStackTrace( \
+ nativeEx))) { } \
+ \
+ x(const apache::geode::client::y& nativeEx, Exception^ innerException) \
+ : GeodeException(ManagedString::Get(nativeEx.getMessage()), \
+ innerException) { } \
+ \
+ static GeodeException^ Create(const apache::geode::client::Exception& ex, \
+ Exception^ innerException) \
+ { \
+ const apache::geode::client::y* nativeEx = dynamic_cast<const apache::geode::client::y*>( &ex ); \
+ if (nativeEx != nullptr) { \
+ if (innerException == nullptr) { \
+ return gcnew x(*nativeEx); \
+ } \
+ else { \
+ return gcnew x(*nativeEx, innerException); \
+ } \
+ } \
+ return nullptr; \
+ } \
+ virtual apache::geode::client::ExceptionPtr GetNative() override \
+ { \
+ String^ msg = this->Message + ": " + this->StackTrace; \
+ ManagedString mg_msg(msg); \
+ apache::geode::client::ExceptionPtr cause; \
+ if (this->InnerException != nullptr) { \
+ cause = GeodeException::GetNative(this->InnerException); \
+ } \
+ return std::make_shared<apache::geode::client::y>(mg_msg.CharPtr, \
+ __nullptr, false, cause); \
+ } \
+ }
+
+/// Creates a class named for each exception <c>x</c>.
+#define _GF_MG_EXCEPTION_DEF3(x) _GF_MG_EXCEPTION_DEF4(x,x)
+
+
+ // For all the native Geode C++ exceptions, a corresponding definition
+ // should be added below *AND* it should also be added to the static array
+ // in ExceptionTypesMN.cpp using _GF_MG_EXCEPTION_ADD3( x )
+
+ /// <summary>
+ /// A geode assertion exception.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( AssertionException );
+
+ /// <summary>
+ /// Thrown when an argument to a method is illegal.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( IllegalArgumentException );
+
+ /// <summary>
+ /// Thrown when the state of cache is manipulated to be illegal.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( IllegalStateException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to create an existing cache.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheExistsException );
+
+ /// <summary>
+ /// Thrown when the cache xml is incorrect.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheXmlException );
+
+ /// <summary>
+ /// Thrown when a timout occurs.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( TimeoutException );
+
+ /// <summary>
+ /// Thrown when the cache writer aborts the operation.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheWriterException );
+
+ /// <summary>
+ /// Thrown when the cache listener throws an exception.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheListenerException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to create an existing region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( RegionExistsException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a closed cache.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheClosedException );
+
+ /// <summary>
+ /// Thrown when lease of cache proxy has expired.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( LeaseExpiredException );
+
+ /// <summary>
+ /// Thrown when the cache loader aborts the operation.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheLoaderException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a destroyed region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( RegionDestroyedException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a destroyed entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( EntryDestroyedException );
+
+ /// <summary>
+ /// Thrown when the connecting target is not running.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NoSystemException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to connect to
+ /// DistributedSystem second time.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( AlreadyConnectedException );
+
+ /// <summary>
+ /// Thrown when a non-existing file is accessed.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( FileNotFoundException );
+
+ /// <summary>
+ /// Thrown when an operation is interrupted.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( InterruptedException );
+
+ /// <summary>
+ /// Thrown when an operation unsupported by the
+ /// current configuration is attempted.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( UnsupportedOperationException );
+
+ /// <summary>
+ /// Thrown when statistics are invoked for a region where
+ /// they are disabled.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( StatisticsDisabledException );
+
+ /// <summary>
+ /// Thrown when a concurrent operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( ConcurrentModificationException );
+
+ /// <summary>
+ /// An unknown exception occurred.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( UnknownException );
+
+ /// <summary>
+ /// Thrown when a cast operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( ClassCastException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted on a non-existent entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( EntryNotFoundException );
+
+ /// <summary>
+ /// Thrown when there is an input/output error.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF4( GeodeIOException, GeodeIOException );
+
+ /// <summary>
+ /// Thrown when geode configuration file is incorrect.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF4( GeodeConfigException, GeodeConfigException );
+
+ /// <summary>
+ /// Thrown when a null argument is provided to a method
+ /// where it is expected to be non-null.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NullPointerException );
+
+ /// <summary>
+ /// Thrown when attempt is made to create an existing entry.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( EntryExistsException );
+
+ /// <summary>
+ /// Thrown when an operation is attempted before connecting
+ /// to the distributed system.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NotConnectedException );
+
+ /// <summary>
+ /// Thrown when there is an error in the cache proxy.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheProxyException );
+
+ /// <summary>
+ /// Thrown when the system cannot allocate any more memory.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( OutOfMemoryException );
+
+ /// <summary>
+ /// Thrown when an attempt is made to release a lock not
+ /// owned by the thread.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NotOwnerException );
+
+ /// <summary>
+ /// Thrown when a region is created in an incorrect scope.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( WrongRegionScopeException );
+
+ /// <summary>
+ /// Thrown when the internal buffer size is exceeded.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( BufferSizeExceededException );
+
+ /// <summary>
+ /// Thrown when a region creation operation fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( RegionCreationFailedException );
+
+ /// <summary>
+ /// Thrown when there is a fatal internal exception in Geode.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( FatalInternalException );
+
+ /// <summary>
+ /// Thrown by the persistence manager when a write
+ /// fails due to disk failure.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( DiskFailureException );
+
+ /// <summary>
+ /// Thrown by the persistence manager when the data
+ /// to be read from disk is corrupt.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( DiskCorruptException );
+
+ /// <summary>
+ /// Thrown when persistence manager fails to initialize.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( InitFailedException );
+
+ /// <summary>
+ /// Thrown when persistence manager fails to close properly.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( ShutdownFailedException );
+
+ /// <summary>
+ /// Thrown when an exception occurs on the cache server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CacheServerException );
+
+ /// <summary>
+ /// Thrown when bound of array/vector etc. is exceeded.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( OutOfRangeException );
+
+ /// <summary>
+ /// Thrown when query exception occurs at the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( QueryException );
+
+ /// <summary>
+ /// Thrown when an unknown message is received from the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( MessageException );
+
+ /// <summary>
+ /// Thrown when a client operation is not authorized on the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NotAuthorizedException );
+
+ /// <summary>
+ /// Thrown when authentication to the server fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( AuthenticationFailedException );
+
+ /// <summary>
+ /// Thrown when credentials are not provided to a server which expects them.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( AuthenticationRequiredException );
+
+ /// <summary>
+ /// Thrown when a duplicate durable client id is provided to the server.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( DuplicateDurableClientException );
+
+ /// <summary>
+ /// Thrown when a client is unable to contact any locators.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( NoAvailableLocatorsException );
+
+ /// <summary>
+ /// Thrown when all connections in a pool are in use..
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( AllConnectionsInUseException );
+
+ /// <summary>
+ /// Thrown when cq is invalid
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CqInvalidException );
+
+ /// <summary>
+ /// Thrown when function execution failed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( FunctionExecutionException );
+
+ /// <summary>
+ /// Thrown during continuous query execution time.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CqException );
+
+ /// <summary>
+ /// Thrown if the Cq on which the operaion performed is closed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CqClosedException );
+
+ /// <summary>
+ /// Thrown if the Cq Query failed
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CqQueryException );
+
+ /// <summary>
+ /// Thrown if a Cq by this name already exists on this client
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CqExistsException );
+
+ _GF_MG_EXCEPTION_DEF3( InvalidDeltaException );
+
+ /// <summary>
+ /// Thrown if a Key is not present in the region.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( KeyNotFoundException );
+
+ /// <summary>
+ /// Thrown if commit fails.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( CommitConflictException );
+
+ /// <summary>
+ /// Thrown if transaction delegate went down.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( TransactionDataNodeHasDepartedException );
+
+ /// <summary>
+ /// Thrown if commit rebalance happens during a transaction.
+ /// </summary>
+ _GF_MG_EXCEPTION_DEF3( TransactionDataRebalancedException );
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Execution.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Execution.cpp b/clicache/src/Execution.cpp
new file mode 100644
index 0000000..2ba9187
--- /dev/null
+++ b/clicache/src/Execution.cpp
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+
+//#include "geode_includes.hpp"
+#include "Execution.hpp"
+#include "begin_native.hpp"
+#include <geode/Execution.hpp>
+#include "end_native.hpp"
+
+#include "ResultCollector.hpp"
+#include "impl/ManagedResultCollector.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ generic<class TFilter>
+ Execution<TResult>^ Execution<TResult>::WithFilter(System::Collections::Generic::ICollection<TFilter>^ routingObj)
+ {
+ if (routingObj != nullptr) {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ auto rsptr = native::CacheableVector::create();
+
+ for each(TFilter item in routingObj)
+ {
+ rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item, nullptr ));
+ }
+
+ try
+ {
+ return Execution<TResult>::Create(m_nativeptr->get()->withFilter(rsptr), this->m_rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ else {
+ throw gcnew IllegalArgumentException("Execution<TResult>::WithFilter: null TFilter provided");
+ }
+ }
+
+ generic<class TResult>
+ generic<class TArgs>
+ Execution<TResult>^ Execution<TResult>::WithArgs( TArgs args )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ auto argsptr = Serializable::GetUnmanagedValueGeneric<TArgs>( args, nullptr );
+ return Execution<TResult>::Create(m_nativeptr->get()->withArgs(argsptr), this->m_rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ Execution<TResult>^ Execution<TResult>::WithCollector(Client::IResultCollector<TResult>^ rc)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ native::ResultCollectorPtr rcptr;
+ if ( rc != nullptr ) {
+ auto rcg = gcnew ResultCollectorGeneric<TResult>();
+ rcg->SetResultCollector(rc);
+ rcptr = std::shared_ptr<native::ManagedResultCollectorGeneric>(new native::ManagedResultCollectorGeneric(rcg));
+ }
+ try
+ {
+ return Execution<TResult>::Create( m_nativeptr->get()->withCollector(rcptr), rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func, UInt32 timeout)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ ManagedString mg_function(func);
+ auto rc = m_nativeptr->get()->execute(mg_function.CharPtr, timeout);
+ if (m_rc == nullptr)
+ return gcnew ResultCollector<TResult>(rc);
+ else
+ return m_rc;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func)
+ {
+ return Execute(func, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Execution.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Execution.hpp b/clicache/src/Execution.hpp
new file mode 100644
index 0000000..44fcf44
--- /dev/null
+++ b/clicache/src/Execution.hpp
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/Execution.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic<class TResult>
+ interface class IResultCollector;
+
+ generic<class TResult>
+ ref class ResultCollector;
+
+ /// <summary>
+ /// This class encapsulates events that occur for cq.
+ /// </summary>
+ generic<class TResult>
+ public ref class Execution sealed
+ {
+ public:
+ /// <summary>
+ /// Add a routing object,
+ /// Return self.
+ /// </summary>
+ generic<class TFilter>
+ Execution<TResult>^ WithFilter(System::Collections::Generic::ICollection<TFilter>^ routingObj);
+
+ /// <summary>
+ /// Add an argument,
+ /// Return self.
+ /// </summary>
+ generic<class TArgs>
+ Execution<TResult>^ WithArgs(TArgs args);
+
+ /// <summary>
+ /// Add a result collector,
+ /// Return self.
+ /// </summary>
+ Execution<TResult>^ WithCollector(IResultCollector<TResult>^ rc);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ /// <param name="timeout"> Value to wait for the operation to finish before timing out.</param>
+ IResultCollector<TResult>^ Execute(String^ func, UInt32 timeout);
+
+ /// <summary>
+ /// Execute a function,
+ /// Return resultCollector.
+ /// </summary>
+ IResultCollector<TResult>^ Execute(String^ func);
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Execution<TResult>^ Create( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Execution<TResult>( nativeptr, rc );
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Execution( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
+ {
+ m_rc = rc;
+ m_nativeptr = gcnew native_shared_ptr<native::Execution>(nativeptr);
+ }
+ private:
+ IResultCollector<TResult>^ m_rc;
+
+ native_shared_ptr<native::Execution>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ExpirationAction.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ExpirationAction.hpp b/clicache/src/ExpirationAction.hpp
new file mode 100644
index 0000000..c8a12bf
--- /dev/null
+++ b/clicache/src/ExpirationAction.hpp
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/ExpirationAction.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Enumerated type for expiration (LRU) actions.
+ /// Contains values for setting an action type.
+ /// </summary>
+ public enum class ExpirationAction
+ {
+ /// <summary>
+ /// When the region or cached object expires, it is invalidated.
+ /// </summary>
+ Invalidate = 0,
+
+ /// <summary>
+ /// When expired, invalidated locally only.
+ /// </summary>
+ LocalInvalidate,
+
+ /// <summary>
+ /// When the region or cached object expires, it is destroyed.
+ /// </summary>
+ Destroy,
+
+ /// <summary>
+ /// When expired, destroyed locally only.
+ /// </summary>
+ LocalDestroy,
+
+ /// <summary>Invalid action type.</summary>
+ InvalidAction
+ };
+
+
+ /// <summary>
+ /// Static class containing convenience methods for <c>ExpirationAction</c>.
+ /// </summary>
+ public ref class Expiration STATICCLASS
+ {
+ public:
+
+ /// <summary>
+ /// Returns true if this action is distributed invalidate.
+ /// </summary>
+ /// <returns>true if this an <c>Invalidate</c></returns>
+ inline static bool IsInvalidate( ExpirationAction type )
+ {
+ return (type == ExpirationAction::Invalidate);
+ }
+
+ /// <summary>
+ /// Returns true if this action is local invalidate.
+ /// </summary>
+ /// <returns>true if this is a <c>LocalInvalidate</c></returns>
+ inline static bool IsLocalInvalidate( ExpirationAction type )
+ {
+ return (type == ExpirationAction::LocalInvalidate);
+ }
+
+ /// <summary>
+ /// Returns true if this action is distributed destroy.
+ /// </summary>
+ /// <returns>true if this is <c>Destroy</c></returns>
+ inline static bool IsDestroy( ExpirationAction type )
+ {
+ return (type == ExpirationAction::Destroy);
+ }
+
+ /// <summary>
+ /// Returns true if this action is local destroy.
+ /// </summary>
+ /// <returns>true if this is <c>LocalDestroy</c></returns>
+ inline static bool IsLocalDestroy( ExpirationAction type )
+ {
+ return (type == ExpirationAction::LocalDestroy);
+ }
+
+ /// <summary>
+ /// Returns true if this action is local.
+ /// </summary>
+ /// <returns>true if this is <c>LocalInvalidate</c> or
+ /// <c>LocalDestroy</c></returns>
+ inline static bool IsLocal( ExpirationAction type )
+ {
+ return (type == ExpirationAction::LocalInvalidate) ||
+ (type == ExpirationAction::LocalDestroy);
+ }
+
+ /// <summary>
+ /// Returns true if this action is distributed.
+ /// </summary>
+ /// <returns>true if this is an <c>Invalidate</c> or
+ /// a <c>Destroy</c></returns>
+ inline static bool IsDistributed( ExpirationAction type )
+ {
+ return (type == ExpirationAction::Invalidate) ||
+ (type == ExpirationAction::Destroy);
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/FunctionService.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/FunctionService.cpp b/clicache/src/FunctionService.cpp
new file mode 100644
index 0000000..456f2e5
--- /dev/null
+++ b/clicache/src/FunctionService.cpp
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <geode/RegionService.hpp>
+#include "end_native.hpp"
+
+#include "FunctionService.hpp"
+#include "Pool.hpp"
+#include "Region.hpp"
+#include "Execution.hpp"
+
+#include "impl/AuthenticatedCache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ generic <class TResult>
+ generic <class TKey, class TValue>
+ Execution<TResult>^ FunctionService<TResult>::OnRegion( IRegion<TKey, TValue>^ rg )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ auto nativeRegion = ((Region<TKey, TValue>^)rg)->GetNative();
+ auto execution = native::FunctionService::onRegion(nativeRegion);
+ return Execution<TResult>::Create( execution, nullptr );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic <class TResult>
+ Execution<TResult>^ FunctionService<TResult>::OnServer( Pool^ pl )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ auto nativeptr = native::FunctionService::onServer(pl->GetNative());
+ return Execution<TResult>::Create( nativeptr , nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic <class TResult>
+ Execution<TResult>^ FunctionService<TResult>::OnServers( Pool^ pl )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ auto nativeptr = native::FunctionService::onServers(pl->GetNative());
+ return Execution<TResult>::Create( nativeptr , nullptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ Execution<TResult>^ FunctionService<TResult>::OnServer( IRegionService^ cache )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ if(auto realCache = dynamic_cast<Cache^>(cache))
+ {
+ auto nativeptr = native::FunctionService::onServer(realCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
+ else
+ {
+ auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ auto nativeptr = native::FunctionService::onServer(authCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ Execution<TResult>^ FunctionService<TResult>::OnServers( IRegionService^ cache )
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ if(auto realCache = dynamic_cast<Cache^>(cache))
+ {
+ auto nativeptr = native::FunctionService::onServers(realCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
+ else
+ {
+ auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ auto nativeptr = native::FunctionService::onServers(authCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/FunctionService.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/FunctionService.hpp b/clicache/src/FunctionService.hpp
new file mode 100644
index 0000000..7af9bc8
--- /dev/null
+++ b/clicache/src/FunctionService.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/FunctionService.hpp>
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // generic<class TKey, class TValue>
+ ref class Pool;
+
+ generic<class TResult>
+ ref class Execution;
+
+ /// <summary>
+ /// A factory class used to create Execute object for function execution
+ /// </summary>
+ /// <remarks>
+ generic<class TResult>
+ public ref class FunctionService
+ {
+ public:
+
+ /// <summary>
+ /// Creates a new region Execution object
+ /// </summary>
+ /// <remarks>
+ /// If Pool is multiusersecure mode then one need to pass logical instance of Region Pool->CreateSecureUserCache(<credentials>)->getRegion(<regionPath>).
+ /// </remarks>
+ generic <class TKey, class TValue>
+ static Execution<TResult>^ OnRegion( IRegion<TKey, TValue>^ rg );
+
+ /// <summary>
+ /// Creates a new Execution object on one server
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ /// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
+ static Execution<TResult>^ OnServer( Pool^ pl );
+
+ /// <summary>
+ /// Creates a new Execution object on all servers in the pool
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ /// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
+ static Execution<TResult>^ OnServers( Pool^ pl );
+
+ /// <summary>
+ /// Creates a new Execution object on one server.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ /// <exception cref="IllegalStateException">when Pool has been closed.</exception>
+ static Execution<TResult>^ OnServer( IRegionService^ cache );
+
+ /// <summary>
+ /// Creates a new Execution object on all servers in the pool.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ /// <exception cref="IllegalStateException">when Pool has been closed.</exception>
+ static Execution<TResult>^ OnServers( IRegionService^ cache );
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/GeodeClassIds.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/GeodeClassIds.hpp b/clicache/src/GeodeClassIds.hpp
new file mode 100644
index 0000000..9d6eebd
--- /dev/null
+++ b/clicache/src/GeodeClassIds.hpp
@@ -0,0 +1,372 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ struct PdxTypes
+ {
+ enum PdxTypesInternal
+ {
+ BOOLEAN,
+ BYTE,
+ CHAR,
+ SHORT,
+ INT,
+ LONG,
+ FLOAT,
+ DOUBLE,
+ DATE,
+ STRING,
+ OBJECT,
+ BOOLEAN_ARRAY,
+ CHAR_ARRAY,
+ BYTE_ARRAY,
+ SHORT_ARRAY,
+ INT_ARRAY,
+ LONG_ARRAY,
+ FLOAT_ARRAY,
+ DOUBLE_ARRAY,
+ STRING_ARRAY,
+ OBJECT_ARRAY,
+ ARRAY_OF_BYTE_ARRAYS
+ };
+ };
+
+ /// <summary>
+ /// Static class containing the classIds of the built-in cacheable types.
+ /// </summary>
+ public ref class GeodeClassIds
+ {
+ public:
+
+ /// <summary>
+ /// ClassId of <c>Properties</c> class
+ /// </summary>
+ literal System::UInt32 Properties =
+ apache::geode::client::GeodeTypeIds::Properties + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CharArray</c> class
+ /// </summary>
+ literal System::UInt32 CharArray =
+ apache::geode::client::GeodeTypeIds::CharArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>BooleanArray</c> class
+ /// </summary>
+ literal System::UInt32 BooleanArray =
+ apache::geode::client::GeodeTypeIds::BooleanArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>RegionAttributes</c> class
+ /// </summary>
+ literal System::UInt32 RegionAttributes =
+ apache::geode::client::GeodeTypeIds::RegionAttributes + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableUndefined</c> class
+ /// Implementation note: this has DSFID of FixedIDByte hence a
+ /// different increment.
+ /// </summary>
+ literal System::UInt32 CacheableUndefined =
+ apache::geode::client::GeodeTypeIds::CacheableUndefined + 0xa0000000;
+
+ literal System::UInt32 EnumInfo =
+ apache::geode::client::GeodeTypeIds::EnumInfo + 0xa0000000;
+
+ /// <summary>
+ /// ClassId of <c>Struct</c> class
+ /// </summary>
+ literal System::UInt32 Struct =
+ apache::geode::client::GeodeTypeIds::Struct + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class
+ /// </summary>
+ literal System::UInt32 CacheableString =
+ apache::geode::client::GeodeTypeIds::CacheableString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for huge strings
+ /// </summary>
+ literal System::UInt32 CacheableStringHuge =
+ apache::geode::client::GeodeTypeIds::CacheableStringHuge + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableBytes</c> class
+ /// </summary>
+ literal System::UInt32 CacheableBytes =
+ apache::geode::client::GeodeTypeIds::CacheableBytes + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16Array</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt16Array =
+ apache::geode::client::GeodeTypeIds::CacheableInt16Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt32Array</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt32Array =
+ apache::geode::client::GeodeTypeIds::CacheableInt32Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt64Array</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt64Array =
+ apache::geode::client::GeodeTypeIds::CacheableInt64Array + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFloatArray</c> class
+ /// </summary>
+ literal System::UInt32 CacheableFloatArray =
+ apache::geode::client::GeodeTypeIds::CacheableFloatArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDoubleArray</c> class
+ /// </summary>
+ literal System::UInt32 CacheableDoubleArray =
+ apache::geode::client::GeodeTypeIds::CacheableDoubleArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableVector</c> class for object arrays
+ /// </summary>
+ literal System::UInt32 CacheableObjectArray =
+ apache::geode::client::GeodeTypeIds::CacheableObjectArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableBoolean</c> class
+ /// </summary>
+ literal System::UInt32 CacheableBoolean =
+ apache::geode::client::GeodeTypeIds::CacheableBoolean + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16</c> class for wide-characters
+ /// </summary>
+ literal System::UInt32 CacheableCharacter =
+ apache::geode::client::GeodeTypeIds::CacheableWideChar + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableByte</c> class
+ /// </summary>
+ literal System::UInt32 CacheableByte =
+ apache::geode::client::GeodeTypeIds::CacheableByte + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt16</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt16 =
+ apache::geode::client::GeodeTypeIds::CacheableInt16 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt32</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt32 =
+ apache::geode::client::GeodeTypeIds::CacheableInt32 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableInt64</c> class
+ /// </summary>
+ literal System::UInt32 CacheableInt64 =
+ apache::geode::client::GeodeTypeIds::CacheableInt64 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFloat</c> class
+ /// </summary>
+ literal System::UInt32 CacheableFloat =
+ apache::geode::client::GeodeTypeIds::CacheableFloat + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDouble</c> class
+ /// </summary>
+ literal System::UInt32 CacheableDouble =
+ apache::geode::client::GeodeTypeIds::CacheableDouble + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableDate</c> class
+ /// </summary>
+ literal System::UInt32 CacheableDate =
+ apache::geode::client::GeodeTypeIds::CacheableDate + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableFileName</c> class
+ /// </summary>
+ literal System::UInt32 CacheableFileName =
+ apache::geode::client::GeodeTypeIds::CacheableFileName + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableStringArray</c> class
+ /// </summary>
+ literal System::UInt32 CacheableStringArray =
+ apache::geode::client::GeodeTypeIds::CacheableStringArray + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableVector</c> class
+ /// </summary>
+ literal System::UInt32 CacheableVector =
+ apache::geode::client::GeodeTypeIds::CacheableVector + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableStack</c> class
+ /// </summary>
+ literal System::UInt32 CacheableStack =
+ apache::geode::client::GeodeTypeIds::CacheableStack + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableArrayList</c> class
+ /// </summary>
+ literal System::UInt32 CacheableArrayList =
+ apache::geode::client::GeodeTypeIds::CacheableArrayList + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableArrayList</c> class
+ /// </summary>
+ literal System::UInt32 CacheableLinkedList =
+ apache::geode::client::GeodeTypeIds::CacheableLinkedList + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashSet</c> class
+ /// </summary>
+ literal System::UInt32 CacheableHashSet =
+ apache::geode::client::GeodeTypeIds::CacheableHashSet + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableLinkedHashSet</c> class
+ /// </summary>
+ literal System::UInt32 CacheableLinkedHashSet =
+ apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashMap</c> class
+ /// </summary>
+ literal System::UInt32 CacheableHashMap =
+ apache::geode::client::GeodeTypeIds::CacheableHashMap + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableHashTable</c> class
+ /// </summary>
+ literal System::UInt32 CacheableHashTable =
+ apache::geode::client::GeodeTypeIds::CacheableHashTable + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableIdentityHashMap</c> class
+ /// </summary>
+ literal System::UInt32 CacheableIdentityHashMap =
+ apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap + 0x80000000;
+
+ /// <summary>
+ /// Not used.
+ /// </summary>
+ literal System::UInt32 CacheableTimeUnit =
+ apache::geode::client::GeodeTypeIds::CacheableTimeUnit + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for null strings
+ /// </summary>
+ literal System::UInt32 CacheableNullString =
+ apache::geode::client::GeodeTypeIds::CacheableNullString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for ASCII strings
+ /// </summary>
+ literal System::UInt32 CacheableASCIIString =
+ apache::geode::client::GeodeTypeIds::CacheableASCIIString + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableString</c> class for huge ASCII strings
+ /// </summary>
+ literal System::UInt32 CacheableASCIIStringHuge =
+ apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge + 0x80000000;
+
+
+ // Built-in managed types.
+
+ /// <summary>
+ /// ClassId of <c>CacheableObject</c> class
+ /// </summary>
+ literal System::UInt32 CacheableManagedObject = 7 + 0x80000000;
+
+ /// <summary>
+ /// ClassId of <c>CacheableObjectXml</c> class
+ /// </summary>
+ literal System::UInt32 CacheableManagedObjectXml = 8 + 0x80000000;
+ internal:
+
+ literal System::UInt32 PdxType = apache::geode::client::GeodeTypeIds::PdxType + 0x80000000;
+
+ literal System::UInt32 DATA_SERIALIZABLE = 45;
+ literal System::UInt32 JAVA_CLASS = 43;
+
+ //internal geode typeids..
+ /* literal Byte USERCLASS = 40;
+ literal Byte USERMAP = 94;
+ literal Byte USERCOLLECTION = 95;
+ literal Byte ARRAYOFBYTEARRAYS = 91;
+ literal Byte GEODEREGION = 98;
+
+ literal Byte BOOLEAN_TYPE = 17;
+ literal Byte CHARACTER_TYPE = 18;
+ literal Byte BYTE_TYPE = 19;
+ literal Byte SHORT_TYPE = 20;
+ literal Byte INTEGER_TYPE = 21;
+ literal Byte LONG_TYPE = 22;
+ literal Byte FLOAT_TYPE = 23;
+ literal Byte DOUBLE_TYPE = 24;
+ literal Byte VOID_TYPE = 25; */
+
+ literal Byte PDX = 93;
+ literal Byte PDX_ENUM = 94;
+
+ literal Byte BYTE_SIZE = 1;
+
+ literal Byte BOOLEAN_SIZE = 1;
+
+ literal Byte CHAR_SIZE = 2;
+
+ literal Byte SHORT_SIZE = 2;
+
+ literal Byte INTEGER_SIZE = 4;
+
+ literal Byte FLOAT_SIZE = 4;
+
+ literal Byte LONG_SIZE = 8;
+
+ literal Byte DOUBLE_SIZE = 8;
+
+ literal Byte DATE_SIZE = 8;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/IAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/IAuthInitialize.hpp b/clicache/src/IAuthInitialize.hpp
new file mode 100644
index 0000000..1b7decc
--- /dev/null
+++ b/clicache/src/IAuthInitialize.hpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+#include "Properties.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Specifies the mechanism to obtain credentials for a client.
+ /// It is mandantory for clients when the server is running in secure
+ /// mode having a <c>security-client-authenticator</c> module specified.
+ /// Implementations should register the library path as
+ /// <c>security-client-auth-library</c> system property and factory
+ /// function (a zero argument function returning pointer to an
+ /// AuthInitialize object) as the <c>security-client-auth-factory</c>
+ /// system property.
+ ///
+ /// For a managed class implementing <c>IAuthInitialize</c> the fully
+ /// qualified name of the factory function should be provided in the
+ /// form {Namespace}.{Class Name}.{Method Name} as the
+ /// <c>security-client-auth-factory</c> property.
+ /// </summary>
+ public interface class IAuthInitialize
+ {
+ public:
+
+ /// <summary>
+ /// Initialize with the given set of security properties
+ /// return the credentials for the client as properties.
+ /// </summary>
+ /// <param name="props">
+ /// the set of <c>security-*</c> properties provided to the
+ /// <see cref="DistributedSystem.connect"/> method
+ /// </param>
+ /// <param name="server">
+ /// the ID of the current endpoint in the format "host:port"
+ /// </param>
+ /// <returns>
+ /// the credentials to be used for the given server
+ /// </returns>
+ /// <remarks>
+ /// This method can modify the given set of properties. For
+ /// example it may invoke external agents or even interact with
+ /// the user.
+ /// </remarks>
+ //generic <class TPropKey, class TPropValue>
+ Properties<String^, Object^>^ GetCredentials(Properties<String^, String^>^ props, String^ server);
+
+ /// <summary>
+ /// Invoked before the cache goes down.
+ /// </summary>
+ void Close();
+
+ delegate Properties<String^, Object^>^ GetCredentialsDelegate(Properties<String^, String^>^ props, String^ server);
+ delegate void CloseDelegate();
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheListener.hpp b/clicache/src/ICacheListener.hpp
new file mode 100644
index 0000000..a61632e
--- /dev/null
+++ b/clicache/src/ICacheListener.hpp
@@ -0,0 +1,210 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "IRegion.hpp"
+//#include "Region.hpp"
+
+#include "EntryEvent.hpp"
+#include "RegionEvent.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// An application plug-in that can be installed on a region.
+ /// </summary>
+ /// <remarks>
+ /// Listeners are change notifications that are invoked
+ /// AFTER the change has occured for region update operations on a client.
+ /// Listeners also receive notifications when entries in a region are modified.
+ /// Multiple events can cause concurrent invocation
+ /// of <c>ICacheListener</c> methods. If event A occurs before event B,
+ /// there is no guarantee that their corresponding <c>ICacheListener</c>
+ /// method invocations will occur in the same order. Any exceptions thrown by
+ /// the listener are caught by Geode and logged. If the exception is due to
+ /// listener invocation on the same thread where a region operation has been
+ /// performed, then a <c>CacheListenerException</c> is thrown back to
+ /// the application. If the exception is for a notification received from
+ /// server then that is logged and the notification thread moves on to
+ /// receiving other notifications.
+ /// <para>
+ /// A cache listener is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ ///
+ /// There are two cases in which listeners are invoked. The first is when a
+ /// region modification operation (e.g. put, create, destroy, invalidate)
+ /// is performed. For this case it is important to ensure that minimal work is
+ /// done in the listener before returning control back to Geode since the
+ /// operation will block till the listener has not completed. For example,
+ /// a listener implementation may choose to hand off the event to a thread pool
+ /// that then processes the event on its thread rather than the listener thread.
+ /// The second is when notifications are received from java server as a result
+ /// of region register interest calls (<c>Region.RegisterKeys</c> etc),
+ /// or invalidate notifications when notify-by-subscription is false on the
+ /// server. In this case the methods of <c>ICacheListener</c> are invoked
+ /// asynchronously (i.e. does not block the thread that receives notification
+ /// messages). Additionally for the latter case of notifications from server,
+ /// listener is always invoked whether or not local operation is successful
+ /// e.g. if a destroy notification is received and key does not exist in the
+ /// region, the listener will still be invoked. This is different from the
+ /// first case where listeners are invoked only when the region update
+ /// operation succeeds.
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheListener" />
+ /// <seealso cref="RegionAttributes.CacheListener" />
+ /// <seealso cref="ICacheLoader" />
+ /// <seealso cref="ICacheWriter" />
+ /// <seealso cref="CacheListenerException" />
+ generic<class TKey, class TValue>
+ public interface class ICacheListener
+ {
+ public:
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <param name="ev">
+ /// Denotes the event object associated with the entry creation.
+ /// </param>
+ /// <seealso cref="Region.Create" />
+ /// <seealso cref="Region.Put" />
+ /// <seealso cref="Region.Get" />
+ void AfterCreate(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry.
+ /// </param>
+ /// <seealso cref="Region.Put" />
+ void AfterUpdate(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being invalidated.
+ /// </summary>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with the entry invalidation.
+ /// </param>
+ void AfterInvalidate(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of an entry being destroyed.
+ /// </summary>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with the entry destruction.
+ /// </param>
+ /// <seealso cref="Region.Destroy" />
+ void AfterDestroy(EntryEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of a region being cleared.
+ /// </summary>
+ void AfterRegionClear(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of a region being invalidated.
+ /// </summary>
+ /// <remarks>
+ /// Events are not invoked for each individual value that is invalidated
+ /// as a result of the region being invalidated. Each subregion, however,
+ /// gets its own <c>RegionInvalidated</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region invalidation.
+ /// </param>
+ /// <seealso cref="Region.InvalidateRegion" />
+ void AfterRegionInvalidate(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of a region being destroyed.
+ /// </summary>
+ /// <remarks>
+ /// Events are not invoked for each individual entry that is destroyed
+ /// as a result of the region being destroyed. Each subregion, however,
+ /// gets its own <c>AfterRegionDestroyed</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region destruction.
+ /// </param>
+ /// <seealso cref="Region.DestroyRegion" />
+ void AfterRegionDestroy(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Handles the event of a region going live.
+ /// </summary>
+ /// <remarks>
+ /// Each subregion gets its own <c>AfterRegionLive</c> event invoked on its listener.
+ /// </remarks>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with the region going live.
+ /// </param>
+ /// <seealso cref="Cache.ReadyForEvents" />
+ void AfterRegionLive(RegionEvent<TKey, TValue>^ ev);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources,
+ /// such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// </remarks>
+ /// <param>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </param>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close(IRegion<TKey, TValue>^ region);
+
+ ///<summary>
+ ///Called when all the endpoints associated with region are down.
+ ///This will be called when all the endpoints are down for the first time.
+ ///If endpoints come up and again go down it will be called again.
+ ///This will also be called when all endpoints are down and region is attached to the pool.
+ ///</summary>
+ ///<remarks>
+ ///</remark>
+ ///<param>
+ ///region Region^ denotes the assosiated region.
+ ///</param>
+ void AfterRegionDisconnected(IRegion<TKey, TValue>^ region);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/ICacheLoader.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/ICacheLoader.hpp b/clicache/src/ICacheLoader.hpp
new file mode 100644
index 0000000..e5b1a8e
--- /dev/null
+++ b/clicache/src/ICacheLoader.hpp
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
+#include "IRegion.hpp"
+//#include "Region.hpp"
+//#include "ICacheableKey.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ //interface class ICacheableKey;
+
+ /// <summary>
+ /// CacheLoader
+ /// </summary>
+ /// <remarks>
+ /// CacheLoader
+ /// </remarks>
+ public ref class CacheLoader STATICCLASS
+ {
+ };
+
+ /// <summary>
+ /// A data-loading application plug-in that can be installed on a region.
+ /// </summary>
+ /// <remarks>
+ /// Loaders facilitate loading of data into the cache from a third-party data source.
+ /// When an application does a
+ /// lookup for a key in a region and it does not exist, Geode checks to
+ /// see if any loaders are available for the region in the system and
+ /// invokes them to get the value for the key into the cache.
+ /// <para>
+ /// A cache loader is defined in the <see cref="RegionAttributes" />.
+ /// </para>
+ /// When <see cref="Region.Get" /> is called for a region
+ /// entry that has a null value, the <see cref="ICacheLoader.Load" />
+ /// method of the region's cache loader is invoked. The <c>Load</c> method
+ /// creates the value for the desired key by performing an operation such
+ /// as a database query.
+ /// </remarks>
+ /// <seealso cref="AttributesFactory.SetCacheLoader" />
+ /// <seealso cref="RegionAttributes.CacheLoader" />
+ /// <seealso cref="ICacheListener" />
+ /// <seealso cref="ICacheWriter" />
+ generic<class TKey, class TValue>
+ public interface class ICacheLoader
+ {
+ public:
+
+ /// <summary>
+ /// Loads a value. Application writers should implement this
+ /// method to customize the loading of a value.
+ /// </summary>
+ /// <remarks>
+ /// This method is called
+ /// by the caching service when the requested value is not in the cache.
+ /// Any exception thrown by this method is propagated back to and thrown
+ /// by the invocation of <see cref="Region.Get" /> that triggered this load.
+ /// </remarks>
+ /// <param name="region">a Region for which this is called.</param>
+ /// <param name="key">the key for the cacheable</param>
+ /// <param name="callbackArgument">
+ /// </param>
+ /// <returns>
+ /// the value supplied for this key, or null if no value can be
+ /// supplied.
+ /// If every available loader returns
+ /// a null value, <see cref="Region.Get" /> will return null.
+ /// </returns>
+ /// <seealso cref="Region.Get" />
+ TValue Load(IRegion<TKey, TValue>^ region, TKey key,
+ Object^ callbackArgument);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external resources, such as
+ /// database connections. Any runtime exceptions this method throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Cache.Close" />
+ /// <seealso cref="Region.DestroyRegion" />
+ void Close(IRegion<TKey, TValue>^ region);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[10/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/SelectResultsIterator.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/SelectResultsIterator.cpp b/clicache/src/SelectResultsIterator.cpp
new file mode 100644
index 0000000..0ac7edc
--- /dev/null
+++ b/clicache/src/SelectResultsIterator.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+#include "SelectResultsIterator.hpp"
+#include "impl/SafeConvert.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ using namespace System;
+
+ generic<class TResult>
+ TResult SelectResultsIterator<TResult>::Current::get( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->current( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ bool SelectResultsIterator<TResult>::MoveNext( )
+ {
+ try
+ {
+ return m_nativeptr->get()->moveNext( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ void SelectResultsIterator<TResult>::Reset( )
+ {
+ try
+ {
+ m_nativeptr->get()->reset( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ TResult SelectResultsIterator<TResult>::Next( )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->next( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ bool SelectResultsIterator<TResult>::HasNext::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->hasNext();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/SelectResultsIterator.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/SelectResultsIterator.hpp b/clicache/src/SelectResultsIterator.hpp
new file mode 100644
index 0000000..0bb6191
--- /dev/null
+++ b/clicache/src/SelectResultsIterator.hpp
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/SelectResultsIterator.hpp>
+#include "end_native.hpp"
+
+#include "native_unique_ptr.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ /// <summary>
+ /// Iterator for a query result.
+ /// </summary>
+ generic<class TResult>
+ public ref class SelectResultsIterator sealed
+ : public System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>
+ {
+ public:
+
+ /// <summary>
+ /// Gets the element in the collection at the current
+ /// position of the enumerator.
+ /// </summary>
+ /// <returns>
+ /// The element in the collection at the current position
+ /// of the enumerator.
+ /// </returns>
+ virtual property /*Apache::Geode::Client::IGeodeSerializable^*/TResult Current
+ {
+ virtual /*Apache::Geode::Client::IGeodeSerializable^*/TResult get( );
+ }
+
+ /// <summary>
+ /// Advances the enumerator to the next element of the collection.
+ /// </summary>
+ /// <returns>
+ /// true if the enumerator was successfully advanced to the next
+ /// element; false if the enumerator has passed the end of
+ /// the collection.
+ /// </returns>
+ virtual bool MoveNext( );
+
+ /// <summary>
+ /// Sets the enumerator to its initial position, which is before
+ /// the first element in the collection.
+ /// </summary>
+ virtual void Reset( );
+
+ /// <summary>
+ /// Get the current element and move to the next one.
+ /// </summary>
+ /*Apache::Geode::Client::IGeodeSerializable^*/TResult Next( );
+
+ /// <summary>
+ /// Check if there is a next element.
+ /// </summary>
+ property bool HasNext
+ {
+ bool get( );
+ }
+
+ ~SelectResultsIterator() {};
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static Apache::Geode::Client::SelectResultsIterator<TResult>^ Create(
+ std::unique_ptr<native::SelectResultsIterator> nativeptr )
+ {
+ return ( nativeptr != nullptr ?
+ gcnew Apache::Geode::Client::SelectResultsIterator<TResult>( std::move(nativeptr) ) : nullptr );
+ }
+
+
+ private:
+
+ virtual property Object^ ICurrent
+ {
+ virtual Object^ get( ) sealed
+ = System::Collections::IEnumerator::Current::get
+ {
+ return Current;
+ }
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline SelectResultsIterator(
+ std::unique_ptr<native::SelectResultsIterator> nativeptr )
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::SelectResultsIterator>(std::move(nativeptr));
+ }
+
+ native_unique_ptr<native::SelectResultsIterator>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Serializable.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Serializable.cpp b/clicache/src/Serializable.cpp
new file mode 100644
index 0000000..8760bab
--- /dev/null
+++ b/clicache/src/Serializable.cpp
@@ -0,0 +1,1480 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include <SerializationRegistry.hpp>
+#include <geode/PoolManager.hpp>
+#include <CacheImpl.hpp>
+#include "CacheRegionHelper.hpp"
+#include "end_native.hpp"
+
+#include <msclr/lock.h>
+
+#include "Serializable.hpp"
+#include "impl/DelegateWrapper.hpp"
+#include "DataOutput.hpp"
+#include "DataInput.hpp"
+#include "CacheableStringArray.hpp"
+
+#include "CacheableBuiltins.hpp"
+#include "impl/SafeConvert.hpp"
+#include "CacheableHashTable.hpp"
+#include "Struct.hpp"
+#include "CacheableUndefined.hpp"
+#include "CacheableObject.hpp"
+#include "CacheableStack.hpp"
+#include "CacheableObjectXml.hpp"
+#include "CacheableHashSet.hpp"
+#include "CacheableObjectArray.hpp"
+#include "CacheableLinkedList.hpp"
+#include "CacheableFileName.hpp"
+#include "CacheableIdentityHashMap.hpp"
+#include "IPdxSerializer.hpp"
+#include "impl/DotNetTypes.hpp"
+#include "CacheRegionHelper.hpp"
+#include "Cache.hpp"
+
+#pragma warning(disable:4091)
+
+using namespace System::Reflection;
+using namespace System::Reflection::Emit;
+
+using namespace System;
+using namespace System::Collections::Generic;
+using namespace Runtime::InteropServices;
+using namespace apache::geode::client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ void Apache::Geode::Client::Serializable::ToData(
+ Apache::Geode::Client::DataOutput^ output)
+ {
+ if (output->IsManagedObject()) {
+ output->WriteBytesToUMDataOutput();
+ }
+ try
+ {
+ auto nativeOutput = output->GetNative();
+ m_nativeptr->get()->toData(*nativeOutput);
+ }
+ finally
+ {
+ GC::KeepAlive(output);
+ GC::KeepAlive(m_nativeptr);
+ }
+ if (output->IsManagedObject()) {
+ output->SetBuffer();
+ }
+ }
+
+ Apache::Geode::Client::IGeodeSerializable^
+ Apache::Geode::Client::Serializable::FromData(
+ Apache::Geode::Client::DataInput^ input)
+ {
+ if (input->IsManagedObject()) {
+ input->AdvanceUMCursor();
+ }
+ auto* nativeInput = input->GetNative();
+
+ try
+ {
+ auto temp = m_nativeptr->get()->fromData(*nativeInput);
+ if (temp != m_nativeptr->get())
+ {
+ m_nativeptr->get_shared_ptr().reset(temp);
+ }
+
+ if (input->IsManagedObject()) {
+ input->SetBuffer();
+ }
+ return this;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::UInt32 Apache::Geode::Client::Serializable::ObjectSize::get()
+ {
+ try
+ {
+ return m_nativeptr->get()->objectSize();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::UInt32 Apache::Geode::Client::Serializable::ClassId::get()
+ {
+ try
+ {
+ auto n = m_nativeptr->get();
+ int8_t typeId = n->typeId();
+ if (typeId == native::GeodeTypeIdsImpl::CacheableUserData ||
+ typeId == native::GeodeTypeIdsImpl::CacheableUserData2 ||
+ typeId == native::GeodeTypeIdsImpl::CacheableUserData4) {
+ return n->classId();
+ }
+ else {
+ return typeId + 0x80000000 + (0x20000000 * n->DSFID());
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ String^ Apache::Geode::Client::Serializable::ToString()
+ {
+ try
+ {
+ auto cStr = m_nativeptr->get()->toString();
+ if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (Byte value)
+ {
+ return (Apache::Geode::Client::Serializable^) CacheableByte::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (bool value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableBoolean::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<bool>^ value)
+ {
+ // return (Apache::Geode::Client::Serializable^)Apache::Geode::Client::CacheableBooleanArray::Create(value);
+ //TODO:split
+ return nullptr;
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<Byte>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableBytes::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (Char value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableCharacter::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<Char>^ value)
+ {
+ //return (Apache::Geode::Client::Serializable^)Apache::Geode::Client::CacheableCharArray::Create(value);
+ //TODO:split
+ return nullptr;
+
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (Double value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableDouble::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<Double>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableDoubleArray::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (Single value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableFloat::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<Single>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableFloatArray::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (System::Int16 value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableInt16::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<System::Int16>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableInt16Array::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (System::Int32 value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableInt32::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<System::Int32>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableInt32Array::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (System::Int64 value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableInt64::Create(value);
+ }
+
+ /*Apache::Geode::Client::*/Serializable::operator /*Apache::Geode::Client::*/Serializable ^ (array<System::Int64>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)Apache::Geode::Client::CacheableInt64Array::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (String^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableString::Create(value);
+ }
+
+ Apache::Geode::Client::Serializable::operator Apache::Geode::Client::Serializable ^ (array<String^>^ value)
+ {
+ return (Apache::Geode::Client::Serializable^)CacheableStringArray::Create(value);
+ }
+
+ System::Int32 Serializable::GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType, const native::Cache* cache)
+ {
+ native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(pdxType));
+ return CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetPDXIdForType(cache->getPoolManager().find(poolName), kPtr);
+ }
+
+ IGeodeSerializable^ Serializable::GetPDXTypeById(const char* poolName, System::Int32 typeId, const native::Cache* cache)
+ {
+ SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetPDXTypeById(cache->getPoolManager().find(poolName), typeId);
+ return SafeUMSerializableConvertGeneric(sPtr);
+ }
+
+ int Serializable::GetEnumValue(Internal::EnumInfo^ ei, const native::Cache* cache)
+ {
+ native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(ei));
+ return CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetEnumValue(cache->getPoolManager().getAll().begin()->second, kPtr);
+ }
+
+ Internal::EnumInfo^ Serializable::GetEnum(int val, const native::Cache* cache)
+ {
+ SerializablePtr sPtr = CacheRegionHelper::getCacheImpl(cache)->getSerializationRegistry()->GetEnum(cache->getPoolManager().getAll().begin()->second, val);
+ return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr);
+ }
+
+ void Serializable::RegisterPdxType(PdxTypeFactoryMethod^ creationMethod)
+ {
+ if (creationMethod == nullptr) {
+ throw gcnew IllegalArgumentException("Serializable.RegisterPdxType(): "
+ "null PdxTypeFactoryMethod delegate passed");
+ }
+ IPdxSerializable^ obj = creationMethod();
+ PdxDelegateMap[obj->GetType()->FullName] = creationMethod;
+ Log::Debug("RegisterPdxType: class registered: " + obj->GetType()->FullName);
+ }
+
+ Object^ Serializable::CreateObject(String^ className)
+ {
+
+ Object^ retVal = CreateObjectEx(className);
+
+ if (retVal == nullptr)
+ {
+ Type^ t = GetType(className);
+ if (t)
+ {
+ retVal = t->GetConstructor(Type::EmptyTypes)->Invoke(nullptr);
+ return retVal;
+ }
+ }
+ return retVal;
+ }
+
+ Object^ Serializable::CreateObjectEx(String^ className)
+ {
+ CreateNewObjectDelegate^ del = nullptr;
+ Dictionary<String^, CreateNewObjectDelegate^>^ tmp = ClassNameVsCreateNewObjectDelegate;
+
+ tmp->TryGetValue(className, del);
+
+ if (del != nullptr)
+ {
+ return del();
+ }
+
+ Type^ t = GetType(className);
+ if (t)
+ {
+ msclr::lock lockInstance(ClassNameVsTypeLockObj);
+ {
+ tmp = ClassNameVsCreateNewObjectDelegate;
+ tmp->TryGetValue(className, del);
+ if (del != nullptr)
+ return del();
+ del = CreateNewObjectDelegateF(t);
+ tmp = gcnew Dictionary<String^, CreateNewObjectDelegate^>(ClassNameVsCreateNewObjectDelegate);
+ tmp[className] = del;
+ ClassNameVsCreateNewObjectDelegate = tmp;
+ return del();
+ }
+ }
+ return nullptr;
+ }
+
+ Object^ Serializable::GetArrayObject(String^ className, int len)
+ {
+ Object^ retArr = GetArrayObjectEx(className, len);
+ if (retArr == nullptr)
+ {
+ Type^ t = GetType(className);
+ if (t)
+ {
+ retArr = t->MakeArrayType()->GetConstructor(singleIntType)->Invoke(gcnew array<Object^>(1) { len });
+ return retArr;
+ }
+ }
+ return retArr;
+ }
+
+ Object^ Serializable::GetArrayObjectEx(String^ className, int len)
+ {
+ CreateNewObjectArrayDelegate^ del = nullptr;
+ Dictionary<String^, CreateNewObjectArrayDelegate^>^ tmp = ClassNameVsCreateNewObjectArrayDelegate;
+
+ tmp->TryGetValue(className, del);
+
+ if (del != nullptr)
+ {
+ return del(len);
+ }
+
+ Type^ t = GetType(className);
+ if (t)
+ {
+ msclr::lock lockInstance(ClassNameVsTypeLockObj);
+ {
+ tmp = ClassNameVsCreateNewObjectArrayDelegate;
+ tmp->TryGetValue(className, del);
+ if (del != nullptr)
+ return del(len);
+ del = CreateNewObjectArrayDelegateF(t);
+ tmp = gcnew Dictionary<String^, CreateNewObjectArrayDelegate^>(ClassNameVsCreateNewObjectArrayDelegate);
+ tmp[className] = del;
+ ClassNameVsCreateNewObjectArrayDelegate = tmp;
+ return del(len);
+ }
+ }
+ return nullptr;
+ }
+
+ //delegate Object^ CreateNewObject();
+ //static CreateNewObjectDelegate^ CreateNewObjectDelegateF(Type^ type);
+ Serializable::CreateNewObjectDelegate^ Serializable::CreateNewObjectDelegateF(Type^ type)
+ {
+ DynamicMethod^ dynam = gcnew DynamicMethod("", Internal::DotNetTypes::ObjectType, Type::EmptyTypes, type, true);
+ ILGenerator^ il = dynam->GetILGenerator();
+
+ ConstructorInfo^ ctorInfo = type->GetConstructor(Type::EmptyTypes);
+ if (ctorInfo == nullptr) {
+ Log::Error("Object missing public no arg constructor");
+ throw gcnew IllegalStateException("Object missing public no arg constructor");
+ }
+
+ il->Emit(OpCodes::Newobj, ctorInfo);
+ il->Emit(OpCodes::Ret);
+
+ return (Serializable::CreateNewObjectDelegate^)dynam->CreateDelegate(createNewObjectDelegateType);
+ }
+
+ //delegate Object^ CreateNewObjectArray(int len);
+ Serializable::CreateNewObjectArrayDelegate^ Serializable::CreateNewObjectArrayDelegateF(Type^ type)
+ {
+ DynamicMethod^ dynam = gcnew DynamicMethod("", Internal::DotNetTypes::ObjectType, singleIntTypeA, type, true);
+ ILGenerator^ il = dynam->GetILGenerator();
+
+ il->Emit(OpCodes::Ldarg_0);
+
+ il->Emit(OpCodes::Newarr, type);
+ il->Emit(OpCodes::Ret);
+
+ return (Serializable::CreateNewObjectArrayDelegate^)dynam->CreateDelegate(createNewObjectArrayDelegateType);
+ }
+
+ Type^ Serializable::getTypeFromRefrencedAssemblies(String^ className, Dictionary<Assembly^, bool>^ referedAssembly, Assembly^ currentAsm)
+ {
+ Type^ t = currentAsm->GetType(className);
+ if (t != nullptr)
+ {
+ Dictionary<String^, Type^>^ tmp = gcnew Dictionary<String^, Type^>(ClassNameVsType);
+ tmp[className] = t;
+ ClassNameVsType = tmp;
+ return t;
+ }
+ //already touched
+ if (referedAssembly->ContainsKey(currentAsm))
+ return nullptr;
+ referedAssembly[currentAsm] = true;
+
+ //get all refrenced assembly
+ array<AssemblyName^>^ ReferencedAssemblies = currentAsm->GetReferencedAssemblies();
+ for each(AssemblyName^ tmpAsm in ReferencedAssemblies)
+ {
+ try
+ {
+ Assembly^ la = Assembly::Load(tmpAsm);
+ if (la != nullptr && (!referedAssembly->ContainsKey(la)))
+ {
+ t = getTypeFromRefrencedAssemblies(className, referedAssembly, la);
+ if (!t)
+ return t;
+ }
+ }
+ catch (System::Exception^){//ignore
+ }
+ }
+ return nullptr;
+ }
+
+ Type^ Serializable::GetType(String^ className)
+ {
+ Type^ retVal = nullptr;
+ Dictionary<String^, Type^>^ tmp = ClassNameVsType;
+ tmp->TryGetValue(className, retVal);
+
+ if (retVal != nullptr)
+ return retVal;
+ msclr::lock lockInstance(ClassNameVsTypeLockObj);
+ {
+ tmp = ClassNameVsType;
+ tmp->TryGetValue(className, retVal);
+
+ if (retVal != nullptr)
+ return retVal;
+
+ Dictionary<Assembly^, bool>^ referedAssembly = gcnew Dictionary<Assembly^, bool>();
+ AppDomain^ MyDomain = AppDomain::CurrentDomain;
+ array<Assembly^>^ AssembliesLoaded = MyDomain->GetAssemblies();
+ for each(Assembly^ tmpAsm in AssembliesLoaded)
+ {
+ retVal = getTypeFromRefrencedAssemblies(className, referedAssembly, tmpAsm);
+ if (retVal)
+ return retVal;
+ }
+ }
+ return retVal;
+ }
+
+ IPdxSerializable^ Serializable::GetPdxType(String^ className)
+ {
+ PdxTypeFactoryMethod^ retVal = nullptr;
+ PdxDelegateMap->TryGetValue(className, retVal);
+
+ if (retVal == nullptr){
+
+ if (PdxSerializer != nullptr)
+ {
+ return gcnew PdxWrapper(className);
+ }
+ try
+ {
+ Object^ retObj = CreateObject(className);
+
+ IPdxSerializable^ retPdx = dynamic_cast<IPdxSerializable^>(retObj);
+ if (retPdx != nullptr)
+ return retPdx;
+ }
+ catch (System::Exception^ ex)
+ {
+ Log::Error("Unable to create object usqing reflection for class: " + className + " : " + ex->Message);
+ }
+ throw gcnew IllegalStateException("Pdx factory method (or PdxSerializer ) not registered (or don't have zero arg constructor)"
+ " to create default instance for class: " + className);
+ }
+
+ return retVal();
+ }
+
+ void Serializable::RegisterPDXManagedCacheableKey(bool appDomainEnable, Cache^ cache)
+ {
+ CacheImpl *cacheImpl = CacheRegionHelper::getCacheImpl(cache->GetNative().get());
+ if (!appDomainEnable)
+ {
+ cacheImpl->getSerializationRegistry()->addType(native::GeodeTypeIdsImpl::PDX,
+ &native::PdxManagedCacheableKey::CreateDeserializable);
+ }
+ else
+ {
+ cacheImpl->getSerializationRegistry()->addType(native::GeodeTypeIdsImpl::PDX,
+ std::bind(native::PdxManagedCacheableKeyBytes::CreateDeserializable, cache->GetNative().get()));
+ }
+ }
+
+ void Apache::Geode::Client::Serializable::RegisterTypeGeneric(TypeFactoryMethodGeneric^ creationMethod, Cache^ cache)
+ {
+ if (creationMethod == nullptr) {
+ throw gcnew IllegalArgumentException("Serializable.RegisterType(): "
+ "null TypeFactoryMethod delegate passed");
+ }
+
+ //--------------------------------------------------------------
+
+ //adding user type as well in global builtin hashmap
+ System::Int64 classId = ((System::Int64)creationMethod()->ClassId);
+ if (!ManagedDelegatesGeneric->ContainsKey(classId))
+ ManagedDelegatesGeneric->Add(classId, creationMethod);
+
+ DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod, cache);
+ TypeFactoryNativeMethodGeneric^ nativeDelegate =
+ gcnew TypeFactoryNativeMethodGeneric(delegateObj,
+ &DelegateWrapperGeneric::NativeDelegateGeneric);
+
+ // this is avoid object being Gced
+ NativeDelegatesGeneric->Add(nativeDelegate);
+
+ // register the type in the DelegateMap, this is pure c# for create domain object
+ IGeodeSerializable^ tmp = creationMethod();
+ Log::Fine("Registering serializable class ID " + tmp->ClassId +
+ ", AppDomain ID " + System::Threading::Thread::GetDomainID());
+ DelegateMapGeneric[tmp->ClassId] = creationMethod;
+
+ _GF_MG_EXCEPTION_TRY2
+ CacheImpl *cacheImpl = CacheRegionHelper::getCacheImpl(cache->GetNative().get());
+ cacheImpl->getSerializationRegistry()->addType((native::Serializable*(*)())System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Apache::Geode::Client::Serializable::RegisterTypeGeneric(Byte typeId,
+ TypeFactoryMethodGeneric^ creationMethod, Type^ type, Cache^ cache)
+ {
+ if (creationMethod == nullptr) {
+ throw gcnew IllegalArgumentException("Serializable.RegisterType(): "
+ "null TypeFactoryMethod delegate passed");
+ }
+ DelegateWrapperGeneric^ delegateObj = gcnew DelegateWrapperGeneric(creationMethod, cache);
+ TypeFactoryNativeMethodGeneric^ nativeDelegate =
+ gcnew TypeFactoryNativeMethodGeneric(delegateObj,
+ &DelegateWrapperGeneric::NativeDelegateGeneric);
+
+ BuiltInDelegatesGeneric[typeId] = nativeDelegate;
+
+ if (type != nullptr)
+ ManagedTypeMappingGeneric[type] = typeId;
+
+ //This is hashmap for manged builtin objects
+ if (!ManagedDelegatesGeneric->ContainsKey(typeId + 0x80000000))
+ ManagedDelegatesGeneric->Add(typeId + 0x80000000, creationMethod);
+
+ // register the type in the DelegateMap
+ IGeodeSerializable^ tmp = creationMethod();
+ Log::Finer("Registering(,) serializable class ID " + tmp->ClassId +
+ ", AppDomain ID " + System::Threading::Thread::GetDomainID());
+ DelegateMapGeneric[tmp->ClassId] = creationMethod;
+
+ try
+ {
+ CacheImpl *cacheImpl = CacheRegionHelper::getCacheImpl(cache->GetNative().get());
+ if (tmp->ClassId < 0xa0000000)
+ {
+ cacheImpl->getSerializationRegistry()->addType(typeId,
+ (native::Serializable*(*)())System::Runtime::InteropServices::
+ Marshal::GetFunctionPointerForDelegate(
+ nativeDelegate).ToPointer());
+ }
+ else
+ {//special case for CacheableUndefined type
+ cacheImpl->getSerializationRegistry()->addType2(typeId,
+ (native::Serializable*(*)())System::Runtime::InteropServices::
+ Marshal::GetFunctionPointerForDelegate(
+ nativeDelegate).ToPointer());
+ }
+
+ }
+ catch (native::IllegalStateException&)
+ {
+ //ignore it as this is internal only
+ }
+ }
+
+ void Apache::Geode::Client::Serializable::UnregisterTypeGeneric(Byte typeId, Cache^ cache)
+ {
+ BuiltInDelegatesGeneric->Remove(typeId);
+ _GF_MG_EXCEPTION_TRY2
+
+ CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->removeType(typeId);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void Apache::Geode::Client::Serializable::RegisterWrapperGeneric(
+ WrapperDelegateGeneric^ wrapperMethod, Byte typeId, System::Type^ type)
+ {
+ if (typeId < 0 || typeId > WrapperEndGeneric)
+ {
+ throw gcnew GeodeException("The TypeID (" + typeId + ") being "
+ "registered is beyond acceptable range of 0-" + WrapperEndGeneric);
+ }
+ NativeWrappersGeneric[typeId] = wrapperMethod;
+ ManagedTypeMappingGeneric[type] = typeId;
+ }
+
+ void Apache::Geode::Client::Serializable::UnregisterNativesGeneric()
+ {
+ BuiltInDelegatesGeneric->Clear();
+ for (Byte typeId = 0; typeId <= WrapperEndGeneric; ++typeId) {
+ NativeWrappersGeneric[typeId] = nullptr;
+ }
+ //TODO:: unregister from managed hashmap as well.
+ // ManagedDelegates->Clear();
+ }
+
+ generic<class TValue>
+ TValue Serializable::GetManagedValueGeneric(native::SerializablePtr val)
+ {
+ if (val == nullptr)
+ {
+ return TValue();
+ }
+
+ Byte typeId = val->typeId();
+ //Log::Debug("Serializable::GetManagedValueGeneric typeid = " + typeId);
+ switch (typeId)
+ {
+ case native::GeodeTypeIds::CacheableByte:
+ {
+ return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
+ /* if (TValue::typeid == System::SByte::typeid) {
+ return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
+ }
+ else {
+ return (TValue)(System::Byte)safe_cast<int8_t>(Serializable::getByte(val));
+ }
+ return safe_cast<TValue>(Serializable::getByte(val));*/
+ }
+ case native::GeodeTypeIds::CacheableBoolean:
+ {
+ return safe_cast<TValue>(Serializable::getBoolean(val));
+ }
+ case native::GeodeTypeIds::CacheableWideChar:
+ {
+ return safe_cast<TValue>(Serializable::getChar(val));
+ }
+ case native::GeodeTypeIds::CacheableDouble:
+ {
+ return safe_cast<TValue>(Serializable::getDouble(val));
+ }
+ case native::GeodeTypeIds::CacheableASCIIString:
+ case native::GeodeTypeIds::CacheableASCIIStringHuge:
+ case native::GeodeTypeIds::CacheableString:
+ case native::GeodeTypeIds::CacheableStringHuge:
+ {
+ //TODO: need to look all strings types
+ return safe_cast<TValue>(Serializable::getASCIIString(val));
+ }
+ case native::GeodeTypeIds::CacheableFloat:
+ {
+ return safe_cast<TValue>(Serializable::getFloat(val));
+ }
+ case native::GeodeTypeIds::CacheableInt16:
+ {
+ /* if (TValue::typeid == System::Int16::typeid) {
+ return (TValue)(System::Int16)safe_cast<System::Int16>(Serializable::getInt16(val));
+ }
+ else {
+ return (TValue)(System::UInt16)safe_cast<System::Int16>(Serializable::getInt16(val));
+ }*/
+ return safe_cast<TValue>(Serializable::getInt16(val));
+ }
+ case native::GeodeTypeIds::CacheableInt32:
+ {
+ /* if (TValue::typeid == System::Int32::typeid) {
+ return (TValue)(System::Int32)safe_cast<System::Int32>(Serializable::getInt32(val));
+ }
+ else {
+ return (TValue)(System::UInt32)safe_cast<System::Int32>(Serializable::getInt32(val));
+ } */
+ return safe_cast<TValue>(Serializable::getInt32(val));
+ }
+ case native::GeodeTypeIds::CacheableInt64:
+ {
+ /*if (TValue::typeid == System::Int64::typeid) {
+ return (TValue)(System::Int64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ }
+ else {
+ return (TValue)(System::UInt64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ }*/
+ return safe_cast<TValue>(Serializable::getInt64(val));
+ }
+ case native::GeodeTypeIds::CacheableDate:
+ {
+ //TODO::
+ Apache::Geode::Client::CacheableDate^ ret = static_cast<Apache::Geode::Client::CacheableDate ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val));
+
+ System::DateTime dt(ret->Value.Ticks);
+ return safe_cast<TValue>(dt);
+ }
+ case native::GeodeTypeIdsImpl::CacheableUserData:
+ case native::GeodeTypeIdsImpl::CacheableUserData2:
+ case native::GeodeTypeIdsImpl::CacheableUserData4:
+ {
+ //TODO::split
+ IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val);
+ return safe_cast<TValue>(ret);
+ //return TValue();
+ }
+ case native::GeodeTypeIdsImpl::PDX:
+ {
+ IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val);
+
+ PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
+
+ if (pdxWrapper != nullptr)
+ {
+ return safe_cast<TValue>(pdxWrapper->GetObject());
+ }
+
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableBytes:
+ {
+ Apache::Geode::Client::CacheableBytes^ ret = safe_cast<Apache::Geode::Client::CacheableBytes ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableDoubleArray:
+ {
+ Apache::Geode::Client::CacheableDoubleArray^ ret = safe_cast<Apache::Geode::Client::CacheableDoubleArray ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableFloatArray:
+ {
+ Apache::Geode::Client::CacheableFloatArray^ ret = safe_cast<Apache::Geode::Client::CacheableFloatArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt16Array:
+ {
+ Apache::Geode::Client::CacheableInt16Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt16Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt32Array:
+ {
+ Apache::Geode::Client::CacheableInt32Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt32Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt64Array:
+ {
+ Apache::Geode::Client::CacheableInt64Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt64Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableStringArray:
+ {
+ Apache::Geode::Client::CacheableStringArray^ ret = safe_cast<Apache::Geode::Client::CacheableStringArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val));
+
+ /* array<String^>^ str = gcnew array<String^>(ret->GetValues()->Length);
+ for(int i=0; i<ret->GetValues()->Length; i++ ) {
+ str[i] = ret->GetValues()[i];
+ }*/
+
+ return safe_cast<TValue>(ret->GetValues());
+ }
+ case native::GeodeTypeIds::CacheableArrayList://Ilist generic
+ {
+ Apache::Geode::Client::CacheableArrayList^ ret = safe_cast<Apache::Geode::Client::CacheableArrayList^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableLinkedList://LinkedList generic
+ {
+ Apache::Geode::Client::CacheableLinkedList^ ret = safe_cast<Apache::Geode::Client::CacheableLinkedList^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ {
+ Apache::Geode::Client::CacheableHashTable^ ret = safe_cast<Apache::Geode::Client::CacheableHashTable^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
+ {
+ Apache::Geode::Client::CacheableHashMap^ ret = safe_cast<Apache::Geode::Client::CacheableHashMap^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ Apache::Geode::Client::CacheableIdentityHashMap^ ret = static_cast<Apache::Geode::Client::CacheableIdentityHashMap^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ {
+ Apache::Geode::Client::CacheableHashSet^ ret = static_cast<Apache::Geode::Client::CacheableHashSet^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ {
+ Apache::Geode::Client::CacheableLinkedHashSet^ ret = static_cast<Apache::Geode::Client::CacheableLinkedHashSet^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableFileName:
+ {
+ Apache::Geode::Client::CacheableFileName^ ret = static_cast<Apache::Geode::Client::CacheableFileName^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableObjectArray:
+ {
+ Apache::Geode::Client::CacheableObjectArray^ ret = static_cast<Apache::Geode::Client::CacheableObjectArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
+ {
+ Apache::Geode::Client::CacheableVector^ ret = static_cast<Apache::Geode::Client::CacheableVector^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableUndefined:
+ {
+ Apache::Geode::Client::CacheableUndefined^ ret = static_cast<Apache::Geode::Client::CacheableUndefined^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::Struct:
+ {
+ return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val));
+ }
+ case native::GeodeTypeIds::CacheableStack:
+ {
+ Apache::Geode::Client::CacheableStack^ ret = static_cast<Apache::Geode::Client::CacheableStack^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case 7: //GeodeClassIds::CacheableManagedObject
+ {
+ Apache::Geode::Client::CacheableObject^ ret = static_cast<Apache::Geode::Client::CacheableObject^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case 8://GeodeClassIds::CacheableManagedObjectXml
+ {
+ Apache::Geode::Client::CacheableObjectXml^ ret = static_cast<Apache::Geode::Client::CacheableObjectXml^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ /* TODO: replace with IDictionary<K, V>
+ case native::GeodeTypeIds::Properties:
+ {
+ Apache::Geode::Client::Properties^ ret = safe_cast<Apache::Geode::Client::Properties^>
+ ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val));
+
+ return safe_cast<TValue>(ret);
+ }*/
+
+ case native::GeodeTypeIds::BooleanArray:
+ {
+ Apache::Geode::Client::BooleanArray^ ret = safe_cast<Apache::Geode::Client::BooleanArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CharArray:
+ {
+ Apache::Geode::Client::CharArray^ ret = safe_cast<Apache::Geode::Client::CharArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case 0://UserFunctionExecutionException unregistered
+ {
+ Apache::Geode::Client::UserFunctionExecutionException^ ret = static_cast<Apache::Geode::Client::UserFunctionExecutionException^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ default:
+ throw gcnew System::Exception("not found typeid");
+ }
+ throw gcnew System::Exception("not found typeid");
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, native::Cache* cache)
+ {
+ //System::Type^ managedType = TKey::typeid;
+ if (key != nullptr) {
+ //System::Type^ managedType = key->GetType();
+ return GetUnmanagedValueGeneric(key->GetType(), key, cache);
+ }
+ return nullptr;
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar, native::Cache* cache)
+ {
+ //System::Type^ managedType = TKey::typeid;
+ if (key != nullptr) {
+ //System::Type^ managedType = key->GetType();
+ return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar, cache);
+ }
+ return nullptr;
+ }
+
+ void Serializable::RegisterPdxSerializer(IPdxSerializer^ pdxSerializer)
+ {
+ /*if(PdxSerializer != nullptr )
+ {
+ throw gcnew IllegalStateException("IPdxSerializer is already registered: " + PdxSerializer->GetType());
+ }*/
+ PdxSerializer = pdxSerializer;
+ }
+
+ void Serializable::SetPdxTypeMapper(IPdxTypeMapper^ pdxTypeMapper)
+ {
+ if (pdxTypeMapper != nullptr)
+ PdxTypeMapper = pdxTypeMapper;
+ }
+
+ String^ Serializable::GetPdxTypeName(String^ localTypeName)
+ {
+ if (PdxTypeMapper == nullptr)
+ return localTypeName;
+ IDictionary<String^, String^>^ tmp = LocalTypeNameToPdx;
+ String^ pdxTypeName = nullptr;
+ tmp->TryGetValue(localTypeName, pdxTypeName);
+
+ if (pdxTypeName != nullptr)
+ return pdxTypeName;
+
+ {
+ msclr::lock lockInstance(LockObj);
+ tmp->TryGetValue(localTypeName, pdxTypeName);
+
+ if (pdxTypeName != nullptr)
+ return pdxTypeName;
+ if (PdxTypeMapper != nullptr)
+ {
+ pdxTypeName = PdxTypeMapper->ToPdxTypeName(localTypeName);
+ if (pdxTypeName == nullptr)
+ {
+ throw gcnew IllegalStateException("PdxTypeName should not be null for local type " + localTypeName);
+ }
+
+ Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
+ localToPdx[localTypeName] = pdxTypeName;
+ LocalTypeNameToPdx = localToPdx;
+ Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
+ localToPdx[pdxTypeName] = localTypeName;
+ PdxTypeNameToLocal = pdxToLocal;
+ }
+ }
+ return pdxTypeName;
+ }
+
+ String^ Serializable::GetLocalTypeName(String^ pdxTypeName)
+ {
+ if (PdxTypeMapper == nullptr)
+ return pdxTypeName;
+
+ IDictionary<String^, String^>^ tmp = PdxTypeNameToLocal;
+ String^ localTypeName = nullptr;
+ tmp->TryGetValue(pdxTypeName, localTypeName);
+
+ if (localTypeName != nullptr)
+ return localTypeName;
+
+ {
+ msclr::lock lockInstance(LockObj);
+ tmp->TryGetValue(pdxTypeName, localTypeName);
+
+ if (localTypeName != nullptr)
+ return localTypeName;
+ if (PdxTypeMapper != nullptr)
+ {
+ localTypeName = PdxTypeMapper->FromPdxTypeName(pdxTypeName);
+ if (localTypeName == nullptr)
+ {
+ throw gcnew IllegalStateException("LocalTypeName should not be null for pdx type " + pdxTypeName);
+ }
+
+ Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
+ localToPdx[localTypeName] = pdxTypeName;
+ LocalTypeNameToPdx = localToPdx;
+ Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
+ localToPdx[pdxTypeName] = localTypeName;
+ PdxTypeNameToLocal = pdxToLocal;
+ }
+ }
+ return localTypeName;
+ }
+
+ void Serializable::Clear()
+ {
+ PdxTypeMapper = nullptr;
+ LocalTypeNameToPdx->Clear();
+ PdxTypeNameToLocal->Clear();
+ ClassNameVsCreateNewObjectDelegate->Clear();
+ ClassNameVsType->Clear();
+ ClassNameVsCreateNewObjectArrayDelegate->Clear();
+ }
+
+ IPdxSerializer^ Serializable::GetPdxSerializer()
+ {
+ return PdxSerializer;
+ }
+
+ bool Serializable::IsObjectAndPdxSerializerRegistered(String^ className)
+ {
+ return PdxSerializer != nullptr;
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, native::Cache* cache)
+ {
+ return GetUnmanagedValueGeneric(managedType, key, false, cache);
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, bool isAsciiChar, native::Cache* cache)
+ {
+ Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(managedType);
+
+ switch (typeId)
+ {
+ case native::GeodeTypeIds::CacheableByte: {
+ return Serializable::getCacheableByte((SByte)key);
+ }
+ case native::GeodeTypeIds::CacheableBoolean:
+ return Serializable::getCacheableBoolean((bool)key);
+ case native::GeodeTypeIds::CacheableWideChar:
+ return Serializable::getCacheableWideChar((Char)key);
+ case native::GeodeTypeIds::CacheableDouble:
+ return Serializable::getCacheableDouble((double)key);
+ case native::GeodeTypeIds::CacheableASCIIString: {
+ if (isAsciiChar)
+ return Serializable::getCacheableASCIIString2((String^)key);
+ else
+ return Serializable::getCacheableASCIIString((String^)key);
+ }
+ case native::GeodeTypeIds::CacheableFloat:
+ return Serializable::getCacheableFloat((float)key);
+ case native::GeodeTypeIds::CacheableInt16: {
+ return Serializable::getCacheableInt16((System::Int16)key);
+ }
+ case native::GeodeTypeIds::CacheableInt32: {
+ return Serializable::getCacheableInt32((System::Int32)key);
+ }
+ case native::GeodeTypeIds::CacheableInt64: {
+ return Serializable::getCacheableInt64((System::Int64)key);
+ }
+ case native::GeodeTypeIds::CacheableBytes:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableDoubleArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableFloatArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt16Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt32Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt64Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableStringArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableFileName:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableArrayList://generic ilist
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableLinkedList://generic linked list
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableStack:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case 7: //GeodeClassIds::CacheableManagedObject
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case 8://GeodeClassIds::CacheableManagedObjectXml
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableObjectArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableDate:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::BooleanArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CharArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key), cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ default:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key, cache));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ }
+ } //
+
+ String^ Serializable::GetString(native::CacheableStringPtr cStr)//native::CacheableString*
+ {
+ if (cStr == nullptr) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
+
+ // These are the new static methods to get/put data from c++
+
+ //byte
+ Byte Serializable::getByte(native::SerializablePtr nativeptr)
+ {
+ native::CacheableByte* ci = static_cast<native::CacheableByte*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableByte(SByte val)
+ {
+ return native::CacheableByte::create(val);
+ }
+
+ //boolean
+ bool Serializable::getBoolean(native::SerializablePtr nativeptr)
+ {
+ native::CacheableBoolean* ci = static_cast<native::CacheableBoolean*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableBoolean(bool val)
+ {
+ return native::CacheableBoolean::create(val);
+ }
+
+ //widechar
+ Char Serializable::getChar(native::SerializablePtr nativeptr)
+ {
+ native::CacheableWideChar* ci = static_cast<native::CacheableWideChar*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableWideChar(Char val)
+ {
+ return native::CacheableWideChar::create(val);
+ }
+
+ //double
+ double Serializable::getDouble(native::SerializablePtr nativeptr)
+ {
+ native::CacheableDouble* ci = static_cast<native::CacheableDouble*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableDouble(double val)
+ {
+ return native::CacheableDouble::create(val);
+ }
+
+ //float
+ float Serializable::getFloat(native::SerializablePtr nativeptr)
+ {
+ native::CacheableFloat* ci = static_cast<native::CacheableFloat*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableFloat(float val)
+ {
+ return native::CacheableFloat::create(val);
+ }
+
+ //int16
+ System::Int16 Serializable::getInt16(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt16* ci = static_cast<native::CacheableInt16*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt16(int val)
+ {
+ return native::CacheableInt16::create(val);
+ }
+
+ //int32
+ System::Int32 Serializable::getInt32(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt32* ci = static_cast<native::CacheableInt32*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt32(System::Int32 val)
+ {
+ return native::CacheableInt32::create(val);
+ }
+
+ //int64
+ System::Int64 Serializable::getInt64(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt64* ci = static_cast<native::CacheableInt64*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt64(System::Int64 val)
+ {
+ return native::CacheableInt64::create(val);
+ }
+
+ //cacheable ascii string
+ String^ Serializable::getASCIIString(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString2(String^ val)
+ {
+ return GetCacheableString2(val);
+ }
+
+ //cacheable ascii string huge
+ String^ Serializable::getASCIIStringHuge(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIStringHuge(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ //cacheable string
+ String^ Serializable::getUTFString(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableUTFString(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ //cacheable string huge
+ String^ Serializable::getUTFStringHuge(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableUTFStringHuge(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ native::CacheableStringPtr Serializable::GetCacheableString(String^ value)
+ {
+ native::CacheableStringPtr cStr;
+ size_t len = 0;
+ if (value != nullptr) {
+ len = value->Length;
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
+ cStr = native::CacheableString::create(pin_value, Convert::ToInt32(len));
+ }
+ else {
+ cStr.reset(static_cast<native::CacheableString *>(
+ native::CacheableString::createDeserializable()));
+ }
+
+ return cStr;
+ }
+
+ native::CacheableStringPtr Serializable::GetCacheableString2(String^ value)
+ {
+ native::CacheableStringPtr cStr;
+ size_t len = 0;
+ if (value != nullptr) {
+ len = value->Length;
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(value)).ToPointer();
+ try
+ {
+ cStr = native::CacheableString::create(chars, Convert::ToInt32(len));
+ }
+ finally
+ {
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
+ }
+ }
+ else {
+ cStr.reset(static_cast<native::CacheableString*>(
+ native::CacheableString::createDeserializable()));
+ }
+
+ return cStr;
+ }
+
+ array<Byte>^ Serializable::getSByteArray(array<SByte>^ sArray)
+ {
+ array<Byte>^ dArray = gcnew array<Byte>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int16>^ Serializable::getInt16Array(array<System::UInt16>^ sArray)
+ {
+ array<System::Int16>^ dArray = gcnew array<System::Int16>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int32>^ Serializable::getInt32Array(array<System::UInt32>^ sArray)
+ {
+ array<System::Int32>^ dArray = gcnew array<System::Int32>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int64>^ Serializable::getInt64Array(array<System::UInt64>^ sArray)
+ {
+ array<System::Int64>^ dArray = gcnew array<System::Int64>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[33/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientRegionTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientRegionTestsN.cs b/clicache/integration-test/ThinClientRegionTestsN.cs
new file mode 100644
index 0000000..3f3242e
--- /dev/null
+++ b/clicache/integration-test/ThinClientRegionTestsN.cs
@@ -0,0 +1,2397 @@
+/*
+ * 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.Collections.Generic;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [Serializable]
+ public class CustomPartitionResolver<TValue> : IPartitionResolver<int, TValue>
+ {
+ public CustomPartitionResolver()
+ {
+ }
+
+ public string GetName()
+ {
+ return (string)"CustomPartitionResolver";
+ }
+
+ public Object GetRoutingObject(EntryEvent<int, TValue> key)
+ {
+ Util.Log("CustomPartitionResolver::GetRoutingObject");
+ return key.Key + 5;
+ }
+
+ public static CustomPartitionResolver<TValue> Create()
+ {
+ return new CustomPartitionResolver<TValue>();
+ }
+ }
+
+ [Serializable]
+ public class CustomPartitionResolver1<TValue> : IFixedPartitionResolver<int, TValue>
+ {
+ public CustomPartitionResolver1()
+ {
+ }
+
+ public string GetName()
+ {
+ return (string)"CustomPartitionResolver1";
+ }
+
+ public Object GetRoutingObject(EntryEvent<int, TValue> key)
+ {
+ Util.Log("CustomPartitionResolver1::GetRoutingObject");
+ int nkey = key.Key;
+
+ return nkey + 5;
+ }
+
+ public static CustomPartitionResolver1<TValue> Create()
+ {
+ return new CustomPartitionResolver1<TValue>();
+ }
+
+ public string GetPartitionName(EntryEvent<int, TValue> entryEvent)
+ {
+ Util.Log("CustomPartitionResolver1::GetPartitionName");
+ int newkey = entryEvent.Key % 6;
+ if (newkey == 0)
+ {
+ return "P1";
+ }
+ else if (newkey == 1)
+ {
+ return "P2";
+ }
+ else if (newkey == 2)
+ {
+ return "P3";
+ }
+ else if (newkey == 3)
+ {
+ return "P4";
+ }
+ else if (newkey == 4)
+ {
+ return "P5";
+ }
+ else if (newkey == 5)
+ {
+ return "P6";
+ }
+ else
+ {
+ return "Invalid";
+ }
+ }
+ }
+
+ [Serializable]
+ public class CustomPartitionResolver2<TValue> : IFixedPartitionResolver<int, TValue>
+ {
+ public CustomPartitionResolver2()
+ {
+ }
+
+ public string GetName()
+ {
+ return (string)"CustomPartitionResolver2";
+ }
+
+ public Object GetRoutingObject(EntryEvent<int, TValue> key)
+ {
+ Util.Log("CustomPartitionResolver2::GetRoutingObject");
+ return key.Key + 4;
+ }
+
+ public static CustomPartitionResolver2<TValue> Create()
+ {
+ return new CustomPartitionResolver2<TValue>();
+ }
+
+ public string GetPartitionName(EntryEvent<int, TValue> entryEvent)
+ {
+ Util.Log("CustomPartitionResolver2::GetPartitionName");
+ string key = entryEvent.Key.ToString();
+ int numKey = Convert.ToInt32(key);
+ int newkey = numKey % 6;
+ if (newkey == 0)
+ {
+ return "P1";
+ }
+ else if (newkey == 1)
+ {
+ return "P2";
+ }
+ else if (newkey == 2)
+ {
+ return "P3";
+ }
+ else if (newkey == 3)
+ {
+ return "P4";
+ }
+ else if (newkey == 4)
+ {
+ return "P5";
+ }
+ else if (newkey == 5)
+ {
+ return "P6";
+ }
+ else
+ {
+ return "Invalid";
+ }
+ }
+ }
+
+ [Serializable]
+ public class CustomPartitionResolver3<TValue> : IFixedPartitionResolver<int, TValue>
+ {
+ public CustomPartitionResolver3()
+ {
+ }
+
+ public string GetName()
+ {
+ return (string)"CustomPartitionResolver3";
+ }
+
+ public Object GetRoutingObject(EntryEvent<int, TValue> key)
+ {
+ Util.Log("CustomPartitionResolver3::GetRoutingObject");
+ return key.Key % 5;
+ }
+
+ public static CustomPartitionResolver3<TValue> Create()
+ {
+ return new CustomPartitionResolver3<TValue>();
+ }
+
+ public string GetPartitionName(EntryEvent<int, TValue> entryEvent)
+ {
+ Util.Log("CustomPartitionResolver3::GetPartitionName");
+ string key = entryEvent.Key.ToString();
+ int numKey = Convert.ToInt32(key);
+ int newkey = numKey % 3;
+ if (newkey == 0)
+ {
+ return "P1";
+ }
+ else if (newkey == 1)
+ {
+ return "P2";
+ }
+ else if (newkey == 2)
+ {
+ return "P3";
+ }
+ else
+ {
+ return "Invalid";
+ }
+ }
+ }
+
+ public class TradeKey : ICacheableKey
+ {
+ public int m_id;
+ public int m_accountid;
+
+ public TradeKey()
+ {
+ }
+
+ public TradeKey(int id)
+ {
+ m_id = id;
+ m_accountid = 1 + id;
+ }
+
+ public TradeKey(int id, int accId)
+ {
+ m_id = id;
+ m_accountid = accId;
+ }
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_id = input.ReadInt32();
+ m_accountid = input.ReadInt32();
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_id);
+ output.WriteInt32(m_accountid);
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x04;
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ UInt32 objectSize = 0;
+ objectSize += (UInt32)sizeof(Int32);
+ objectSize += (UInt32)sizeof(Int32);
+ return objectSize;
+ }
+ }
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new TradeKey();
+ }
+
+ public bool Equals(ICacheableKey other)
+ {
+ if (other == null)
+ return false;
+ TradeKey bc = other as TradeKey;
+ if (bc == null)
+ return false;
+
+ if (bc == this)
+ return true;
+
+ if (bc.m_id == this.m_id)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ [Serializable]
+ public class TradeKeyResolver : IPartitionResolver<TradeKey, Object>
+ {
+ public TradeKeyResolver()
+ {
+ }
+
+ public string GetName()
+ {
+ return (string)"TradeKeyResolver";
+ }
+
+ public Object GetRoutingObject(EntryEvent<TradeKey, Object> key)
+ {
+ Util.Log("TradeKeyResolver::GetRoutingObject");
+ TradeKey tkey = (TradeKey)key.Key;
+ Util.Log("TradeKeyResolver::GetRoutingObject done {0} ", tkey.m_id + 5);
+ return tkey.m_id + 5;
+ }
+
+ public static TradeKeyResolver Create()
+ {
+ return new TradeKeyResolver();
+ }
+ }
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ThinClientRegionTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(DestroyRegions);
+ m_client2.Call(DestroyRegions);
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ CacheHelper.StopJavaLocators();
+ }
+ base.EndTest();
+ }
+
+ public void RegisterOtherType()
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(OtherType.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ignored since we run multiple times for pool and non pool cases.
+ }
+ }
+
+ public void DoPutsOtherTypeWithEx(OtherType.ExceptionType exType)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ for (int keyNum = 1; keyNum <= 10; ++keyNum)
+ {
+ try
+ {
+ region["key-" + keyNum] = new OtherType(keyNum, keyNum * keyNum, exType);
+ if (exType != OtherType.ExceptionType.None)
+ {
+ Assert.Fail("Expected an exception in Put");
+ }
+ }
+ catch (GeodeIOException ex)
+ {
+ if (exType == OtherType.ExceptionType.Geode)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected exception in Put: " + ex);
+ }
+ else if (exType == OtherType.ExceptionType.GeodeGeode)
+ {
+ if (ex.InnerException is CacheServerException)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected exception in Put: " + ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw;
+ }
+ }
+ catch (CacheServerException ex)
+ {
+ if (exType == OtherType.ExceptionType.GeodeSystem)
+ {
+ if (ex.InnerException is IOException)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected exception in Put: " + ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw;
+ }
+ }
+ catch (IOException ex)
+ {
+ if (exType == OtherType.ExceptionType.System)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected system exception in Put: " + ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ catch (ApplicationException ex)
+ {
+ if (exType == OtherType.ExceptionType.SystemGeode)
+ {
+ if (ex.InnerException is CacheServerException)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected system exception in Put: " + ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ else if (exType == OtherType.ExceptionType.SystemSystem)
+ {
+ if (ex.InnerException is IOException)
+ {
+ // Successfully changed exception back and forth
+ Util.Log("Got expected system exception in Put: " + ex);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+ }
+
+ public void RegexInterestAllStep2() //client 2 //pxr2
+ {
+ Util.Log("RegexInterestAllStep2 Enters.");
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ List<object> resultKeys = new List<object>();
+ //CreateEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ //CreateEntry(m_regionNames[1], m_keys[1], m_vals[1]);
+ region0.GetSubscriptionService().RegisterAllKeys(false, resultKeys, true);
+ region1.GetSubscriptionService().RegisterAllKeys(false, null, true);
+ if (region0.Count != 1 || region1.Count != 1)
+ {
+ Assert.Fail("Expected one entry in region");
+ }
+ if (resultKeys.Count != 1)
+ {
+ Assert.Fail("Expected one key from registerAllKeys");
+ }
+ object value = resultKeys[0];
+ if (!(value.ToString().Equals(m_keys[0])))
+ {
+ Assert.Fail("Unexpected key from RegisterAllKeys");
+ }
+ Util.Log("RegexInterestAllStep2 complete.");
+ }
+
+ public void CheckAndPutKey()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+
+ IRegionService regServ = region0.RegionService;
+
+ Cache cache = regServ as Cache;
+
+ Assert.IsNotNull(cache);
+
+ if (region0.ContainsKey("keyKey01"))
+ {
+ Assert.Fail("Did not expect keyKey01 to be on Server");
+ }
+ region0["keyKey01"] = "valueValue01";
+ if (!region0.ContainsKey("keyKey01"))
+ {
+ Assert.Fail("Expected keyKey01 to be on Server");
+ }
+ }
+
+ public void ClearRegionStep1()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterAllKeys();
+ CreateEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ CreateEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ if (region0.Count != 2)
+ {
+ Assert.Fail("Expected region size 2");
+ }
+ }
+ public void ClearRegionListenersStep1()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterAllKeys();
+ AttributesMutator<object, object> attrMutator = region0.AttributesMutator;
+ TallyListener<object, object> listener = new TallyListener<object, object>();
+ attrMutator.SetCacheListener(listener);
+ TallyWriter<object, object> writer = new TallyWriter<object, object>();
+ attrMutator.SetCacheWriter(writer);
+ }
+
+ public void ClearRegionStep2()
+ {
+ //Console.WriteLine("IRegion<object, object> Name = {0}", m_regionNames[0]);
+
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ if (region0 == null)
+ {
+ Console.WriteLine("Region0 is Null");
+ }
+ else
+ {
+ //Console.WriteLine("NIL:Before clear call");
+ region0.Clear();
+ //Console.WriteLine("NIL:After clear call");
+
+ if (region0.Count != 0)
+ {
+ Assert.Fail("Expected region size 0");
+ }
+ }
+ Thread.Sleep(20000);
+ }
+
+ public void ClearRegionListenersStep2()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ if (region0.Count != 2)
+ {
+ Assert.Fail("Expected region size 2");
+ }
+ }
+
+ public void ClearRegionListenersStep3()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ if (region0.Count != 0)
+ {
+ Assert.Fail("Expected region size 0");
+ }
+ Apache.Geode.Client.RegionAttributes<object, object> attr = region0.Attributes;
+ TallyListener<object, object> listener = attr.CacheListener as TallyListener<object, object>;
+ TallyWriter<object, object> writer = attr.CacheWriter as TallyWriter<object, object>;
+ if (listener.Clears != 1)
+ {
+ Assert.Fail("Expected listener clear count 1");
+ }
+ if (writer.Clears != 1)
+ {
+ Assert.Fail("Expected writer clear count 1");
+ }
+ CreateEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ CreateEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ if (region0.Count != 2)
+ {
+ Assert.Fail("Expected region size 2");
+ }
+ region0.GetLocalView().Clear();
+ if (listener.Clears != 2)
+ {
+ Assert.Fail("Expected listener clear count 2");
+ }
+ if (writer.Clears != 2)
+ {
+ Assert.Fail("Expected writer clear count 2");
+ }
+ if (region0.Count != 0)
+ {
+ Assert.Fail("Expected region size 0");
+ }
+ }
+
+ public void ClearRegionStep3()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ if (region0.Count != 2)
+ {
+ Assert.Fail("Expected region size 2");
+ }
+
+ if (!region0.ContainsKey(m_keys[0]))
+ {
+ Assert.Fail("m_key[0] is not on Server");
+ }
+ if (!region0.ContainsKey(m_keys[1]))
+ {
+ Assert.Fail("m_key[1] is not on Server");
+ }
+ }
+
+ public void GetInterests()
+ {
+ string[] testregex = { "Key-*1", "Key-*2", "Key-*3", "Key-*4", "Key-*5", "Key-*6" };
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterRegex(testregex[0]);
+ region0.GetSubscriptionService().RegisterRegex(testregex[1]);
+ ICollection<object> myCollection1 = new Collection<object>();
+ myCollection1.Add((object)m_keys[0]);
+ region0.GetSubscriptionService().RegisterKeys(myCollection1);
+
+ ICollection<object> myCollection2 = new Collection<object>();
+ myCollection2.Add((object)m_keys[1]);
+ region0.GetSubscriptionService().RegisterKeys(myCollection2);
+
+ ICollection<string> regvCol = region0.GetSubscriptionService().GetInterestListRegex();
+ string[] regv = new string[regvCol.Count];
+ regvCol.CopyTo(regv, 0);
+
+ if (regv.Length != 2)
+ {
+ Assert.Fail("regex list length is not 2");
+ }
+ for (int i = 0; i < regv.Length; i++)
+ {
+ Util.Log("regv[{0}]={1}", i, regv[i]);
+ bool found = false;
+ for (int j = 0; j < regv.Length; j++)
+ {
+ if (regv[i].Equals(testregex[j]))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ Assert.Fail("Unexpected regex");
+ }
+ }
+
+ ICollection<object> keyvCol = region0.GetSubscriptionService().GetInterestList();
+ string[] keyv = new string[keyvCol.Count];
+ keyvCol.CopyTo(keyv, 0);
+
+ if (keyv.Length != 2)
+ {
+ Assert.Fail("interest list length is not 2");
+ }
+ for (int i = 0; i < keyv.Length; i++)
+ {
+ Util.Log("keyv[{0}]={1}", i, keyv[i].ToString());
+ bool found = false;
+ for (int j = 0; j < keyv.Length; j++)
+ {
+ if (keyv[i].ToString().Equals(m_keys[j]))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ Assert.Fail("Unexpected key");
+ }
+ }
+ }
+
+ public void RegexInterestAllStep3(string locators)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region0.GetSubscriptionService().UnregisterAllKeys();
+ region1.GetSubscriptionService().UnregisterAllKeys();
+ region0.GetLocalView().DestroyRegion();
+ region1.GetLocalView().DestroyRegion();
+ List<object> resultKeys = new List<object>();
+ CreateTCRegions_Pool(RegionNames, locators, "__TESTPOOL1_", true);
+ region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ CreateEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ region0.GetSubscriptionService().RegisterRegex(".*", false, resultKeys, true);
+ region1.GetSubscriptionService().RegisterRegex(".*", false, null, true);
+ if (region0.Count != 1)
+ {
+ Assert.Fail("Expected one entry in region");
+ }
+ if (region1.Count != 1)
+ {
+ Assert.Fail("Expected one entry in region");
+ }
+ if (resultKeys.Count != 1)
+ {
+ Assert.Fail("Expected one key from registerAllKeys");
+ }
+ object value = resultKeys[0];
+ if (!(value.ToString().Equals(m_keys[0])))
+ {
+ Assert.Fail("Unexpected key from RegisterAllKeys");
+ }
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[1], m_keys[2]);
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ Util.Log("RegexInterestAllStep3 complete.");
+ }
+
+ public void RegexInterestAllStep4()
+ {
+ List<object> resultKeys = new List<object>();
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ region0.GetSubscriptionService().RegisterAllKeys(false, resultKeys, false);
+ if (region0.Count != 1)
+ {
+ Assert.Fail("Expected one entry in region");
+ }
+ if (!region0.ContainsKey(m_keys[0]))
+ {
+ Assert.Fail("Expected region to contain the key");
+ }
+
+ if (region0.ContainsValueForKey(m_keys[0]))
+ {
+ Assert.Fail("Expected region to not contain the value");
+ }
+ if (resultKeys.Count != 1)
+ {
+ Assert.Fail("Expected one key from registerAllKeys");
+ }
+ object value = resultKeys[0];
+ if (!(value.ToString().Equals(m_keys[0])))
+ {
+ Assert.Fail("Unexpected key from RegisterAllKeys");
+ }
+
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ resultKeys.Clear();
+ region1.GetSubscriptionService().RegisterRegex(".*", false, resultKeys, false);
+
+ if (region1.Count != 1)
+ {
+ Assert.Fail("Expected one entry in region");
+ }
+
+ if (!region1.ContainsKey(m_keys[2]))
+ {
+ Assert.Fail("Expected region to contain the key");
+ }
+
+ if (region1.ContainsValueForKey(m_keys[2]))
+ {
+ Assert.Fail("Expected region to not contain the value");
+ }
+ if (resultKeys.Count != 1)
+ {
+ Assert.Fail("Expected one key from registerAllKeys");
+ }
+ value = resultKeys[0];
+ if (!(value.ToString().Equals(m_keys[2])))
+ {
+ Assert.Fail("Unexpected key from RegisterAllKeys");
+ }
+ CreateEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ UpdateEntry(m_regionNames[0], m_keys[0], m_vals[0], false);
+ CreateEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+
+ public void RegexInterestAllStep5()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ if (region1.Count != 2 || region0.Count != 2)
+ {
+ Assert.Fail("Expected two entry in region");
+ }
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[1], m_keys[2]);
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+
+ }
+
+ public void RegexInterestAllStep6()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_nvals[0], false);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_nvals[2], false);
+ }
+
+ public void RegexInterestAllStep7() //client 2
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1], false);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3], false);
+ }
+
+ public void RegexInterestAllStep8()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region0.GetSubscriptionService().UnregisterAllKeys();
+ region1.GetSubscriptionService().UnregisterAllKeys();
+ }
+
+ public void RegexInterestAllStep9()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[0], m_vals[0], false);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1], false);
+ UpdateEntry(m_regionNames[1], m_keys[2], m_vals[2], false);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3], false);
+ }
+
+ public void RegexInterestAllStep10()
+ {
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ VerifyEntry(m_regionNames[1], m_keys[2], m_nvals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ }
+
+ //public void GetAll(string endpoints, bool pool, bool locator)
+ //{
+ // Util.Log("Enters GetAll");
+ // IRegion<object, object> region0 = CacheHelper.GetVerifyRegion(m_regionNames[0]);
+ // List<ICacheableKey> resultKeys = new List<ICacheableKey>();
+ // CacheableKey key0 = m_keys[0];
+ // CacheableKey key1 = m_keys[1];
+ // resultKeys.Add(key0);
+ // resultKeys.Add(key1);
+ // region0.LocalDestroyRegion();
+ // region0 = null;
+ // if (pool) {
+ // if (locator) {
+ // region0 = CacheHelper.CreateTCRegion_Pool(RegionNames[0], true, false, null, null, endpoints, "__TESTPOOL1_", true); //caching enable false
+ // }
+ // else {
+ // region0 = CacheHelper.CreateTCRegion_Pool(RegionNames[0], true, false, null, endpoints, null, "__TESTPOOL1_", true); //caching enable false
+ // }
+ // }
+ // else {
+ // region0 = CacheHelper.CreateTCRegion(RegionNames[0], true, false, null, endpoints, true); //caching enable false
+ // }
+ // try {
+ // region0.GetAll(resultKeys.ToArray(), null, null, true);
+ // Assert.Fail("Expected IllegalArgumentException");
+ // }
+ // catch (IllegalArgumentException ex) {
+ // Util.Log("Got expected IllegalArgumentException" + ex.Message);
+ // }
+ // //recreate region with caching enabled true
+ // region0.LocalDestroyRegion();
+ // region0 = null;
+ // if (pool) {
+ // if (locator) {
+ // region0 = CacheHelper.CreateTCRegion_Pool(RegionNames[0], true, true, null, null, endpoints, "__TESTPOOL1_", true); //caching enable true
+ // }
+ // else {
+ // region0 = CacheHelper.CreateTCRegion_Pool(RegionNames[0], true, true, null, endpoints, null, "__TESTPOOL1_", true); //caching enable true
+ // }
+ // }
+ // else {
+ // region0 = CacheHelper.CreateTCRegion(RegionNames[0], true, true, null, endpoints, true); //caching enable true
+ // }
+ // Dictionary<ICacheableKey, IGeodeSerializable> values = new Dictionary<ICacheableKey, IGeodeSerializable>();
+ // Dictionary<ICacheableKey, Exception> exceptions = new Dictionary<ICacheableKey, Exception>();
+ // resultKeys.Clear();
+ // try {
+ // region0.GetAll(resultKeys.ToArray(), values, exceptions);
+ // Assert.Fail("Expected IllegalArgumentException");
+ // }
+ // catch (IllegalArgumentException ex) {
+ // Util.Log("Got expected IllegalArgumentException" + ex.Message);
+ // }
+ // resultKeys.Add(key0);
+ // resultKeys.Add(key1);
+ // try {
+ // region0.GetAll(resultKeys.ToArray(), null, null, false);
+ // Assert.Fail("Expected IllegalArgumentException");
+ // }
+ // catch (IllegalArgumentException ex) {
+ // Util.Log("Got expected IllegalArgumentException" + ex.Message);
+ // }
+ // region0.GetAll(resultKeys.ToArray(), values, exceptions);
+ // if (values.Count != 2) {
+ // Assert.Fail("Expected 2 values");
+ // }
+ // if (exceptions.Count != 0) {
+ // Assert.Fail("No exception expected");
+ // }
+ // try {
+ // CacheableString val0 = (CacheableString)values[(resultKeys[0])];
+ // CacheableString val1 = (CacheableString)values[(resultKeys[1])];
+ // if (!(val0.ToString().Equals(m_nvals[0])) || !(val1.ToString().Equals(m_nvals[1]))) {
+ // Assert.Fail("Got unexpected value");
+ // }
+ // }
+ // catch (Exception ex) {
+ // Assert.Fail("Key should have been found" + ex.Message);
+ // }
+ // IRegion<object, object> region1 = CacheHelper.GetVerifyRegion(m_regionNames[1]);
+ // CacheableKey key2 = m_keys[2];
+ // CacheableKey key3 = m_keys[3];
+ // region1.LocalInvalidate(key2);
+ // resultKeys.Clear();
+ // resultKeys.Add(key2);
+ // resultKeys.Add(key3);
+ // values.Clear();
+ // exceptions.Clear();
+ // region1.GetAll(resultKeys.ToArray(), values, exceptions, true);
+ // if (values.Count != 2) {
+ // Assert.Fail("Expected 2 values");
+ // }
+ // if (exceptions.Count != 0) {
+ // Assert.Fail("Expected no exception");
+ // }
+ // try {
+ // CacheableString val2 = (CacheableString)values[(resultKeys[0])];
+ // CacheableString val3 = (CacheableString)values[(resultKeys[1])];
+ // if (!(val2.ToString().Equals(m_nvals[2])) || !(val3.ToString().Equals(m_vals[3]))) {
+ // Assert.Fail("Got unexpected value");
+ // }
+ // }
+ // catch (Exception ex) {
+ // Assert.Fail("Key should have been found" + ex.Message);
+ // }
+ // if (region1.Size != 2) {
+ // Assert.Fail("Expected 2 entry in the region");
+ // }
+ // RegionEntry[] regionEntry = region1.GetEntries(false);//Not of subregions
+ // if (regionEntry.Length != 2) {
+ // Assert.Fail("Should have two values in the region");
+ // }
+ // VerifyEntry(RegionNames[1], m_keys[2], m_nvals[2], true);
+ // VerifyEntry(RegionNames[1], m_keys[3], m_vals[3], true);
+ // region1.LocalInvalidate(key3);
+ // values = null;
+ // exceptions.Clear();
+ // region1.GetAll(resultKeys.ToArray(), values, exceptions, true);
+ // if (region1.Size != 2) {
+ // Assert.Fail("Expected 2 entry in the region");
+ // }
+ // regionEntry = region1.GetEntries(false);
+ // if (regionEntry.Length != 2) {
+ // Assert.Fail("Should have two values in the region");
+ // }
+ // VerifyEntry(RegionNames[1], m_keys[2], m_nvals[2], true);
+ // VerifyEntry(RegionNames[1], m_keys[3], m_nvals[3], true);
+ // Util.Log("Exits GetAll");
+ //}
+
+ //private void UpdateEntry(string p, string p_2, string p_3)
+ //{
+ // throw new Exception("The method or operation is not implemented.");
+ //}
+
+ public void PutAllStep3()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ List<object> resultKeys = new List<object>();
+ object key0 = m_keys[0];
+ object key1 = m_keys[1];
+ resultKeys.Add(key0);
+ resultKeys.Add(key1);
+ region0.GetSubscriptionService().RegisterKeys(resultKeys.ToArray());
+ Util.Log("Step three completes");
+ }
+
+ public void PutAllStep4()
+ {
+ Dictionary<object, object> map0 = new Dictionary<object, object>();
+ Dictionary<object, object> map1 = new Dictionary<object, object>();
+ object key0 = m_keys[0];
+ object key1 = m_keys[1];
+ string val0 = m_vals[0];
+ string val1 = m_vals[1];
+ map0.Add(key0, val0);
+ map0.Add(key1, val1);
+
+ object key2 = m_keys[2];
+ object key3 = m_keys[3];
+ string val2 = m_vals[2];
+ string val3 = m_vals[3];
+ map1.Add(key2, val2);
+ map1.Add(key3, val3);
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region0.PutAll(map0);
+ region1.PutAll(map1);
+ Util.Log("Put All Complets");
+ }
+
+ public void PutAllStep5()
+ {
+ VerifyCreated(m_regionNames[0], m_keys[0]);
+ VerifyCreated(m_regionNames[0], m_keys[1]);
+
+ VerifyEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+
+ DoNetsearch(m_regionNames[1], m_keys[2], m_vals[2], true);
+ DoNetsearch(m_regionNames[1], m_keys[3], m_vals[3], true);
+
+ Util.Log("StepFive complete.");
+ }
+
+ public void PutAllStep6()
+ {
+ Dictionary<object, object> map0 = new Dictionary<object, object>();
+ Dictionary<object, object> map1 = new Dictionary<object, object>();
+
+ object key0 = m_keys[0];
+ object key1 = m_keys[1];
+ string val0 = m_nvals[0];
+ string val1 = m_nvals[1];
+ map0.Add(key0, val0);
+ map0.Add(key1, val1);
+
+ object key2 = m_keys[2];
+ object key3 = m_keys[3];
+ string val2 = m_nvals[2];
+ string val3 = m_nvals[3];
+ map1.Add(key2, val2);
+ map1.Add(key3, val3);
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ region0.PutAll(map0);
+ region1.PutAll(map1);
+ Util.Log("Step6 Complets");
+ }
+
+ public void PutAllStep7() //client 1
+ {
+ //Region0 is changed at client 1 because keys[0] and keys[1] were registered.PutAllStep3
+ VerifyEntry(m_regionNames[0], m_keys[0], m_nvals[0]);
+ VerifyEntry(m_regionNames[0], m_keys[1], m_nvals[1]);
+ // region1 is not changed at client beacuse no regsiter interest.
+ VerifyEntry(m_regionNames[1], m_keys[2], m_vals[2]);
+ VerifyEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ Util.Log("PutAllStep7 complete.");
+ }
+
+ public virtual void RemoveAllStep1()
+ {
+ CreateEntry(m_regionNames[0], m_keys[0], m_vals[0]);
+ CreateEntry(m_regionNames[0], m_keys[1], m_vals[1]);
+ CreateEntry(m_regionNames[0], m_keys[2], m_vals[2]);
+
+ CreateEntry(m_regionNames[1], m_keys[3], m_vals[3]);
+ CreateEntry(m_regionNames[1], m_keys[4], m_vals[4]);
+ CreateEntry(m_regionNames[1], m_keys[5], m_vals[5]);
+ Util.Log("RemoveAllStep1 complete.");
+ }
+
+ public virtual void RemoveAllStep2()
+ {
+ IRegion<object, object> reg0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> reg1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ ICollection<object> keys0 = new List<object>();
+ ICollection<object> keys1 = new List<object>();
+ for (int i = 0; i < 3; i++)
+ {
+ keys0.Add(m_keys[i]);
+ keys1.Add(m_keys[i + 3]);
+ }
+
+ //try remove all
+ reg0.RemoveAll(keys0);
+ reg1.RemoveAll(keys1);
+ Util.Log("RemoveAllStep2 complete.");
+ }
+
+ public virtual void RemoveAllStep3()
+ {
+ VerifyDestroyed(m_regionNames[0], m_keys[0]);
+ VerifyDestroyed(m_regionNames[0], m_keys[1]);
+ VerifyDestroyed(m_regionNames[0], m_keys[2]);
+
+ VerifyDestroyed(m_regionNames[1], m_keys[3]);
+ VerifyDestroyed(m_regionNames[1], m_keys[4]);
+ VerifyDestroyed(m_regionNames[1], m_keys[5]);
+
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[1]);
+ Assert.AreEqual(region0.Count, 0, "Remove all should remove the entries specified");
+ Assert.AreEqual(region1.Count, 0, "Remove all should remove the entries specified");
+ Util.Log("RemoveAllStep3 complete.");
+ }
+
+ public virtual void RemoveAllSingleHopStep()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetVerifyRegion<object, object>(m_regionNames[0]);
+ ICollection<object> keys = new Collection<object>();
+ for (int y = 0; y < 1000; y++)
+ {
+ Util.Log("put:{0}", y);
+ region0[y] = y;
+ keys.Add(y);
+ }
+ region0.RemoveAll(keys);
+ Assert.AreEqual(0, region0.Count);
+ Util.Log("RemoveAllSingleHopStep completed");
+ }
+
+ void runDistOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateNonExistentRegion, CacheHelper.Locators);
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(CheckServerKeys);
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runDistOps2()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml", "cacheserver3.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, true);
+ Util.Log("StepSix complete.");
+ //m_client1.Call(GetAll, pool, locator);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runCheckPutGet()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheServer_pdxreadserialized.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ PutGetTests putGetTest = new PutGetTests();
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) regions created");
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 2 (pool locators) regions created");
+
+ m_client1.Call(putGetTest.SetRegion, RegionNames[0]);
+ m_client2.Call(putGetTest.SetRegion, RegionNames[0]);
+
+ long dtTicks = DateTime.Now.Ticks;
+ CacheableHelper.RegisterBuiltins(dtTicks);
+
+ putGetTest.TestAllKeyValuePairs(m_client1, m_client2,
+ RegionNames[0], true, dtTicks);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runCheckPutGetWithAppDomain()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheServer_pdxreadserialized.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ PutGetTests putGetTest = new PutGetTests();
+
+ m_client1.Call(InitializeAppDomain);
+ long dtTime = DateTime.Now.Ticks;
+ m_client1.Call(CreateTCRegions_Pool_AD, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, dtTime);
+ Util.Log("Client 1 (pool locators) regions created");
+
+ m_client1.Call(SetRegionAD, RegionNames[0]);
+ //m_client2.Call(putGetTest.SetRegion, RegionNames[0]);
+
+ // CacheableHelper.RegisterBuiltins();
+
+ //putGetTest.TestAllKeyValuePairs(m_client1, m_client2,
+ //RegionNames[0], true, pool);
+ m_client1.Call(TestAllKeyValuePairsAD, RegionNames[0], true, dtTime);
+ //m_client1.Call(CloseCacheAD);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.CloseCache();
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void putGetTest()
+ {
+
+ }
+
+ void runPdxAppDomainTest(bool caching, bool readPdxSerialized)
+ {
+ CacheHelper.SetupJavaServers(true, "cacheServer_pdxreadserialized.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+
+ m_client1.Call(InitializeAppDomain);
+
+ m_client1.Call(CreateTCRegions_Pool_AD2, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, false, caching, readPdxSerialized);
+ Util.Log("Client 1 (pool locators) regions created");
+
+ m_client1.Call(SetRegionAD, RegionNames[0]);
+
+ m_client1.Call(pdxPutGetTest, caching, readPdxSerialized);
+ m_client1.Call(pdxGetPutTest, caching, readPdxSerialized);
+ //m_client2.Call(putGetTest.SetRegion, RegionNames[0]);
+
+ // CacheableHelper.RegisterBuiltins();
+
+ //putGetTest.TestAllKeyValuePairs(m_client1, m_client2,
+ //RegionNames[0], true, pool);
+ // m_client1.Call(TestAllKeyValuePairsAD, RegionNames[0], true, pool);
+ m_client1.Call(CloseCacheAD);
+
+ Util.Log("Client 1 closed");
+
+ //CacheHelper.CloseCache();
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runPartitionResolver()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pr.xml",
+ "cacheserver2_pr.xml", "cacheserver3_pr.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ PutGetTests putGetTest = new PutGetTests();
+ // Create and Add partition resolver to the regions.
+ //CustomPartitionResolver<object> cpr = CustomPartitionResolver<object>.Create();
+
+ m_client1.Call(CreateTCRegions_Pool2_WithPartitionResolver, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, true);
+ Util.Log("Client 1 (pool locators) regions created");
+ m_client2.Call(CreateTCRegions_Pool2_WithPartitionResolver, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false, true);
+ Util.Log("Client 2 (pool locators) regions created");
+
+ m_client1.Call(putGetTest.SetRegion, RegionNames[1]);
+ m_client2.Call(putGetTest.SetRegion, RegionNames[1]);
+ putGetTest.DoPRSHPartitionResolverTasks(m_client1, m_client2, RegionNames[1]);
+
+ m_client1.Call(putGetTest.SetRegion, RegionNames[0]);
+ m_client2.Call(putGetTest.SetRegion, RegionNames[0]);
+ putGetTest.DoPRSHPartitionResolverTasks(m_client1, m_client2, RegionNames[0]);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runTradeKeyResolver()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_TradeKey.xml",
+ "cacheserver2_TradeKey.xml", "cacheserver3_TradeKey.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ m_client1.Call(CreateTCRegion2, TradeKeyRegion, true, true, TradeKeyResolver.Create(),
+ CacheHelper.Locators, true);
+ Util.Log("Client 1 (pool locators) region created");
+
+ PutGetTests putGetTest = new PutGetTests();
+ m_client1.Call(putGetTest.DoPRSHTradeResolverTasks, TradeKeyRegion);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFixedPartitionResolver()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_fpr.xml",
+ "cacheserver2_fpr.xml", "cacheserver3_fpr.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ PutGetTests putGetTest = new PutGetTests();
+
+ m_client1.Call(CreateTCRegions_Pool1, PartitionRegion1,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) PartitionRegion1 created");
+
+ m_client1.Call(CreateTCRegions_Pool1, PartitionRegion2,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) PartitionRegion2 created");
+
+ m_client1.Call(CreateTCRegions_Pool1, PartitionRegion3,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) PartitionRegion3 created");
+
+ m_client1.Call(putGetTest.SetRegion, PartitionRegion1);
+ putGetTest.DoPRSHFixedPartitionResolverTasks(m_client1, PartitionRegion1);
+
+ m_client1.Call(putGetTest.SetRegion, PartitionRegion2);
+ putGetTest.DoPRSHFixedPartitionResolverTasks(m_client1, PartitionRegion2);
+
+ m_client1.Call(putGetTest.SetRegion, PartitionRegion3);
+ putGetTest.DoPRSHFixedPartitionResolverTasks(m_client1, PartitionRegion3);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runCheckPut()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_hashcode.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ PutGetTests putGetTest = new PutGetTests();
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) regions created");
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 2 (pool locators) regions created");
+
+ m_client1.Call(putGetTest.SetRegion, RegionNames[0]);
+ m_client2.Call(putGetTest.SetRegion, RegionNames[0]);
+ long dtTime = DateTime.Now.Ticks;
+ CacheableHelper.RegisterBuiltinsJavaHashCode(dtTime);
+ putGetTest.TestAllKeys(m_client1, m_client2, RegionNames[0], dtTime);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runCheckNativeException()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(RegisterOtherType);
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.None);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.Geode);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.System);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.GeodeGeode);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.GeodeSystem);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.SystemGeode);
+ m_client1.Call(DoPutsOtherTypeWithEx, OtherType.ExceptionType.SystemSystem);
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailover()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(StepFiveFailover);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, false);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runNotification()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(RegisterAllKeysR0WithoutValues);
+ m_client1.Call(RegisterAllKeysR1WithoutValues);
+
+ m_client2.Call(RegisterAllKeysR0WithoutValues);
+ m_client2.Call(RegisterAllKeysR1WithoutValues);
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixNotify, false);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenNotify, false);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightNotify, false);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNineNotify, false);
+ Util.Log("StepNine complete.");
+
+ m_client2.Call(StepTen);
+ Util.Log("StepTen complete.");
+
+ m_client1.Call(StepEleven);
+ Util.Log("StepEleven complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailover2()
+ {
+ // This test is for client failover with client notification.
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(RegisterAllKeysR0WithoutValues);
+ m_client1.Call(RegisterAllKeysR1WithoutValues);
+
+ m_client2.Call(RegisterAllKeysR0WithoutValues);
+ m_client2.Call(RegisterAllKeysR1WithoutValues);
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(CheckServerKeys);
+ m_client1.Call(StepFive, false);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSixNotify, false);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSevenNotify, false);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEightNotify, false);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNineNotify, false);
+ Util.Log("StepNine complete.");
+
+ m_client2.Call(StepTen);
+ Util.Log("StepTen complete.");
+
+ m_client1.Call(StepEleven);
+ Util.Log("StepEleven complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailover3()
+ {
+ CacheHelper.SetupJavaServers(true,
+ "cacheserver.xml", "cacheserver2.xml", "cacheserver3.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+ CacheHelper.StartJavaServerWithLocators(3, "GFECS3", 1);
+ Util.Log("Cacheserver 3 started.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ m_client1.Call(StepFive, false);
+ Util.Log("StepFive complete.");
+
+ m_client2.Call(StepSix, false);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ CacheHelper.StopJavaServer(3);
+ Util.Log("Cacheserver 3 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runFailoverInterestAll()
+ {
+ runFailoverInterestAll(false);
+ }
+
+ void runFailoverInterestAll(bool ssl)
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC", null, ssl);
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1, ssl);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true, ssl);
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true, ssl);
+
+ Util.Log("CreateTCRegions complete.");
+
+ m_client2.Call(RegexInterestAllStep2);
+ Util.Log("RegexInterestAllStep2 complete.");
+
+ m_client2.Call(RegexInterestAllStep3, CacheHelper.Locators);
+ Util.Log("RegexInterestAllStep3 complete.");
+
+ m_client1.Call(RegexInterestAllStep4);
+ Util.Log("RegexInterestAllStep4 complete.");
+
+ m_client2.Call(RegexInterestAllStep5);
+ Util.Log("RegexInterestAllStep5 complete.");
+
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1, ssl);
+
+ CacheHelper.StopJavaServer(1); //failover happens
+ Util.Log("Cacheserver 2 started and failover forced");
+
+ m_client1.Call(RegexInterestAllStep6);
+ Util.Log("RegexInterestAllStep6 complete.");
+
+ System.Threading.Thread.Sleep(5000); // sleep to let updates arrive
+
+ m_client2.Call(RegexInterestAllStep7);
+ Util.Log("RegexInterestAllStep7 complete.");
+
+ m_client2.Call(RegexInterestAllStep8);
+ Util.Log("RegexInterestAllStep8 complete.");
+
+ m_client1.Call(RegexInterestAllStep9);
+ Util.Log("RegexInterestAllStep9 complete.");
+
+ m_client2.Call(RegexInterestAllStep10);
+ Util.Log("RegexInterestAllStep10 complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1, true, ssl);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runPutAll()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription.xml",
+ "cacheserver_notify_subscription2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true); //Client Notification true for client 1
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", true); //Cleint notification true for client 2
+
+ Util.Log("IRegion<object, object> creation complete.");
+
+ m_client1.Call(PutAllStep3);
+ Util.Log("PutAllStep3 complete.");
+
+ m_client2.Call(PutAllStep4);
+ Util.Log("PutAllStep4 complete.");
+
+ m_client1.Call(PutAllStep5);
+ Util.Log("PutAllStep5 complete.");
+
+ m_client2.Call(PutAllStep6);
+ Util.Log("PutAllStep6 complete.");
+
+ m_client1.Call(PutAllStep7);
+ Util.Log("PutAllStep7 complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRemoveAll()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(RemoveAllStep1);
+ Util.Log("RemoveAllStep1 complete.");
+
+ m_client1.Call(RemoveAllStep2);
+ Util.Log("RemoveAllStep2 complete.");
+
+ m_client2.Call(RemoveAllStep3);
+ Util.Log("RemoveAllStep3 complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRemoveAllWithSingleHop()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_pr.xml",
+ "cacheserver2_pr.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("Cacheserver 2 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("Client 1 (pool locators) regions created");
+ Util.Log("Region creation complete.");
+
+ m_client1.Call(RemoveAllSingleHopStep);
+ Util.Log("RemoveAllSingleHopStep complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRemoveOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client1.Call(RemoveStepFive);
+ Util.Log("RemoveStepFive complete.");
+
+ m_client2.Call(RemoveStepSix);
+ Util.Log("RemoveStepSix complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runRemoveOps1()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver1_expiry.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames2,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client2.Call(CreateTCRegions_Pool, RegionNames2,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepTwo (pool locators) complete.");
+
+ m_client2.Call(RemoveStepEight);
+ Util.Log("RemoveStepEight complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+ m_client2.Call(Close);
+ Util.Log("Client 2 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ void runIdictionaryOps()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames2,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ Util.Log("StepOne (pool locators) complete.");
+
+ m_client1.Call(IdictionaryRegionOperations, "DistRegionAck");
+ Util.Log("IdictionaryRegionOperations complete.");
+
+ m_client1.Call(IdictionaryRegionNullKeyOperations, "DistRegionAck");
+ Util.Log("IdictionaryRegionNullKeyOperations complete.");
+
+ m_client1.Call(IdictionaryRegionArrayOperations, "DistRegionAck");
+ Util.Log("IdictionaryRegionArrayOperations complete.");
+
+ m_client1.Call(Close);
+ Util.Log("Client 1 closed");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator 1 stopped.");
+
+ CacheHelper.ClearEndpoints();
+ CacheHelper.ClearLocators();
+ }
+
+ public void EmptyByteArrayTest()
+ {
+ IRegion<int, byte[]> region = CacheHelper.GetVerifyRegion<int, byte[]>(RegionNames3[0]);
+
+ IRegionService regServ = region.RegionService;
+
+ Cache cache = regServ as Cache;
+
+ Assert.IsNotNull(cache);
+
+ region[0] = new byte[0];
+ Util.Log("Put empty byteArray in region");
+ Assert.AreEqual(0, region[0].Length);
+
+ region[1] = new byte[2];
+ Util.Log("Put non empty byteArray in region");
+
+ Assert.AreEqual(2, region[1].Length);
+
+ region[2] = System.Text.Encoding.ASCII.GetBytes("TestString");
+ Util.Log("Put string in region");
+
+ Assert.AreEqual(0, "TestString".CompareTo(System.Text.Encoding.ASCII.GetString(region[2]).ToString()));
+ Util.Log("EmptyByteArrayTest completed successfully");
+ }
+
+ #region Tests
+
+ [Test]
+ public void PutEmptyByteArrayTest()
+ {
+ CacheHelper.SetupJavaServers("cacheserver.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+ m_client1.Call(CreateTCRegions_Pool, RegionNames3,
+ (string)null, "__TESTPOOL1_", true);
+ Util.Log("StepOne of region creation complete.");
+
+ m_client1.Call(EmptyByteArrayTest);
+ Util.Log("EmptyByteArrayTest completed.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ }
+
+
+ [Test]
+ public void CheckKeyOnServer()
+ {
+ CacheHelper.SetupJavaServers("cacheserver.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ (string)null, "__TESTPOOL1_", true);
+ Util.Log("StepOne of region creation complete.");
+
+ m_client1.Call(CheckAndPutKey);
+ Util.Log("Check for ContainsKeyOnServer complete.");
+
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ [Test]
+ public void RegionClearTest()
+ {
+ CacheHelper.SetupJavaServers("cacheserver_notify_subscription.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ (string)null, "__TESTPOOL1_", true);
+ Util.Log("client 1 StepOne of region creation complete.");
+ m_client2.Call(CreateTCRegions_Pool, RegionNames,
+ (string)null, "__TESTPOOL1_", true);
+ Util.Log("client 2 StepOne of region creation complete.");
+
+ m_client1.Call(ClearRegionListenersStep1);
+ m_client2.Call(ClearRegionStep1);
+ m_client1.Call(ClearRegionListenersStep2);
+ m_client2.Call(ClearRegionStep2);
+ m_client1.Call(ClearRegionListenersStep3);
+ m_client2.Call(ClearRegionStep3);
+ Util.Log("StepTwo of check for RegionClearTest complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ [Test]
+ public void GetInterestsOnClient()
+ {
+ CacheHelper.SetupJavaServers("cacheserver_notify_subscription.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(CreateTCRegions_Pool, RegionNames,
+ (string)null, "__TESTPOOL1_", true);
+
+
+ Util.Log("StepOne of region creation complete.");
+
+ m_client1.Call(GetInterests);
+ Util.Log("StepTwo of check for GetInterestsOnClient complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ [Test]
+ public void DistOps()
+ {
+ runDistOps();
+ }
+
+ [Test]
+ public void DistOps2()
+ {
+ runDistOps2();
+ }
+
+ [Test]
+ public void Notification()
+ {
+ runNotification();
+ }
+
+ [Test]
+ public void CheckPutGet()
+ {
+ runCheckPutGet();
+ }
+
+ [Test]
+ public void CheckPutGetWithAppDomain()
+ {
+ runCheckPutGetWithAppDomain();
+ }
+
+ [Test]
+ public void PdxAppDomainTest()
+ {
+ runPdxAppDomainTest(false, true); // pool with locators
+ runPdxAppDomainTest(true, true); // pool with locators
+ runPdxAppDomainTest(false, false); // pool with locators
+ runPdxAppDomainTest(true, false); // pool with locators
+ }
+
+ [Test]
+ public void JavaHashCode()
+ {
+ runCheckPut();
+ }
+
+ [Test]
+ public void CheckPartitionResolver()
+ {
+ runPartitionResolver();
+ }
+
+ [Test]
+ public void TradeKeyPartitionResolver()
+ {
+ runTradeKeyResolver();
+ }
+
+ [Test]
+ public void CheckFixedPartitionResolver()
+ {
+ runFixedPartitionResolver();
+ }
+
+ [Test]
+ public void CheckNativeException()
+ {
+ runCheckNativeException();
+ }
+
+ [Test]
+ public void Failover()
+ {
+ runFailover();
+ }
+
+ [Test]
+ public void Failover2()
+ {
+ runFailover2();
+ }
+
+ [Test]
+ public void Failover3()
+ {
+ runFailover3();
+ }
+
+ [Test]
+ public void FailOverInterestAll()
+ {
+ runFailoverInterestAll();
+ }
+
+ [Test]
+ public void FailOverInterestAllWithSSL()
+ {
+ runFailoverInterestAll(true);
+ }
+
+ [Test]
+ public void PutAll()
+ {
+ runPutAll();
+ }
+
+ [Test]
+ public void RemoveAll()
+ {
+ runRemoveAll();
+ }
+
+ [Test]
+ public void RemoveAllWithSingleHop()
+ {
+ runRemoveAllWithSingleHop();
+ }
+
+
+ [Test]
+ public void RemoveOps()
+ {
+ runRemoveOps();
+ }
+
+ [Test]
+ public void RemoveOps1()
+ {
+ runRemoveOps1();
+ }
+
+ [Test]
+ public void IdictionaryOps()
+ {
+ runIdictionaryOps();
+ }
+
+ #endregion
+ }
+}
[02/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxHelper.cpp b/clicache/src/impl/PdxHelper.cpp
new file mode 100644
index 0000000..f611146
--- /dev/null
+++ b/clicache/src/impl/PdxHelper.cpp
@@ -0,0 +1,451 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "begin_native.hpp"
+#include <CacheImpl.hpp>
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+#include "PdxHelper.hpp"
+#include "PdxTypeRegistry.hpp"
+#include "PdxWriterWithTypeCollector.hpp"
+#include "PdxReaderWithTypeCollector.hpp"
+#include "PdxRemoteReader.hpp"
+#include "PdxRemoteWriter.hpp"
+#include "../Serializable.hpp"
+#include "PdxWrapper.hpp"
+#include "../Log.hpp"
+#include "PdxInstanceImpl.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+
+ void PdxHelper::SerializePdx(DataOutput^ dataOutput, IPdxSerializable^ pdxObject)
+ {
+ dataOutput->setPdxSerialization(true);
+ String^ pdxClassname = nullptr;
+ bool isPdxWrapper = false;
+ //String^ className = nullptr;
+ Type^ pdxType = nullptr;
+
+ PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(pdxObject);
+
+ if(pdxWrapper != nullptr)
+ {
+ //className = pdxWrapper->GetObject()->GetType()->FullName;
+ isPdxWrapper = true;
+ pdxType = pdxWrapper->GetObject()->GetType();
+ }
+ else
+ {
+ PdxInstanceImpl^ pdxII = dynamic_cast<PdxInstanceImpl^>(pdxObject);
+ if(pdxII != nullptr)
+ {
+ PdxType^ piPt = pdxII->getPdxType();
+ if(piPt != nullptr && piPt->TypeId == 0)//from pdxInstance factory need to get typeid from server
+ {
+ int typeId = PdxTypeRegistry::GetPDXIdForType(piPt, dataOutput->GetPoolName(), dataOutput->GetNative()->getCache());
+ pdxII->setPdxId(typeId);
+ }
+ PdxLocalWriter^ plw = gcnew PdxLocalWriter(dataOutput, piPt);
+ pdxII->ToData(plw);
+
+ plw->EndObjectWriting();//now write typeid
+
+ int len = 0;
+ System::Byte* pdxStream = plw->GetPdxStream(len);
+ pdxII->updatePdxStream( pdxStream, len);
+
+
+ return;
+ }
+ //className = pdxObject->GetType()->FullName;
+ pdxType = pdxObject->GetType();
+ }
+
+ pdxClassname = Serializable::GetPdxTypeName(pdxType->FullName);
+ PdxType^ localPdxType = PdxTypeRegistry::GetLocalPdxType(pdxClassname);
+
+ if(localPdxType == nullptr)
+ {
+ //need to grab type info, as fromdata is not called yet
+ PdxWriterWithTypeCollector^ ptc = gcnew PdxWriterWithTypeCollector(dataOutput, pdxClassname);
+ pdxObject->ToData(ptc);
+
+ PdxType^ nType = ptc->PdxLocalType;//local type
+ nType->InitializeType();//initialize it
+
+ //get type id from server and then set it
+ int nTypeId = PdxTypeRegistry::GetPDXIdForType(pdxType,
+ dataOutput->GetPoolName(), nType, true, dataOutput->GetNative()->getCache());
+ nType->TypeId = nTypeId;
+
+ ptc->EndObjectWriting();//now write typeid
+
+ PdxTypeRegistry::AddLocalPdxType(pdxClassname, nType);//add classname VS pdxType
+ PdxTypeRegistry::AddPdxType(nTypeId, nType);//add typeid vs pdxtype
+
+ //This is for pdx Statistics
+ System::Byte* stPos = dataOutput->GetStartBufferPosition() + ptc->getStartPositionOffset();
+ int pdxLen = PdxHelper::ReadInt32(stPos);
+ // TODO global - Figure out why dataInput cache is nullptr
+ // CacheRegionHelper::getCacheImpl(dataOutput->GetNative()->getCache())->getCachePerfStats().incPdxSerialization(pdxLen + 1 + 2*4); //pdxLen + 93 DSID + len + typeID
+ // GC::KeepAlive(dataOutput);
+ }
+ else//we know locasl type, need to see preerved data
+ {
+ //if object got from server than create instance of RemoteWriter otherwise local writer.
+ PdxRemotePreservedData^ pd = PdxTypeRegistry::GetPreserveData(pdxObject);
+
+ //now always remotewriter as we have API Read/WriteUnreadFields
+ //so we don't know whether user has used those or not;; Can we do some trick here?
+ PdxRemoteWriter^ prw = nullptr;
+ if(pd != nullptr)
+ {
+ PdxType^ mergedPdxType = PdxTypeRegistry::GetPdxType(pd->MergedTypeId);
+
+ prw = gcnew PdxRemoteWriter(dataOutput, mergedPdxType, pd);
+ }
+ else
+ {
+ prw = gcnew PdxRemoteWriter(dataOutput, pdxClassname);
+ }
+
+ pdxObject->ToData(prw);
+
+ prw->EndObjectWriting();
+
+ //This is for pdx Statistics
+ System::Byte* stPos = dataOutput->GetStartBufferPosition() + prw->getStartPositionOffset();
+ int pdxLen = PdxHelper::ReadInt32(stPos);
+ // TODO global - Figure out why dataInput cache is nullptr
+ // CacheRegionHelper::getCacheImpl(dataOutput->GetNative()->getCache())->getCachePerfStats().incPdxSerialization(pdxLen + 1 + 2*4); //pdxLen + 93 DSID + len + typeID
+ // GC::KeepAlive(dataOutput);
+ }
+ }
+
+
+ IPdxSerializable^ PdxHelper::DeserializePdx(DataInput^ dataInput, bool forceDeserialize, int typeId, int len, const native::SerializationRegistry* serializationRegistry)
+ {
+ dataInput->setPdxdeserialization(true);
+ String^ pdxClassname = nullptr;
+ String^ pdxDomainClassname = nullptr;
+ IPdxSerializable^ pdxObject = nullptr;
+ dataInput->AdvanceUMCursor();//it will increase the cursor in c++ layer
+ dataInput->SetBuffer();//it will c++ buffer in cli layer
+
+ PdxType^ pType = PdxTypeRegistry::GetPdxType(typeId);
+ PdxType^ pdxLocalType = nullptr;
+
+ if(pType != nullptr)//this may happen with PdxInstanceFactory
+ pdxLocalType = PdxTypeRegistry::GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMapper
+
+ if(pType != nullptr && pdxLocalType != nullptr)//type found
+ {
+ pdxClassname = pType->PdxClassName;
+ pdxDomainClassname = Serializable::GetLocalTypeName(pdxClassname);
+ //Log::Debug("found type " + typeId + " " + pType->IsLocal);
+ pdxObject = Serializable::GetPdxType(pdxDomainClassname);
+ if(pType->IsLocal)//local type no need to read Unread data
+ {
+ PdxLocalReader^ plr = gcnew PdxLocalReader(dataInput, pType, len);
+ pdxObject->FromData(plr);
+ plr->MoveStream();//it will set stream
+ }
+ else
+ {
+ PdxRemoteReader^ prr = gcnew PdxRemoteReader(dataInput, pType, len);
+ pdxObject->FromData(prr);
+
+ PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxRemotePreservedData^ preserveData = prr->GetPreservedData(mergedVersion, pdxObject);
+ if(preserveData != nullptr)
+ PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);//it will set data in weakhashmap
+ prr->MoveStream();
+ }
+ }
+ else//type not found; need to get from server
+ {
+ if(pType == nullptr)
+ {
+ pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->GetNative()->getCache()));
+ pdxLocalType = PdxTypeRegistry::GetLocalPdxType(pType->PdxClassName);//this should be fine for IPdxTypeMappers
+ }
+
+ pdxClassname = pType->PdxClassName;
+ pdxDomainClassname = Serializable::GetLocalTypeName(pdxClassname);
+
+ pdxObject = Serializable::GetPdxType(pdxDomainClassname);
+
+ Object^ pdxRealObject = pdxObject;
+ bool isPdxWrapper = false;
+
+ PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(pdxObject);
+
+ if(pdxWrapper != nullptr)
+ {
+ //pdxDomainType = pdxWrapper->GetObject()->GetType();
+ isPdxWrapper = true;
+ }
+ else
+ {
+ //pdxDomainType = pdxObject->GetType();
+ }
+
+ if(pdxLocalType == nullptr)//need to know local type
+ {
+ PdxReaderWithTypeCollector^ prtc = gcnew PdxReaderWithTypeCollector(dataInput,pType,len);
+ pdxObject->FromData(prtc);
+
+ if(isPdxWrapper)
+ pdxRealObject = pdxWrapper->GetObject();
+
+ pdxLocalType = prtc->LocalType;
+
+ if(pType->Equals(pdxLocalType))//same
+ {
+ PdxTypeRegistry::AddLocalPdxType(pdxClassname, pType);
+ PdxTypeRegistry::AddPdxType(pType->TypeId, pType);
+ pType->IsLocal = true;
+ }
+ else
+ {
+ //need to know local type and then merge type
+ pdxLocalType->InitializeType();
+ pdxLocalType->TypeId = PdxTypeRegistry::GetPDXIdForType(pdxObject->GetType(),
+ dataInput->GetPoolName(),
+ pdxLocalType, true, dataInput->GetNative()->getCache());
+ pdxLocalType->IsLocal = true;
+ PdxTypeRegistry::AddLocalPdxType(pdxClassname, pdxLocalType);//added local type
+ PdxTypeRegistry::AddPdxType(pdxLocalType->TypeId, pdxLocalType);
+
+ pType->InitializeType();
+ PdxTypeRegistry::AddPdxType(pType->TypeId, pType); //adding remote type
+ //pdxLocalType->AddOtherVersion(pType);
+ //pdxLocalType->AddOtherVersion(pdxLocalType);//no need to add local type
+
+ //need to create merge type
+ CreateMergedType(pdxLocalType, pType, dataInput, serializationRegistry);
+
+ PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxRemotePreservedData^ preserveData = prtc->GetPreservedData(mergedVersion, pdxObject);
+ if(preserveData != nullptr)
+ PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);
+ }
+ prtc->MoveStream();
+ }
+ else//remote reader will come here as local type is there
+ {
+ pType->InitializeType();
+ //Log::Debug("Adding type " + pType->TypeId);
+ PdxTypeRegistry::AddPdxType(pType->TypeId, pType); //adding remote type
+ //pdxLocalType->AddOtherVersion(pType);
+
+ PdxRemoteReader^ prr = gcnew PdxRemoteReader(dataInput, pType, len);
+
+ pdxObject->FromData(prr);
+
+ if(isPdxWrapper)
+ pdxRealObject = pdxWrapper->GetObject();
+
+ //need to create merge type
+ CreateMergedType(pdxLocalType, pType, dataInput, serializationRegistry);
+
+ PdxType^ mergedVersion = PdxTypeRegistry::GetMergedType(pType->TypeId);
+ PdxRemotePreservedData^ preserveData = prr->GetPreservedData(mergedVersion, pdxObject);
+ if(preserveData != nullptr)
+ PdxTypeRegistry::SetPreserveData(pdxObject, preserveData);
+ prr->MoveStream();
+ }
+ }//end type not found
+ return pdxObject;
+ }
+
+ IPdxSerializable^ PdxHelper::DeserializePdx(DataInput^ dataInput, bool forceDeserialize, const native::SerializationRegistry* serializationRegistry)
+ {
+ try
+ {
+ dataInput->setPdxdeserialization(true);
+ if(PdxTypeRegistry::PdxReadSerialized == false || forceDeserialize ||dataInput->isRootObjectPdx())
+ {
+
+ //here we are reading length and typeId..Note; our internal typeid already read in c++ layer
+ int len = dataInput->ReadInt32();
+ int typeId= dataInput->ReadInt32();
+
+ //This is for pdx Statistics
+ CacheRegionHelper::getCacheImpl(dataInput->GetNative()->getCache())->getCachePerfStats().incPdxDeSerialization(len + 9);//pdxLen + 1 + 2*4
+
+ return DeserializePdx(dataInput, forceDeserialize, typeId, len, serializationRegistry);
+ }//create PdxInstance
+ else
+ {
+ IPdxSerializable^ pdxObject = nullptr;
+ //here we are reading length and typeId..Note; our internal typeid already read in c++ layer
+ int len = dataInput->ReadInt32();
+ int typeId= dataInput->ReadInt32();
+
+// Log::Debug(" len " + len + " " + typeId + " readbytes " + dataInput->BytesReadInternally);
+
+ PdxType^ pType = PdxTypeRegistry::GetPdxType(typeId);
+
+ if(pType == nullptr)
+ {
+ PdxType^ pType = (PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId, dataInput->GetNative()->getCache()));
+ //this should be fine for IPdxTypeMapper
+ PdxTypeRegistry::AddLocalPdxType(pType->PdxClassName, pType);
+ PdxTypeRegistry::AddPdxType(pType->TypeId, pType);
+ //pType->IsLocal = true; ?????
+ }
+
+ // pdxObject = gcnew PdxInstanceImpl(gcnew DataInput(dataInput->GetBytes(dataInput->GetCursor(), len + 8 ), len + 8));
+ pdxObject = gcnew PdxInstanceImpl(dataInput->GetBytes(dataInput->GetCursor(), len ), len, typeId, true, dataInput->GetNative()->getCache());
+
+ dataInput->AdvanceCursorPdx(len );
+
+ dataInput->AdvanceUMCursor();
+
+ dataInput->SetBuffer();
+
+ //This is for pdxinstance Statistics
+ CacheRegionHelper::getCacheImpl(dataInput->GetNative()->getCache())->getCachePerfStats().incPdxInstanceCreations();
+ return pdxObject;
+ }
+ }finally
+ {
+ dataInput->setPdxdeserialization(false);
+ }
+ }
+
+ Int32 PdxHelper::GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, const native::Cache* cache)
+ {
+ //in case app want different name
+ enumClassName = Serializable::GetPdxTypeName(enumClassName);
+ EnumInfo^ ei = gcnew EnumInfo(enumClassName, enumName, hashcode);
+ return PdxTypeRegistry::GetEnumValue(ei, cache);
+ }
+
+ Object^ PdxHelper::GetEnum(int enumId, const native::Cache* cache)
+ {
+ EnumInfo^ ei = PdxTypeRegistry::GetEnum(enumId, cache);
+ return ei->GetEnum();
+ }
+
+ void PdxHelper::CreateMergedType(PdxType^ localType, PdxType^ remoteType, DataInput^ dataInput, const native::SerializationRegistry* serializationRegistry)
+ {
+ PdxType^ mergedVersion = localType->MergeVersion(remoteType);
+
+ if(mergedVersion->Equals(localType))
+ {
+ PdxTypeRegistry::SetMergedType(remoteType->TypeId, localType);
+ }
+ else if(mergedVersion->Equals(remoteType))
+ {
+ PdxTypeRegistry::SetMergedType(remoteType->TypeId, remoteType);
+ }
+ else
+ {//need to create new version
+ mergedVersion->InitializeType();
+ if(mergedVersion->TypeId == 0)
+ mergedVersion->TypeId = Serializable::GetPDXIdForType(dataInput->GetPoolName(), mergedVersion, dataInput->GetNative()->getCache());
+
+ // PdxTypeRegistry::AddPdxType(remoteType->TypeId, mergedVersion);
+ PdxTypeRegistry::AddPdxType(mergedVersion->TypeId, mergedVersion);
+ PdxTypeRegistry::SetMergedType(remoteType->TypeId, mergedVersion);
+ PdxTypeRegistry::SetMergedType(mergedVersion->TypeId, mergedVersion);
+ }
+ }
+
+ Int32 PdxHelper::ReadInt32(System::Byte* offsetPosition)
+ {
+ Int32 data = offsetPosition[0];
+ data = (data << 8) | offsetPosition[1];
+ data = (data << 8) | offsetPosition[2];
+ data = (data << 8) | offsetPosition[3];
+
+ return data;
+ }
+
+ Int32 PdxHelper::ReadInt16(System::Byte* offsetPosition)
+ {
+ System::Int16 data = offsetPosition[0];
+ data = (data << 8) | offsetPosition[1];
+ return (Int32)data;
+ }
+
+ Int32 PdxHelper::ReadUInt16(System::Byte* offsetPosition)
+ {
+ UInt16 data = offsetPosition[0];
+ data = (data << 8) | offsetPosition[1];
+ return (Int32)data;
+ }
+
+ Int32 PdxHelper::ReadByte(System::Byte* offsetPosition)
+ {
+ return (Int32)offsetPosition[0];
+ }
+
+ void PdxHelper::WriteInt32(System::Byte* offsetPosition, Int32 value)
+ {
+ offsetPosition[0] = (System::Byte)(value >> 24);
+ offsetPosition[1] = (System::Byte)(value >> 16);
+ offsetPosition[2] = (System::Byte)(value >> 8);
+ offsetPosition[3] = (System::Byte)value;
+ }
+
+ void PdxHelper::WriteInt16(System::Byte* offsetPosition, Int32 value)
+ {
+ Int16 val = (Int16)value;
+ offsetPosition[0] = (System::Byte)(val >> 8);
+ offsetPosition[1] = (System::Byte)val;
+ }
+
+ void PdxHelper::WriteByte(System::Byte* offsetPosition, Int32 value)
+ {
+ offsetPosition[0] = (Byte)value;
+ }
+
+ Int32 PdxHelper::ReadInt(System::Byte* offsetPosition, int size)
+ {
+ switch(size)
+ {
+ case 1:
+ return ReadByte(offsetPosition);
+ case 2:
+ return ReadUInt16(offsetPosition);
+ case 4:
+ return ReadInt32(offsetPosition);
+ }
+ throw gcnew System::ArgumentException("Size should be 1,2 or 4 in PdxHelper::ReadInt.");
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxHelper.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxHelper.hpp b/clicache/src/impl/PdxHelper.hpp
new file mode 100644
index 0000000..7cc9c82
--- /dev/null
+++ b/clicache/src/impl/PdxHelper.hpp
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+#pragma once
+//#include "../DataOutput.hpp"
+#include "begin_native.hpp"
+#include <geode/DataOutput.hpp>
+#include "SerializationRegistry.hpp"
+#include "end_native.hpp"
+
+#include "../IPdxSerializable.hpp"
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+ ref class DataOutput;
+ ref class DataInput;
+ namespace Internal
+ {
+ ref class PdxType;
+ public ref class PdxHelper
+ {
+ public:
+
+ static void SerializePdx(DataOutput^ dataOutput, IPdxSerializable^ pdxObject);
+
+ static IPdxSerializable^ DeserializePdx(DataInput^ dataOutput, bool forceDeserialize, const native::SerializationRegistry* serializationRegistry);
+
+ static IPdxSerializable^ PdxHelper::DeserializePdx(DataInput^ dataInput, bool forceDeserialize, int typeId, int length, const native::SerializationRegistry* serializationRegistry);
+
+ literal Byte PdxHeader = 8;
+
+ static Int32 ReadInt32(System::Byte* offsetPosition);
+
+ static Int32 ReadInt16(System::Byte* offsetPosition);
+
+ static Int32 PdxHelper::ReadUInt16(System::Byte* offsetPosition);
+
+ static Int32 ReadByte(System::Byte* offsetPosition);
+
+ static void WriteInt32(System::Byte* offsetPosition, Int32 value);
+
+ static void WriteInt16(System::Byte* offsetPosition, Int32 value);
+
+ static void WriteByte(System::Byte* offsetPosition, Int32 value);
+
+ static Int32 ReadInt(System::Byte* offsetPosition, int size);
+
+ static Int32 GetEnumValue(String^ enumClassName, String^ enumName, int hashcode, const native::Cache* cache);
+
+ static Object^ GetEnum(int enumId, const native::Cache* cache);
+
+ private:
+ static void CreateMergedType(PdxType^ localType, PdxType^ remoteType, DataInput^ dataInput, const native::SerializationRegistry* serializationRegistry);
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxInstanceFactoryImpl.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxInstanceFactoryImpl.cpp b/clicache/src/impl/PdxInstanceFactoryImpl.cpp
new file mode 100644
index 0000000..230972a
--- /dev/null
+++ b/clicache/src/impl/PdxInstanceFactoryImpl.cpp
@@ -0,0 +1,359 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "begin_native.hpp"
+#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
+#include "end_native.hpp"
+#include "PdxInstanceFactoryImpl.hpp"
+#include "PdxInstanceImpl.hpp"
+#include "DotNetTypes.hpp"
+using namespace System::Text;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(String^ className, native::Cache* cache)
+ {
+ if (className == nullptr)
+ throw gcnew IllegalStateException(
+ "Classname should not be null.");
+ m_pdxType = gcnew PdxType(className, false);
+ m_FieldVsValues = gcnew Dictionary<String^, Object^>();
+ m_created = false;
+ m_cache = cache;
+ }
+
+ IPdxInstance^ PdxInstanceFactoryImpl::Create()
+ {
+ if (m_created)
+ {
+ throw gcnew IllegalStateException(
+ "The IPdxInstanceFactory.Create() method can only be called once.");
+ }
+ //need to get typeid;
+ IPdxInstance^ pi = gcnew PdxInstanceImpl(m_FieldVsValues, m_pdxType, &CacheRegionHelper::getCacheImpl(m_cache)->getCachePerfStats(), m_cache);
+ m_created = true;
+ return pi;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteChar(String^ fieldName, Char value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "char", PdxTypes::CHAR, GeodeClassIds::CHAR_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBoolean(String^ fieldName, Boolean value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "boolean", PdxTypes::BOOLEAN, GeodeClassIds::BOOLEAN_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByte(String^ fieldName, SByte value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "byte", PdxTypes::BYTE, GeodeClassIds::BYTE_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShort(String^ fieldName, Int16 value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "short", PdxTypes::SHORT, GeodeClassIds::SHORT_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteInt(String^ fieldName, Int32 value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "int", PdxTypes::INT, GeodeClassIds::INTEGER_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLong(String^ fieldName, Int64 value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "long", PdxTypes::LONG, GeodeClassIds::LONG_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloat(String^ fieldName, float value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "float", PdxTypes::FLOAT, GeodeClassIds::FLOAT_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDouble(String^ fieldName, double value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "double", PdxTypes::DOUBLE, GeodeClassIds::DOUBLE_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDate(String^ fieldName, System::DateTime value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddFixedLengthTypeField(fieldName, "Date", PdxTypes::DATE, GeodeClassIds::DATE_SIZE);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteString(String^ fieldName, String^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "String", PdxTypes::STRING);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObject(String^ fieldName, Object^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Object", PdxTypes::OBJECT);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBooleanArray(String^ fieldName, array<Boolean>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "bool[]", PdxTypes::BOOLEAN_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteCharArray(String^ fieldName, array<Char>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "char[]", PdxTypes::CHAR_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByteArray(String^ fieldName, array<Byte>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "byte[]", PdxTypes::BYTE_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShortArray(String^ fieldName, array<Int16>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "short[]", PdxTypes::SHORT_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteIntArray(String^ fieldName, array<Int32>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "int[]", PdxTypes::INT_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLongArray(String^ fieldName, array<Int64>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "long[]", PdxTypes::LONG_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloatArray(String^ fieldName, array<float>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "float[]", PdxTypes::FLOAT_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDoubleArray(String^ fieldName, array<double>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "double[]", PdxTypes::DOUBLE_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteStringArray(String^ fieldName, array<String^>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "String[]", PdxTypes::STRING_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObjectArray(String^ fieldName, System::Collections::Generic::List<Object^>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "Object[]", PdxTypes::OBJECT_ARRAY);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ value)
+ {
+ isFieldAdded(fieldName);
+ m_pdxType->AddVariableLengthTypeField(fieldName, "byte[][]", PdxTypes::ARRAY_OF_BYTE_ARRAYS);
+ m_FieldVsValues->Add(fieldName, value);
+ return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteField(String^ fieldName, Object^ fieldValue, Type^ type)
+ {
+ isFieldAdded(fieldName);
+ if (type->Equals(DotNetTypes::IntType))
+ {
+ return this->WriteInt(fieldName, (int)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::StringType))
+ {
+ return this->WriteString(fieldName, (String^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::BooleanType))
+ {
+ return this->WriteBoolean(fieldName, (bool)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::FloatType))
+ {
+ return this->WriteFloat(fieldName, (float)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::DoubleType))
+ {
+ return this->WriteDouble(fieldName, (double)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::CharType))
+ {
+ return this->WriteChar(fieldName, (Char)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::SByteType))
+ {
+ return this->WriteByte(fieldName, (SByte)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::ShortType))
+ {
+ return this->WriteShort(fieldName, (short)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::LongType))
+ {
+ return this->WriteLong(fieldName, (Int64)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::ByteArrayType))
+ {
+ return this->WriteByteArray(fieldName, (array<Byte>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::DoubleArrayType))
+ {
+ return this->WriteDoubleArray(fieldName, (array<double>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::FloatArrayType))
+ {
+ return this->WriteFloatArray(fieldName, (array<float>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::ShortArrayType))
+ {
+ return this->WriteShortArray(fieldName, (array<Int16>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::IntArrayType))
+ {
+ return this->WriteIntArray(fieldName, (array<System::Int32>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::LongArrayType))
+ {
+ return this->WriteLongArray(fieldName, (array<Int64>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::BoolArrayType))
+ {
+ return this->WriteBooleanArray(fieldName, (array<bool>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::CharArrayType))
+ {
+ return this->WriteCharArray(fieldName, (array<Char>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::StringArrayType))
+ {
+ return this->WriteStringArray(fieldName, (array<String^>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::DateType))
+ {
+ return this->WriteDate(fieldName, (DateTime)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::ByteArrayOfArrayType))
+ {
+ return this->WriteArrayOfByteArrays(fieldName, (array<array<Byte>^>^)fieldValue);
+ }
+ else if (type->Equals(DotNetTypes::ObjectArrayType))
+ {
+ return this->WriteObjectArray(fieldName, safe_cast<System::Collections::Generic::List<Object^>^>(fieldValue));
+ }
+ else
+ {
+ return this->WriteObject(fieldName, fieldValue);
+ //throw gcnew IllegalStateException("WriteField unable to serialize "
+ // + fieldName + " of " + type);
+ }
+ // return this;
+ }
+
+ IPdxInstanceFactory^ PdxInstanceFactoryImpl::MarkIdentityField(String^ fieldName)
+ {
+ PdxFieldType^ pft = m_pdxType->GetPdxField(fieldName);
+
+ if (pft == nullptr)
+ {
+ throw gcnew IllegalStateException(
+ "Field must be added before calling MarkIdentityField ");
+ }
+
+ pft->IdentityField = true;
+ return this;
+ }
+
+ void PdxInstanceFactoryImpl::isFieldAdded(String^ fieldName)
+ {
+ if (fieldName == nullptr || fieldName->Length == 0 || m_FieldVsValues->ContainsKey(fieldName))
+ {
+ throw gcnew IllegalStateException(
+ "Field: " + fieldName + " either already added into PdxInstanceFactory or it is null");
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxInstanceFactoryImpl.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxInstanceFactoryImpl.hpp b/clicache/src/impl/PdxInstanceFactoryImpl.hpp
new file mode 100644
index 0000000..cce22e4
--- /dev/null
+++ b/clicache/src/impl/PdxInstanceFactoryImpl.hpp
@@ -0,0 +1,402 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+#include "../IPdxInstanceFactory.hpp"
+#include "../IPdxSerializable.hpp"
+#include "../DataInput.hpp"
+#include "PdxLocalWriter.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+
+ namespace native = apache::geode::client;
+
+ ref class PdxInstanceFactoryImpl : IPdxInstanceFactory
+ {
+ private:
+ bool m_created;
+ PdxType^ m_pdxType;
+ Dictionary<String^, Object^>^ m_FieldVsValues;
+ native::Cache* m_cache;
+ internal:
+ PdxInstanceFactoryImpl(String^ className, native::Cache* cache);
+ void isFieldAdded(String^ fieldName);
+
+
+ public:
+ /// <summary>
+ /// Create a {@link PdxInstance}. The instance
+ /// will contain any data written to this factory
+ /// using the write methods.
+ /// @return the created instance
+ /// @throws IllegalStateException if called more than once
+ /// </summary>
+ virtual IPdxInstance^ Create();
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>char</code>.
+ /// <p>Java char is mapped to .NET System.Char.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteChar(String^ fieldName, Char value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>boolean</code>.
+ /// <p>Java boolean is mapped to .NET System.Boolean.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteBoolean(String^ fieldName, Boolean value);
+
+ /// </summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>byte</code>.
+ /// <p>Java byte is mapped to .NET System.SByte.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteByte(String^ fieldName, SByte value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>short</code>.
+ /// <p>Java short is mapped to .NET System.Int16.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteShort(String^ fieldName, Int16 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>int</code>.
+ /// <p>Java int is mapped to .NET System.Int32.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteInt(String^ fieldName, Int32 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>long</code>.
+ /// <p>Java long is mapped to .NET System.Int64.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteLong(String^ fieldName, Int64 value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>float</code>.
+ /// <p>Java float is mapped to .NET System.Float.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteFloat(String^ fieldName, float value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>double</code>.
+ /// <p>Java double is mapped to .NET System.Double.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteDouble(String^ fieldName, double value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Date</code>.
+ /// <p>Java Date is mapped to .NET System.DateTime.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteDate(String^ fieldName, System::DateTime value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>String</code>.
+ /// <p>Java String is mapped to .NET System.String.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteString(String^ fieldName, String^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Object</code>.
+ /// <p>
+ /// It is best to use one of the other writeXXX methods if your field type
+ /// will always be XXX. This method allows the field value to be anything
+ /// that is an instance of Object. This gives you more flexibility but more
+ /// space is used to store the serialized field.
+ /// <p>
+ /// Note that some Java objects serialized with this method may not be compatible with non-java languages.
+ /// To ensure that only portable objects are serialized use {@link #writeObject(String, Object, boolean)}.
+ ///
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteObject(String^ fieldName, Object^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>boolean[]</code>.
+ /// <p>Java boolean[] is mapped to .NET System.Boolean[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteBooleanArray(String^ fieldName, array<Boolean>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>char[]</code>.
+ /// <p>Java char[] is mapped to .NET System.Char[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteCharArray(String^ fieldName, array<Char>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>byte[]</code>.
+ /// <p>Java byte[] is mapped to .NET System.Byte[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteByteArray(String^ fieldName, array<Byte>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>short[]</code>.
+ /// <p>Java short[] is mapped to .NET System.Int16[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteShortArray(String^ fieldName, array<Int16>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>int[]</code>.
+ /// <p>Java int[] is mapped to .NET System.Int32[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteIntArray(String^ fieldName, array<Int32>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>long[]</code>.
+ /// <p>Java long[] is mapped to .NET System.Int64[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteLongArray(String^ fieldName, array<Int64>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>float[]</code>.
+ /// <p>Java float[] is mapped to .NET System.Float[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteFloatArray(String^ fieldName, array<float>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>double[]</code>.
+ /// <p>Java double[] is mapped to .NET System.Double[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteDoubleArray(String^ fieldName, array<double>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>String[]</code>.
+ /// <p>Java String[] is mapped to .NET System.String[].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteStringArray(String^ fieldName, array<String^>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>Object[]</code>.
+ /// <p>Java Object[] is mapped to .NET System.Collections.Generic.List<Object>.
+ /// For how each element of the array is a mapped to .NET see {@link #writeObject(String, Object, boolean) writeObject}.
+ /// Note that this call may serialize elements that are not compatible with non-java languages.
+ /// To ensure that only portable objects are serialized use {@link #writeObjectArray(String, Object[], boolean)}.
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteObjectArray(String^ fieldName, System::Collections::Generic::List<Object^>^ value);
+ /// <summary>
+ /// Writes the named field with the given value to the serialized form.
+ /// The fields type is <code>byte[][]</code>.
+ /// <p>Java byte[][] is mapped to .NET System.Byte[][].
+ /// @param fieldName the name of the field to write
+ /// @param value the value of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// </summary>
+ virtual IPdxInstanceFactory^ WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ value);
+
+ /// <summary>
+ /// Writes the named field with the given value and type to the serialized form.
+ /// This method uses the <code>fieldType</code> to determine which writeXXX method it should call.
+ /// If it can not find a specific match to a writeXXX method it will call {@link #writeObject(String, Object) writeObject}.
+ /// This method may serialize objects that are not portable to non-java languages.
+ /// To ensure that only objects that are portable to non-java languages are serialized use {@link #writeField(String, Object, Class, boolean)} instead.
+ /// <p>The fieldTypes that map to a specific method are:
+ /// <ul>
+ /// <li>boolean.class: {@link #writeBoolean}
+ /// <li>byte.class: {@link #writeByte}
+ /// <li>char.class: {@link #writeChar}
+ /// <li>short.class: {@link #writeShort}
+ /// <li>int.class: {@link #writeInt}
+ /// <li>long.class: {@link #writeLong}
+ /// <li>float.class: {@link #writeFloat}
+ /// <li>double.class: {@link #writeDouble}
+ /// <li>String.class: {@link #writeString}
+ /// <li>Date.class: {@link #writeDate}
+ /// <li>boolean[].class: {@link #writeBooleanArray}
+ /// <li>byte[].class: {@link #writeByteArray}
+ /// <li>char[].class: {@link #writeCharArray}
+ /// <li>short[].class: {@link #writeShortArray}
+ /// <li>int[].class: {@link #writeIntArray}
+ /// <li>long[].class: {@link #writeLongArray}
+ /// <li>float[].class: {@link #writeFloatArray}
+ /// <li>double[].class: {@link #writeDoubleArray}
+ /// <li>String[].class: {@link #writeStringArray}
+ /// <li>byte[][].class: {@link #writeArrayOfByteArrays}
+ /// <li>any other array class: {@link #writeObjectArray}
+ /// </ul>
+ /// Note that the object form of primitives, for example Integer.class and Long.class, map to {@link #writeObject(String, Object) writeObject}.
+ /// @param fieldName the name of the field to write
+ /// @param fieldValue the value of the field to write; this parameter's class must extend the <code>fieldType</code>
+ /// @param fieldType the type of the field to write
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldAlreadyExistsException if the named field has already been written
+ /// @throws PdxSerializationException if serialization of the field fails.
+ /// <summary>
+ virtual IPdxInstanceFactory^ WriteField(String^ fieldName, Object^ fieldValue, Type^ fieldType);
+
+ /// <summary>
+ /// Indicate that the named field should be included in hashCode and equals checks
+ /// of this object on a server that is accessing {@link PdxInstance}
+ /// or when a client executes a query on a server.
+ ///
+ /// The fields that are marked as identity fields are used to generate the hashCode and
+ /// equals methods of {@link PdxInstance}. Because of this, the identity fields should themselves
+ /// either be primitives, or implement hashCode and equals.
+ ///
+ /// If no fields are set as identity fields, then all fields will be used in hashCode and equals
+ /// checks.
+ ///
+ /// The identity fields should make marked after they are written using a write/// method.
+ ///
+ /// @param fieldName the name of the field to mark as an identity field.
+ /// @return this PdxInstanceFactory
+ /// @throws PdxFieldDoesNotExistException if the named field has not already been written.
+ /// </summary>
+ virtual IPdxInstanceFactory^ MarkIdentityField(String^ fieldName);
+
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
[03/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedPersistenceManager.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedPersistenceManager.cpp b/clicache/src/impl/ManagedPersistenceManager.cpp
new file mode 100644
index 0000000..5eeeeb4
--- /dev/null
+++ b/clicache/src/impl/ManagedPersistenceManager.cpp
@@ -0,0 +1,247 @@
+/*
+ * 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.
+ */
+
+
+#include "ManagedPersistenceManager.hpp"
+#include "../IPersistenceManager.hpp"
+
+#include <string>
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::PersistenceManager* ManagedPersistenceManagerGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath = Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName = Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ managedptr = nullptr;
+ try
+ {
+ managedptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ ManagedPersistenceManagerGeneric* mgcl = new ManagedPersistenceManagerGeneric(managedptr);
+
+ Type^ clgType = Type::GetType("Apache.Geode.Client.PersistenceManagerGeneric`2");
+ clgType = clgType->MakeGenericType(types);
+ Object^ clg = Activator::CreateInstance(clgType);
+
+ mInfo = clgType->GetMethod("SetPersistenceManager");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = managedptr;
+ mInfo->Invoke(clg, params);
+
+ mgcl->setptr((Apache::Geode::Client::IPersistenceManagerProxy^)clg);
+
+ return mgcl;
+ }
+ else
+ {
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedPersistenceManagerGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+
+ void ManagedPersistenceManagerGeneric::write(const CacheableKeyPtr& key, const CacheablePtr& value, void *& PersistenceInfo)
+ {
+ m_managedptr->write(key, value);
+ }
+
+ bool ManagedPersistenceManagerGeneric::writeAll()
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ void ManagedPersistenceManagerGeneric::init(const RegionPtr& region, PropertiesPtr& diskProperties)
+ {
+ m_managedptr->init(region, diskProperties);
+ }
+
+ CacheablePtr ManagedPersistenceManagerGeneric::read(const CacheableKeyPtr& key, void *& PersistenceInfo)
+ {
+ return m_managedptr->read(key);
+ }
+
+ bool ManagedPersistenceManagerGeneric::readAll()
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ void ManagedPersistenceManagerGeneric::destroy(const CacheableKeyPtr& key, void *& PersistenceInfo)
+ {
+ m_managedptr->destroy(key);
+ }
+ void ManagedPersistenceManagerGeneric::close()
+ {
+ m_managedptr->close();
+ }
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedPersistenceManager.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedPersistenceManager.hpp b/clicache/src/impl/ManagedPersistenceManager.hpp
new file mode 100644
index 0000000..6f19e0a
--- /dev/null
+++ b/clicache/src/impl/ManagedPersistenceManager.hpp
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/PersistenceManager.hpp>
+#include "end_native.hpp"
+
+#include "PersistenceManagerProxy.hpp"
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IPersistenceManager" />
+ /// object and implements the native <c>apache::geode::client::PersistenceManager</c> interface.
+ /// </summary>
+ class ManagedPersistenceManagerGeneric : public apache::geode::client::PersistenceManager
+ {
+ public:
+
+ inline ManagedPersistenceManagerGeneric(Object^ userptr) : m_userptr(userptr) { }
+
+ static apache::geode::client::PersistenceManager* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ virtual ~ManagedPersistenceManagerGeneric() { }
+
+
+ virtual void write(const CacheableKeyPtr& key, const CacheablePtr& value, void *& PersistenceInfo);
+ virtual bool writeAll();
+ virtual void init(const RegionPtr& region, PropertiesPtr& diskProperties);
+ virtual CacheablePtr read(const CacheableKeyPtr& key, void *& PersistenceInfo);
+ virtual bool readAll();
+ virtual void destroy(const CacheableKeyPtr& key, void *& PersistenceInfo);
+ virtual void close();
+
+ inline void setptr(Apache::Geode::Client::IPersistenceManagerProxy^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IPersistenceManager
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IPersistenceManagerProxy^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+
+ // Disable the copy and assignment constructors
+ ManagedPersistenceManagerGeneric(const ManagedPersistenceManagerGeneric&);
+ ManagedPersistenceManagerGeneric& operator = (const ManagedPersistenceManagerGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedResultCollector.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedResultCollector.cpp b/clicache/src/impl/ManagedResultCollector.cpp
new file mode 100644
index 0000000..91a353d
--- /dev/null
+++ b/clicache/src/impl/ManagedResultCollector.cpp
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+//#include "../../geode_includes.hpp"
+//#include "../../../geode_includes.hpp"
+#include "ManagedResultCollector.hpp"
+//#include "../../../IGeodeSerializable.hpp"
+
+
+//#include "../IGeodeSerializable.hpp"
+#include "ManagedString.hpp"
+#include "SafeConvert.hpp"
+#include "../ExceptionTypes.hpp"
+#include <string>
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::ResultCollector* ManagedResultCollectorGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+ Int32 dotIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedResultCollector: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ mg_typeName = mg_factoryFunctionName->Substring(0, dotIndx);
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedResultCollector: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ Object^ typeInst = assmb->CreateInstance(mg_typeName, true);
+ if (typeInst != nullptr)
+ {
+ MethodInfo^ mInfo = typeInst->GetType()->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+ if (mInfo != nullptr)
+ {
+ //Apache::Geode::Client::ResultCollector<Object^>^ managedptr = nullptr;
+ Object^ userptr = nullptr;
+ try
+ {
+ throw apache::geode::client::UnsupportedOperationException("Not supported");
+ /*managedptr = dynamic_cast<Apache::Geode::Client::ResultCollector<Object^>^>(
+ mInfo->Invoke( typeInst, nullptr ) );*/
+ userptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ userptr = nullptr;
+ }
+ if (userptr == nullptr)
+ {
+ std::string ex_str = "ManagedResultCollector: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ //TODO::need to pass proper pointer here
+ return new ManagedResultCollectorGeneric(/*(Apache::Geode::Client::ResultCollector<Object^>^) managedptr*/nullptr);
+ }
+ else
+ {
+ std::string ex_str = "ManagedResultCollector: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedResultCollector: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedResultCollector: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ void ManagedResultCollectorGeneric::addResult(CacheablePtr& result)
+ {
+ try {
+ Object^ rs = Apache::Geode::Client::Serializable::GetManagedValueGeneric<Object^>(result);
+ m_managedptr->AddResult(rs);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedResultCollector: Got an exception in"
+ "addResult: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ CacheableVectorPtr ManagedResultCollectorGeneric::getResult(System::UInt32 timeout)
+ {
+ try {
+ //array<IGeodeSerializable^>^ rs = m_managedptr->GetResult(timeout);
+ //apache::geode::client::CacheableVectorPtr rsptr = apache::geode::client::CacheableVector::create();
+ //for( int index = 0; index < rs->Length; index++ )
+ //{
+ // //apache::geode::client::CacheablePtr valueptr(Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<IGeodeSerializable^>(rs[ index]));
+ // apache::geode::client::CacheablePtr valueptr (SafeMSerializableConvert(rs[ index]));
+ // rsptr->push_back(valueptr);
+ //}
+ //return rsptr;
+ throw apache::geode::client::IllegalStateException("This should not be get callled.");
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedResultCollector: Got an exception in"
+ "getResult: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return nullptr;
+ }
+ void ManagedResultCollectorGeneric::endResults()
+ {
+ try {
+ m_managedptr->EndResults();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedResultCollector: Got an exception in"
+ "endResults: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ void ManagedResultCollectorGeneric::clearResults()
+ {
+ try {
+ m_managedptr->ClearResults(/*false*/);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedResultCollector: Got an exception in"
+ "clearResults: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedResultCollector.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedResultCollector.hpp b/clicache/src/impl/ManagedResultCollector.hpp
new file mode 100644
index 0000000..3dd419e
--- /dev/null
+++ b/clicache/src/impl/ManagedResultCollector.hpp
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/ResultCollector.hpp>
+#include "end_native.hpp"
+
+#include "ResultCollectorProxy.hpp"
+#include "SafeConvert.hpp"
+
+//using namespace apache::geode::client;
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IResultCollector" />
+ /// object and implements the native <c>apache::geode::client::ResultCollector</c> interface.
+ /// </summary>
+ class ManagedResultCollectorGeneric
+ : public apache::geode::client::ResultCollector
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedResultCollectorGeneric(Apache::Geode::Client::ResultCollectorG^ userptr)
+ : m_managedptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedResultCollector</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICacheListener</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>IResultCollector</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static apache::geode::client::ResultCollector* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedResultCollectorGeneric() { }
+
+ CacheableVectorPtr getResult(System::UInt32 timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ void addResult(CacheablePtr& result);
+ void endResults();
+ void clearResults();
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ResultCollectorG^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+
+ private:
+
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheListener
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ResultCollectorG^> m_managedptr;
+ //Apache::Geode::Client::IResultCollector^ m_managedptr;
+ //gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedString.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedString.hpp b/clicache/src/impl/ManagedString.hpp
new file mode 100644
index 0000000..ed67695
--- /dev/null
+++ b/clicache/src/impl/ManagedString.hpp
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "../geode_defs.hpp"
+
+#ifdef _WIN32
+// FIXME: Why is this needed?
+//#define snprintf _snprintf
+#endif
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class ManagedString sealed
+ {
+ private:
+
+ IntPtr m_str;
+
+
+ public:
+
+ // Constructors
+
+ inline ManagedString( String^ str )
+ {
+ m_str = (str == nullptr) ? IntPtr::Zero :
+ System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi( str );
+ }
+
+ // Destructor
+
+ inline ~ManagedString( )
+ {
+ if (m_str != IntPtr::Zero)
+ {
+ System::Runtime::InteropServices::Marshal::FreeHGlobal( m_str );
+ }
+ }
+
+ // The finalizer should normally never be called; either use non-pointer object
+ // or call delete explicitly.
+ !ManagedString( )
+ {
+ if (m_str != IntPtr::Zero)
+ {
+ System::Runtime::InteropServices::Marshal::FreeHGlobal( m_str );
+ }
+#if GF_DEVEL_ASSERTS == 1
+ throw gcnew System::ApplicationException(
+ "Finalizer for ManagedString should not have been called!!" );
+#endif
+ }
+
+ inline static String^ Get( const char* str )
+ {
+ return ((str == nullptr) ? nullptr : gcnew String( str ));
+ }
+
+ inline static String^ Get( const wchar_t* str )
+ {
+ return ((str == nullptr) ? nullptr : gcnew String( str ));
+ }
+
+ // Properties
+
+ property const char* CharPtr
+ {
+ inline const char* get( )
+ {
+ return ((m_str == IntPtr::Zero) ? nullptr :
+ static_cast<const char*>( m_str.ToPointer( ) ));
+ }
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedTransactionListener.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedTransactionListener.cpp b/clicache/src/impl/ManagedTransactionListener.cpp
new file mode 100644
index 0000000..99a683b
--- /dev/null
+++ b/clicache/src/impl/ManagedTransactionListener.cpp
@@ -0,0 +1,263 @@
+/*
+ * 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.
+ */
+
+#ifdef CSTX_COMMENTED
+//#include "../geode_includes.hpp"
+#include "ManagedTransactionListener.hpp"
+//#include "../TransactionEvent.hpp"
+#include "../Log.hpp"
+//#include "../ITransactionListener.hpp"
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::TransactionListener* ManagedTransactionListenerGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ userptr = nullptr;
+ try
+ {
+ userptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ userptr = nullptr;
+ }
+ if (userptr == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return new ManagedTransactionListenerGeneric(userptr);
+ }
+ else
+ {
+ std::string ex_str = "ManagedTransactionListenerGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedTransactionListenerGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedTransactionListenerGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+ void ManagedTransactionListenerGeneric::afterCommit(apache::geode::client::TransactionEventPtr& te)
+ {
+ try {
+ Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in");
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
+ m_managedptr->AfterCommit(%mevent);
+ Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in");
+
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+ void ManagedTransactionListenerGeneric::afterFailedCommit(apache::geode::client::TransactionEventPtr& te)
+ {
+ try {
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
+ m_managedptr->AfterFailedCommit(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+ void ManagedTransactionListenerGeneric::afterRollback(apache::geode::client::TransactionEventPtr& te)
+ {
+ try {
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
+ m_managedptr->AfterRollback(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+ void ManagedTransactionListenerGeneric::close()
+ {
+ try {
+ m_managedptr->Close();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedTransactionListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedTransactionListener.hpp b/clicache/src/impl/ManagedTransactionListener.hpp
new file mode 100644
index 0000000..cd48375
--- /dev/null
+++ b/clicache/src/impl/ManagedTransactionListener.hpp
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include <cppcache/TransactionListener.hpp>
+#include "../ITransactionListener.hpp"
+
+
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ITransactionListener" />
+ /// object and implements the native <c>apache::geode::client::TransactionListener</c> interface.
+ /// </summary>
+ class ManagedTransactionListenerGeneric
+ : public apache::geode::client::TransactionListener
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedTransactionListenerGeneric(Object^ userptr )
+ : m_userptr( userptr ) { }
+
+ static apache::geode::client::TransactionListener* create( const char* assemblyPath,
+ const char* factoryFunctionName );
+
+ virtual ~ManagedTransactionListenerGeneric( ) { }
+
+ virtual void afterCommit(apache::geode::client::TransactionEventPtr& te);
+
+ virtual void afterFailedCommit(apache::geode::client::TransactionEventPtr& te);
+
+ virtual void afterRollback(apache::geode::client::TransactionEventPtr& te);
+
+ virtual void close();
+
+ inline Apache::Geode::Client::ITransactionListener^ ptr( ) const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr( Apache::Geode::Client::ITransactionListener^ managedptr )
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr( ) const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ITransactionListener
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ITransactionListener^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedTransactionWriter.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedTransactionWriter.cpp b/clicache/src/impl/ManagedTransactionWriter.cpp
new file mode 100644
index 0000000..bde9cbe
--- /dev/null
+++ b/clicache/src/impl/ManagedTransactionWriter.cpp
@@ -0,0 +1,222 @@
+/*
+ * 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.
+ */
+
+#ifdef CSTX_COMMENTED
+//#include "../geode_includes.hpp"
+#include "ManagedTransactionWriter.hpp"
+//#include "../TransactionEvent.hpp"
+#include "../Log.hpp"
+#include "../ExceptionTypes.hpp"
+//#include "../ITransactionWriter.hpp"
+#include "ManagedString.hpp"
+
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+//using namespace Apache::Geode::Client;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::TransactionWriter* ManagedTransactionWriterGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ userptr = nullptr;
+ try
+ {
+ userptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ userptr = nullptr;
+ }
+ if (userptr == nullptr)
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return new ManagedTransactionWriterGeneric(userptr);
+ }
+ else
+ {
+ std::string ex_str = "ManagedTransactionWriterGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedTransactionWriterGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedTransactionWriterGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+ void ManagedTransactionWriterGeneric::beforeCommit(apache::geode::client::TransactionEventPtr& te)
+ {
+ try {
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
+ m_managedptr->BeforeCommit(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedTransactionWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedTransactionWriter.hpp b/clicache/src/impl/ManagedTransactionWriter.hpp
new file mode 100644
index 0000000..b4871cb
--- /dev/null
+++ b/clicache/src/impl/ManagedTransactionWriter.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include <cppcache/TransactionWriter.hpp>
+#include "../ITransactionWriter.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+interface class ITransactionWriter;
+ }
+ }
+}
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ITransactionWriter" />
+ /// object and implements the native <c>apache::geode::client::TransactionWriter</c> interface.
+ /// </summary>
+ class ManagedTransactionWriterGeneric
+ : public apache::geode::client::TransactionWriter
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedTransactionWriterGeneric(Object^ userptr )
+ : m_userptr( userptr ) { }
+
+ static apache::geode::client::TransactionWriter* create( const char* assemblyPath,
+ const char* factoryFunctionName );
+
+ virtual ~ManagedTransactionWriterGeneric( ) { }
+
+ virtual void beforeCommit(apache::geode::client::TransactionEventPtr& te);
+
+ inline Apache::Geode::Client::ITransactionWriter^ ptr( ) const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr( Apache::Geode::Client::ITransactionWriter^ managedptr )
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr( ) const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ITransactionWriter
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ITransactionWriter^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedVisitor.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedVisitor.cpp b/clicache/src/impl/ManagedVisitor.cpp
new file mode 100644
index 0000000..3808ea8
--- /dev/null
+++ b/clicache/src/impl/ManagedVisitor.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+//#include "../../../../geode_includes.hpp"
+#include "ManagedVisitor.hpp"
+#include "SafeConvert.hpp"
+#include "../ExceptionTypes.hpp"
+
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ void ManagedVisitorGeneric::visit(CacheableKeyPtr& key, CacheablePtr& value)
+ {
+ using namespace Apache::Geode::Client;
+ try {
+ ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key));
+ IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value));
+
+ m_visitor->Invoke(mg_key, (Apache::Geode::Client::IGeodeSerializable^)mg_value);
+ }
+ catch (GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedVisitor.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedVisitor.hpp b/clicache/src/impl/ManagedVisitor.hpp
new file mode 100644
index 0000000..a9f5947
--- /dev/null
+++ b/clicache/src/impl/ManagedVisitor.hpp
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/Properties.hpp>
+#include "end_native.hpp"
+
+#include "../Properties.hpp"
+
+//using namespace apache::geode::client;
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.PropertyVisitor" />
+ /// delegate and implements the native <c>apache::geode::client::Properties::Visitor</c> interface.
+ /// </summary>
+ class ManagedVisitorGeneric
+ : public apache::geode::client::Properties::Visitor
+ {
+ public:
+
+ /// <summary>
+ /// Create a <c>apache::geode::client::Properties::Visitor</c> from the given managed
+ /// <c>PropertyVisitor</c> delegate.
+ /// </summary>
+ inline ManagedVisitorGeneric(Object^ visitorFunc) : m_managedptr(visitorFunc) { }
+
+ /// <summary>
+ /// Invokes the managed <c>PropertyVisitor</c> delegate for the given
+ /// <c>Property</c> key and value.
+ /// </summary>
+ virtual void visit(CacheableKeyPtr& key, CacheablePtr& value);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedVisitorGeneric() { }
+
+ void setptr(Apache::Geode::Client::PropertyVisitor^ visitor)
+ {
+ m_visitor = visitor;
+ }
+
+ private:
+
+ // Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ // Note: not using auto_gcroot since it will result in 'Dispose' of the PropertyVisitor
+ // to be called which is not what is desired when this object is destroyed. Normally this
+ // managed object may be created by the user and will be handled automatically by the GC.
+ gcroot<Object^> m_managedptr;
+
+ gcroot<Apache::Geode::Client::PropertyVisitor^> m_visitor;
+
+ // Disable the copy and assignment constructors
+ ManagedVisitorGeneric();
+ ManagedVisitorGeneric(const ManagedVisitorGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/MemoryPressureHandler.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/MemoryPressureHandler.cpp b/clicache/src/impl/MemoryPressureHandler.cpp
new file mode 100644
index 0000000..080fa3a
--- /dev/null
+++ b/clicache/src/impl/MemoryPressureHandler.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+#include "../geode_includes.hpp"
+#include "MemoryPressureHandler.hpp"
+#include "windows.h"
+#include "psapi.h"
+#include "../Log.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ System::Int64 g_prevUnmanagedSize = 0;
+
+ int MemoryPressureHandler::handle_timeout( const ACE_Time_Value&
+ current_time, const void* arg )
+ {
+ HANDLE hProcess = GetCurrentProcess( );
+
+ PROCESS_MEMORY_COUNTERS pmc;
+
+ if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) {
+ System::Int64 totalmem = (System::Int64)pmc.WorkingSetSize;
+ System::Int64 curr_managed_size = GC::GetTotalMemory( false );
+ System::Int64 curr_unmanagedMemory = totalmem - curr_managed_size;
+ Log::Finest( "Current total memory usage: {0}, managed memory: {1}, "
+ "unmanaged memory: {2}", totalmem, curr_managed_size,
+ curr_unmanagedMemory );
+ if ( curr_unmanagedMemory > 0 ) {
+ System::Int64 increase = curr_unmanagedMemory - g_prevUnmanagedSize;
+ if ( Math::Abs( increase ) > 20*1024*1024 ) {
+ if ( increase > 0 ) {
+ Log::Fine( "Adding memory pressure information to assist .NET GC: {0} bytes", increase );
+ GC::AddMemoryPressure( increase );
+ }
+ else {
+ Log::Fine( "Removing memory pressure information to assist .NET GC: {0} bytes", -increase );
+ GC::RemoveMemoryPressure( -increase );
+ }
+ g_prevUnmanagedSize = curr_unmanagedMemory;
+ }
+ }
+ }
+ else {
+ return -1;
+ }
+ return 0;
+ }
+
+ int MemoryPressureHandler::handle_close(ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask)
+ {
+ return 0;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/MemoryPressureHandler.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/MemoryPressureHandler.hpp b/clicache/src/impl/MemoryPressureHandler.hpp
new file mode 100644
index 0000000..c8ac0e7
--- /dev/null
+++ b/clicache/src/impl/MemoryPressureHandler.hpp
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "begin_native.hpp"
+#include <geode/geode_globals.hpp>
+#include <ExpiryTaskManager.hpp>
+#include "end_native.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ class MemoryPressureHandler
+ : public ACE_Event_Handler
+ {
+ public:
+ int handle_timeout( const ACE_Time_Value& current_time,
+ const void* arg );
+
+ int handle_close( ACE_HANDLE handle, ACE_Reactor_Mask close_mask );
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PartitionResolver.hpp b/clicache/src/impl/PartitionResolver.hpp
new file mode 100644
index 0000000..8223e19
--- /dev/null
+++ b/clicache/src/impl/PartitionResolver.hpp
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+#pragma once
+
+//#include "../geode_includes.hpp"
+//#include "../../../IPartitionResolver.hpp"
+#include "../IPartitionResolver.hpp"
+#include "../Region.hpp"
+#include "SafeConvert.hpp"
+#include "ManagedString.hpp"
+//#include "../../../Region.hpp"
+//#include "../../../Cache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ public interface class IPartitionResolverProxy
+ {
+ public:
+ apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev);
+ const char * getName();
+ };
+
+ generic<class TKey, class TValue>
+ public ref class PartitionResolverGeneric : IPartitionResolverProxy
+ {
+ private:
+
+ IPartitionResolver<TKey, TValue>^ m_resolver;
+
+ public:
+
+ void SetPartitionResolver(IPartitionResolver<TKey, TValue>^ resolver)
+ {
+ m_resolver = resolver;
+ }
+
+ virtual apache::geode::client::CacheableKeyPtr getRoutingObject(const apache::geode::client::EntryEvent& ev)
+ {
+ EntryEvent<TKey, TValue> gevent(&ev);
+ Object^ groutingobject = m_resolver->GetRoutingObject(%gevent);
+ return Serializable::GetUnmanagedValueGeneric<Object^>(groutingobject, nullptr);
+ }
+
+ virtual const char * getName()
+ {
+ ManagedString mg_name(m_resolver->GetName());
+ return mg_name.CharPtr;
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxFieldType.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxFieldType.cpp b/clicache/src/impl/PdxFieldType.cpp
new file mode 100644
index 0000000..c319ccd
--- /dev/null
+++ b/clicache/src/impl/PdxFieldType.cpp
@@ -0,0 +1,194 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "PdxFieldType.hpp"
+#include "begin_native.hpp"
+#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ Int32 PdxFieldType::SequenceId::get()
+ {
+ return m_sequenceId;
+ }
+
+ String^ PdxFieldType::FieldName::get()
+ {
+ return m_fieldName;
+ }
+
+ String^ PdxFieldType::ClassName::get()
+ {
+ return m_className;
+ }
+
+ Byte PdxFieldType::TypeId::get()
+ {
+ return m_typeId;
+ }
+
+ bool PdxFieldType::IsVariableLengthType::get()
+ {
+ return m_isVariableLengthType;
+ }
+
+ Int32 PdxFieldType::Size::get()
+ {
+ return m_fixedSize;
+ }
+
+ Int32 PdxFieldType::VarLenFieldIdx::get()
+ {
+ return m_varLenFieldIdx;
+ }
+
+ Int32 PdxFieldType::VarLenOffsetIndex::get()
+ {
+ return m_vlOffsetIndex;
+ }
+
+ void PdxFieldType::VarLenOffsetIndex::set(Int32 val)
+ {
+ m_vlOffsetIndex = val;
+ }
+
+ Int32 PdxFieldType::RelativeOffset::get()
+ {
+ return m_relativeOffset;
+ }
+
+ void PdxFieldType::RelativeOffset::set(Int32 val)
+ {
+ m_relativeOffset = val;
+ }
+
+ //it compares fieldname and type-id
+ bool PdxFieldType::Equals(Object^ otherObj)
+ {
+ if (otherObj == nullptr)
+ return false;
+
+ PdxFieldType^ otherFieldType = dynamic_cast<PdxFieldType^>(otherObj);
+
+ if (otherFieldType == nullptr)
+ return false;
+
+ if (otherFieldType == this)
+ return true;
+
+ if (otherFieldType->m_fieldName == m_fieldName && otherFieldType->m_typeId == m_typeId)
+ return true;
+
+ return false;
+ }
+
+ Int32 PdxFieldType::GetHashCode()
+ {
+ int hash = m_cachedHashcode;
+ if (hash == 0)
+ {
+ if (m_fieldName != nullptr)
+ {
+ hash = hash * 31 + m_fieldName->GetHashCode();
+ }
+
+ hash = hash * 31 + m_typeId;
+ if (hash == 0)
+ hash = 1;
+ m_cachedHashcode = hash;
+ }
+
+ return m_cachedHashcode;
+ }
+
+ void PdxFieldType::ToData(DataOutput^ output)
+ {
+ output->WriteString(m_fieldName);
+ output->WriteInt32(m_sequenceId);
+ output->WriteInt32(m_varLenFieldIdx);
+ output->WriteByte(m_typeId);
+
+ output->WriteInt32(m_relativeOffset);
+ output->WriteInt32(m_vlOffsetIndex);
+ output->WriteBoolean(m_isIdentityField);
+ }
+
+ IGeodeSerializable^ PdxFieldType::FromData(DataInput^ input)
+ {
+ m_fieldName = input->ReadString();
+ m_sequenceId = input->ReadInt32();
+ m_varLenFieldIdx = input->ReadInt32();
+ m_typeId = input->ReadByte();
+
+ m_relativeOffset = input->ReadInt32();
+ m_vlOffsetIndex = input->ReadInt32();
+ m_isIdentityField = input->ReadBoolean();
+
+ m_fixedSize = getFixedTypeSize();
+
+ if (m_fixedSize != -1)
+ m_isVariableLengthType = false;
+ else
+ m_isVariableLengthType = true;
+
+ return this;
+ }
+
+ Int32 PdxFieldType::getFixedTypeSize()
+ {
+ switch (m_typeId)
+ {
+ case PdxTypes::BYTE:
+ case PdxTypes::BOOLEAN:
+ return GeodeClassIds::BOOLEAN_SIZE;
+
+ case PdxTypes::SHORT:
+ case PdxTypes::CHAR:
+ //case apache::geode::client::GeodeTypeIds::CacheableChar: //TODO
+ return GeodeClassIds::CHAR_SIZE;
+
+ case PdxTypes::INT:
+ case PdxTypes::FLOAT:
+ //case DSCODE.ENUM:
+ return GeodeClassIds::INTEGER_SIZE;
+
+ case PdxTypes::LONG:
+ case PdxTypes::DOUBLE:
+ case PdxTypes::DATE:
+ return GeodeClassIds::LONG_SIZE;
+
+ default:
+ return -1;
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/PdxFieldType.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/PdxFieldType.hpp b/clicache/src/impl/PdxFieldType.hpp
new file mode 100644
index 0000000..fdef59b
--- /dev/null
+++ b/clicache/src/impl/PdxFieldType.hpp
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+using namespace System;
+#include "../DataOutput.hpp"
+#include "../DataInput.hpp"
+#include "../GeodeClassIds.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace Internal
+ {
+ public ref class PdxFieldType : IGeodeSerializable
+ {
+ private:
+ String^ m_fieldName;
+ String^ m_className;
+ Byte m_typeId;
+ Int32 m_sequenceId;
+ bool m_isVariableLengthType;
+ bool m_isIdentityField;
+ Int32 m_fixedSize;
+ Int32 m_varLenFieldIdx;
+
+ Int32 m_vlOffsetIndex;
+ Int32 m_relativeOffset;
+ Int32 m_cachedHashcode;
+ Int32 getFixedTypeSize();
+ public:
+ PdxFieldType(String^ fieldName,
+ String^ className,
+ Byte typeId,
+ Int32 sequenceId,
+ bool isVariableLengthType,
+ Int32 fixedSize,
+ Int32 varLenFieldIdx)
+ {
+ m_cachedHashcode = 0;
+ m_fieldName = fieldName;
+ m_className = className;
+ m_typeId = typeId;
+ m_sequenceId = sequenceId;//start with 0
+ m_isVariableLengthType = isVariableLengthType;
+ m_fixedSize = fixedSize;
+ m_varLenFieldIdx = varLenFieldIdx;//start with 0
+ m_isIdentityField = false;
+ }
+
+ PdxFieldType()
+ {
+ m_cachedHashcode = 0;
+ }
+
+ property Int32 SequenceId
+ {
+ Int32 get();
+ }
+
+ property String^ FieldName
+ {
+ String^ get();
+ }
+
+ property String^ ClassName
+ {
+ String^ get();
+ }
+
+ property Byte TypeId
+ {
+ Byte get();
+ }
+
+ property bool IsVariableLengthType
+ {
+ bool get();
+ }
+
+ property bool IdentityField
+ {
+ bool get() { return m_isIdentityField; }
+ void set(bool value) { m_isIdentityField = value; }
+ }
+
+ property Int32 Size
+ {
+ Int32 get();
+ }
+
+ property Int32 VarLenFieldIdx
+ {
+ Int32 get();
+ }
+
+ property Int32 VarLenOffsetIndex
+ {
+ Int32 get();
+ void set(Int32 Value);
+ }
+
+ property Int32 RelativeOffset
+ {
+ Int32 get();
+ void set(Int32 Value);
+ }
+
+ virtual bool Equals(Object^ otherObj) override;
+ virtual Int32 GetHashCode() override;
+
+ virtual void ToData(DataOutput^ output);
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+ virtual property System::UInt32 ObjectSize
+ {
+ System::UInt32 get(){ return 0; }
+ }
+ virtual property System::UInt32 ClassId
+ {
+ System::UInt32 get(){ return m_typeId; }
+ }
+ virtual String^ ToString() override
+ {
+ return "PdxFieldName:" + m_fieldName + ", TypeId: " + m_typeId + ", VarLenFieldIdx:" + m_varLenFieldIdx + ", sequenceid:" + m_sequenceId;
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+ } // namespace Apache
+
+}
[05/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheLoader.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheLoader.hpp b/clicache/src/impl/ManagedCacheLoader.hpp
new file mode 100644
index 0000000..4d09d49
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheLoader.hpp
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
+
+#include "../ICacheLoader.hpp"
+#include "CacheLoader.hpp"
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ICacheLoader" />
+ /// object and implements the native <c>apache::geode::client::CacheLoader</c> interface.
+ /// </summary>
+ class ManagedCacheLoaderGeneric
+ : public apache::geode::client::CacheLoader
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheLoaderGeneric(
+ /*Generic::ICacheLoader<Object^, Object^>^ managedptr,*/ Object^ userptr)
+ : /*m_managedptr( managedptr ),*/ m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedCacheLoader</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICacheLoader</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>ICacheLoader</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static apache::geode::client::CacheLoader* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ virtual ~ManagedCacheLoaderGeneric() { }
+
+ /// <summary>
+ /// Loads a value. Application writers should implement this
+ /// method to customize the loading of a value.
+ /// </summary>
+ /// <remarks>
+ /// This method is called by the caching service when the requested
+ /// value is not in the cache. Any exception thrown by this method
+ /// is propagated back to and thrown by the invocation of
+ /// <see cref="Apache.Geode.Client.Region.Get" /> that triggered this load.
+ /// </remarks>
+ /// <param name="region">a Region Pointer for which this is called.</param>
+ /// <param name="key">the key for the cacheable</param>
+ /// <param name="aCallbackArgument">any related user data, or null</param>
+ /// <returns>
+ /// the value supplied for this key, or null if no value can be
+ /// supplied.
+ /// If every available loader returns
+ /// a null value, <see cref="Apache.Geode.Client.Region.Get" />
+ /// will return null.
+ /// </returns>
+ /// <seealso cref="Apache.Geode.Client.Region.Get" />
+ virtual CacheablePtr load(const RegionPtr& region,
+ const CacheableKeyPtr& key, const UserDataPtr& aCallbackArgument);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external
+ /// resources, such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <param name="region">the region pointer</param>
+ /// <seealso cref="Apache.Geode.Client.Cache.Close" />
+ /// <seealso cref="Apache.Geode.Client.Region.DestroyRegion" />
+ virtual void close(const RegionPtr& region);
+
+ /*
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ICacheLoader^ ptr( ) const
+ {
+ return m_managedptr;
+ }
+ */
+
+ inline void setptr(Apache::Geode::Client::ICacheLoaderProxy^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheLoader
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ICacheLoaderProxy^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+
+ // Disable the copy and assignment constructors
+ ManagedCacheLoaderGeneric(const ManagedCacheLoaderGeneric&);
+ ManagedCacheLoaderGeneric& operator = (const ManagedCacheLoaderGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheWriter.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheWriter.cpp b/clicache/src/impl/ManagedCacheWriter.cpp
new file mode 100644
index 0000000..646cf7e
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheWriter.cpp
@@ -0,0 +1,316 @@
+/*
+ * 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.
+ */
+
+//#include "../geode_includes.hpp"
+#include "ManagedCacheWriter.hpp"
+#include "../ICacheWriter.hpp"
+#include "../Region.hpp"
+#include "../RegionEvent.hpp"
+#include "../EntryEvent.hpp"
+#include "../Log.hpp"
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+#include "CacheWriter.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ CacheWriter* ManagedCacheWriterGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine(
+ "Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+ if (mInfo != nullptr)
+ {
+ Object^ managedptr = nullptr;
+ try
+ {
+ managedptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ ManagedCacheWriterGeneric* mgcw = new ManagedCacheWriterGeneric(managedptr);
+
+ Type^ cwgType = Type::GetType("Apache.Geode.Client.CacheWriterGeneric`2");
+ cwgType = cwgType->MakeGenericType(types);
+ Object^ cwg = Activator::CreateInstance(cwgType);
+
+ mInfo = cwgType->GetMethod("SetCacheWriter");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = managedptr;
+ mInfo->Invoke(cwg, params);
+
+ mgcw->setptr((Apache::Geode::Client::ICacheWriter<Object^, Object^>^)cwg);
+
+ return mgcw;
+ }
+ else
+ {
+ std::string ex_str = "ManagedCacheWriterGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedCacheWriterGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCacheWriterGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ bool ManagedCacheWriterGeneric::beforeUpdate(const EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+
+ return m_managedptr->BeforeUpdate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ bool ManagedCacheWriterGeneric::beforeCreate(const EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+
+ return m_managedptr->BeforeCreate(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ bool ManagedCacheWriterGeneric::beforeDestroy(const EntryEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::EntryEvent<Object^, Object^> mevent(&ev);
+
+ return m_managedptr->BeforeDestroy(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+ bool ManagedCacheWriterGeneric::beforeRegionClear(const RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+
+ return m_managedptr->BeforeRegionClear(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ bool ManagedCacheWriterGeneric::beforeRegionDestroy(const RegionEvent& ev)
+ {
+ try {
+ Apache::Geode::Client::RegionEvent<Object^, Object^> mevent(&ev);
+
+ return m_managedptr->BeforeRegionDestroy(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ void ManagedCacheWriterGeneric::close(const RegionPtr& rp)
+ {
+ try {
+ Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
+ Apache::Geode::Client::Region<Object^, Object^>::Create(rp);
+
+ m_managedptr->Close(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(mregion));
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheWriter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheWriter.hpp b/clicache/src/impl/ManagedCacheWriter.hpp
new file mode 100644
index 0000000..0b6eba1
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheWriter.hpp
@@ -0,0 +1,191 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CacheWriter.hpp>
+#include "end_native.hpp"
+
+#include "../ICacheWriter.hpp"
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ICacheWriter" />
+ /// object and implements the native <c>apache::geode::client::CacheWriter</c> interface.
+ /// </summary>
+ class ManagedCacheWriterGeneric
+ : public CacheWriter
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheWriterGeneric(Object^ userptr) : m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedCacheWriter</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICacheWriter</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>ICacheWriter</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static CacheWriter* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ virtual ~ManagedCacheWriterGeneric() { }
+
+ /// <summary>
+ /// Called before an entry is updated. The entry update is initiated by a
+ /// <c>put</c> or a <c>get</c> that causes the loader to update an existing entry.
+ /// </summary>
+ /// <remarks>
+ /// The entry previously existed in the cache where the operation was
+ /// initiated, although the old value may have been null. The entry being
+ /// updated may or may not exist in the local cache where the CacheWriter is
+ /// installed.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ /// <seealso cref="Apache.Geode.Client.Region.Get" />
+ bool beforeUpdate(const EntryEvent& ev);
+
+ /// <summary>
+ /// Called before an entry is created. Entry creation is initiated by a
+ /// <c>create</c>, a <c>put</c>, or a <c>get</c>.
+ /// </summary>
+ /// <remarks>
+ /// The <c>CacheWriter</c> can determine whether this value comes from a
+ /// <c>get</c> or not from <c>load</c>. The entry being created may already
+ /// exist in the local cache where this <c>CacheWriter</c> is installed,
+ /// but it does not yet exist in the cache where the operation was initiated.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with creating the entry
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Create" />
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ /// <seealso cref="Apache.Geode.Client.Region.Get" />
+ bool beforeCreate(const EntryEvent& ev);
+
+ /// <summary>
+ /// Called before an entry is destroyed.
+ /// </summary>
+ /// <remarks>
+ /// The entry being destroyed may or may
+ /// not exist in the local cache where the CacheWriter is installed. This method
+ /// is <em>not</em> called as a result of expiration or
+ /// <see cref="Apache.Geode.Client.Region.LocalDestroyRegion" />.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with destroying the entry
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Destroy" />
+ bool beforeDestroy(const EntryEvent& ev);
+
+ /// <summary>
+ /// called before this region is cleared
+ /// </summary>
+ bool beforeRegionClear(const RegionEvent& ev);
+
+ /// <summary>
+ /// called before this region is destroyed
+ /// </summary>
+ /// <param name="ev">
+ /// RegionEvent denotes the event object associated with destroying the region
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.DestroyRegion" />
+ bool beforeRegionDestroy(const RegionEvent& ev);
+
+ /// <summary>
+ /// Called when the region containing this callback is destroyed, when
+ /// the cache is closed.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should clean up any external
+ /// resources, such as database connections. Any runtime exceptions this method
+ /// throws will be logged.
+ /// <para>
+ /// It is possible for this method to be called multiple times on a single
+ /// callback instance, so implementations must be tolerant of this.
+ /// </para>
+ /// </remarks>
+ /// <seealso cref="Apache.Geode.Client.Cache.Close" />
+ /// <seealso cref="Apache.Geode.Client.Region.DestroyRegion" />
+ void close(const RegionPtr& rp);
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ICacheWriter<Object^, Object^>^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::ICacheWriter<Object^, Object^>^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheWriter
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ICacheWriter<Object^, Object^>^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableDelta.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableDelta.cpp b/clicache/src/impl/ManagedCacheableDelta.cpp
new file mode 100644
index 0000000..8c0c0d1
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -0,0 +1,282 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include "ManagedCacheableDelta.hpp"
+#include "../DataInput.hpp"
+#include "../DataOutput.hpp"
+#include "../CacheableString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ void ManagedCacheableDeltaGeneric::toData(DataOutput& output) const
+ {
+ try {
+ System::UInt32 pos = (int)output.getBufferLength();
+ Apache::Geode::Client::DataOutput mg_output(&output, true);
+ m_managedSerializableptr->ToData(%mg_output);
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+ ManagedCacheableDeltaGeneric* tmp = const_cast<ManagedCacheableDeltaGeneric*>(this);
+ tmp->m_objectSize = (int)(output.getBufferLength() - pos);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ Serializable* ManagedCacheableDeltaGeneric::fromData(DataInput& input)
+ {
+ try {
+ int pos = input.getBytesRead();
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ m_managedSerializableptr->FromData(%mg_input);
+
+ //this will move the cursor in c++ layer
+ input.advanceCursor(mg_input.BytesReadInternally);
+
+ m_objectSize = input.getBytesRead() - pos;
+
+ if (m_hashcode == 0)
+ m_hashcode = m_managedptr->GetHashCode();
+
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return this;
+ }
+
+ System::UInt32 ManagedCacheableDeltaGeneric::objectSize() const
+ {
+ try {
+ int ret = m_managedSerializableptr->ObjectSize;
+ if (ret > m_objectSize)
+ return ret;
+ else
+ return m_objectSize;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ System::Int32 ManagedCacheableDeltaGeneric::classId() const
+ {
+ System::UInt32 classId;
+ try {
+ classId = m_managedSerializableptr->ClassId;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return (classId >= 0x80000000 ? 0 : classId);
+ }
+
+ int8_t ManagedCacheableDeltaGeneric::typeId() const
+ {
+ try {
+ System::UInt32 classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) % 0x20000000);
+ }
+ else if (classId <= 0x7F) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData;
+ }
+ else if (classId <= 0x7FFF) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData4;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ int8_t ManagedCacheableDeltaGeneric::DSFID() const
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ System::UInt32 classId = m_managedSerializableptr->ClassId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) / 0x20000000);
+ }
+ return 0;
+ }
+
+ bool ManagedCacheableDeltaGeneric::hasDelta()
+ {
+ return m_managedptr->HasDelta();
+ }
+
+ void ManagedCacheableDeltaGeneric::toDelta(DataOutput& output) const
+ {
+ try {
+ Apache::Geode::Client::DataOutput mg_output(&output, true);
+ m_managedptr->ToDelta(%mg_output);
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheableDeltaGeneric::fromDelta(DataInput& input)
+ {
+ try {
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ m_managedptr->FromDelta(%mg_input);
+
+ //this will move the cursor in c++ layer
+ input.advanceCursor(mg_input.BytesReadInternally);
+
+ m_hashcode = m_managedptr->GetHashCode();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ DeltaPtr ManagedCacheableDeltaGeneric::clone()
+ {
+ try {
+ ICloneable^ cloneable = dynamic_cast<ICloneable^>((
+ Apache::Geode::Client::IGeodeDelta^) m_managedptr);
+ if (cloneable) {
+ Apache::Geode::Client::IGeodeSerializable^ Mclone =
+ dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(cloneable->Clone());
+ return DeltaPtr(static_cast<ManagedCacheableDeltaGeneric*>(
+ SafeMSerializableConvertGeneric(Mclone)));
+ }
+ else {
+ return Delta::clone();
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ bool ManagedCacheableDeltaGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
+ {
+ try {
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const ManagedCacheableDeltaGeneric* p_other =
+ dynamic_cast<const ManagedCacheableDeltaGeneric*>(&other);
+ if (p_other != NULL) {
+ return m_managedptr->Equals(p_other->ptr());
+ }
+ return false;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ bool ManagedCacheableDeltaGeneric::operator == (const ManagedCacheableDeltaGeneric& other) const
+ {
+ try {
+ return m_managedptr->Equals(other.ptr());
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+
+ }
+
+ System::Int32 ManagedCacheableDeltaGeneric::hashcode() const
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ size_t ManagedCacheableDeltaGeneric::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ if (maxLength > 0) {
+ String^ logstr = m_managedptr->GetType()->Name + '(' +
+ m_managedptr->ToString() + ')';
+ Apache::Geode::Client::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableDelta.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableDelta.hpp b/clicache/src/impl/ManagedCacheableDelta.hpp
new file mode 100644
index 0000000..9211a8d
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/Delta.hpp>
+#include "end_native.hpp"
+
+#include "../IGeodeDelta.hpp"
+#include "../IGeodeSerializable.hpp"
+
+
+using namespace System;
+//using namespace apache::geode::client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+ interface class IGeodeDelta;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeDelta" />
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
+ /// </summary>
+ class ManagedCacheableDeltaGeneric
+ : public apache::geode::client::CacheableKey, public apache::geode::client::Delta
+ {
+ private:
+ int m_hashcode;
+ int m_classId;
+ int m_objectSize;
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheableDeltaGeneric(
+ Apache::Geode::Client::IGeodeDelta^ managedptr)
+ : Delta(nullptr), m_managedptr(managedptr)
+ {
+ m_managedSerializableptr = dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (managedptr);
+ m_classId = m_managedSerializableptr->ClassId;
+ m_objectSize = 0;
+ }
+
+ inline ManagedCacheableDeltaGeneric(
+ Apache::Geode::Client::IGeodeDelta^ managedptr, int hashcode, int classId)
+ :Delta(nullptr), m_managedptr(managedptr) {
+ m_hashcode = hashcode;
+ m_classId = classId;
+ m_managedSerializableptr = dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (managedptr);
+ m_objectSize = 0;
+ }
+
+ /// <summary>
+ /// serialize this object
+ /// </summary>
+ virtual void toData(apache::geode::client::DataOutput& output) const;
+
+ /// <summary>
+ /// deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input);
+
+ virtual void toDelta(apache::geode::client::DataOutput& output) const;
+
+ virtual void fromDelta(apache::geode::client::DataInput& input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual System::UInt32 objectSize() const;
+
+ /// <summary>
+ /// return the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual System::Int32 classId() const;
+
+ /// <summary>
+ /// return the typeId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int8_t typeId() const;
+
+ /// <summary>
+ /// return the Data Serialization Fixed ID type.
+ /// This is used to determine what instance type to create
+ /// and deserialize into.
+ ///
+ /// Note that this should not be overridden by custom implementations
+ /// and is reserved only for builtin types.
+ /// </summary>
+ virtual int8_t DSFID() const;
+
+ virtual bool hasDelta();
+
+ virtual apache::geode::client::DeltaPtr clone();
+
+ /// <summary>
+ /// return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 hashcode() const;
+
+ /// <summary>
+ /// return true if this key matches other CacheableKey
+ /// </summary>
+ virtual bool operator == (const CacheableKey& other) const;
+
+ /// <summary>
+ /// return true if this key matches other ManagedCacheableDeltaGeneric
+ /// </summary>
+ virtual bool operator == (const ManagedCacheableDeltaGeneric& other) const;
+
+ /// <summary>
+ /// Copy the string form of a key into a char* buffer for logging purposes.
+ /// implementations should only generate a string as long as maxLength chars,
+ /// and return the number of chars written. buffer is expected to be large
+ /// enough to hold at least maxLength chars.
+ /// The default implementation renders the classname and instance address.
+ /// </summary>
+ virtual size_t logString(char* buffer, size_t maxLength) const;
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IGeodeDelta^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeDelta
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IGeodeDelta^> m_managedptr;
+ gcroot<Apache::Geode::Client::IGeodeSerializable^> m_managedSerializableptr;
+ // Disable the copy and assignment constructors
+ ManagedCacheableDeltaGeneric(const ManagedCacheableDeltaGeneric&);
+ ManagedCacheableDeltaGeneric& operator = (const ManagedCacheableDeltaGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
new file mode 100644
index 0000000..18472c4
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
@@ -0,0 +1,337 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include "ManagedCacheableDeltaBytes.hpp"
+#include "../DataInput.hpp"
+#include "../DataOutput.hpp"
+#include "../CacheableString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ void ManagedCacheableDeltaBytesGeneric::toData(DataOutput& output) const
+ {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
+ try {
+ output.writeBytesOnly(m_bytes, m_size);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ Serializable* ManagedCacheableDeltaBytesGeneric::fromData(DataInput& input)
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromData: classid " + m_classId);
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ const System::Byte* objStartPos = input.currentBufferPosition();
+
+ Apache::Geode::Client::IGeodeSerializable^ obj =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+ input.advanceCursor(mg_input.BytesReadInternally);
+
+ m_hashCode = obj->GetHashCode();
+
+ const System::Byte* objEndPos = input.currentBufferPosition();
+
+ //m_size = mg_input.BytesRead;
+ m_size = (System::UInt32)(objEndPos - objStartPos);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return this;
+ }
+
+ System::UInt32 ManagedCacheableDeltaBytesGeneric::objectSize() const
+ {
+ try {
+ return m_size;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ System::Int32 ManagedCacheableDeltaBytesGeneric::classId() const
+ {
+ System::UInt32 classId;
+ try {
+ classId = m_classId;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return (classId >= 0x80000000 ? 0 : classId);
+ }
+
+ int8_t ManagedCacheableDeltaBytesGeneric::typeId() const
+ {
+ try {
+ System::UInt32 classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) % 0x20000000);
+ }
+ else if (classId <= 0x7F) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData;
+ }
+ else if (classId <= 0x7FFF) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData4;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ int8_t ManagedCacheableDeltaBytesGeneric::DSFID() const
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ System::UInt32 classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) / 0x20000000);
+ }
+ return 0;
+ }
+
+ bool ManagedCacheableDeltaBytesGeneric::hasDelta()
+ {
+ //Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
+ //return deltaObj->HasDelta();
+ return m_hasDelta;
+ }
+
+ void ManagedCacheableDeltaBytesGeneric::toDelta(DataOutput& output) const
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
+ Apache::Geode::Client::DataOutput mg_output(&output, true);
+ deltaObj->ToDelta(%mg_output);
+ mg_output.WriteBytesToUMDataOutput();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ void ManagedCacheableDeltaBytesGeneric::fromDelta(DataInput& input)
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta:");
+ Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ deltaObj->FromDelta(%mg_input);
+
+ Apache::Geode::Client::IGeodeSerializable^ managedptr =
+ dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (deltaObj);
+ if (managedptr != nullptr)
+ {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
+ auto dataOut = input.getCache()->createDataOutput();
+ Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
+ managedptr->ToData(%mg_output);
+
+ //move cursor
+ //dataOut.advanceCursor(mg_output.BufferLength);
+ mg_output.WriteBytesToUMDataOutput();
+
+ GF_SAFE_DELETE(m_bytes);
+ m_bytes = dataOut->getBufferCopy();
+ m_size = dataOut->getBufferLength();
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ m_hashCode = managedptr->GetHashCode();
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ DeltaPtr ManagedCacheableDeltaBytesGeneric::clone()
+ {
+ try {
+ Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
+ ICloneable^ cloneable = dynamic_cast<ICloneable^>((Apache::Geode::Client::IGeodeDelta^) deltaObj);
+ if (cloneable) {
+ Apache::Geode::Client::IGeodeSerializable^ Mclone =
+ dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(cloneable->Clone());
+ return DeltaPtr(static_cast<ManagedCacheableDeltaBytesGeneric*>(
+ SafeMSerializableConvertGeneric(Mclone)));
+ }
+ else {
+ return Delta::clone();
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ Apache::Geode::Client::IGeodeDelta^
+ ManagedCacheableDeltaBytesGeneric::getManagedObject() const
+ {
+
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::getManagedObject");
+
+ auto dinp = m_cache->createDataInput(m_bytes, m_size);
+ Apache::Geode::Client::DataInput mg_dinp(dinp.get(), true, m_cache);
+ Apache::Geode::Client::TypeFactoryMethodGeneric^ creationMethod =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId);
+ Apache::Geode::Client::IGeodeSerializable^ newObj = creationMethod();
+
+ Apache::Geode::Client::IGeodeDelta^ managedDeltaptr =
+ dynamic_cast <Apache::Geode::Client::IGeodeDelta^> (newObj->FromData(%mg_dinp));
+ return managedDeltaptr;
+ }
+
+ bool ManagedCacheableDeltaBytesGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal");
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const ManagedCacheableDeltaBytesGeneric* p_other =
+ dynamic_cast<const ManagedCacheableDeltaBytesGeneric*>(&other);
+ if (p_other != NULL) {
+ auto di = m_cache->createDataInput(m_bytes, m_size);
+ Apache::Geode::Client::DataInput mg_input(di.get(), true, m_cache);
+ Apache::Geode::Client::IGeodeSerializable^ obj =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+ bool ret = obj->Equals(p_other->ptr());
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
+ return ret;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal returns false");
+ return false;
+ }
+
+ bool ManagedCacheableDeltaBytesGeneric::operator ==(const ManagedCacheableDeltaBytesGeneric& other) const
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal. ");
+ auto di = m_cache->createDataInput(m_bytes, m_size);
+ Apache::Geode::Client::DataInput mg_input(di.get(), true, m_cache);
+ Apache::Geode::Client::IGeodeSerializable^ obj =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+ bool ret = obj->Equals(other.ptr());
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
+ return ret;
+ //return obj->Equals(other.get());
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return false");
+ return false;
+ }
+
+ System::Int32 ManagedCacheableDeltaBytesGeneric::hashcode() const
+ {
+ throw gcnew System::NotSupportedException;
+ }
+
+ size_t ManagedCacheableDeltaBytesGeneric::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ Apache::Geode::Client::IGeodeDelta^ manageObject = getManagedObject();
+ if (manageObject != nullptr)
+ {
+ if (maxLength > 0) {
+ String^ logstr = manageObject->GetType()->Name + '(' +
+ manageObject->ToString() + ')';
+ Apache::Geode::Client::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableDeltaBytes.hpp b/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
new file mode 100644
index 0000000..c5fcbb2
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include "SerializationRegistry.hpp"
+#include <geode/Cache.hpp>
+#include <geode/Delta.hpp>
+#include <geode/DataOutput.hpp>
+#include "end_native.hpp"
+
+#include "../Log.hpp"
+#include "../DataOutput.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+ interface class IGeodeDelta;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeDelta" />
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
+ /// </summary>
+ class ManagedCacheableDeltaBytesGeneric
+ : public CacheableKey, public Delta
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedDeltaptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheableDeltaBytesGeneric(
+ Apache::Geode::Client::IGeodeDelta^ managedDeltaptr, bool storeBytes)
+ :Delta(nullptr), m_domainId(System::Threading::Thread::GetDomainID()),
+ m_classId(0),
+ m_bytes(NULL),
+ m_size(0),
+ m_hasDelta(false),
+ m_hashCode(0)
+ {
+ if (storeBytes)
+ m_hasDelta = managedDeltaptr->HasDelta();
+ Apache::Geode::Client::IGeodeSerializable^ managedptr =
+ dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (managedDeltaptr);
+ if (managedptr != nullptr)
+ {
+ m_classId = managedptr->ClassId;
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString() + " storeBytes:" + storeBytes);
+ if (storeBytes)
+ {
+ auto dataOut = m_cache->createDataOutput();
+ Apache::Geode::Client::DataOutput mg_output(dataOut.get(), true);
+ managedptr->ToData(%mg_output);
+
+ //move cursor
+ //dataOut.advanceCursor(mg_output.BufferLength);
+ mg_output.WriteBytesToUMDataOutput();
+
+ m_bytes = dataOut->getBufferCopy();
+ m_size = dataOut->getBufferLength();
+ m_hashCode = managedptr->GetHashCode();
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ }
+ }
+ }
+
+ /// <summary>
+ /// serialize this object
+ /// </summary>
+ virtual void toData(apache::geode::client::DataOutput& output) const;
+
+ /// <summary>
+ /// deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input);
+
+ virtual void toDelta(apache::geode::client::DataOutput& output) const;
+
+ virtual void fromDelta(apache::geode::client::DataInput& input);
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual System::UInt32 objectSize() const;
+
+ /// <summary>
+ /// return the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual System::Int32 classId() const;
+
+ /// <summary>
+ /// return the typeId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int8_t typeId() const;
+
+ /// <summary>
+ /// return the Data Serialization Fixed ID type.
+ /// This is used to determine what instance type to create
+ /// and deserialize into.
+ ///
+ /// Note that this should not be overridden by custom implementations
+ /// and is reserved only for builtin types.
+ /// </summary>
+ virtual int8_t DSFID() const;
+
+ virtual bool hasDelta();
+
+ virtual apache::geode::client::DeltaPtr clone();
+
+ /// <summary>
+ /// return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 hashcode() const;
+
+ /// <summary>
+ /// return true if this key matches other CacheableKey
+ /// </summary>
+ virtual bool operator == (const CacheableKey& other) const;
+
+ /// <summary>
+ /// return true if this key matches other ManagedCacheableDeltaBytesGeneric
+ /// </summary>
+ virtual bool operator == (const ManagedCacheableDeltaBytesGeneric& other) const;
+
+ /// <summary>
+ /// Copy the string form of a key into a char* buffer for logging purposes.
+ /// implementations should only generate a string as long as maxLength chars,
+ /// and return the number of chars written. buffer is expected to be large
+ /// enough to hold at least maxLength chars.
+ /// The default implementation renders the classname and instance address.
+ /// </summary>
+ virtual size_t logString(char* buffer, size_t maxLength) const;
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IGeodeDelta^ ptr() const
+ {
+ return getManagedObject();
+ }
+
+ inline ~ManagedCacheableDeltaBytesGeneric()
+ {
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
+ GF_SAFE_DELETE(m_bytes);
+ }
+
+ private:
+ Apache::Geode::Client::IGeodeDelta^ getManagedObject() const;
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeDelta
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ //gcroot<Apache::Geode::Client::IGeodeDelta^> m_managedptr;
+ //gcroot<Apache::Geode::Client::IGeodeSerializable^> m_managedSerializableptr;
+
+ int m_domainId;
+ UInt32 m_classId;
+ System::Byte * m_bytes;
+ System::UInt32 m_size;
+ System::UInt32 m_hashCode;
+ bool m_hasDelta;
+
+ // Disable the copy and assignment constructors
+ ManagedCacheableDeltaBytesGeneric(const ManagedCacheableDeltaBytesGeneric&);
+ ManagedCacheableDeltaBytesGeneric& operator = (const ManagedCacheableDeltaBytesGeneric&);
+ };
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableKey.cpp b/clicache/src/impl/ManagedCacheableKey.cpp
new file mode 100644
index 0000000..8cefef9
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableKey.cpp
@@ -0,0 +1,230 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include "../ICacheableKey.hpp"
+#include "ManagedCacheableKey.hpp"
+#include "../DataInput.hpp"
+#include "../DataOutput.hpp"
+#include "../CacheableString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "../Log.hpp"
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ void ManagedCacheableKeyGeneric::toData(apache::geode::client::DataOutput& output) const
+ {
+ try {
+ System::UInt32 pos = (int)output.getBufferLength();
+ //Apache::Geode::Client::Log::Debug("ManagedCacheableKeyGeneric::toData");
+ Apache::Geode::Client::DataOutput mg_output(&output, true);
+ m_managedptr->ToData(%mg_output);
+ //this will move the cursor in c++ layer
+ mg_output.WriteBytesToUMDataOutput();
+
+ ManagedCacheableKeyGeneric* tmp = const_cast<ManagedCacheableKeyGeneric*>(this);
+ tmp->m_objectSize = (int)(output.getBufferLength() - pos);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ apache::geode::client::Serializable* ManagedCacheableKeyGeneric::fromData(apache::geode::client::DataInput& input)
+ {
+ try {
+ int pos = input.getBytesRead();
+ //Apache::Geode::Client::Log::Debug("ManagedCacheableKeyGeneric::fromData");
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ m_managedptr = m_managedptr->FromData(%mg_input);
+
+ //this will move the cursor in c++ layer
+ input.advanceCursor(mg_input.BytesReadInternally);
+ m_objectSize = input.getBytesRead() - pos;
+ //if(m_hashcode == 0)
+ //m_hashcode = m_managedptr->GetHashCode();
+
+
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return this;
+ }
+
+ System::UInt32 ManagedCacheableKeyGeneric::objectSize() const
+ {
+ try {
+ int ret = m_managedptr->ObjectSize;
+ if (ret > m_objectSize)
+ return ret;
+ else
+ return m_objectSize;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ System::Int32 ManagedCacheableKeyGeneric::classId() const
+ {
+ return (m_classId >= 0x80000000 ? 0 : m_classId);
+ }
+
+ int8_t ManagedCacheableKeyGeneric::typeId() const
+ {
+ if (m_classId >= 0x80000000) {
+ return (int8_t)((m_classId - 0x80000000) % 0x20000000);
+ }
+ else if (m_classId <= 0x7F) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData;
+ }
+ else if (m_classId <= 0x7FFF) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData4;
+ }
+ }
+
+ int8_t ManagedCacheableKeyGeneric::DSFID() const
+ {
+ if (m_classId >= 0x80000000) {
+ return (int8_t)((m_classId - 0x80000000) / 0x20000000);
+ }
+ return 0;
+ }
+
+ apache::geode::client::CacheableStringPtr ManagedCacheableKeyGeneric::toString() const
+ {
+ try {
+ apache::geode::client::CacheableStringPtr cStr;
+ Apache::Geode::Client::CacheableString::GetCacheableString(
+ m_managedptr->ToString(), cStr);
+ return cStr;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ bool ManagedCacheableKeyGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
+ {
+ try {
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const ManagedCacheableKeyGeneric* p_other =
+ dynamic_cast<const ManagedCacheableKeyGeneric*>(&other);
+ if (p_other != NULL) {
+ return static_cast<Apache::Geode::Client::ICacheableKey^>(
+ (static_cast<Apache::Geode::Client::IGeodeSerializable^>((Apache::Geode::Client::IGeodeSerializable^)m_managedptr)))->Equals(
+ static_cast<Apache::Geode::Client::ICacheableKey^>(p_other->ptr()));
+ }
+ return false;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ bool ManagedCacheableKeyGeneric::operator ==(const ManagedCacheableKeyGeneric& other) const
+ {
+ try {
+ return static_cast<Apache::Geode::Client::ICacheableKey^>(
+ (Apache::Geode::Client::IGeodeSerializable^)(Apache::Geode::Client::IGeodeSerializable^)m_managedptr)->Equals(
+ static_cast<Apache::Geode::Client::ICacheableKey^>(other.ptr()));
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return false;
+ }
+
+ System::Int32 ManagedCacheableKeyGeneric::hashcode() const
+ {
+ if (m_hashcode != 0)
+ return m_hashcode;
+ try {
+
+ ManagedCacheableKeyGeneric* tmp = const_cast<ManagedCacheableKeyGeneric*>(this);
+ tmp->m_hashcode = ((Apache::Geode::Client::ICacheableKey^)
+ (Apache::Geode::Client::IGeodeSerializable^)m_managedptr)
+ ->GetHashCode();
+ return m_hashcode;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ size_t ManagedCacheableKeyGeneric::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ if (maxLength > 0) {
+ String^ logstr = m_managedptr->GetType()->Name + '(' +
+ m_managedptr->ToString() + ')';
+ Apache::Geode::Client::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableKey.hpp b/clicache/src/impl/ManagedCacheableKey.hpp
new file mode 100644
index 0000000..1f3c27f
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableKey.hpp
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include <GeodeTypeIdsImpl.hpp>
+#include "SerializationRegistry.hpp"
+#include "end_native.hpp"
+
+#include "../IGeodeSerializable.hpp"
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeSerializable" />
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
+ /// </summary>
+ class ManagedCacheableKeyGeneric
+ : public apache::geode::client::CacheableKey
+ {
+ private:
+ int m_hashcode;
+ int m_classId;
+ native::SerializationRegistry* m_serializationRegistry;
+ int m_objectSize;
+ public:
+
+ inline ManagedCacheableKeyGeneric(
+ Apache::Geode::Client::IGeodeSerializable^ managedptr, int hashcode, int classId, native::SerializationRegistry * serializationRegistry)
+ : m_managedptr(managedptr) {
+ m_hashcode = hashcode;
+ m_classId = classId;
+ m_serializationRegistry = serializationRegistry;
+ m_objectSize = 0;
+ }
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheableKeyGeneric(Apache::Geode::Client::IGeodeSerializable^ managedptr, native::SerializationRegistry * serializationRegistry)
+ : m_managedptr(managedptr) {
+ // m_hashcode = managedptr->GetHashCode();
+ m_hashcode = 0;
+ m_classId = managedptr->ClassId;
+ m_serializationRegistry = serializationRegistry;
+ m_objectSize = 0;
+ }
+
+ /// <summary>
+ /// serialize this object
+ /// </summary>
+ virtual void toData(apache::geode::client::DataOutput& output) const;
+
+ /// <summary>
+ /// deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input);
+
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual System::UInt32 objectSize() const;
+
+ /// <summary>
+ /// return the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual System::Int32 classId() const;
+
+ /// <summary>
+ /// return the typeId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int8_t typeId() const;
+
+ /// <summary>
+ /// return the Data Serialization Fixed ID type.
+ /// This is used to determine what instance type to create
+ /// and deserialize into.
+ ///
+ /// Note that this should not be overridden by custom implementations
+ /// and is reserved only for builtin types.
+ /// </summary>
+ virtual int8_t DSFID() const;
+
+ /// <summary>
+ /// Display this object as 'string', which depends on the implementation in
+ /// the managed class
+ /// </summary>
+ virtual apache::geode::client::CacheableStringPtr toString() const;
+
+ /// <summary>
+ /// return true if this key matches other CacheableKey
+ /// </summary>
+ virtual bool operator == (const CacheableKey& other) const;
+ /// <summary>
+ /// return true if this key matches other ManagedCacheableKey
+ /// </summary>
+ virtual bool operator == (const ManagedCacheableKeyGeneric& other) const;
+
+ /// <summary>
+ /// return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 hashcode() const;
+
+ /// <summary>
+ /// Copy the string form of a key into a char* buffer for logging purposes.
+ /// implementations should only generate a string as long as maxLength chars,
+ /// and return the number of chars written. buffer is expected to be large
+ /// enough to hold at least maxLength chars.
+ /// The default implementation renders the classname and instance address.
+ /// </summary>
+ virtual size_t logString(char* buffer, size_t maxLength) const;
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IGeodeSerializable^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeSerializable
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IGeodeSerializable^> m_managedptr;
+
+ // Disable the copy and assignment constructors
+ ManagedCacheableKeyGeneric(const ManagedCacheableKeyGeneric&);
+ ManagedCacheableKeyGeneric& operator = (const ManagedCacheableKeyGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
[43/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/PutGetTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/PutGetTestsN.cs b/clicache/integration-test/PutGetTestsN.cs
new file mode 100644
index 0000000..2147821
--- /dev/null
+++ b/clicache/integration-test/PutGetTestsN.cs
@@ -0,0 +1,536 @@
+/*
+ * 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.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ // using Apache.Geode.Client;
+ using Apache.Geode.Client;
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class PutGetTests : UnitTests
+ {
+ #region Private members and constants
+
+ public const int NumKeys = 20;
+ public const int KeySize = 256;
+ public const int ValueSize = 4096;
+ private const string RegionName = "PutGetTest";
+ private const string KeyChecksumPrefix = "KeyChecksum:";
+ private const string ValChecksumPrefix = "ValChecksum:";
+ private UnitProcess m_client1, m_client2;
+ private IRegion<object, object> m_region;
+ private CacheableKeyWrapper[] m_cKeys;
+ private uint[] m_cKeyCksums;
+ private CacheableWrapper[] m_cValues;
+ private uint[] m_cValCksums;
+ private static string FEOnRegionPrSHOP_OptimizeForWrite = "FEOnRegionPrSHOP_OptimizeForWrite";
+ private static string FEOnRegionPrSHOP = "FEOnRegionPrSHOP";
+ private static string getFuncName = "MultiGetFunction";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ #region Public accessors
+
+ public CacheableWrapper[] CacheableKeys
+ {
+ get
+ {
+ return m_cKeys;
+ }
+ }
+
+ public CacheableWrapper[] CacheableValues
+ {
+ get
+ {
+ return m_cValues;
+ }
+ }
+
+ #endregion
+
+ #region Private functions
+
+ private Type GetValueType()
+ {
+ Type valType = null;
+ if (m_cValues[0].Cacheable != null)
+ {
+ valType = m_cValues[0].Cacheable.GetType();
+ }
+ return valType;
+ }
+
+ #endregion
+
+ #region Functions invoked by the tests
+
+ /// <summary>
+ /// Initialize the keys for different key types.
+ /// </summary>
+ public int InitKeys(UInt32 typeId, int numKeys, int maxSize)
+ {
+ Util.Log("InitKeys typeId " + typeId + " numKeys= " + numKeys + "maxSize=" + maxSize);
+ Assert.Greater(numKeys, 0,
+ "Number of keys should be greater than zero.");
+ Type type = CacheableWrapperFactory.GetTypeForId(typeId);
+ CacheableKeyWrapper instance = CacheableWrapperFactory.CreateKeyInstance(typeId);
+ Assert.IsNotNull(instance, "InitKeys: Type '{0}' could not be instantiated.", type.Name);
+ int maxKeys = instance.MaxKeys;
+ if (numKeys > maxKeys)
+ {
+ numKeys = maxKeys;
+ }
+ m_cKeys = new CacheableKeyWrapper[numKeys];
+ m_cKeyCksums = new uint[numKeys];
+ for (int keyIndex = 0; keyIndex < numKeys; keyIndex++)
+ {
+ instance = CacheableWrapperFactory.CreateKeyInstance(typeId);
+ instance.InitKey(keyIndex, maxSize);
+ m_cKeyCksums[keyIndex] = instance.GetChecksum();
+ m_cKeys[keyIndex] = instance;
+ }
+
+ Util.Log("InitKeys final m_cKeyCksums " + m_cKeyCksums.Length + " m_cKeys:" + m_cKeys.Length + "numKeys: " + numKeys);
+ return numKeys;
+ }
+
+ /// <summary>
+ /// Initialize the values to random values for different value types.
+ /// </summary>
+ public void InitValues(UInt32 typeId, int numValues, int maxSize)
+ {
+ Util.Log("InitValues typeId " + typeId + " numKeys= " + numValues + "maxSize=" + maxSize);
+ Assert.Greater(numValues, 0,
+ "Number of values should be greater than zero.");
+ Type type = CacheableWrapperFactory.GetTypeForId(typeId);
+ m_cValues = new CacheableWrapper[numValues];
+ m_cValCksums = new uint[numValues];
+ CacheableWrapper instance;
+ for (int valIndex = 0; valIndex < numValues; valIndex++)
+ {
+ instance = CacheableWrapperFactory.CreateInstance(typeId);
+ Util.Log(" in initvalue type " + instance.GetType().ToString());
+ Assert.IsNotNull(instance, "InitValues: Type '{0}' could not be instantiated.",
+ type.Name);
+ instance.InitRandomValue(maxSize);
+ m_cValCksums[valIndex] = instance.GetChecksum();
+ m_cValues[valIndex] = instance;
+ }
+
+ Util.Log("InitValues final m_cValCksums " + m_cValCksums.Length + " m_cValues:" + m_cValues.Length);
+ }
+
+ public void SetRegion(string regionName)
+ {
+ m_region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ }
+
+ public void DoPuts()
+ {
+ Assert.IsNotNull(m_cKeys, "DoPuts: null keys array.");
+ Assert.IsNotNull(m_cValues, "DoPuts: null values array.");
+ Assert.IsNotNull(m_region, "DoPuts: null region.");
+
+ for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
+ {
+ object key = m_cKeys[keyIndex].CacheableKey;
+ object val = m_cValues[keyIndex].Cacheable;
+ if (val != null)
+ {
+ Util.Log(" DoPuts() key hashcode " + key.GetHashCode());
+ Util.Log(" DoPuts() " + key.GetType().ToString() + " : " + val.GetType().ToString());
+ m_region[key] = val;
+ }
+ else
+ {
+ try
+ {
+ m_region.Remove(key);//Destroy() replaced by Remove() Api
+ }
+ catch (EntryNotFoundException)
+ {
+ // expected
+ }
+ m_region.Add(key, val); //Create() replaced by Add() Api.
+ }
+ }
+ Util.Log("DoPuts completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), GetValueType());
+ }
+
+ public void DoHashPuts()
+ {
+ Assert.IsNotNull(m_cKeys, "DoPuts: null keys array.");
+ Assert.IsNotNull(m_region, "DoPuts: null region.");
+ for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
+ {
+ object key = m_cKeys[keyIndex].CacheableKey;
+
+ //TODO: GetHashCode() is C# builtIn function. it needs to match with our implementation of GetHashCode().
+ //Console.WriteLine("Key type = {0}", key.GetType());
+
+ //int val = key.GetHashCodeN();
+ int val = key.GetHashCode();
+ m_region[key] = val;
+ }
+ }
+
+ public void DoPRSHPartitionResolverPuts(string rname)
+ {
+
+ }
+
+ public void DoPRSHTradeResolverTasks(string rname)
+ {
+
+ }
+
+ public void DoPRSHFixedPartitionResolverTests(string rname)
+ {
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(rname);
+ int metadatarefreshCount = 0;
+ int metadatarefreshCount1 = 0;
+ Assert.IsNotNull(region, "DoPRSHPartitionResolverPuts: null region.");
+ Util.Log("Inside DoPRSHFixedPartitionResolverTests region name is {0} ", region.Name.ToString());
+ for (int i = 0; i < 2000; i++)
+ {
+ try
+ {
+ int key = i;
+ int val = key/*.GetHashCode()*/;
+ region[key] = val;
+ Util.Log("Put inside DoPRSHFixedPartitionResolverTests successfull {0} {1}", key, val);
+ }
+ catch (CacheServerException ex)
+ {
+ Util.Log("CacheServerException: Put caused networkhop");
+ Assert.Fail("Got CacheServerException (0}", ex.Message);
+ }
+ catch (CacheWriterException ex)
+ {
+ Util.Log("CacheWriterException: Put caused networkhop");
+ Assert.Fail("Got CacheWriterException (0}", ex.Message);
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Exception: Put caused networkhop ");
+ Util.Log("Got Exception (0} {1} {2} ", ex.Message, ex.StackTrace, ex.Source);
+ Assert.Fail("Got Exception (0} {1} {2} ", ex.Message, ex.StackTrace, ex.Source);
+ }
+ }
+
+ }
+
+ public void DoPRSHFixedPartitionResolverTasks(ClientBase client1, string regionName)
+ {
+ client1.Call(DoPRSHFixedPartitionResolverTests, regionName);
+ }
+
+ public void DoPRSHPartitionResolverTasks(ClientBase client1, ClientBase client2, string regionName)
+ {
+ client1.Call(DoPRSHPartitionResolverPuts, regionName);
+ client2.Call(DoPRSHPartitionResolverPuts, regionName);
+ }
+
+ public void DoHashCodePuts(ClientBase client1, ClientBase client2, string regionName)
+ {
+ client1.Call(DoHashPuts);
+ client2.Call(DoHashPuts);
+ }
+
+ public void DoKeyChecksumPuts()
+ {
+ Assert.IsNotNull(m_cKeyCksums, "PutKeyChecksums: null checksums array.");
+ Assert.IsNotNull(m_region, "PutKeyChecksums: null region.");
+ Util.Log("DoKeyChecksumPuts number of keys " + m_cKeyCksums.Length);
+ for (int keyIndex = 0; keyIndex < m_cKeyCksums.Length; keyIndex++)
+ {
+ m_region[KeyChecksumPrefix + keyIndex] = (int)m_cKeyCksums[keyIndex];
+ }
+ Util.Log("DoKeyChecksumPuts completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), GetValueType());
+ }
+
+ public void DoValChecksumPuts()
+ {
+ Assert.IsNotNull(m_cValCksums, "PutValChecksums: null checksums array.");
+ Assert.IsNotNull(m_region, "PutValChecksums: null region.");
+ Util.Log("DoValChecksumPuts number of keys " + m_cValCksums.Length);
+ for (int keyIndex = 0; keyIndex < m_cValCksums.Length; keyIndex++)
+ {
+ m_region[ValChecksumPrefix + keyIndex] = (int)m_cValCksums[keyIndex];
+ }
+ Util.Log("DoValChecksumPuts completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), GetValueType());
+ }
+
+ /// <summary>
+ /// Run a query on server for native client to force deserialization
+ /// on server and thereby check serialization/deserialization compability
+ /// between native clients and java server.
+ /// </summary>
+ public void DoRunQuery()
+ {
+ Assert.IsNotNull(m_cKeys, "DoGets: null keys array.");
+ Assert.IsNotNull(m_region, "DoGets: null region.");
+
+ // for a type that cannot be handled by server, delete these values
+ // before next query that will cause problem
+ Type valType = GetValueType();
+ if (CacheableHelper.IsUnhandledType(m_cValues[0].TypeId))
+ {
+ Util.Log("DoRunQuery: deleting entries with value type {0}", valType);
+ for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
+ {
+ m_region.Remove(m_cKeys[keyIndex].CacheableKey); // Destroy() -> Remove()
+ }
+ }
+ else
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(m_region.Attributes.PoolName).GetQueryService<object, object>();
+ Query<object> qry = qs.NewQuery("SELECT * FROM " + m_region.FullPath);
+ ISelectResults<object> results = qry.Execute();
+ // not really interested in results but loop through them neverthless
+ Util.Log("DoRunQuery: obtained {0} results", results.Size);
+ int numResults = 0;
+ foreach (object res in results)
+ {
+ ++numResults;
+ }
+ Assert.AreEqual(results.Size, numResults,
+ "Expected the number of results to match the size of ISelectResults");
+ }
+ Util.Log("DoQuery completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), valType);
+ }
+
+ public void DoGetsVerify()
+ {
+ Util.Log("DoGetsVerify: m_cKeys " + m_cKeys.Length);
+ Assert.IsNotNull(m_cKeys, "DoGetsVerify: null keys array.");
+ Assert.IsNotNull(m_cValues, "DoGetsVerify: null values array.");
+ Assert.IsNotNull(m_region, "DoGetsVerify: null region.");
+
+ for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
+ {
+ Util.Log("DoGetsVerify key type " + m_cKeys[keyIndex].CacheableKey.GetType());
+ Object actualValue = m_region[m_cKeys[keyIndex].CacheableKey];
+
+ if (actualValue == null)
+ Util.Log("DoGetsVerify value is null");
+ else
+ Util.Log("DoGetsVerify value is not null ");
+ uint cksum = m_cKeys[keyIndex].GetChecksum();
+ //Util.Log("DoGetsVerify key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
+ //Util.Log("DoGetsVerify key clasid " + m_region[(KeyChecksumPrefix + keyIndex).ClassId]);
+ //Util.Log("DoGetsVerify key type " + m_region.Get(KeyChecksumPrefix + keyIndex).GetType().ToString());
+ //CacheableInt32 putCksum = m_region[KeyChecksumPrefix + keyIndex] as CacheableInt32;
+ Util.Log("DoGetsVerify key type " + m_region[KeyChecksumPrefix + keyIndex].GetType().ToString());
+ int putCksum = (int)m_region[KeyChecksumPrefix + keyIndex];
+ Assert.IsNotNull(putCksum,
+ "DoGetsVerify: Could not find checksum for key at index {0}.",
+ keyIndex);
+ Assert.AreEqual(cksum, (uint)putCksum,
+ "DoGetsVerify: Checksums of the keys at index {0} differ.",
+ keyIndex);
+ Util.Log("actualValue Type = {0}", actualValue.GetType());
+ cksum = m_cValues[keyIndex].GetChecksum((object)actualValue);
+ putCksum = (int)m_region[ValChecksumPrefix + keyIndex];
+ Assert.IsNotNull(putCksum, "DoGetsVerify: Could not find checksum for value at index {0}.", keyIndex);
+ Assert.AreEqual(cksum, (uint)putCksum, "DoGetsVerify: Checksums of the values at index {0} differ.", keyIndex);
+
+ // Also check in local cache using GetEntry
+ Util.Log("DoGetsVerify() key hashcode " + m_cKeys[keyIndex].CacheableKey.GetHashCode());
+ RegionEntry<object, object> entry = m_region.GetEntry(m_cKeys[keyIndex].CacheableKey);
+
+ if (entry != null)
+ {
+ try
+ {
+ cksum = m_cValues[keyIndex].GetChecksum(entry.Value);
+ }
+ catch (Exception ex)
+ {
+ Util.Log("DoGetsVerify() got exception " + ex.Message);
+ Util.Log("DoGetsVerify() get stacktrace " + ex.StackTrace);
+ throw ex;
+ }
+ }
+ else
+ {
+ cksum = 0;
+ }
+ Assert.AreEqual(cksum, (uint)putCksum, "DoGetsVerify: " +
+ "Checksums of the values at index {0} differ using GetEntry.",
+ keyIndex);
+ }
+ Util.Log("DoGetsVerify completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), GetValueType());
+ }
+
+ public void DoGets()
+ {
+ Assert.IsNotNull(m_cKeys, "DoGets: null keys array.");
+ Assert.IsNotNull(m_region, "DoGets: null region.");
+
+ for (int keyIndex = 0; keyIndex < m_cKeys.Length; keyIndex++)
+ {
+ //Object actualValue = m_region[m_cKeys[keyIndex].CacheableKey];
+ Object actualValue = m_region[m_cKeys[keyIndex].CacheableKey];
+ if (actualValue == null)
+ {
+ Assert.AreEqual(GeodeClassIds.CacheableNullString,
+ m_cValues[keyIndex].TypeId, "Only null string should return a " +
+ "null object");
+ }
+ }
+ Util.Log("DoGets completed for keyType [{0}], valType [{1}].",
+ m_cKeys[0].CacheableKey.GetType(), GetValueType());
+ }
+
+ public void PutGetSteps(ClientBase client1, ClientBase client2,
+ string regionName, bool verifyGets, bool runQuery)
+ {
+ if (verifyGets)
+ {
+ client1.Call(DoPuts);
+ client1.Call(DoKeyChecksumPuts);
+ client1.Call(DoValChecksumPuts);
+ client2.Call(DoGetsVerify);
+ InvalidateRegion(regionName, client1);
+ if (runQuery)
+ {
+ // run a query for ThinClient regions to check for deserialization
+ // compability on server
+ client1.Call(DoRunQuery);
+ }
+ client2.Call(DoPuts);
+ client2.Call(DoKeyChecksumPuts);
+ client2.Call(DoValChecksumPuts);
+ client1.Call(DoGetsVerify);
+ }
+ else
+ {
+ client1.Call(DoPuts);
+ client2.Call(DoGets);
+ InvalidateRegion(regionName, client1);
+ client2.Call(DoPuts);
+ client1.Call(DoGets);
+ }
+ // this query invocation is primarily to delete the entries that cannot
+ // be deserialized by the server
+ if (runQuery)
+ {
+ client1.Call(DoRunQuery);
+ }
+ }
+
+ public void InvalidateRegion(string regionName, params ClientBase[] clients)
+ {
+ if (clients != null)
+ {
+ foreach (ClientBase client in clients)
+ {
+ client.Call(CacheHelper.InvalidateRegionNonGeneric, regionName, true, true);
+ }
+ }
+ }
+
+ public void TestAllKeyValuePairs(ClientBase client1, ClientBase client2,
+ string regionName, bool runQuery, long dtTicks)
+ {
+ ICollection<UInt32> registeredKeyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> registeredValueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+
+ client1.Call(CacheableHelper.RegisterBuiltins, dtTicks);
+ client2.Call(CacheableHelper.RegisterBuiltins, dtTicks);
+
+ foreach (UInt32 keyTypeId in registeredKeyTypeIds)
+ {
+ int numKeys;
+ client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
+ client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
+
+ Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId);
+ foreach (UInt32 valueTypeId in registeredValueTypeIds)
+ {
+ client1.Call(InitValues, valueTypeId, numKeys, ValueSize);
+ client2.Call(InitValues, valueTypeId, numKeys, ValueSize);
+ Type valueType = CacheableWrapperFactory.GetTypeForId(valueTypeId);
+
+ Util.Log("Starting gets/puts with keyType '{0}' and valueType '{1}'",
+ keyType.Name, valueType.Name);
+ StartTimer();
+ Util.Log("Running warmup task which verifies the puts.");
+ PutGetSteps(client1, client2, regionName, true, runQuery);
+ Util.Log("End warmup task.");
+ LogTaskTiming(client1,
+ string.Format("IRegion<object, object>:{0},Key:{1},Value:{2},KeySize:{3},ValueSize:{4},NumOps:{5}",
+ regionName, keyType.Name, valueType.Name, KeySize, ValueSize, 4 * numKeys),
+ 4 * numKeys);
+
+ InvalidateRegion(regionName, client1, client2);
+
+ }
+ }
+ }
+
+ public void TestAllKeys(ClientBase client1, ClientBase client2, string regionName, long dtTime)
+ {
+ ICollection<UInt32> registeredKeyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> registeredValueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+
+ client1.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime);
+ client2.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime);
+
+ foreach (UInt32 keyTypeId in registeredKeyTypeIds)
+ {
+ int numKeys;
+ client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
+ client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize);
+ Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId);
+ StartTimer();
+ Util.Log("Running warmup task which verifies the puts.");
+ DoHashCodePuts(client1, client2, regionName);
+ }
+ }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/RegionEntryTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/RegionEntryTests.cs b/clicache/integration-test/RegionEntryTests.cs
new file mode 100644
index 0000000..ba76dae
--- /dev/null
+++ b/clicache/integration-test/RegionEntryTests.cs
@@ -0,0 +1,105 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ [Category("unicast_only")]
+ public class RegionEntryTests : UnitTests
+ {
+ private const string hostName = "REGIONENTRYTEST";
+ private const string regionName = "TESTREGIONENTRY_ROOT_REGION";
+ private Region region;
+
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ CacheHelper.InitName(hostName, hostName);
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ try
+ {
+ CacheHelper.Close();
+ }
+ finally
+ {
+ base.EndTests();
+ }
+ }
+
+ public void TestEntries(Region region, int num)
+ {
+ string regionName = region.Name;
+ Util.Log("Creating {0} entries in Region {1}", num, regionName);
+
+ for (int i = 0; i < num; i++)
+ {
+ region.Create(regionName + ": " + i.ToString(),
+ regionName + ": value of " + i.ToString());
+ }
+ ICacheableKey[] cKeys = region.GetKeys();
+ IGeodeSerializable[] cValues = region.GetValues();
+ Assert.AreEqual(num, cKeys.Length, "Number of keys in region is incorrect.");
+ Assert.AreEqual(num, cValues.Length, "Number of values in region is incorrect.");
+
+ foreach (ICacheableKey key in cKeys)
+ {
+ region.LocalInvalidate(key);
+ }
+ cKeys = region.GetKeys();
+ cValues = region.GetValues();
+ Assert.AreEqual(num, cKeys.Length, "Number of keys in region is incorrect after invalidate.");
+ Assert.AreEqual(0, cValues.Length, "Number of values in region is incorrect after invalidate.");
+
+ foreach (ICacheableKey key in cKeys)
+ {
+ region.LocalDestroy(key);
+ }
+ cKeys = region.GetKeys();
+ cValues = region.GetValues();
+ Assert.AreEqual(0, cKeys.Length, "Number of keys in region is incorrect after destroy.");
+ Assert.AreEqual(0, cValues.Length, "Number of values in region is incorrect after destroy.");
+ }
+
+ [Test]
+ public void RegionEntryFunction()
+ {
+ CacheHelper.CreatePlainRegion(regionName);
+ region = CacheHelper.GetVerifyRegion(regionName);
+
+ TestEntries(region, 10);
+ TestEntries(region, 100);
+ TestEntries(region, 10000);
+
+ region.LocalDestroyRegion();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/RegionOperationN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/RegionOperationN.cs b/clicache/integration-test/RegionOperationN.cs
new file mode 100644
index 0000000..a0db56f
--- /dev/null
+++ b/clicache/integration-test/RegionOperationN.cs
@@ -0,0 +1,97 @@
+/*
+ * 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.Diagnostics;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+ public class RegionOperation
+ {
+ protected IRegion<object, object> m_region;
+
+ public Region Region
+ {
+ get
+ {
+ return m_region;
+ }
+ }
+
+ public RegionOperation(string RegionName)
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes1.CreateDeserializable);
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ m_region = CacheHelper.GetRegion<object, object>(RegionName);
+ }
+
+ public void PutOp(int key, Object CallbackArg)
+ {
+
+ Object value = "value";
+ for (int i = 1; i <= key; i++)
+ {
+ Util.Log("PutOp:key={0},value={1}",i,value);
+ m_region.Put(i,value,CallbackArg);
+ //m_region[10000 + i] = new PdxTests.PdxTypes1();
+ m_region[10000 + i] = new PdxTests.PdxTypes8();
+ }
+ }
+
+ public void InvalidateOp(int key, Object CallbackArg)
+ {
+ for (int i = 1; i <= key; i++)
+ {
+ Util.Log("InvalidateOp:key={0}", i);
+ m_region.GetLocalView().Invalidate(i, CallbackArg);
+ }
+ }
+
+ public void DestroyOp(int key, Object CallbackArg)
+ {
+ for (int i = 1; i <= key; i++)
+ {
+ Util.Log("DestroyOp:key={0}", i);
+ m_region.Remove(i, CallbackArg);
+ }
+ }
+ public void DestroyOpWithPdxValue(int key, Object CallbackArg)
+ {
+ for (int i = 1; i <= key; i++)
+ {
+ Util.Log("DestroyOpWithPdxValue:key={0}", i);
+ m_region.Remove(i, CallbackArg);
+ m_region.Remove(10000 + i, null);
+ }
+ }
+
+ public void RemoveOp(int key, Object CallbackArg)
+ {
+
+ string value = "value";
+ for (int i = 1; i <= key; i++) {
+ Util.Log("PutOp:key={0},value={1}", i, value);
+ m_region.Remove(i, value, CallbackArg);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/RegionWrapperN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/RegionWrapperN.cs b/clicache/integration-test/RegionWrapperN.cs
new file mode 100644
index 0000000..224db45
--- /dev/null
+++ b/clicache/integration-test/RegionWrapperN.cs
@@ -0,0 +1,243 @@
+/*
+ * 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.Diagnostics;
+using System.Threading;
+using System.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ public class RegionWrapper
+ {
+ protected IRegion<object, object> m_region;
+ protected bool m_noack;
+
+ public IRegion<object, object> Region
+ {
+ get
+ {
+ return m_region;
+ }
+ }
+
+ public RegionWrapper(IRegion<object, object> region)
+ {
+ if (region == null)
+ {
+ Assert.Fail("Cannot wrap null region.");
+ }
+ m_region = region;
+ }
+
+ public RegionWrapper(string name)
+ {
+ m_region = CacheHelper.GetRegion<object, object>(name);
+ if (m_region == null)
+ {
+ Assert.Fail("No region with name {0} found!", name);
+ }
+ }
+
+ public virtual void Put(int key, int value)
+ {
+ m_region["key" + key.ToString()] = value;
+ }
+
+ public virtual bool WaitForKey(string key)
+ {
+ return WaitForKey(key, 100, 100);
+ }
+
+ public virtual bool WaitForKey(string key, int maxTries, int sleepMillis)
+ {
+ int tries = 0;
+ bool found = false;
+
+ while ((tries < maxTries) && (!(found = m_region.ContainsKey(key))))
+ {
+ Thread.Sleep(sleepMillis);
+ tries++;
+ }
+ return found;
+ }
+
+ public virtual bool WaitForValue(ICacheableKey key)
+ {
+ return WaitForValue(key, 100, 100);
+ }
+
+ public virtual bool WaitForValue(ICacheableKey cKey, int maxTries, int sleepMillis)
+ {
+ int tries = 0;
+ bool found = false;
+
+ while ((tries++ < maxTries) && (!(found = m_region.ContainsValueForKey(cKey))))
+ {
+ Thread.Sleep(sleepMillis);
+ }
+ return found;
+ }
+
+ public virtual Object WaitForValueGet(ICacheableKey cKey,
+ int maxTries, int sleepMillis)
+ {
+ int tries = 0;
+ Object cVal = null;
+
+ while ((tries++ < maxTries) && ((cVal = m_region[cKey]) != null))
+ {
+ Thread.Sleep(sleepMillis);
+ }
+ return cVal;
+ }
+
+ public virtual int WaitForValue(Object key, int expected, bool noack)
+ {
+ int val = -1;
+ Object cVal = null;
+
+ if (noack)
+ {
+ for (int tries = 0; tries < 100; tries++)
+ {
+ cVal = m_region[key];
+ Assert.IsNotNull(cVal, "value should not be null.");
+ Util.Log("WaitForValue: Received value: {0}", cVal);
+ val = int.Parse(cVal.ToString());
+ if (val == expected)
+ {
+ break;
+ }
+ Thread.Sleep(100);
+ }
+ }
+ else
+ {
+ cVal = m_region[key];
+ Assert.IsNotNull(cVal, "value should not be null.");
+ val = int.Parse(cVal.ToString());
+ }
+ return val;
+ }
+
+ // by convention, we'll accept value of -1 to mean not exists, 0 to mean invalid, and otherwise we'll compare.
+ public virtual void Test(int key, int value)
+ {
+ Test(key, value, m_noack);
+ }
+
+ public virtual void Test(int key, int value, bool noack)
+ {
+ string cKey = "key" + key.ToString();
+ StackFrame sf = new StackFrame(1, true);
+ int line = sf.GetFileLineNumber();
+ string method = sf.GetMethod().Name;
+ if (value == -1)
+ {
+ Assert.IsFalse(m_region.GetLocalView().ContainsKey(cKey),
+ "unexpected key found at line {0} in method {1}.", line, method);
+ if (noack)
+ { // need to wait a bit and retest...
+ Thread.Sleep(1000);
+ Assert.IsFalse(m_region.GetLocalView().ContainsKey(cKey),
+ "unexpected key found at line {0} in method {1}.", line, method);
+ }
+ }
+ else if (value == 0)
+ {
+ if (noack)
+ {
+ WaitForKey(cKey);
+ }
+ Assert.IsTrue(m_region.GetLocalView().ContainsKey(cKey),
+ "missing key at line {0} in method {1}.", line, method);
+ Assert.IsFalse(m_region.ContainsValueForKey(cKey),
+ "should have found invalid at line {0} in method {1}.", line, method);
+ }
+ else
+ {
+ if (noack)
+ {
+ WaitForKey(cKey);
+ }
+ Assert.IsTrue(m_region.GetLocalView().ContainsKey(cKey),
+ "missing key at line {0} in method {1}.", line, method);
+ int val = WaitForValue(cKey, value, noack);
+ Assert.AreEqual(value, val,
+ "unexpected value: \"{0}\", expected \"{1}\" from line {2} in method {3}",
+ val, value, line, method);
+
+ }
+ }
+
+ // by convention, we'll accept value of -1 to mean not exists, otherwise we'll compare.
+ public virtual void NetSearch(int key, int value)
+ {
+ string cKey = "key" + key.ToString();
+ Assert.IsFalse(m_region.ContainsKey(cKey), "shouldn't have key before NetSearch.");
+ int cVal = (int)m_region[cKey];
+ if (value == -1)
+ {
+ Assert.IsNull(cVal, "unexpected value found.");
+ }
+ else
+ {
+ Assert.IsNotNull(cVal, "missing value for key[{0}].", cKey);
+ Util.Log("got value='{0}' for key[{1}]", cVal, cKey);
+ Assert.AreEqual(value, cVal);
+ Assert.IsTrue(m_region.ContainsValueForKey(cKey),
+ "should now be in the local cache.");
+ }
+ }
+
+ public void ShowKeys()
+ {
+ ICollection<Object> keys = m_region.Keys;
+ int len = keys.Count;
+ Util.Log("Total keys in IRegion<object, object> {0} : {1}", m_region.Name, len);
+ CacheHelper.ShowKeys(keys);
+ }
+
+ public void ShowValues()
+ {
+ ICollection<Object> values = m_region.Values;
+ int len = values.Count;
+ Util.Log("Total values in IRegion<object, object> {0} : {1}", m_region.Name, len);
+ CacheHelper.ShowValues(values);
+ }
+
+ public void ShowKeysValues()
+ {
+ //Object value;
+ ICollection<Object> keys = m_region.Keys;
+ int len = keys.Count;
+ Util.Log("Total keys in IRegion<object, object> {0} : {1}", m_region.Name, len);
+ for (int i = 0; i < len; i++)
+ {
+ //TODO UNCOMMENT ONCE WE ATTACH THE LIST TO THE COLLECTION
+ //value = m_region[keys[i]];
+ //Util.Log("Key[{0}] = {1}, Value[{2}] = {3}", i, keys[i], i, value);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/SecurityTestUtilN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/SecurityTestUtilN.cs b/clicache/integration-test/SecurityTestUtilN.cs
new file mode 100644
index 0000000..aced33d
--- /dev/null
+++ b/clicache/integration-test/SecurityTestUtilN.cs
@@ -0,0 +1,267 @@
+/*
+ * 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.Collections.Generic;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using AssertionException = Apache.Geode.Client.AssertionException;
+
+ /// <summary>
+ /// Enumeration to indicate the result expected of an operation.
+ /// </summary>
+ public enum ExpectedResult
+ {
+ Success,
+ AuthRequiredException,
+ AuthFailedException,
+ NotAuthorizedException,
+ OtherException
+ }
+
+ /// <summary>
+ /// Helper class to start/stop cache servers and other utility methods
+ /// for security tests.
+ /// </summary>
+ public class SecurityTestUtil
+ {
+ public static List<CredentialGenerator> getAllGenerators(bool isMultiUser)
+ {
+ string dataDir = Util.GetEnvironmentVariable("CPP_TESTOUT");
+ List<CredentialGenerator> generators = new List<CredentialGenerator>();
+ foreach (CredentialGenerator.ClassCode code in Enum.GetValues(
+ typeof(CredentialGenerator.ClassCode)))
+ {
+ CredentialGenerator gen = CredentialGenerator.Create(code, isMultiUser);
+ if (gen != null)
+ {
+ gen.Init(dataDir, dataDir);
+ generators.Add(gen);
+ }
+ }
+ return generators;
+ }
+
+ public static string GetServerArgs(string authenticator,
+ Properties<string, string> extraProps, Properties<string, string> javaProps)
+ {
+ return Utility.GetServerArgs(authenticator, null, null,
+ extraProps, javaProps);
+ }
+
+ public static string GetServerArgs(string authenticator, string accessor,
+ string accessorPP, Properties<string, string> extraProps, Properties<string, string> javaProps)
+ {
+ return Utility.GetServerArgs(authenticator, accessor, accessorPP,
+ extraProps, javaProps);
+ }
+
+ public static Properties<string, string> ConcatProperties(params Properties<string, string>[] propsArray)
+ {
+ Properties<string, string> result = null;
+ if (propsArray != null)
+ {
+ result = new Properties<string, string>();
+ foreach (Properties<string, string> props in propsArray)
+ {
+ result.AddAll(props);
+ }
+ }
+ return result;
+ }
+
+ public static void CreateClientMU(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, bool isMultiuser)
+ {
+ CreateClient(regionName, locators, authInit, credentials,
+ ExpectedResult.Success, isMultiuser, null);
+ }
+ //for notification
+ public static void CreateClientMU2(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, bool isMultiuser, bool notificationEnabled)
+ {
+ CreateClient<object, object>(regionName, locators,
+ authInit, credentials, false,
+ notificationEnabled, 0, -1,
+ null, ExpectedResult.Success, isMultiuser, null, false, false);
+ }
+ //for durable client...
+ public static void CreateMUDurableClient(string regionName, string locators,
+ string authInit, string durableClientId, bool isMultiuser, bool notificationEnabled)
+ {
+ CreateClient<object, object>(regionName, locators,
+ authInit, null, false,
+ notificationEnabled, 0, -1,
+ null, ExpectedResult.Success, isMultiuser, durableClientId, false, false);
+ }
+
+ public static void CreateClient(string regionName, string locators,
+ string authInit, Properties<string, string> credentials)
+ {
+ CreateClient(regionName, locators, authInit, credentials,
+ ExpectedResult.Success);
+ }
+
+ public static void CreateClientSSL(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, bool ssl, bool withPassword)
+ {
+ CreateClient<object, object>(regionName, locators, authInit, credentials,
+ true, true, 1, -1, null, ExpectedResult.Success, false, null, ssl, withPassword);
+ }
+
+ public static void CreateClientR0(string regionName, string locators,
+ string authInit, Properties<string, string> credentials)
+ {
+ CreateClient(regionName, locators, authInit, credentials,
+ ExpectedResult.Success, 0);
+ }
+
+ public static void CreateClient(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, ExpectedResult expect, int redundancy)
+ {
+ CreateClient<object, object>(regionName, locators, authInit, credentials, true, true,
+ redundancy, -1, null, expect);
+ }
+
+ public static void CreateClient(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, ExpectedResult expect,
+ bool isMultiuser, string durebleClientId)
+ {
+ CreateClient<object, object>(regionName, locators, authInit, credentials, false, false,
+ 0, -1, null, expect, isMultiuser, durebleClientId, false, false);
+ }
+
+ public static void CreateClient(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, ExpectedResult expect)
+ {
+ CreateClient<object, object>(regionName, locators, authInit, credentials, true, true,
+ 1, -1, null, expect);
+ }
+
+ public static void CreateClient(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, int numConnections,
+ ExpectedResult expect)
+ {
+ CreateClient<object, object>(regionName, locators, authInit, credentials, true, true,
+ 1, numConnections, null, expect);
+ }
+
+ public static void CreateClient<TKey, TValue>(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, bool caching,
+ bool clientNotification, int redundancyLevel, int numConnections,
+ ICacheListener<TKey, TValue> listener, ExpectedResult expect)
+ {
+ CreateClient<TKey, TValue>(regionName, locators, authInit, credentials, true, true,
+ redundancyLevel, numConnections, null, expect, false, null, false, false);
+ }
+
+ public static void CreateClient<TKey, TValue>(string regionName, string locators,
+ string authInit, Properties<string, string> credentials, bool caching,
+ bool clientNotification, int redundancyLevel, int numConnections,
+ ICacheListener<TKey, TValue> listener, ExpectedResult expect, bool isMultiUser, string durableClientId, bool ssl, bool withPassword)
+ {
+ Util.Log("Redundancy Level = {0}", redundancyLevel);
+ CacheHelper.Close();
+ Properties<string, string> sysProps = new Properties<string, string>();
+ if (durableClientId != null)
+ sysProps.Insert("durable-client-id", durableClientId);
+ Utility.GetClientProperties(authInit, credentials, ref sysProps);
+ if (numConnections >= 0)
+ {
+ sysProps.Insert("connection-pool-size", numConnections.ToString());
+ }
+
+ if (ssl && withPassword)
+ {
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.password.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ sysProps.Insert("ssl-keystore-password", "gemstone");
+ }
+ else if (ssl)
+ {
+ string keystore = Util.GetEnvironmentVariable("CPP_TESTOUT") + "/keystore";
+ sysProps.Insert("ssl-enabled", "true");
+ sysProps.Insert("ssl-keystore", keystore + "/client_keystore.pem");
+ sysProps.Insert("ssl-truststore", keystore + "/client_truststore.pem");
+ }
+ try
+ {
+ CacheHelper.InitConfig(sysProps);
+
+ CacheHelper.CreatePool<TKey, TValue>("__TESTPOOL1_", locators, (string)null,
+ redundancyLevel, clientNotification, numConnections, isMultiUser);
+ CacheHelper.CreateTCRegion_Pool<TKey, TValue>(regionName, true, caching,
+ listener, locators, "__TESTPOOL1_", clientNotification);
+
+ if (expect != ExpectedResult.Success)
+ {
+ Assert.Fail(
+ "CreateClient: expected an exception in creating region.");
+ }
+ }
+ catch (AssertionException)
+ {
+ throw;
+ }
+ catch (AuthenticationRequiredException ex)
+ {
+ if (expect == ExpectedResult.AuthRequiredException)
+ {
+ Util.Log("CreateClient: got expected exception in creating region: "
+ + ex.Message);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ catch (AuthenticationFailedException ex)
+ {
+ if (expect == ExpectedResult.AuthFailedException)
+ {
+ Util.Log("CreateClient: got expected exception in creating region: "
+ + ex.Message);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (expect == ExpectedResult.OtherException)
+ {
+ Util.Log("CreateClient: got expected exception in creating region: "
+ + ex.GetType() + "::" + ex.Message);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/SerializationTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/SerializationTestsN.cs b/clicache/integration-test/SerializationTestsN.cs
new file mode 100644
index 0000000..9fb63f6
--- /dev/null
+++ b/clicache/integration-test/SerializationTestsN.cs
@@ -0,0 +1,1280 @@
+/*
+ * 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.Diagnostics;
+using System.IO;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+
+ [TestFixture]
+ [Category("generics")]
+ public class SerializationTests : ThinClientRegionSteps
+ {
+ private const int OTHER_TYPE1 = 1;
+ private const int OTHER_TYPE2 = 2;
+ private const int OTHER_TYPE22 = 3;
+ private const int OTHER_TYPE4 = 4;
+ private const int OTHER_TYPE42 = 5;
+ private const int OTHER_TYPE43 = 6;
+
+ private UnitProcess sender, receiver;
+
+ protected override ClientBase[] GetClients()
+ {
+ sender = new UnitProcess();
+ receiver = new UnitProcess();
+ return new ClientBase[] { sender, receiver };
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTests();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ sender.Call(DestroyRegions);
+ receiver.Call(DestroyRegions);
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ private IGeodeSerializable CreateOtherType(int i, int otherType)
+ {
+ IGeodeSerializable ot;
+ switch (otherType)
+ {
+ case OTHER_TYPE1: ot = new OtherType(i, i + 20000); break;
+ case OTHER_TYPE2: ot = new OtherType2(i, i + 20000); break;
+ case OTHER_TYPE22: ot = new OtherType22(i, i + 20000); break;
+ case OTHER_TYPE4: ot = new OtherType4(i, i + 20000); break;
+ case OTHER_TYPE42: ot = new OtherType42(i, i + 20000); break;
+ case OTHER_TYPE43: ot = new OtherType43(i, i + 20000); break;
+ default: ot = new OtherType(i, i + 20000); break;
+ }
+ return ot;
+ }
+
+ #region Functions that are invoked by the tests
+
+ public void CreateRegionForOT(string locators)
+ {
+ CacheHelper.CreateTCRegion2<object, object>(RegionNames[0], true, false,
+ null, locators, false);
+ Serializable.RegisterTypeGeneric(OtherType.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(OtherType2.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(OtherType22.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(OtherType4.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(OtherType42.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(OtherType43.CreateDeserializable, CacheHelper.DCache);
+ }
+
+ public void DoNPuts(int n)
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(OtherType.CreateDeserializable, CacheHelper.DCache);
+ Assert.Fail("Expected exception in registering the type again.");
+ }
+ catch (IllegalStateException ex)
+ {
+ Util.Log("Got expected exception in RegisterType: {0}", ex);
+ }
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ for (int i = 0; i < n; i++)
+ {
+ //CacheableInt32 key = new CacheableInt32(i);
+ //region.Put(key, key);
+
+ int key = i;
+ region[key] = key;
+ }
+ }
+
+ public void DoValidates(int n)
+ {
+ try
+ {
+ Serializable.RegisterTypeGeneric(OtherType.CreateDeserializable, CacheHelper.DCache);
+ Assert.Fail("Expected exception in registering the type again.");
+ }
+ catch (IllegalStateException ex)
+ {
+ Util.Log("Got expected exception in RegisterType: {0}", ex);
+ }
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ for (int i = 0; i < n; i++)
+ {
+ //CacheableInt32 val = region.Get(i) as CacheableInt32;
+ object val = region[i];
+ Assert.AreEqual(i, val, "Found unexpected value");
+ }
+ }
+
+ public void DoNPutsOtherType(int n, int otherType)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ for (int i = 0; i < n; i++)
+ {
+ IGeodeSerializable ot = CreateOtherType(i, otherType);
+ region[i + 10] = ot;
+ }
+ }
+
+ public void DoValidateNPutsOtherType(int n, int otherType)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(RegionNames[0]);
+ for (int i = 0; i < n; i++)
+ {
+ object val = region[i + 10];
+ IGeodeSerializable ot = CreateOtherType(i, otherType);
+ Assert.IsTrue(ot.Equals(val), "Found unexpected value");
+ }
+ }
+
+ #endregion
+
+ #region Tests
+
+ [Test]
+ public void CustomTypes()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ sender.Call(CreateRegionForOT, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ receiver.Call(CreateRegionForOT, CacheHelper.Locators);
+ Util.Log("StepTwo complete.");
+
+ sender.Call(DoNPuts, 10);
+ receiver.Call(DoValidates, 10);
+ Util.Log("StepThree complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE1);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE1);
+ Util.Log("StepFour complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE2);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE2);
+ Util.Log("StepFive complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE22);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE22);
+ Util.Log("StepSix complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE4);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE4);
+ Util.Log("StepSeven complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE42);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE42);
+ Util.Log("StepEight complete.");
+
+ sender.Call(DoNPutsOtherType, 10, OTHER_TYPE43);
+ receiver.Call(DoValidateNPutsOtherType, 10, OTHER_TYPE43);
+ Util.Log("StepNine complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ }
+
+ #endregion
+ }
+
+ [Serializable]
+ public struct CData
+ {
+ #region Private members
+
+ private Int32 m_first;
+ private Int64 m_second;
+
+ #endregion
+
+ #region Public accessors
+
+ public Int32 First
+ {
+ get
+ {
+ return m_first;
+ }
+ set
+ {
+ m_first = value;
+ }
+ }
+
+ public Int64 Second
+ {
+ get
+ {
+ return m_second;
+ }
+ set
+ {
+ m_second = value;
+ }
+ }
+
+ #endregion
+
+ public CData(Int32 first, Int64 second)
+ {
+ m_first = first;
+ m_second = second;
+ }
+
+ public static bool operator ==(CData obj1, CData obj2)
+ {
+ return ((obj1.m_first == obj2.m_first) && (obj1.m_second == obj2.m_second));
+ }
+
+ public static bool operator !=(CData obj1, CData obj2)
+ {
+ return ((obj1.m_first != obj2.m_first) || (obj1.m_second != obj2.m_second));
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is CData)
+ {
+ CData otherObj = (CData)obj;
+ return ((m_first == otherObj.m_first) && (m_second == otherObj.m_second));
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return m_first.GetHashCode() ^ m_second.GetHashCode();
+ }
+ };
+
+ public class PdxCData : IPdxSerializable
+ {
+ #region Private members
+
+ private Int32 m_first;
+ private Int64 m_second;
+
+ #endregion
+
+ #region Public accessors
+
+ public Int32 First
+ {
+ get
+ {
+ return m_first;
+ }
+ set
+ {
+ m_first = value;
+ }
+ }
+
+ public Int64 Second
+ {
+ get
+ {
+ return m_second;
+ }
+ set
+ {
+ m_second = value;
+ }
+ }
+
+ #endregion
+
+ public PdxCData(Int32 first, Int64 second)
+ {
+ m_first = first;
+ m_second = second;
+ }
+
+ public PdxCData() { }
+
+ public static PdxCData CreateDeserializable()
+ {
+ return new PdxCData();
+ }
+ public static bool operator ==(PdxCData obj1, PdxCData obj2)
+ {
+ return ((obj1.m_first == obj2.m_first) && (obj1.m_second == obj2.m_second));
+ }
+
+ public static bool operator !=(PdxCData obj1, PdxCData obj2)
+ {
+ return ((obj1.m_first != obj2.m_first) || (obj1.m_second != obj2.m_second));
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is PdxCData)
+ {
+ PdxCData otherObj = (PdxCData)obj;
+ return ((m_first == otherObj.m_first) && (m_second == otherObj.m_second));
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return m_first.GetHashCode();
+ }
+
+ #region IPdxSerializable Members
+
+ public void FromData(IPdxReader reader)
+ {
+ m_first = reader.ReadInt("m_first");
+ m_second = reader.ReadLong("m_second");
+ }
+
+ public void ToData(IPdxWriter writer)
+ {
+ writer.WriteInt("m_first", m_first);
+ writer.MarkIdentityField("m_first");
+ writer.WriteLong("m_second", m_second);
+ }
+
+ #endregion
+
+
+
+
+ };
+
+ public class OtherType : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ //DataInput din = new DataInput(dout.GetBuffer());
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x0;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType ot = obj as OtherType;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+ }
+
+ public class OtherType2 : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType2()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType2(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType2(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x8C;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType2();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType2 ot = obj as OtherType2;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+
+ }
+
+ public class OtherType22 : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType22()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType22(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType22(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x8C0;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType22();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType22 ot = obj as OtherType22;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+ }
+
+ public class OtherType4 : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType4()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType4(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType4(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x8FC0;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType4();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType4 ot = obj as OtherType4;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+
+ }
+
+ public class OtherType42 : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType42()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType42(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType42(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x6F3F97;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType42();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType42 ot = obj as OtherType42;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+
+ }
+
+ public class OtherType43 : IGeodeSerializable
+ {
+ private CData m_struct;
+ private ExceptionType m_exType;
+
+ public enum ExceptionType
+ {
+ None,
+ Geode,
+ System,
+ // below are with inner exceptions
+ GeodeGeode,
+ GeodeSystem,
+ SystemGeode,
+ SystemSystem
+ }
+
+ public OtherType43()
+ {
+ m_exType = ExceptionType.None;
+ }
+
+ public OtherType43(Int32 first, Int64 second)
+ : this(first, second, ExceptionType.None)
+ {
+ }
+
+ public OtherType43(Int32 first, Int64 second, ExceptionType exType)
+ {
+ m_struct.First = first;
+ m_struct.Second = second;
+ m_exType = exType;
+ }
+
+ public CData Data
+ {
+ get
+ {
+ return m_struct;
+ }
+ }
+
+ public static IGeodeSerializable Duplicate(IGeodeSerializable orig)
+ {
+ DataOutput dout = CacheHelper.DCache.CreateDataOutput();
+ orig.ToData(dout);
+
+ DataInput din = CacheHelper.DCache.CreateDataInput(dout.GetBuffer());
+ IGeodeSerializable dup = (IGeodeSerializable)din.ReadObject();
+ return dup;
+ }
+
+ #region IGeodeSerializable Members
+
+ public IGeodeSerializable FromData(DataInput input)
+ {
+ m_struct.First = input.ReadInt32();
+ m_struct.Second = input.ReadInt64();
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ return this;
+ }
+
+ public void ToData(DataOutput output)
+ {
+ output.WriteInt32(m_struct.First);
+ output.WriteInt64(m_struct.Second);
+ switch (m_exType)
+ {
+ case ExceptionType.None:
+ break;
+ case ExceptionType.Geode:
+ throw new GeodeIOException("Throwing an exception");
+ case ExceptionType.System:
+ throw new IOException("Throwing an exception");
+ case ExceptionType.GeodeGeode:
+ throw new GeodeIOException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.GeodeSystem:
+ throw new CacheServerException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ case ExceptionType.SystemGeode:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new CacheServerException("This is an inner exception"));
+ case ExceptionType.SystemSystem:
+ throw new ApplicationException("Throwing an exception with inner " +
+ "exception", new IOException("This is an inner exception"));
+ }
+ }
+
+ public UInt32 ObjectSize
+ {
+ get
+ {
+ return (UInt32)(sizeof(Int32) + sizeof(Int64));
+ }
+ }
+
+ public UInt32 ClassId
+ {
+ get
+ {
+ return 0x7FFFFFFF;
+ }
+ }
+
+ #endregion
+
+ public static IGeodeSerializable CreateDeserializable()
+ {
+ return new OtherType43();
+ }
+
+ public override int GetHashCode()
+ {
+ return m_struct.First.GetHashCode() ^ m_struct.Second.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ OtherType43 ot = obj as OtherType43;
+ if (ot != null)
+ {
+ return (m_struct.Equals(ot.m_struct));
+ }
+ return false;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/Settings.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/Settings.xml b/clicache/integration-test/Settings.xml
new file mode 100644
index 0000000..50cb7f5
--- /dev/null
+++ b/clicache/integration-test/Settings.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ 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.
+-->
+
+<Settings>
+ <DataIOTests>
+ <Byte>
+ <byte value="0x11" />
+ </Byte>
+ <Boolean>
+ <bool value="true" bytes="0x1" />
+ <bool value="false" bytes="0x0" />
+ </Boolean>
+ <Int16>
+ <short value="0x1122" bytes="0x11:0x22" />
+ </Int16>
+ <Int32>
+ <int value="0x11223344" bytes="0x11:0x22:0x33:0x44" />
+ </Int32>
+ <Int64>
+ <long value="0x1122334455667788" bytes="0x11:0x22:0x33:0x44:0x55:0x66:0x77:0x88" />
+ </Int64>
+ <Float>
+ <float value="1.2" bytes="0x3f:0x99:0x99:0x9a" />
+ </Float>
+ <Double>
+ <double value="1.2" bytes="0x3f:0xf3:0x33:0x33:0x33:0x33:0x33:0x33" />
+ </Double>
+ <ASCIIString>
+ <ascii value="This is fun." byte0="0x00" byte1="0x0c" />
+ </ASCIIString>
+ <UTFString>
+ <utf value="0x00:0x7f:0x80:0x81:0xffff" bytes="0x00:0x0a:0xc0:0x80:0x7f:0xc2:0x80:0xc2:0x81:0xef:0xbf:0xbf" />
+ </UTFString>
+ </DataIOTests>
+</Settings>
[20/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DataOutput.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/DataOutput.cpp b/clicache/src/DataOutput.cpp
new file mode 100644
index 0000000..8b1d1cc
--- /dev/null
+++ b/clicache/src/DataOutput.cpp
@@ -0,0 +1,921 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "CacheRegionHelper.hpp"
+#include "CacheImpl.hpp"
+#include "end_native.hpp"
+
+#include <vcclr.h>
+
+#include "DataOutput.hpp"
+#include "IGeodeSerializable.hpp"
+#include "CacheableObjectArray.hpp"
+#include "impl/PdxHelper.hpp"
+#include "impl/PdxWrapper.hpp"
+
+using namespace System;
+using namespace System::Runtime::InteropServices;
+using namespace apache::geode::client;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ void DataOutput::WriteByte(Byte value)
+ {
+ EnsureCapacity(1);
+ m_bytes[m_cursor++] = value;
+ }
+
+ void DataOutput::WriteSByte(SByte value)
+ {
+ EnsureCapacity(1);
+ m_bytes[m_cursor++] = value;
+ }
+
+ void DataOutput::WriteBoolean(bool value)
+ {
+ EnsureCapacity(1);
+ if (value)
+ m_bytes[m_cursor++] = 0x01;
+ else
+ m_bytes[m_cursor++] = 0x00;
+ }
+
+ void DataOutput::WriteChar(Char value)
+ {
+ EnsureCapacity(2);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 8);
+ m_bytes[m_cursor++] = (System::Byte)value;
+ }
+
+ void DataOutput::WriteBytes(array<Byte>^ bytes, System::Int32 len)
+ {
+ if (bytes != nullptr && bytes->Length >= 0)
+ {
+ if (len >= 0 && len <= bytes->Length)
+ {
+ WriteArrayLen(len);
+ EnsureCapacity(len);
+ for (int i = 0; i < len; i++)
+ m_bytes[m_cursor++] = bytes[i];
+ }
+ else
+ {
+ throw gcnew IllegalArgumentException("DataOutput::WriteBytes argument len is not in byte array range.");
+ }
+ }
+ else
+ {
+ WriteByte(0xFF);
+ }
+ }
+
+ void DataOutput::WriteArrayLen(System::Int32 len)
+ {
+ if (len == -1) {//0xff
+ WriteByte(0xFF);
+ }
+ else if (len <= 252) { // 252 is java's ((byte)-4 && 0xFF) or 0xfc
+ WriteByte((Byte)(len));
+ }
+ else if (len <= 0xFFFF) {
+ WriteByte(0xFE);//0xfe
+ WriteUInt16((len));
+ }
+ else {
+ WriteByte((0xFD));//0xfd
+ WriteUInt32(len);
+ }
+ }
+
+ void DataOutput::WriteSBytes(array<SByte>^ bytes, System::Int32 len)
+ {
+ if (bytes != nullptr && bytes->Length >= 0)
+ {
+ if (len >= 0 && len <= bytes->Length)
+ {
+ WriteArrayLen(len);
+ EnsureCapacity(len);
+ for (int i = 0; i < len; i++)
+ m_bytes[m_cursor++] = bytes[i];
+ }
+ else
+ {
+ throw gcnew IllegalArgumentException("DataOutput::WriteSBytes argument len is not in SByte array range.");
+ }
+ }
+ else
+ {
+ WriteByte(0xFF);
+ }
+ }
+
+ void DataOutput::WriteBytesOnly(array<Byte>^ bytes, System::UInt32 len)
+ {
+ WriteBytesOnly(bytes, len, 0);
+ }
+
+ void DataOutput::WriteBytesOnly(array<Byte>^ bytes, System::UInt32 len, System::UInt32 offset)
+ {
+ if (bytes != nullptr)
+ {
+ if (len >= 0 && len <= ((System::UInt32)bytes->Length - offset))
+ {
+ EnsureCapacity(len);
+ for (System::UInt32 i = 0; i < len; i++)
+ m_bytes[m_cursor++] = bytes[offset + i];
+ }
+ else
+ {
+ throw gcnew IllegalArgumentException("DataOutput::WriteBytesOnly argument len is not in Byte array range.");
+ }
+ }
+ }
+
+ void DataOutput::WriteSBytesOnly(array<SByte>^ bytes, System::UInt32 len)
+ {
+ if (bytes != nullptr)
+ {
+ if (len >= 0 && len <= (System::UInt32)bytes->Length)
+ {
+ EnsureCapacity(len);
+ for (System::UInt32 i = 0; i < len; i++)
+ m_bytes[m_cursor++] = bytes[i];
+ }
+ else
+ {
+ throw gcnew IllegalArgumentException("DataOutput::WriteSBytesOnly argument len is not in SByte array range.");
+ }
+ }
+ }
+
+ void DataOutput::WriteUInt16(System::UInt16 value)
+ {
+ EnsureCapacity(2);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 8);
+ m_bytes[m_cursor++] = (System::Byte)value;
+ }
+
+ void DataOutput::WriteUInt32(System::UInt32 value)
+ {
+ EnsureCapacity(4);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 24);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 16);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 8);
+ m_bytes[m_cursor++] = (System::Byte)value;
+ }
+
+ void DataOutput::WriteUInt64(System::UInt64 value)
+ {
+ EnsureCapacity(8);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 56);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 48);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 40);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 32);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 24);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 16);
+ m_bytes[m_cursor++] = (System::Byte)(value >> 8);
+ m_bytes[m_cursor++] = (System::Byte)value;
+ }
+
+ void DataOutput::WriteInt16(System::Int16 value)
+ {
+ WriteUInt16(value);
+ }
+
+ void DataOutput::WriteInt32(System::Int32 value)
+ {
+ WriteUInt32(value);
+ }
+
+ void DataOutput::WriteInt64(System::Int64 value)
+ {
+ WriteUInt64(value);
+ }
+
+ void DataOutput::WriteFloat(float value)
+ {
+ array<Byte>^ bytes = BitConverter::GetBytes(value);
+ EnsureCapacity(4);
+ for (int i = 4 - 1; i >= 0; i--)
+ m_bytes[m_cursor++] = bytes[i];
+ }
+
+ void DataOutput::WriteDouble(double value)
+ {
+ array<Byte>^ bytes = BitConverter::GetBytes(value);
+ EnsureCapacity(8);
+ for (int i = 8 - 1; i >= 0; i--)
+ m_bytes[m_cursor++] = bytes[i];
+ }
+
+ void DataOutput::WriteDictionary(System::Collections::IDictionary^ dict)
+ {
+ if (dict != nullptr)
+ {
+ this->WriteArrayLen(dict->Count);
+ for each(System::Collections::DictionaryEntry^ entry in dict)
+ {
+ this->WriteObject(entry->Key);
+ this->WriteObject(entry->Value);
+ }
+ }
+ else
+ {
+ WriteByte((int8_t)-1);
+ }
+ }
+
+ void DataOutput::WriteCollection(System::Collections::IList^ collection)
+ {
+ if (collection != nullptr)
+ {
+ this->WriteArrayLen(collection->Count);
+ for each (Object^ obj in collection) {
+ this->WriteObject(obj);
+ }
+ }
+ else
+ this->WriteByte((int8_t)-1);
+ }
+
+ void DataOutput::WriteDate(System::DateTime date)
+ {
+ if (date.Ticks != 0L)
+ {
+ CacheableDate^ cd = gcnew CacheableDate(date);
+ cd->ToData(this);
+ }
+ else
+ this->WriteInt64(-1L);
+ }
+
+ void DataOutput::WriteCharArray(array<Char>^ charArray)
+ {
+ if (charArray != nullptr)
+ {
+ this->WriteArrayLen(charArray->Length);
+ for (int i = 0; i < charArray->Length; i++) {
+ this->WriteObject(charArray[i]);
+ }
+ }
+ else
+ this->WriteByte((int8_t)-1);
+ }
+
+ void DataOutput::WriteObjectArray(List<Object^>^ objectArray)
+ {
+ if (objectArray != nullptr)
+ {
+ CacheableObjectArray^ coa = CacheableObjectArray::Create(objectArray);
+ coa->ToData(this);
+ }
+ else
+ this->WriteByte((int8_t)-1);
+ }
+
+ void DataOutput::WriteDotNetObjectArray(Object^ objectArray)
+ {
+ System::Collections::IList^ list = (System::Collections::IList^)objectArray;
+ this->WriteArrayLen(list->Count);
+ WriteByte((int8_t)apache::geode::client::GeodeTypeIdsImpl::Class);
+ String^ pdxDomainClassname = Serializable::GetPdxTypeName(objectArray->GetType()->GetElementType()->FullName);
+ WriteByte((int8_t)apache::geode::client::GeodeTypeIds::CacheableASCIIString);
+ WriteUTF(pdxDomainClassname);
+ for each(Object^ o in list)
+ WriteObject(o);
+ }
+
+ void DataOutput::WriteArrayOfByteArrays(array<array<Byte>^>^ byteArrays)
+ {
+ if (byteArrays != nullptr)
+ {
+ int fdLen = byteArrays->Length;
+ this->WriteArrayLen(byteArrays->Length);
+ for (int i = 0; i < fdLen; i++) {
+ this->WriteBytes(byteArrays[i]);
+ }
+ }
+ else
+ this->WriteByte((int8_t)-1);
+ }
+
+ void DataOutput::WriteUTF(String^ value)
+ {
+ if (value != nullptr) {
+ int len = getEncodedLength(value);
+
+ if (len > 0xffff)
+ len = 0xffff;
+
+ WriteUInt16(len);
+ EnsureCapacity(len);
+ EncodeUTF8String(value, len);
+ }
+ else {
+ WriteUInt16(0);
+ }
+ }
+
+ void DataOutput::WriteStringWithType(String^ value)
+ {
+ //value will not be null
+ int len = getEncodedLength(value);
+
+ if (len > 0xffff)
+ {
+ if (len == value->Length)//huge ascii
+ {
+ WriteByte(GeodeTypeIds::CacheableASCIIStringHuge);
+ WriteASCIIHuge(value);
+ }
+ else//huge utf
+ {
+ WriteByte(GeodeTypeIds::CacheableStringHuge);
+ WriteUTFHuge(value);
+ }
+ return;
+ }
+
+ if (len == value->Length)
+ {
+ WriteByte(GeodeTypeIds::CacheableASCIIString);//ascii string
+ }
+ else
+ {
+ WriteByte(GeodeTypeIds::CacheableString);//utf string
+ }
+ WriteUInt16(len);
+ EnsureCapacity(len);
+ EncodeUTF8String(value, len);
+
+ }
+
+ void DataOutput::WriteASCIIHuge(String^ value)
+ {
+ if (value != nullptr) {
+ const int strLength = value->Length;
+ WriteUInt32(strLength);
+ EnsureCapacity(strLength);
+ for (int i = 0; i < strLength; i++) {
+ m_bytes[m_cursor++] = (System::Byte)value[i];
+ }
+ }
+ else {
+ WriteUInt32(0);
+ }
+ }
+
+ /* Write UTF-16 */
+ void DataOutput::WriteUTFHuge(String^ value)
+ {
+ if (value != nullptr) {
+ WriteUInt32(value->Length);
+ EnsureCapacity(value->Length * 2);
+ for (int i = 0; i < value->Length; i++)
+ {
+ Char ch = value[i];
+ m_bytes[m_cursor++] = (Byte)((ch & 0xff00) >> 8);
+ m_bytes[m_cursor++] = (Byte)(ch & 0xff);
+ }
+ }
+ else {
+ WriteUInt32(0);
+ }
+ }
+
+ /*void DataOutput::WriteObject( Object^ obj )
+ {
+ WriteObjectInternal((IGeodeSerializable^)obj);
+ }*/
+
+ /*void DataOutput::WriteObject( Object^ obj )
+ {
+ WriteObject( (IGeodeSerializable^)obj );
+ }*/
+
+ int8_t DataOutput::GetTypeId(System::UInt32 classId)
+ {
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) % 0x20000000);
+ }
+ else if (classId <= 0x7F) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData;
+ }
+ else if (classId <= 0x7FFF) {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)GeodeTypeIdsImpl::CacheableUserData4;
+ }
+ }
+
+ int8_t DataOutput::DSFID(System::UInt32 classId)
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) / 0x20000000);
+ }
+ return 0;
+ }
+
+ void DataOutput::WriteObject(Object^ obj)
+ {
+
+ if (obj == nullptr)
+ {
+ WriteByte((int8_t)GeodeTypeIds::NullObj);
+ return;
+ }
+
+ if (m_ispdxSerialization && obj->GetType()->IsEnum)
+ {
+ //need to set
+ int enumVal = Internal::PdxHelper::GetEnumValue(obj->GetType()->FullName, Enum::GetName(obj->GetType(), obj), obj->GetHashCode(), m_nativeptr->get()->getCache());
+ WriteByte(GeodeClassIds::PDX_ENUM);
+ WriteByte(enumVal >> 24);
+ WriteArrayLen(enumVal & 0xFFFFFF);
+ return;
+ }
+
+ //Apache::Geode::Client::Log::Debug("DataOutput::WriteObject " + obj);
+
+ Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(obj->GetType());
+
+ switch (typeId)
+ {
+ case apache::geode::client::GeodeTypeIds::CacheableByte:
+ {
+ WriteByte(typeId);
+ WriteSByte((SByte)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableBoolean:
+ {
+ WriteByte(typeId);
+ WriteBoolean((bool)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableWideChar:
+ {
+ WriteByte(typeId);
+ WriteObject((Char)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDouble:
+ {
+ WriteByte(typeId);
+ WriteDouble((Double)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableASCIIString:
+ {
+ //CacheableString^ cStr = CacheableString::Create((String^)obj);
+ //// TODO: igfser mapping between generic and non generic
+ //WriteObjectInternal(cStr);
+ WriteStringWithType((String^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableFloat:
+ {
+ WriteByte(typeId);
+ WriteFloat((float)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt16:
+ {
+ WriteByte(typeId);
+ WriteInt16((Int16)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt32:
+ {
+ WriteByte(typeId);
+ WriteInt32((Int32)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt64:
+ {
+ WriteByte(typeId);
+ WriteInt64((Int64)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDate:
+ {
+ //CacheableDate^ cd = gcnew CacheableDate((DateTime)obj);
+ // TODO: igfser mapping between generic and non generic
+ //WriteObjectInternal(cd);
+ WriteByte(typeId);
+ WriteDate((DateTime)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableBytes:
+ {
+ WriteByte(typeId);
+ WriteBytes((array<Byte>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableDoubleArray:
+ {
+ WriteByte(typeId);
+ WriteObject((array<Double>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableFloatArray:
+ {
+ WriteByte(typeId);
+ WriteObject((array<float>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt16Array:
+ {
+ WriteByte(typeId);
+ WriteObject((array<Int16>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt32Array:
+ {
+ WriteByte(typeId);
+ WriteObject((array<Int32>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableInt64Array:
+ {
+ WriteByte(typeId);
+ WriteObject((array<Int64>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::BooleanArray:
+ {
+ WriteByte(typeId);
+ WriteObject((array<bool>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CharArray:
+ {
+ WriteByte(typeId);
+ WriteObject((array<char>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableStringArray:
+ {
+ WriteByte(typeId);
+ WriteObject((array<String^>^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableHashTable:
+ case apache::geode::client::GeodeTypeIds::CacheableHashMap:
+ case apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ WriteByte(typeId);
+ WriteDictionary((System::Collections::IDictionary^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableVector:
+ {
+ //CacheableVector^ cv = gcnew CacheableVector((System::Collections::IList^)obj);
+ //// TODO: igfser mapping between generic and non generic
+ //WriteObjectInternal(cv);
+ WriteByte(apache::geode::client::GeodeTypeIds::CacheableVector);
+ WriteList((System::Collections::IList^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableLinkedList:
+ {
+ //CacheableArrayList^ cal = gcnew CacheableArrayList((System::Collections::IList^)obj);
+ //// TODO: igfser mapping between generic and non generic
+ //WriteObjectInternal(cal);
+ WriteByte(apache::geode::client::GeodeTypeIds::CacheableLinkedList);
+ System::Collections::ICollection^ linkedList = (System::Collections::ICollection^)obj;
+ this->WriteArrayLen(linkedList->Count);
+ for each (Object^ o in linkedList)
+ this->WriteObject(o);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableArrayList:
+ {
+ //CacheableArrayList^ cal = gcnew CacheableArrayList((System::Collections::IList^)obj);
+ //// TODO: igfser mapping between generic and non generic
+ //WriteObjectInternal(cal);
+ WriteByte(apache::geode::client::GeodeTypeIds::CacheableArrayList);
+ WriteList((System::Collections::IList^)obj);
+ return;
+ }
+ case apache::geode::client::GeodeTypeIds::CacheableStack:
+ {
+ CacheableStack^ cs = gcnew CacheableStack((System::Collections::ICollection^)obj);
+ // TODO: igfser mapping between generic and non generic
+ WriteObjectInternal(cs);
+ return;
+ }
+ default:
+ {
+ IPdxSerializable^ pdxObj = dynamic_cast<IPdxSerializable^>(obj);
+ if (pdxObj != nullptr)
+ {
+ WriteByte(GeodeClassIds::PDX);
+ Internal::PdxHelper::SerializePdx(this, pdxObj);
+ return;
+ }
+ else
+ {
+ //pdx serialization and is array of object
+ if (m_ispdxSerialization && obj->GetType()->IsArray)
+ {
+ WriteByte(apache::geode::client::GeodeTypeIds::CacheableObjectArray);
+ WriteDotNetObjectArray(obj);
+ return;
+ }
+
+ IGeodeSerializable^ ct = dynamic_cast<IGeodeSerializable^>(obj);
+ if (ct != nullptr) {
+ WriteObjectInternal(ct);
+ return;
+ }
+
+ if (Serializable::IsObjectAndPdxSerializerRegistered(nullptr))
+ {
+ pdxObj = gcnew PdxWrapper(obj);
+ WriteByte(GeodeClassIds::PDX);
+ Internal::PdxHelper::SerializePdx(this, pdxObj);
+ return;
+ }
+ }
+
+ throw gcnew System::Exception("DataOutput not found appropriate type to write it for object: " + obj->GetType());
+ }
+ }
+ }
+
+ void DataOutput::WriteStringArray(array<String^>^ strArray)
+ {
+ if (strArray != nullptr)
+ {
+ this->WriteArrayLen(strArray->Length);
+ for (int i = 0; i < strArray->Length; i++)
+ {
+ // this->WriteUTF(strArray[i]);
+ WriteObject(strArray[i]);
+ }
+ }
+ else
+ WriteByte(-1);
+ }
+
+ void DataOutput::WriteObjectInternal(IGeodeSerializable^ obj)
+ {
+ //CacheableKey^ key = gcnew CacheableKey();
+ if (obj == nullptr) {
+ WriteByte((int8_t)GeodeTypeIds::NullObj);
+ }
+ else {
+ int8_t typeId = DataOutput::GetTypeId(obj->ClassId);
+ switch (DataOutput::DSFID(obj->ClassId)) {
+ case GeodeTypeIdsImpl::FixedIDByte:
+ WriteByte((int8_t)GeodeTypeIdsImpl::FixedIDByte);
+ WriteByte(typeId); // write the type ID.
+ break;
+ case GeodeTypeIdsImpl::FixedIDShort:
+ WriteByte((int8_t)GeodeTypeIdsImpl::FixedIDShort);
+ WriteInt16((System::Int16)typeId); // write the type ID.
+ break;
+ case GeodeTypeIdsImpl::FixedIDInt:
+ WriteByte((int8_t)GeodeTypeIdsImpl::FixedIDInt);
+ WriteInt32((System::Int32)typeId); // write the type ID.
+ break;
+ default:
+ WriteByte(typeId); // write the type ID.
+ break;
+ }
+
+ if ((System::Int32)typeId == GeodeTypeIdsImpl::CacheableUserData) {
+ WriteByte((int8_t)obj->ClassId);
+ }
+ else if ((System::Int32)typeId == GeodeTypeIdsImpl::CacheableUserData2) {
+ WriteInt16((System::Int16)obj->ClassId);
+ }
+ else if ((System::Int32)typeId == GeodeTypeIdsImpl::CacheableUserData4) {
+ WriteInt32((System::Int32)obj->ClassId);
+ }
+ obj->ToData(this); // let the obj serialize itself.
+ }
+ }
+
+ void DataOutput::AdvanceCursor(System::UInt32 offset)
+ {
+ EnsureCapacity(offset);
+ m_cursor += offset;
+ }
+
+ void DataOutput::RewindCursor(System::UInt32 offset)
+ {
+ //first set native one
+ WriteBytesToUMDataOutput();
+ try
+ {
+ m_nativeptr->get()->rewindCursor(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ SetBuffer();
+ }
+
+ array<Byte>^ DataOutput::GetBuffer()
+ {
+ try
+ {
+ WriteBytesToUMDataOutput();
+ SetBuffer();
+ int buffLen = m_nativeptr->get()->getBufferLength();
+ array<Byte>^ buffer = gcnew array<Byte>(buffLen);
+
+ if (buffLen > 0) {
+ pin_ptr<Byte> pin_buffer = &buffer[0];
+ memcpy((void*)pin_buffer, m_nativeptr->get()->getBuffer(), buffLen);
+ }
+ return buffer;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::UInt32 DataOutput::BufferLength::get()
+ {
+ //first set native one
+ WriteBytesToUMDataOutput();
+ SetBuffer();
+
+ try
+ {
+ return m_nativeptr->get()->getBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void DataOutput::Reset()
+ {
+ WriteBytesToUMDataOutput();
+ try
+ {
+ m_nativeptr->get()->reset();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ SetBuffer();
+ }
+
+ void DataOutput::WriteString(String^ value)
+ {
+ if (value == nullptr)
+ {
+ this->WriteByte(GeodeTypeIds::CacheableNullString);
+ }
+ else
+ {
+ WriteObject(value);
+ /*CacheableString^ cs = gcnew CacheableString(value);
+
+ this->WriteByte( (Byte)(cs->ClassId - 0x80000000));
+ cs->ToData(this);*/
+ }
+ }
+
+ void DataOutput::WriteBytesToUMDataOutput()
+ {
+ try
+ {
+ m_nativeptr->get()->advanceCursor(m_cursor);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ m_cursor = 0;
+ m_remainingBufferLength = 0;
+ m_bytes = nullptr;
+ }
+
+ void DataOutput::WriteObject(bool% obj)
+ {
+ WriteBoolean(obj);
+ }
+
+ void DataOutput::WriteObject(Byte% obj)
+ {
+ WriteByte(obj);
+ }
+
+ void DataOutput::WriteObject(Char% obj)
+ {
+ unsigned short us = (unsigned short)obj;
+ EnsureCapacity(2);
+ m_bytes[m_cursor++] = us >> 8;
+ m_bytes[m_cursor++] = (Byte)us;
+ }
+
+ void DataOutput::WriteObject(Double% obj)
+ {
+ WriteDouble(obj);
+ }
+
+ void DataOutput::WriteObject(Single% obj)
+ {
+ WriteFloat(obj);
+ }
+
+ void DataOutput::WriteObject(System::Int16% obj)
+ {
+ WriteInt16(obj);
+ }
+
+ void DataOutput::WriteObject(System::Int32% obj)
+ {
+ WriteInt32(obj);
+ }
+
+ void DataOutput::WriteObject(System::Int64% obj)
+ {
+ WriteInt64(obj);
+ }
+
+ void DataOutput::WriteObject(UInt16% obj)
+ {
+ WriteUInt16(obj);
+ }
+
+ void DataOutput::WriteObject(UInt32% obj)
+ {
+ WriteUInt32(obj);
+ }
+
+ void DataOutput::WriteObject(UInt64% obj)
+ {
+ WriteUInt64(obj);
+ }
+
+ void DataOutput::WriteBooleanArray(array<bool>^ boolArray)
+ {
+ WriteObject<bool>(boolArray);
+ }
+
+ void DataOutput::WriteShortArray(array<Int16>^ shortArray)
+ {
+ WriteObject<Int16>(shortArray);
+ }
+
+ void DataOutput::WriteIntArray(array<Int32>^ intArray)
+ {
+ WriteObject<Int32>(intArray);
+ }
+
+ void DataOutput::WriteLongArray(array<Int64>^ longArray)
+ {
+ WriteObject<Int64>(longArray);
+ }
+
+ void DataOutput::WriteFloatArray(array<float>^ floatArray)
+ {
+ WriteObject<float>(floatArray);
+ }
+
+ void DataOutput::WriteDoubleArray(array<double>^ doubleArray)
+ {
+ WriteObject<double>(doubleArray);
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DataOutput.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/DataOutput.hpp b/clicache/src/DataOutput.hpp
new file mode 100644
index 0000000..c98245c
--- /dev/null
+++ b/clicache/src/DataOutput.hpp
@@ -0,0 +1,656 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/DataOutput.hpp>
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
+#include "native_conditional_unique_ptr.hpp"
+#include "Log.hpp"
+#include "ExceptionTypes.hpp"
+#include "Serializable.hpp"
+
+#include "CacheableString.hpp"
+#include "CacheableDate.hpp"
+#include "CacheableVector.hpp"
+#include "CacheableArrayList.hpp"
+#include "CacheableStack.hpp"
+
+using namespace System;
+using namespace System::Runtime::CompilerServices;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ /// <summary>
+ /// Provides operations for writing primitive data values, and
+ /// user-defined objects implementing IGeodeSerializable, to a byte stream.
+ /// This class is intentionally not thread safe.
+ /// </summary>
+ public ref class DataOutput sealed
+ {
+ private:
+ System::Int32 m_cursor;
+ bool m_isManagedObject;
+ System::Byte * m_bytes;
+ System::Int32 m_remainingBufferLength;
+ bool m_ispdxSerialization;
+ native_conditional_unique_ptr<native::DataOutput>^ m_nativeptr;
+
+ public:
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ inline DataOutput(native::Cache* cache)
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(cache->createDataOutput());
+ m_isManagedObject = true;
+ m_cursor = 0;
+ try
+ {
+ m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
+ m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ m_ispdxSerialization = false;
+ }
+
+ /// <summary>
+ /// Write length of the array to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="len">Array len to write.</param>
+ void WriteArrayLen( System::Int32 len );
+
+ /// <summary>
+ /// Write a signed byte to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The signed byte to write.</param>
+ void WriteSByte( SByte value );
+
+ /// <summary>
+ /// Write a boolean value to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The boolean value to write.</param>
+ void WriteBoolean( bool value );
+
+ /// <summary>
+ /// Write a char value to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The char value to write.</param>
+ void WriteChar( Char value );
+
+ /// <summary>
+ /// Write a given length of bytes to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of bytes to write.</param>
+ /// <param name="len">
+ /// The number of bytes from the start of array to write.
+ /// </param>
+ void WriteBytes( array<Byte>^ bytes, System::Int32 len );
+
+ /// <summary>
+ /// Write an array of bytes to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of bytes to write.</param>
+ inline void WriteBytes( array<Byte>^ bytes )
+ {
+ WriteBytes( bytes, ( bytes == nullptr ? -1 : bytes->Length ) );
+ }
+
+ /// <summary>
+ /// Write a given length of signed bytes to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of signed bytes to write.</param>
+ /// <param name="len">
+ /// The number of bytes from the start of array to write.
+ /// </param>
+ void WriteSBytes( array<SByte>^ bytes, System::Int32 len );
+
+ /// <summary>
+ /// Write an array of signed bytes to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of signed bytes to write.</param>
+ inline void WriteSBytes( array<SByte>^ bytes )
+ {
+ WriteSBytes( bytes, ( bytes == nullptr ? -1 : bytes->Length ) );
+ }
+
+ /// <summary>
+ /// Write a given length of bytes without its length to the
+ /// <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of bytes to write.</param>
+ /// <param name="len">
+ /// The number of bytes from the start of array to write.
+ /// </param>
+ void WriteBytesOnly( array<Byte>^ bytes, System::UInt32 len );
+
+ void WriteBytesOnly( array<Byte>^ bytes, System::UInt32 len, System::UInt32 offset );
+
+ /// <summary>
+ /// Write an array of bytes without its length to the
+ /// <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of bytes to write.</param>
+ inline void WriteBytesOnly( array<Byte>^ bytes )
+ {
+ WriteBytesOnly( bytes, ( bytes == nullptr ? 0 : bytes->Length ) );
+ }
+
+ /// <summary>
+ /// Write a given length of signed bytes without its length
+ /// to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of signed bytes to write.</param>
+ /// <param name="len">
+ /// The number of bytes from the start of array to write.
+ /// </param>
+ void WriteSBytesOnly( array<SByte>^ bytes, System::UInt32 len );
+
+ /// <summary>
+ /// Write an array of signed bytes without its length
+ /// to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="bytes">The array of signed bytes to write.</param>
+ inline void WriteSBytesOnly( array<SByte>^ bytes )
+ {
+ WriteSBytesOnly( bytes, ( bytes == nullptr ? 0 : bytes->Length ) );
+ }
+
+ /// <summary>
+ /// Write a 16-bit integer to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The 16-bit integer to write.</param>
+ void WriteInt16( System::Int16 value );
+
+ /// <summary>
+ /// Write a 32-bit integer to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The 32-bit integer to write.</param>
+ void WriteInt32( System::Int32 value );
+
+ /// <summary>
+ /// Write a 64-bit integer to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The 64-bit integer to write.</param>
+ void WriteInt64( System::Int64 value );
+
+ /// <summary>
+ /// Write a float to the DataOutput.
+ /// </summary>
+ /// <param name="value">The float value to write.</param>
+ void WriteFloat( float value );
+
+ /// <summary>
+ /// Write a double precision real number to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">
+ /// The double precision real number to write.
+ /// </param>
+ void WriteDouble( double value );
+
+ /// <summary>
+ /// Write a string using java-modified UTF-8 encoding to
+ /// <c>DataOutput</c>.
+ /// The maximum length supported is 2^16-1 beyond which the string
+ /// shall be truncated.
+ /// </summary>
+ /// <param name="value">The UTF encoded string to write.</param>
+ void WriteUTF( String^ value );
+
+ /// <summary>
+ /// Write a string using java-modified UTF-8 encoding to
+ /// <c>DataOutput</c>.
+ /// Length should be more than 2^16 -1.
+ /// </summary>
+ /// <param name="value">The UTF encoded string to write.</param>
+ void WriteUTFHuge( String^ value );
+
+ /// <summary>
+ /// Write a string(only ASCII char) to
+ /// <c>DataOutput</c>.
+ /// Length should be more than 2^16 -1.
+ /// </summary>
+ /// <param name="value">The UTF encoded string to write.</param>
+ void WriteASCIIHuge( String^ value );
+
+ /// <summary>
+ /// Write an <c>IGeodeSerializable</c> object to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="obj">The object to write.</param>
+ // void WriteObject( IGeodeSerializable^ obj );
+
+ /// <summary>
+ /// Write a <c>Serializable</c> object to the <c>DataOutput</c>.
+ /// This is provided to conveniently pass primitive types (like string)
+ /// that shall be implicitly converted to corresponding
+ /// <c>IGeodeSerializable</c> wrapper types.
+ /// </summary>
+ /// <param name="obj">The object to write.</param>
+ void WriteObject( Object^ obj );
+
+ /// <summary>
+ /// Advance the buffer cursor by the given offset.
+ /// </summary>
+ /// <param name="offset">
+ /// The offset by which to advance the cursor.
+ /// </param>
+ void AdvanceCursor( System::UInt32 offset );
+
+ /// <summary>
+ /// Rewind the buffer cursor by the given offset.
+ /// </summary>
+ /// <param name="offset">
+ /// The offset by which to rewind the cursor.
+ /// </param>
+ void RewindCursor( System::UInt32 offset );
+
+ /// <summary>
+ /// Get a copy of the current buffer.
+ /// </summary>
+ array<Byte>^ GetBuffer( );
+
+ /// <summary>
+ /// Get the length of current data in the buffer.
+ /// </summary>
+ property System::UInt32 BufferLength
+ {
+ System::UInt32 get( );
+ }
+
+ /// <summary>
+ /// Reset the cursor to the start of the buffer.
+ /// </summary>
+ void Reset( );
+
+ /// <summary>
+ /// Write a Dictionary to the DataOutput.
+ /// </summary>
+ /// <param name="value">The object which implements IDictionary to write.</param>
+ void WriteDictionary(System::Collections::IDictionary^ value);
+
+ /// <summary>
+ /// Write a date to the DataOutput.
+ /// </summary>
+ /// <param name="value">The date value to write.</param>
+ void WriteDate(System::DateTime value);
+
+ /// <summary>
+ /// Write a collection to the DataOutput.
+ /// </summary>
+ /// <param name="value">The object which implements IList to write.</param>
+ void WriteCollection(System::Collections::IList^ value);
+
+ /// <summary>
+ /// Write a char array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The char array to write.</param>
+ void WriteCharArray(array<Char>^ value);
+
+ /// <summary>
+ /// Write a bool array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The bool array to write.</param>
+ void WriteBooleanArray(array<bool>^ value);
+
+ /// <summary>
+ /// Write a short array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The short array to write.</param>
+ void WriteShortArray(array<Int16>^ value);
+
+ /// <summary>
+ /// Write a int array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The int array to write.</param>
+ void WriteIntArray(array<Int32>^ value);
+
+ /// <summary>
+ /// Write a long array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The long array to write.</param>
+ void WriteLongArray(array<Int64>^ value);
+
+ /// <summary>
+ /// Write a float array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The float array to write.</param>
+ void WriteFloatArray(array<float>^ value);
+
+ /// <summary>
+ /// Write a double array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The double array to write.</param>
+ void WriteDoubleArray(array<double>^ value);
+
+ /// <summary>
+ /// Write a object array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The object array to write.</param>
+ void WriteObjectArray(List<Object^>^ value);
+
+ /// <summary>
+ /// Write a array of sign byte array to the DataOutput.
+ /// </summary>
+ /// <param name="value">The array of sign byte array to write.</param>
+ void WriteArrayOfByteArrays(array<array<Byte>^>^ value);
+
+ internal:
+
+ native::DataOutput* GetNative()
+ {
+ return m_nativeptr->get();
+ }
+
+ void WriteDotNetObjectArray(Object^ objectArray);
+
+ /// <summary>
+ /// Write a byte to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The byte to write.</param>
+ void WriteByte( Byte value );
+
+ /// <summary>
+ /// Write an unsigned short integer (System::Int16) to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The unsigned 16-bit integer to write.</param>
+ void WriteUInt16( System::UInt16 value );
+
+ /// <summary>
+ /// Write an unsigned 32-bit integer to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The unsigned 32-bit integer to write.</param>
+ void WriteUInt32( System::UInt32 value );
+
+ /// <summary>
+ /// Write an unsigned 64-bit integer to the <c>DataOutput</c>.
+ /// </summary>
+ /// <param name="value">The unsigned 64-bit integer to write.</param>
+ void WriteUInt64( System::UInt64 value );
+
+
+ System::Int32 GetBufferLengthPdx()
+ {
+ try
+ {
+ return (System::Int32)m_nativeptr->get()->getBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void WriteString(String^ value);
+
+ System::Int32 GetCursorPdx()
+ {
+ return m_cursor;
+ }
+
+ const char * GetPoolName()
+ {
+ try
+ {
+ return m_nativeptr->get()->getPoolName();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void WriteStringArray(array<String^>^ strArray);
+
+ void EncodeUTF8String( String^ input, int encLength )
+ {
+ const int strLength = input->Length;
+ const int end = m_cursor + encLength;
+ for ( int i = 0; i < strLength && m_cursor < end; i++ )
+ {
+ unsigned short c = (unsigned short)input[i];
+
+ if( c == 0 )
+ {
+ m_bytes[m_cursor++] = 0xc0;
+ m_bytes[m_cursor++] = 0x80;
+ }
+ else if ( c < 0x80 )//ASCII character
+ {
+ // 7-bits done in one byte.
+ m_bytes[m_cursor++] = (System::Byte)c;
+ }
+ else if ( c < 0x800 )
+ {
+ // 8-11 bits done in 2 bytes
+ m_bytes[m_cursor++] = ( 0xC0 | c >> 6 );
+ m_bytes[m_cursor++] = ( 0x80 | c & 0x3F );
+ }
+ else
+ {
+ // 12-16 bits done in 3 bytes
+ m_bytes[m_cursor++] = ( 0xE0 | c >> 12 );
+ m_bytes[m_cursor++] = ( 0x80 | c >> 6 & 0x3F );
+ m_bytes[m_cursor++] = ( 0x80 | c & 0x3F );
+ }
+ }
+
+ // TODO ASSERT end = m_cursor
+ }
+
+ static int getEncodedLength(String^ input)
+ {
+ int count = 0;
+ for ( int i = 0; i < input->Length; i++ )
+ {
+ unsigned short c = (unsigned short)input[i];
+
+ if( c == 0)
+ {
+ count += 2;
+ }
+ else if ( c < 0x80 )//ASCII character
+ {
+ count++;
+ }
+ else if ( c < 0x800 )
+ {
+ count += 2;
+ }
+ else
+ {
+ count += 3;
+ }
+ }// end for
+
+ return count;
+ }
+
+ void setPdxSerialization(bool val)
+ {
+ m_ispdxSerialization = val;
+ }
+
+ void WriteStringWithType( String^ value );
+
+ static int8_t GetTypeId(System::UInt32 classId );
+
+ static int8_t DSFID(System::UInt32 classId);
+
+ void WriteObjectInternal( IGeodeSerializable^ obj );
+
+ void WriteBytesToUMDataOutput();
+
+ void WriteObject(bool% obj);
+
+ void WriteObject(Byte% obj);
+
+ void WriteObject(Char% obj);
+
+ void WriteObject(Double% obj);
+
+ void WriteObject(Single% obj);
+
+ void WriteObject(System::Int16% obj);
+
+ void WriteObject(System::Int32% obj);
+
+ void WriteObject(System::Int64% obj);
+
+ void WriteObject(UInt16% obj);
+
+ void WriteObject(UInt32% obj);
+
+ void WriteObject(UInt64% obj);
+
+
+ template <typename mType>
+ void WriteObject(array<mType>^ %objArray)
+ {
+ if(objArray != nullptr) {
+ int arrayLen = objArray->Length;
+ WriteArrayLen(arrayLen);
+ if(arrayLen > 0) {
+ int i = 0;
+ for( i = 0; i < arrayLen; i++ ){
+ WriteObject(objArray[i]);
+ }
+ }
+ }
+ else {
+ WriteByte(0xff);
+ }
+ }
+
+ bool IsManagedObject()
+ {
+ return m_isManagedObject;
+ }
+
+ void SetBuffer()
+ {
+ m_cursor = 0;
+ try
+ {
+ m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
+ m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::Byte* GetStartBufferPosition()
+ {
+ try
+ {
+ return const_cast<System::Byte *>( m_nativeptr->get()->getBuffer());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ };
+ }
+
+ inline void EnsureCapacity( System::Int32 size )
+ {
+ System::Int32 bytesLeft = m_remainingBufferLength - m_cursor;
+ if ( bytesLeft < size ) {
+ try
+ {
+ auto p = m_nativeptr->get();
+ p->ensureCapacity(m_cursor + size);
+ m_bytes = const_cast<System::Byte *>( p->getCursor());
+ m_remainingBufferLength = (System::Int32)p->getRemainingBufferLength();
+ }
+ catch(apache::geode::client::OutOfMemoryException ex )
+ {
+ throw gcnew OutOfMemoryException(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ }
+
+ //it expects list is not null
+ inline void WriteList(System::Collections::IList^ list)
+ {
+ this->WriteArrayLen(list->Count);
+ for each (Object^ obj in list)
+ this->WriteObject(obj);
+ }
+
+ System::Byte* GetBytes(System::Byte* src, System::UInt32 size)
+ {
+ try
+ {
+ return m_nativeptr->get()->getBufferCopyFrom(src, size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ System::Int32 GetRemainingBufferLength()
+ {
+ try
+ {
+ return (System::Int32) m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline DataOutput( apache::geode::client::DataOutput* nativeptr, bool managedObject )
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(nativeptr);
+ m_isManagedObject = managedObject;
+ m_cursor = 0;
+ m_bytes = const_cast<System::Byte *>(nativeptr->getCursor());
+ m_remainingBufferLength = (System::Int32)nativeptr->getRemainingBufferLength();
+ m_ispdxSerialization = false;
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DiskPolicyType.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/DiskPolicyType.hpp b/clicache/src/DiskPolicyType.hpp
new file mode 100644
index 0000000..e9d3953
--- /dev/null
+++ b/clicache/src/DiskPolicyType.hpp
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/DiskPolicyType.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Enumerated type for disk policy.
+ /// Contains values for setting the disk policy type.
+ /// </summary>
+ public enum class DiskPolicyType
+ {
+ /// <summary>No policy.</summary>
+ None = 0,
+
+ /// <summary>Overflow to disk.</summary>
+ Overflows
+ };
+
+
+ /// <summary>
+ /// Static class containing convenience methods for <c>DiskPolicyType</c>.
+ /// </summary>
+ /// <seealso cref="RegionAttributes.DiskPolicy" />
+ /// <seealso cref="AttributesFactory.SetDiskPolicy" />
+ public ref class DiskPolicy STATICCLASS
+ {
+ public:
+
+ /// <summary>
+ /// True if the current policy is <c>Overflows</c>.
+ /// </summary>
+ inline static bool IsOverflow( DiskPolicyType type )
+ {
+ return (type == DiskPolicyType::Overflows);
+ }
+
+ /// <summary>
+ /// True if the current policy is <c>None</c>.
+ /// </summary>
+ inline static bool IsNone( DiskPolicyType type )
+ {
+ return (type == DiskPolicyType::None);
+ }
+
+ ///// <summary>
+ ///// True if the current policy is <c>Persist</c>.
+ ///// </summary> -- Persist is NOT YET IMPLEMENTED IN C++
+ //inline static bool IsPersist( DiskPolicyType type )
+ //{
+ // return (type == DiskPolicyType::Persist);
+ //}
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DistributedSystem.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/DistributedSystem.cpp b/clicache/src/DistributedSystem.cpp
new file mode 100644
index 0000000..7431933
--- /dev/null
+++ b/clicache/src/DistributedSystem.cpp
@@ -0,0 +1,574 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <version.h>
+#include <geode/CacheLoader.hpp>
+#include <geode/CacheListener.hpp>
+#include <geode/FixedPartitionResolver.hpp>
+#include <geode/CacheWriter.hpp>
+#include <geode/GeodeTypeIds.hpp>
+#include <geode/Cache.hpp>
+#include <CacheImpl.hpp>
+#include <CacheXmlParser.hpp>
+#include <DistributedSystemImpl.hpp>
+#include <ace/Process.h> // Added to get rid of unresolved token warning
+#include "end_native.hpp"
+
+#include "Cache.hpp"
+#include "Serializable.hpp"
+#include "DistributedSystem.hpp"
+#include "SystemProperties.hpp"
+#include "CacheFactory.hpp"
+#include "CacheableDate.hpp"
+#include "CacheableFileName.hpp"
+#include "CacheableHashMap.hpp"
+#include "CacheableHashSet.hpp"
+#include "CacheableHashTable.hpp"
+#include "CacheableIdentityHashMap.hpp"
+#include "CacheableObjectArray.hpp"
+#include "CacheableString.hpp"
+#include "CacheableStringArray.hpp"
+#include "CacheableUndefined.hpp"
+#include "CacheableVector.hpp"
+#include "CacheableArrayList.hpp"
+#include "CacheableStack.hpp"
+#include "CacheableObject.hpp"
+#include "CacheableObjectXml.hpp"
+#include "CacheableBuiltins.hpp"
+#include "Log.hpp"
+#include "Struct.hpp"
+#include "impl/MemoryPressureHandler.hpp"
+#include "impl/SafeConvert.hpp"
+#include "impl/PdxType.hpp"
+#include "impl/EnumInfo.hpp"
+#include "impl/ManagedPersistenceManager.hpp"
+
+// disable spurious warning
+#pragma warning(disable:4091)
+#include <msclr/lock.h>
+#pragma warning(default:4091)
+
+
+using namespace System;
+
+using namespace Apache::Geode::Client;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+ class ManagedCacheLoaderGeneric
+ : public CacheLoader
+ {
+ public:
+
+ static CacheLoader* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+ };
+
+ class ManagedCacheListenerGeneric
+ : public CacheListener
+ {
+ public:
+
+ static CacheListener* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+ };
+
+ class ManagedFixedPartitionResolverGeneric
+ : public FixedPartitionResolver
+ {
+ public:
+
+ static PartitionResolver* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+ };
+
+ class ManagedCacheWriterGeneric
+ : public CacheWriter
+ {
+ public:
+
+ static CacheWriter* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+ };
+
+ class ManagedAuthInitializeGeneric
+ : public AuthInitialize
+ {
+ public:
+
+ static AuthInitialize* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+ };
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+
+ namespace native = apache::geode::client;
+
+ DistributedSystem^ DistributedSystem::Connect(String^ name, Cache^ cache)
+ {
+ return DistributedSystem::Connect(name, nullptr, cache);
+ }
+
+ DistributedSystem^ DistributedSystem::Connect(String^ name, Properties<String^, String^>^ config, Cache ^ cache)
+ {
+ native::DistributedSystemImpl::acquireDisconnectLock();
+
+ _GF_MG_EXCEPTION_TRY2
+
+ ManagedString mg_name(name);
+
+ // this we are calling after all .NET initialization required in
+ // each AppDomain
+ auto nativeptr = native::DistributedSystem::create(mg_name.CharPtr, cache->GetNative().get(),
+ config->GetNative());
+ nativeptr->connect();
+
+ ManagedPostConnect(cache);
+
+ return gcnew DistributedSystem(std::move(nativeptr));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ finally {
+ native::DistributedSystemImpl::releaseDisconnectLock();
+ }
+ }
+
+ void DistributedSystem::Disconnect(Cache^ cache)
+ {
+ native::DistributedSystemImpl::acquireDisconnectLock();
+
+ _GF_MG_EXCEPTION_TRY2
+
+
+ Serializable::UnregisterNativesGeneric();
+ DistributedSystem::UnregisterBuiltinManagedTypes(cache);
+ m_nativeptr->get()->disconnect();
+ GC::KeepAlive(m_nativeptr);
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ finally {
+ native::DistributedSystemImpl::releaseDisconnectLock();
+ }
+ }
+
+ void DistributedSystem::AppDomainInstanceInitialization(Cache^ cache)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ // Register wrapper types for built-in types, this are still cpp wrapper
+
+ //byte
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableByte::Create),
+ native::GeodeTypeIds::CacheableByte, SByte::typeid);
+
+ //boolean
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableBoolean::Create),
+ native::GeodeTypeIds::CacheableBoolean, Boolean::typeid);
+ //wide char
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableCharacter::Create),
+ native::GeodeTypeIds::CacheableWideChar, Char::typeid);
+ //double
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableDouble::Create),
+ native::GeodeTypeIds::CacheableDouble, Double::typeid);
+ //ascii string
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableString::Create),
+ native::GeodeTypeIds::CacheableASCIIString, String::typeid);
+
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableFloat::Create),
+ native::GeodeTypeIds::CacheableFloat, float::typeid);
+ //int 16
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableInt16::Create),
+ native::GeodeTypeIds::CacheableInt16, Int16::typeid);
+ //int32
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableInt32::Create),
+ native::GeodeTypeIds::CacheableInt32, Int32::typeid);
+ //int64
+ Serializable::RegisterWrapperGeneric(
+ gcnew WrapperDelegateGeneric(CacheableInt64::Create),
+ native::GeodeTypeIds::CacheableInt64, Int64::typeid);
+
+ //Now onwards all will be wrap in managed cacheable key..
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableBytes,
+ gcnew TypeFactoryMethodGeneric(CacheableBytes::CreateDeserializable),
+ Type::GetType("System.Byte[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableDoubleArray,
+ gcnew TypeFactoryMethodGeneric(CacheableDoubleArray::CreateDeserializable),
+ Type::GetType("System.Double[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableFloatArray,
+ gcnew TypeFactoryMethodGeneric(CacheableFloatArray::CreateDeserializable),
+ Type::GetType("System.Single[]"), cache);
+
+ //TODO:
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableHashSet,
+ gcnew TypeFactoryMethodGeneric(CacheableHashSet::CreateDeserializable),
+ nullptr, cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableLinkedHashSet,
+ gcnew TypeFactoryMethodGeneric(CacheableLinkedHashSet::CreateDeserializable),
+ nullptr, cache);
+
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableInt16Array,
+ gcnew TypeFactoryMethodGeneric(CacheableInt16Array::CreateDeserializable),
+ Type::GetType("System.Int16[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableInt32Array,
+ gcnew TypeFactoryMethodGeneric(CacheableInt32Array::CreateDeserializable),
+ Type::GetType("System.Int32[]"), cache);
+
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableInt64Array,
+ gcnew TypeFactoryMethodGeneric(CacheableInt64Array::CreateDeserializable),
+ Type::GetType("System.Int64[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::BooleanArray,
+ gcnew TypeFactoryMethodGeneric(BooleanArray::CreateDeserializable),
+ Type::GetType("System.Boolean[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CharArray,
+ gcnew TypeFactoryMethodGeneric(CharArray::CreateDeserializable),
+ Type::GetType("System.Char[]"), cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableStringArray,
+ gcnew TypeFactoryMethodGeneric(CacheableStringArray::CreateDeserializable),
+ Type::GetType("System.String[]"), cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::Struct,
+ gcnew TypeFactoryMethodGeneric(Struct::CreateDeserializable),
+ nullptr, cache);
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::EnumInfo,
+ gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Internal::EnumInfo::CreateDeserializable),
+ nullptr, cache);
+
+ // End register generic wrapper types for built-in types
+
+ //if (!native::DistributedSystem::isConnected())
+ //{
+ // Set the Generic ManagedAuthInitialize factory function
+ native::SystemProperties::managedAuthInitializeFn =
+ native::ManagedAuthInitializeGeneric::create;
+
+ // Set the Generic ManagedCacheLoader/Listener/Writer factory functions.
+ native::CacheXmlParser::managedCacheLoaderFn =
+ native::ManagedCacheLoaderGeneric::create;
+ native::CacheXmlParser::managedCacheListenerFn =
+ native::ManagedCacheListenerGeneric::create;
+ native::CacheXmlParser::managedCacheWriterFn =
+ native::ManagedCacheWriterGeneric::create;
+
+ // Set the Generic ManagedPartitionResolver factory function
+ native::CacheXmlParser::managedPartitionResolverFn =
+ native::ManagedFixedPartitionResolverGeneric::create;
+
+ // Set the Generic ManagedPersistanceManager factory function
+ native::CacheXmlParser::managedPersistenceManagerFn =
+ native::ManagedPersistenceManagerGeneric::create;
+ //}
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ void DistributedSystem::ManagedPostConnect(Cache^ cache)
+ {
+ // The registration into the native map should be after
+ // native connect since it can be invoked only once
+
+ // Register other built-in types
+
+ // End register other built-in types
+
+ // Register other built-in types for generics
+ //c# datatime
+
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableDate,
+ gcnew TypeFactoryMethodGeneric(CacheableDate::CreateDeserializable),
+ Type::GetType("System.DateTime"), cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableFileName,
+ gcnew TypeFactoryMethodGeneric(CacheableFileName::CreateDeserializable),
+ nullptr, cache);
+
+ //for generic dictionary define its type in static constructor of Serializable.hpp
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableHashMap,
+ gcnew TypeFactoryMethodGeneric(CacheableHashMap::CreateDeserializable),
+ nullptr, cache);
+
+ //c# hashtable
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableHashTable,
+ gcnew TypeFactoryMethodGeneric(CacheableHashTable::CreateDeserializable),
+ Type::GetType("System.Collections.Hashtable"), cache);
+
+ //Need to keep public as no counterpart in c#
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableIdentityHashMap,
+ gcnew TypeFactoryMethodGeneric(
+ CacheableIdentityHashMap::CreateDeserializable),
+ nullptr, cache);
+
+ //keep as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableUndefined,
+ gcnew TypeFactoryMethodGeneric(CacheableUndefined::CreateDeserializable),
+ nullptr, cache);
+
+ //c# arraylist
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableVector,
+ gcnew TypeFactoryMethodGeneric(CacheableVector::CreateDeserializable),
+ nullptr, cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableObjectArray,
+ gcnew TypeFactoryMethodGeneric(
+ CacheableObjectArray::CreateDeserializable),
+ nullptr, cache);
+
+ //Generic::List
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableArrayList,
+ gcnew TypeFactoryMethodGeneric(CacheableArrayList::CreateDeserializable),
+ nullptr, cache);
+
+ //c# generic stack
+ Serializable::RegisterTypeGeneric(
+ native::GeodeTypeIds::CacheableStack,
+ gcnew TypeFactoryMethodGeneric(CacheableStack::CreateDeserializable),
+ nullptr, cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ GeodeClassIds::CacheableManagedObject - 0x80000000,
+ gcnew TypeFactoryMethodGeneric(CacheableObject::CreateDeserializable),
+ nullptr, cache);
+
+ //as it is
+ Serializable::RegisterTypeGeneric(
+ GeodeClassIds::CacheableManagedObjectXml - 0x80000000,
+ gcnew TypeFactoryMethodGeneric(CacheableObjectXml::CreateDeserializable),
+ nullptr, cache);
+
+ // End register other built-in types
+
+ // TODO: what will happen for following if first appDomain unload ??
+ // Testing shows that there are problems; need to discuss -- maybe
+ // maintain per AppDomainID functions in C++ layer.
+
+ // Log the version of the C# layer being used
+ Log::Config(".NET layer assembly version: {0}({1})", System::Reflection::
+ Assembly::GetExecutingAssembly()->GetName()->Version->ToString(),
+ System::Reflection::Assembly::GetExecutingAssembly()->ImageRuntimeVersion);
+
+ Log::Config(".NET runtime version: {0} ", System::Environment::Version);
+ Log::Config(".NET layer source repository (revision): {0} ({1})",
+ PRODUCT_SOURCE_REPOSITORY, PRODUCT_SOURCE_REVISION);
+ }
+
+ void DistributedSystem::AppDomainInstancePostInitialization()
+ {
+ // TODO global - Is this necessary?
+ //to create .net memory pressure handler
+ //Create(native::DistributedSystem::getInstance());
+ }
+
+ void DistributedSystem::UnregisterBuiltinManagedTypes(Cache^ cache)
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ native::DistributedSystemImpl::acquireDisconnectLock();
+
+ Serializable::UnregisterNativesGeneric();
+
+ int remainingInstances =
+ native::DistributedSystemImpl::currentInstances();
+
+ if (remainingInstances == 0) { // last instance
+
+
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableDate, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableFileName, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableHashMap, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableHashTable, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableIdentityHashMap, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableVector, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableObjectArray, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableArrayList, cache);
+ Serializable::UnregisterTypeGeneric(
+ native::GeodeTypeIds::CacheableStack, cache);
+ Serializable::UnregisterTypeGeneric(
+ GeodeClassIds::CacheableManagedObject - 0x80000000, cache);
+ Serializable::UnregisterTypeGeneric(
+ GeodeClassIds::CacheableManagedObjectXml - 0x80000000, cache);
+
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ finally {
+ native::DistributedSystemImpl::releaseDisconnectLock();
+ }
+ }
+
+ Apache::Geode::Client::SystemProperties^ DistributedSystem::SystemProperties::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ return Apache::Geode::Client::SystemProperties::Create(
+ &(m_nativeptr->get()->getSystemProperties()));
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ String^ DistributedSystem::Name::get()
+ {
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getName().c_str());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ void DistributedSystem::HandleMemoryPressure(System::Object^ state)
+ {
+ // TODO global - Need single memory pressue event running?
+ ACE_Time_Value dummy(1);
+ MemoryPressureHandler handler;
+ handler.handle_timeout(dummy, nullptr);
+ }
+
+ DistributedSystem^ DistributedSystem::Create(native::DistributedSystem* nativeptr)
+ {
+ auto instance = gcnew DistributedSystem(nativeptr);
+ return instance;
+ }
+
+ DistributedSystem::DistributedSystem(std::unique_ptr<native::DistributedSystem> nativeptr)
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DistributedSystem>(std::move(nativeptr));
+ }
+
+ DistributedSystem::DistributedSystem(native::DistributedSystem* nativeptr)
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DistributedSystem>(nativeptr);
+ }
+
+ DistributedSystem::~DistributedSystem()
+ {
+ m_memoryPressureHandler->Dispose(nullptr);
+ }
+
+ void DistributedSystem::acquireDisconnectLock()
+ {
+ native::DistributedSystemImpl::acquireDisconnectLock();
+ }
+
+ void DistributedSystem::disconnectInstance()
+ {
+ native::DistributedSystemImpl::disconnectInstance();
+ }
+
+ void DistributedSystem::releaseDisconnectLock()
+ {
+ native::DistributedSystemImpl::releaseDisconnectLock();
+ }
+
+ void DistributedSystem::connectInstance()
+ {
+ native::DistributedSystemImpl::connectInstance();
+ }
+
+ void DistributedSystem::registerCliCallback()
+ {
+ m_cliCallBackObj = gcnew CliCallbackDelegate();
+ auto nativeCallback =
+ gcnew cliCallback(m_cliCallBackObj,
+ &CliCallbackDelegate::Callback);
+
+ native::DistributedSystemImpl::registerCliCallback(System::Threading::Thread::GetDomainID(),
+ (native::CliCallbackMethod)System::Runtime::InteropServices::
+ Marshal::GetFunctionPointerForDelegate(
+ nativeCallback).ToPointer());
+ }
+
+ void DistributedSystem::unregisterCliCallback()
+ {
+ native::DistributedSystemImpl::unregisterCliCallback(System::Threading::Thread::GetDomainID());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/DistributedSystem.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/DistributedSystem.hpp b/clicache/src/DistributedSystem.hpp
new file mode 100644
index 0000000..48c2723
--- /dev/null
+++ b/clicache/src/DistributedSystem.hpp
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/DistributedSystem.hpp>
+#include "end_native.hpp"
+
+#include "native_conditional_unique_ptr.hpp"
+#include "SystemProperties.hpp"
+#include "Properties.hpp"
+#include "impl/CliCallbackDelgate.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// DistributedSystem encapsulates this applications "connection" into the
+ /// Geode Java servers.
+ /// </summary>
+ /// <remarks>
+ /// In order to participate as a client in the Geode Java servers
+ /// distributed system, each application needs to connect to the
+ /// DistributedSystem.
+ /// </remarks>
+ public ref class DistributedSystem sealed
+ {
+ public:
+
+ /// <summary>
+ /// Initializes the Native Client system to be able to connect to the Geode Java servers.
+ /// </summary>
+ /// <param name="name">the name of the system to connect to</param>
+ /// <exception cref="IllegalArgumentException">if name is null</exception>
+ /// <exception cref="NoSystemException">
+ /// if the connecting target is not running
+ /// </exception>
+ /// <exception cref="AlreadyConnectedException">
+ /// if trying a second connect.
+ /// An application can have one only one connection to a DistributedSystem.
+ /// </exception>
+ /// <exception cref="UnknownException">otherwise</exception>
+ DistributedSystem^ Connect(String^ name, Cache^ cache);
+
+ /// <summary>
+ /// Initializes the Native Client system to be able to connect to the
+ /// Geode Java servers.
+ /// </summary>
+ /// <param name="name">the name of the system to connect to</param>
+ /// <param name="config">the set of properties</param>
+ /// <exception cref="IllegalArgumentException">if name is null</exception>
+ /// <exception cref="NoSystemException">
+ /// if the connecting target is not running
+ /// </exception>
+ /// <exception cref="AlreadyConnectedException">
+ /// if trying a second connect.
+ /// An application can have one only one connection to a DistributedSystem.
+ /// </exception>
+ /// <exception cref="UnknownException">otherwise</exception>
+ static DistributedSystem^ Connect(String^ name, Properties<String^, String^>^ config, Cache^ cache);
+
+ /// <summary>
+ /// Disconnect from the distributed system.
+ /// </summary>
+ /// <exception cref="IllegalStateException">if not connected</exception>
+ void Disconnect(Cache^ cache);
+
+ /// <summary>
+ /// Returns the SystemProperties used to create this instance of a
+ /// <c>DistributedSystem</c>.
+ /// </summary>
+ /// <returns>the SystemProperties</returns>
+ property Apache::Geode::Client::SystemProperties^ SystemProperties
+ {
+ Apache::Geode::Client::SystemProperties^ get();
+ }
+
+ /// <summary>
+ /// Get the name that identifies this DistributedSystem instance.
+ /// </summary>
+ /// <returns>the name of the DistributedSystem instance.</returns>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ static DistributedSystem^ Create(native::DistributedSystem* nativeptr);
+
+ DistributedSystem(std::unique_ptr<native::DistributedSystem> nativeptr);
+
+ static void acquireDisconnectLock();
+
+ static void disconnectInstance();
+
+ static void releaseDisconnectLock();
+
+ static void connectInstance();
+
+ delegate void cliCallback(apache::geode::client::Cache& cache);
+
+ static void registerCliCallback();
+
+ static void unregisterCliCallback();
+ /// <summary>
+ /// Stuff that needs to be done for Connect in each AppDomain.
+ /// </summary>
+ static void AppDomainInstanceInitialization(Cache^ cache);
+
+ /// <summary>
+ /// Managed registrations and other stuff to be done for the manage
+ /// layer after the first connect.
+ /// </summary>
+ static void ManagedPostConnect(Cache^ cache);
+
+ /// <summary>
+ /// Stuff that needs to be done for Connect in each AppDomain but
+ /// only after the first Connect has completed.
+ /// </summary>
+ static void AppDomainInstancePostInitialization();
+
+ /// <summary>
+ /// Unregister the builtin managed types like CacheableObject.
+ /// </summary>
+ static void UnregisterBuiltinManagedTypes(Cache^ cache);
+
+ native::DistributedSystem& GetNative()
+ {
+ return *(m_nativeptr->get());
+ }
+
+ private:
+
+ ///// <summary>
+ ///// Stores the task ID of the task that adjusts unmanaged memory
+ ///// pressure in managed GC.
+ ///// </summary>
+ //static long s_memoryPressureTaskID = -1;
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ DistributedSystem(native::DistributedSystem* nativeptr);
+
+ /// <summary>
+ /// Finalizer for the singleton instance of this class.
+ /// </summary>
+ ~DistributedSystem();
+
+ native_conditional_unique_ptr<native::DistributedSystem>^ m_nativeptr;
+
+
+ /// <summary>
+ /// Periodically adjust memory pressure of unmanaged heap for GC.
+ /// </summary>
+ static void HandleMemoryPressure(System::Object^ state);
+
+ /// <summary>
+ /// Timer task to periodically invoke <c>HandleMemoryPressure</c>.
+ /// </summary>
+ System::Threading::Timer^ m_memoryPressureHandler;
+
+ /// <summary>
+ /// Singleton instance of this class.
+ /// </summary>
+ static volatile DistributedSystem^ m_instance;
+
+ /// <summary>
+ /// Static lock object to protect the singleton instance of this class.
+ /// </summary>
+ static System::Object^ m_singletonSync = gcnew System::Object();
+
+ static CliCallbackDelegate^ m_cliCallBackObj;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/EntryEvent.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/EntryEvent.cpp b/clicache/src/EntryEvent.cpp
new file mode 100644
index 0000000..51a0ef5
--- /dev/null
+++ b/clicache/src/EntryEvent.cpp
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+#include "EntryEvent.hpp"
+#include "Region.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ IRegion<TKey, TValue>^ EntryEvent<TKey, TValue>::Region::get( )
+ {
+ apache::geode::client::RegionPtr regionptr = m_nativeptr->getRegion();
+ return Client::Region<TKey, TValue>::Create( regionptr );
+ }
+
+ generic<class TKey, class TValue>
+ TKey EntryEvent<TKey, TValue>::Key::get( )
+ {
+ apache::geode::client::CacheableKeyPtr& keyptr( m_nativeptr->getKey( ) );
+ return Serializable::GetManagedValueGeneric<TKey>( keyptr );
+ }
+
+ generic<class TKey, class TValue>
+ TValue EntryEvent<TKey, TValue>::OldValue::get( )
+ {
+ apache::geode::client::CacheablePtr& valptr( m_nativeptr->getOldValue( ) );
+ return Serializable::GetManagedValueGeneric<TValue>( valptr );
+ }
+
+ generic<class TKey, class TValue>
+ TValue EntryEvent<TKey, TValue>::NewValue::get( )
+ {
+ apache::geode::client::CacheablePtr& valptr( m_nativeptr->getNewValue( ) );
+ return Serializable::GetManagedValueGeneric<TValue>( valptr );
+ }
+
+ generic<class TKey, class TValue>
+ Object^ EntryEvent<TKey, TValue>::CallbackArgument::get()
+ {
+ apache::geode::client::UserDataPtr& valptr(m_nativeptr->getCallbackArgument());
+ return Serializable::GetManagedValueGeneric<Object^>( valptr );
+ }
+
+ generic<class TKey, class TValue>
+ bool EntryEvent<TKey, TValue>::RemoteOrigin::get()
+ {
+ return m_nativeptr->remoteOrigin();
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/EntryEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/EntryEvent.hpp b/clicache/src/EntryEvent.hpp
new file mode 100644
index 0000000..36008ea
--- /dev/null
+++ b/clicache/src/EntryEvent.hpp
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/EntryEvent.hpp>
+#include "end_native.hpp"
+
+#include "IRegion.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ interface class IGeodeSerializable;
+
+ // ref class Region;
+ //interface class ICacheableKey;
+
+ /// <summary>
+ /// This class encapsulates events that occur for an entry in a region.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class EntryEvent sealed
+ {
+ public:
+
+ /// <summary>
+ /// Return the region this event occurred in.
+ /// </summary>
+ property IRegion<TKey, TValue>^ Region
+ {
+ IRegion<TKey, TValue>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the key this event describes.
+ /// </summary>
+ property TKey Key
+ {
+ TKey get( );
+ }
+
+ /// <summary>
+ /// Returns 'null' if there was no value in the cache. If the prior state
+ /// of the entry was invalid, or non-existent/destroyed, then the old
+ /// value will be 'null'.
+ /// </summary>
+ property TValue OldValue
+ {
+ TValue get( );
+ }
+
+ /// <summary>
+ /// Return the updated value from this event. If the event is a destroy
+ /// or invalidate operation, then the new value will be NULL.
+ /// </summary>
+ property TValue NewValue
+ {
+ TValue get( );
+ }
+
+ /// <summary>
+ /// Returns the callbackArgument passed to the method that generated
+ /// this event. See the <see cref="Region" /> interface methods
+ /// that take a callbackArgument parameter.
+ /// </summary>
+ property Object^ CallbackArgument
+ {
+ Object^ get();
+ }
+
+ /// <summary>
+ /// If the event originated in a remote process, returns true.
+ /// </summary>
+ property bool RemoteOrigin
+ {
+ bool get( );
+ }
+
+ internal:
+ const native::EntryEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline EntryEvent<TKey, TValue>( const native::EntryEvent* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+ private:
+ const native::EntryEvent* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
[04/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/clicache/src/impl/ManagedCacheableKeyBytes.cpp
new file mode 100644
index 0000000..93e01bc
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableKeyBytes.cpp
@@ -0,0 +1,288 @@
+/*
+ * 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.
+ */
+
+#include "begin_native.hpp"
+#include <geode/Cache.hpp>
+#include <GeodeTypeIdsImpl.hpp>
+#include "DataInputInternal.hpp"
+#include "end_native.hpp"
+
+#include "ManagedCacheableKeyBytes.hpp"
+#include "../DataInput.hpp"
+#include "../DataOutput.hpp"
+#include "../Serializable.hpp"
+#include "../CacheableString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "ManagedString.hpp"
+
+
+using namespace System;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+ void ManagedCacheableKeyBytesGeneric::toData(apache::geode::client::DataOutput& output) const
+ {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
+ try {
+ //TODO: I think this should work as it is
+ output.writeBytesOnly(m_bytes, m_size);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ }
+
+ apache::geode::client::Serializable* ManagedCacheableKeyBytesGeneric::fromData(apache::geode::client::DataInput& input)
+ {
+ try {
+
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::fromData: classid " + m_classId + "aid = " + +System::Threading::Thread::GetDomainID());
+ Apache::Geode::Client::DataInput mg_input(&input, true, input.getCache());
+ const System::Byte* objStartPos = input.currentBufferPosition();
+
+ Apache::Geode::Client::IGeodeSerializable^ obj = Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+
+ input.advanceCursor(mg_input.BytesReadInternally);
+
+ m_hashCode = obj->GetHashCode();
+
+ const System::Byte* objEndPos = input.currentBufferPosition();
+
+ //m_size = mg_input.BytesRead;
+ m_size = (System::UInt32)(objEndPos - objStartPos);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::fromData: objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ m_bytes = input.getBufferCopyFrom(objStartPos, m_size);
+
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return this;
+ }
+
+ System::UInt32 ManagedCacheableKeyBytesGeneric::objectSize() const
+ {
+ try {
+ //return m_managedptr->ObjectSize;
+ return m_size;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ System::Int32 ManagedCacheableKeyBytesGeneric::classId() const
+ {
+ System::UInt32 classId;
+ try {
+ //classId = m_managedptr->ClassId;
+ classId = m_classId;
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return (classId >= 0x80000000 ? 0 : classId);
+ }
+
+ int8_t ManagedCacheableKeyBytesGeneric::typeId() const
+ {
+ try {
+ //System::UInt32 classId = m_managedptr->ClassId;
+ System::UInt32 classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) % 0x20000000);
+ }
+ else if (classId <= 0x7F) {
+ return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData;
+ }
+ else if (classId <= 0x7FFF) {
+ return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData2;
+ }
+ else {
+ return (int8_t)apache::geode::client::GeodeTypeIdsImpl::CacheableUserData4;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ int8_t ManagedCacheableKeyBytesGeneric::DSFID() const
+ {
+ // convention that [0x8000000, 0xa0000000) is for FixedIDDefault,
+ // [0xa000000, 0xc0000000) is for FixedIDByte,
+ // [0xc0000000, 0xe0000000) is for FixedIDShort
+ // and [0xe0000000, 0xffffffff] is for FixedIDInt
+ // Note: depends on fact that FixedIDByte is 1, FixedIDShort is 2
+ // and FixedIDInt is 3; if this changes then correct this accordingly
+ //System::UInt32 classId = m_managedptr->ClassId;
+ System::UInt32 classId = m_classId;
+ if (classId >= 0x80000000) {
+ return (int8_t)((classId - 0x80000000) / 0x20000000);
+ }
+ return 0;
+ }
+
+ apache::geode::client::CacheableStringPtr ManagedCacheableKeyBytesGeneric::toString() const
+ {
+ try {
+ Apache::Geode::Client::IGeodeSerializable^ manageObject = getManagedObject();
+ if (manageObject != nullptr)
+ {
+ apache::geode::client::CacheableStringPtr cStr;
+ Apache::Geode::Client::CacheableString::GetCacheableString(
+ manageObject->ToString(), cStr);
+ return cStr;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ bool ManagedCacheableKeyBytesGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal");
+ // now checking classId(), typeId(), DSFID() etc. will be much more
+ // expensive than just a dynamic_cast
+ const ManagedCacheableKeyBytesGeneric* p_other =
+ dynamic_cast<const ManagedCacheableKeyBytesGeneric*>(&other);
+ if (p_other != NULL) {
+ DataInputInternal di(m_bytes, m_size, nullptr);
+ Apache::Geode::Client::DataInput mg_input(&di, true, nullptr);
+ Apache::Geode::Client::IGeodeSerializable^ obj =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+ bool ret = obj->Equals(p_other->ptr());
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
+ return ret;
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal returns false");
+ return false;
+ }
+
+ bool ManagedCacheableKeyBytesGeneric::operator ==(const ManagedCacheableKeyBytesGeneric& other) const
+ {
+ try {
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal. ");
+ DataInputInternal di(m_bytes, m_size, nullptr);
+ Apache::Geode::Client::DataInput mg_input(&di, true, nullptr);
+ Apache::Geode::Client::IGeodeSerializable^ obj =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
+ obj->FromData(%mg_input);
+ bool ret = obj->Equals(other.ptr());
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
+ return ret;
+ //return obj->Equals(other.get());
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return false");
+ return false;
+ }
+
+ System::Int32 ManagedCacheableKeyBytesGeneric::hashcode() const
+ {
+ return m_hashCode;
+ }
+
+ size_t ManagedCacheableKeyBytesGeneric::logString(char* buffer, size_t maxLength) const
+ {
+ try {
+ Apache::Geode::Client::IGeodeSerializable^ manageObject = getManagedObject();
+ if (manageObject != nullptr)
+ {
+ if (maxLength > 0) {
+ String^ logstr = manageObject->GetType()->Name + '(' +
+ manageObject->ToString() + ')';
+ Apache::Geode::Client::ManagedString mg_str(logstr);
+ return snprintf(buffer, maxLength, "%s", mg_str.CharPtr);
+ }
+ }
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return 0;
+ }
+
+ Apache::Geode::Client::IGeodeSerializable^
+ ManagedCacheableKeyBytesGeneric::getManagedObject() const
+ {
+
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::getManagedObject " + m_size);
+
+ //System::Text::StringBuilder^ sb = gcnew System::Text::StringBuilder(2000);
+ //for(System::UInt32 i = 0; i<m_size; i++)
+ //{
+ // if(m_bytes[i] != 0)
+ // sb->Append(System::Convert::ToChar( m_bytes[i]));
+ // //sb->Append(' ');
+ //}
+
+ // Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::getManagedObject " + sb);
+ DataInputInternal dinp(m_bytes, m_size, nullptr);
+ Apache::Geode::Client::DataInput mg_dinp(&dinp, true, nullptr);
+ Apache::Geode::Client::TypeFactoryMethodGeneric^ creationMethod =
+ Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId);
+ Apache::Geode::Client::IGeodeSerializable^ newObj = creationMethod();
+ return newObj->FromData(%mg_dinp);
+ }
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCacheableKeyBytes.hpp b/clicache/src/impl/ManagedCacheableKeyBytes.hpp
new file mode 100644
index 0000000..10f0466
--- /dev/null
+++ b/clicache/src/impl/ManagedCacheableKeyBytes.hpp
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CacheableKey.hpp>
+#include "DataOutputInternal.hpp"
+#include "end_native.hpp"
+
+#include "../Log.hpp"
+#include "../DataOutput.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ interface class IGeodeSerializable;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IGeodeSerializable" />
+ /// object and implements the native <c>apache::geode::client::CacheableKey</c> interface.
+ /// </summary>
+ class ManagedCacheableKeyBytesGeneric
+ : public apache::geode::client::CacheableKey
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="managedptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedCacheableKeyBytesGeneric(
+ Apache::Geode::Client::IGeodeSerializable^ managedptr, bool storeBytes)
+ : m_domainId(System::Threading::Thread::GetDomainID()),
+ m_classId(managedptr->ClassId),
+ m_bytes(NULL),
+ m_size(0),
+ m_hashCode(0)
+ {
+ if (managedptr != nullptr)
+ {
+ if (storeBytes)//if value is from app
+ {
+ DataOutputInternal dataOut;
+ Apache::Geode::Client::DataOutput mg_output(&dataOut, true);
+ managedptr->ToData(%mg_output);
+
+ //move cursor
+ //dataOut.advanceCursor(mg_output.BufferLength);
+ mg_output.WriteBytesToUMDataOutput();
+
+ m_bytes = dataOut.getBufferCopy();
+ m_size = dataOut.getBufferLength();
+
+ m_hashCode = managedptr->GetHashCode();
+ Apache::Geode::Client::Log::Fine(
+ "ManagedCacheableKeyBytes::Constructor objectSize = " + m_size + " m_hashCode = " + m_hashCode);
+ }
+ }
+ }
+
+ /// <summary>
+ /// serialize this object
+ /// </summary>
+ virtual void toData(apache::geode::client::DataOutput& output) const;
+
+ /// <summary>
+ /// deserialize this object, typical implementation should return
+ /// the 'this' pointer.
+ /// </summary>
+ virtual apache::geode::client::Serializable* fromData(apache::geode::client::DataInput& input);
+
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// </summary>
+ virtual System::UInt32 objectSize() const;
+
+ /// <summary>
+ /// return the classId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual System::Int32 classId() const;
+
+ /// <summary>
+ /// return the typeId of the instance being serialized.
+ /// This is used by deserialization to determine what instance
+ /// type to create and deserialize into.
+ /// </summary>
+ virtual int8_t typeId() const;
+
+ /// <summary>
+ /// return the Data Serialization Fixed ID type.
+ /// This is used to determine what instance type to create
+ /// and deserialize into.
+ ///
+ /// Note that this should not be overridden by custom implementations
+ /// and is reserved only for builtin types.
+ /// </summary>
+ virtual int8_t DSFID() const;
+
+ /// <summary>
+ /// Display this object as 'string', which depends on the implementation in
+ /// the managed class
+ /// </summary>
+ virtual apache::geode::client::CacheableStringPtr toString() const;
+
+ /// <summary>
+ /// return true if this key matches other CacheableKey
+ /// </summary>
+ virtual bool operator == (const apache::geode::client::CacheableKey& other) const;
+ /// <summary>
+ /// return true if this key matches other ManagedCacheableKeyBytes
+ /// </summary>
+ virtual bool operator == (const ManagedCacheableKeyBytesGeneric& other) const;
+
+ /// <summary>
+ /// return the hashcode for this key.
+ /// </summary>
+ virtual System::Int32 hashcode() const;
+
+ /// <summary>
+ /// Copy the string form of a key into a char* buffer for logging purposes.
+ /// implementations should only generate a string as long as maxLength chars,
+ /// and return the number of chars written. buffer is expected to be large
+ /// enough to hold at least maxLength chars.
+ /// The default implementation renders the classname and instance address.
+ /// </summary>
+ virtual size_t logString(char* buffer, size_t maxLength) const;
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IGeodeSerializable^ ptr() const
+ {
+ return getManagedObject();
+ }
+
+ inline ~ManagedCacheableKeyBytesGeneric()
+ {
+ Apache::Geode::Client::Log::Fine(
+ "ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
+ System::Threading::Thread::GetDomainID() + " for object: " +
+ System::Convert::ToString((UInt64) this) + " with its AppDomain ID: " + m_domainId);
+ GF_SAFE_DELETE(m_bytes);
+ }
+
+ private:
+
+ Apache::Geode::Client::IGeodeSerializable^ getManagedObject() const;
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IGeodeSerializable
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ // gcroot<IGeodeSerializable^> m_managedptr;
+ int m_domainId;
+ UInt32 m_classId;
+ System::Byte * m_bytes;
+ System::UInt32 m_size;
+ System::UInt32 m_hashCode;
+ // Disable the copy and assignment constructors
+ ManagedCacheableKeyBytesGeneric(const ManagedCacheableKeyBytesGeneric&);
+ ManagedCacheableKeyBytesGeneric& operator = (const ManagedCacheableKeyBytesGeneric&);
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCqListener.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCqListener.cpp b/clicache/src/impl/ManagedCqListener.cpp
new file mode 100644
index 0000000..92678d8
--- /dev/null
+++ b/clicache/src/impl/ManagedCqListener.cpp
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+//#include "../geode_includes.hpp"
+#include "ManagedCqListener.hpp"
+#include "../ICqListener.hpp"
+#include "../CqEvent.hpp"
+
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+#include <string>
+
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+
+//using namespace apache::geode::client;
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::CqListener* ManagedCqListenerGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+ System::Int32 dotIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedCqListener: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ mg_typeName = mg_factoryFunctionName->Substring(0, dotIndx);
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedCqListener: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ Object^ typeInst = assmb->CreateInstance(mg_typeName, true);
+ if (typeInst != nullptr)
+ {
+ MethodInfo^ mInfo = typeInst->GetType()->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+ if (mInfo != nullptr)
+ {
+ Apache::Geode::Client::ICqListener<Object^, Object^>^ managedptr = nullptr;
+ try
+ {
+ managedptr = dynamic_cast<Apache::Geode::Client::ICqListener<Object^, Object^>^>(
+ mInfo->Invoke(typeInst, nullptr));
+ }
+ catch (System::Exception^)
+ {
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedCqListener: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return new ManagedCqListenerGeneric((Apache::Geode::Client::ICqListener<Object^, Object^>^)managedptr);
+ }
+ else
+ {
+ std::string ex_str = "ManagedCqListener: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedCqListener: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqListener: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ void ManagedCqListenerGeneric::onEvent(const CqEvent& ev)
+ {
+ try {
+
+ Apache::Geode::Client::CqEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->OnEvent(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqListener: Got an exception in"
+ "onEvent: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ void ManagedCqListenerGeneric::onError(const CqEvent& ev)
+ {
+ Apache::Geode::Client::CqEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->OnError(%mevent);
+ }
+
+ void ManagedCqListenerGeneric::close()
+ {
+ try {
+ m_managedptr->Close();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqListener: Got an exception in"
+ "close: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCqListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCqListener.hpp b/clicache/src/impl/ManagedCqListener.hpp
new file mode 100644
index 0000000..f5a3267
--- /dev/null
+++ b/clicache/src/impl/ManagedCqListener.hpp
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+#pragma once
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CqListener.hpp>
+#include "end_native.hpp"
+
+//#include "../ICqListener.hpp"
+#include "../ICqListener.hpp"
+#include "CqListenerProxy.hpp"
+
+//using namespace apache::geode::client;
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ICacheListener" />
+ /// object and implements the native <c>apache::geode::client::CacheListener</c> interface.
+ /// </summary>
+ class ManagedCqListenerGeneric
+ : public apache::geode::client::CqListener
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The user object.
+ /// </param>
+ inline ManagedCqListenerGeneric( /*Generic::ICqListener<Object^, Object^>^ managedptr*/Object^ userptr)
+ : /*m_managedptr( managedptr )*/m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedCacheListener</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICacheListener</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>ICacheListener</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static CqListener* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedCqListenerGeneric() { }
+
+ /// <summary>
+ /// Handles the event of a new key being added to a region.
+ /// </summary>
+ /// <remarks>
+ /// The entry did not previously exist in this region in the local cache
+ /// (even with a null value).
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// </remarks>
+ /// <param name="ev">
+ /// Denotes the event object associated with the entry creation.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Create" />
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ /// <seealso cref="Apache.Geode.Client.Region.Get" />
+ virtual void onEvent(const apache::geode::client::CqEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being modified in a region.
+ /// </summary>
+ /// <remarks>
+ /// This entry previously existed in this region in the local cache,
+ /// but its previous value may have been null.
+ /// </remarks>
+ /// <param name="ev">
+ /// EntryEvent denotes the event object associated with updating the entry.
+ /// </param>
+ /// <seealso cref="Apache.Geode.Client.Region.Put" />
+ virtual void onError(const apache::geode::client::CqEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being invalidated.
+ /// </summary>
+ /// EntryEvent denotes the event object associated with the entry invalidation.
+ /// </param>
+ virtual void close();
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ICqListener<Object^, Object^>^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::ICqListener<Object^, Object^>^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+ private:
+
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICacheListener
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ICqListener<Object^, Object^>^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCqStatusListener.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCqStatusListener.cpp b/clicache/src/impl/ManagedCqStatusListener.cpp
new file mode 100644
index 0000000..21c8473
--- /dev/null
+++ b/clicache/src/impl/ManagedCqStatusListener.cpp
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+
+
+#include "ManagedCqStatusListener.hpp"
+#include "../ICqStatusListener.hpp"
+#include "../CqEvent.hpp"
+
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+#include <string>
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ apache::geode::client::CqListener* ManagedCqStatusListenerGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+ System::Int32 dotIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ mg_typeName = mg_factoryFunctionName->Substring(0, dotIndx);
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ Object^ typeInst = assmb->CreateInstance(mg_typeName, true);
+ if (typeInst != nullptr)
+ {
+ MethodInfo^ mInfo = typeInst->GetType()->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+ if (mInfo != nullptr)
+ {
+ Apache::Geode::Client::ICqStatusListener<Object^, Object^>^ managedptr = nullptr;
+ try
+ {
+ managedptr = dynamic_cast<Apache::Geode::Client::ICqStatusListener<Object^, Object^>^>(
+ mInfo->Invoke(typeInst, nullptr));
+ }
+ catch (System::Exception^)
+ {
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return new ManagedCqStatusListenerGeneric((Apache::Geode::Client::ICqListener<Object^, Object^>^)managedptr);
+ }
+ else
+ {
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ void ManagedCqStatusListenerGeneric::onEvent(const CqEvent& ev)
+ {
+ try {
+
+ Apache::Geode::Client::CqEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->OnEvent(%mevent);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Got an exception in"
+ "onEvent: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ void ManagedCqStatusListenerGeneric::onError(const CqEvent& ev)
+ {
+ Apache::Geode::Client::CqEvent<Object^, Object^> mevent(&ev);
+ m_managedptr->OnError(%mevent);
+ }
+
+ void ManagedCqStatusListenerGeneric::close()
+ {
+ try {
+ m_managedptr->Close();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Got an exception in"
+ "close: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ void ManagedCqStatusListenerGeneric::onCqDisconnected()
+ {
+ try {
+ m_managedptr->OnCqDisconnected();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Got an exception in"
+ "onCqDisconnected: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ void ManagedCqStatusListenerGeneric::onCqConnected()
+ {
+ try {
+ m_managedptr->OnCqConnected();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedCqStatusListenerGeneric: Got an exception in"
+ "OnCqConnected: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedCqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedCqStatusListener.hpp b/clicache/src/impl/ManagedCqStatusListener.hpp
new file mode 100644
index 0000000..42a2988
--- /dev/null
+++ b/clicache/src/impl/ManagedCqStatusListener.hpp
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/CqStatusListener.hpp>
+#include "end_native.hpp"
+
+#include "../ICqStatusListener.hpp"
+#include "CqStatusListenerProxy.hpp"
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.ICqStatusListener" />
+ /// object and implements the native <c>apache::geode::client::CqStatusListener</c> interface.
+ /// </summary>
+ class ManagedCqStatusListenerGeneric
+ : public apache::geode::client::CqStatusListener
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The user object.
+ /// </param>
+ inline ManagedCqStatusListenerGeneric(Object^ userptr)
+ : m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedCqStatusListenerGeneric</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>ICqStatusListener</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>ICqStatusListener</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static CqListener* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedCqStatusListenerGeneric() { }
+
+ /// <summary>
+ /// This method is invoked when an event is occurred on the region
+ /// that satisfied the query condition of this CQ.
+ /// This event does not contain an error.
+ /// </summary>
+ virtual void onEvent(const apache::geode::client::CqEvent& ev);
+
+ /// <summary>
+ /// This method is invoked when there is an error during CQ processing.
+ /// The error can appear while applying query condition on the event.
+ /// e.g if the event doesn't has attributes as specified in the CQ query.
+ /// This event does contain an error. The newValue may or may not be
+ /// available, and will be nullptr if not available.
+ /// </summary>
+ virtual void onError(const apache::geode::client::CqEvent& ev);
+
+ /// <summary>
+ /// Handles the event of an entry's value being invalidated.
+ /// </summary>
+ /// EntryEvent denotes the event object associated with the entry invalidation.
+ /// </param>
+ virtual void close();
+
+ /// <summary>
+ /// Called when the cq loses connection with all servers
+ /// </summary>
+ virtual void onCqDisconnected();
+
+ /// <summary>
+ /// Called when the cq establishes a connection with a server
+ /// </summary>
+ virtual void onCqConnected();
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::ICqStatusListener<Object^, Object^>^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::ICqStatusListener<Object^, Object^>^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+ private:
+
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the ICqStatusListener
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::ICqStatusListener<Object^, Object^>^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedFixedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedFixedPartitionResolver.cpp b/clicache/src/impl/ManagedFixedPartitionResolver.cpp
new file mode 100644
index 0000000..26f3f3b
--- /dev/null
+++ b/clicache/src/impl/ManagedFixedPartitionResolver.cpp
@@ -0,0 +1,262 @@
+/*
+ * 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.
+ */
+
+#include "ManagedFixedPartitionResolver.hpp"
+#include "../IFixedPartitionResolver.hpp"
+#include "../Region.hpp"
+#include "../Log.hpp"
+#include "ManagedString.hpp"
+#include "../EntryEvent.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+#include "FixedPartitionResolver.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+ PartitionResolver* ManagedFixedPartitionResolverGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine(
+ "Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ managedptr = nullptr;
+ try
+ {
+ managedptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ ManagedFixedPartitionResolverGeneric * mgpr = new ManagedFixedPartitionResolverGeneric(managedptr);
+
+ Type^ prgType = Type::GetType("Apache.Geode.Client.FixedPartitionResolverGeneric`2");
+ prgType = prgType->MakeGenericType(types);
+ Object^ prg = Activator::CreateInstance(prgType);
+
+ mInfo = prgType->GetMethod("SetPartitionResolver");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = managedptr;
+ mInfo->Invoke(prg, params);
+
+ mgpr->setptr((Apache::Geode::Client::IFixedPartitionResolverProxy^)prg);
+
+ return mgpr;
+ }
+ else
+ {
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedFixedPartitionResolverGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ CacheableKeyPtr ManagedFixedPartitionResolverGeneric::getRoutingObject(const EntryEvent& key)
+ {
+ try {
+ return m_managedptr->getRoutingObject(key);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ const char* ManagedFixedPartitionResolverGeneric::getName()
+ {
+ try {
+ return m_managedptr->getName();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return NULL;
+ }
+
+ const char* ManagedFixedPartitionResolverGeneric::getPartitionName(const EntryEvent& opDetails)
+ {
+ try {
+ return m_managedptr->getPartitionName(opDetails);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return NULL;
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedFixedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedFixedPartitionResolver.hpp b/clicache/src/impl/ManagedFixedPartitionResolver.hpp
new file mode 100644
index 0000000..aba0bf0
--- /dev/null
+++ b/clicache/src/impl/ManagedFixedPartitionResolver.hpp
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/FixedPartitionResolver.hpp>
+#include "end_native.hpp"
+
+
+#include "FixedPartitionResolver.hpp"
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IFixedPartitionResolver" />
+ /// object and implements the native <c>apache::geode::client::FixedPartitionResolver</c> interface.
+ /// </summary>
+ class ManagedFixedPartitionResolverGeneric
+ : public FixedPartitionResolver
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedFixedPartitionResolverGeneric(Object^ userptr) : m_userptr(userptr) { }
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedFixedPartitionResolverGeneric() { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedFixedPartitionResolver</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>IFixedPartitionResolver</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>IFixedPartitionResolver</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static PartitionResolver* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// return object associated with entry event which allows the Partitioned Region to store associated data together.
+ /// </summary>
+ /// <remarks>
+ /// throws RuntimeException - any exception thrown will terminate the operation and the exception will be passed to the
+ /// calling thread.
+ /// </remarks>
+ /// <param name="key">
+ /// key the detail of the entry event.
+ /// </param>
+
+ virtual CacheableKeyPtr getRoutingObject(const EntryEvent& key);
+
+ /// <summary>
+ /// Returns the name of the FixedPartitionResolver.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// <returns>
+ /// the name of the FixedPartitionResolver
+ /// </returns>
+ /// </remarks>
+ virtual const char* getName();
+
+
+ /// <summary>
+ /// This method is used to get the name of the partition for the given entry
+ /// operation.
+ /// <param name="opDetails">
+ /// the details of the entry event e.g. {@link Region#get(Object)}
+ /// </param>
+ /// <returns>
+ /// partition-name associated with node which allows mapping of given data to user defined partition.
+ /// </returns>
+ virtual const char* getPartitionName(const EntryEvent& opDetails);
+
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IFixedPartitionResolverProxy^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::IFixedPartitionResolverProxy^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IFixedPartitionResolver
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IFixedPartitionResolverProxy^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedPartitionResolver.cpp b/clicache/src/impl/ManagedPartitionResolver.cpp
new file mode 100644
index 0000000..51279c5
--- /dev/null
+++ b/clicache/src/impl/ManagedPartitionResolver.cpp
@@ -0,0 +1,252 @@
+/*
+ * 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.
+ */
+
+//#include "../geode_includes.hpp"
+#include "ManagedPartitionResolver.hpp"
+#include "../IPartitionResolver.hpp"
+#include "../Region.hpp"
+#include "../Log.hpp"
+#include "ManagedString.hpp"
+//#include "../../../Region.hpp"
+#include "../EntryEvent.hpp"
+#include "ManagedString.hpp"
+#include "../ExceptionTypes.hpp"
+#include "SafeConvert.hpp"
+#include "PartitionResolver.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Reflection;
+
+namespace apache
+{
+ namespace geode
+ {
+ namespace client
+ {
+
+ PartitionResolver* ManagedPartitionResolverGeneric::create(const char* assemblyPath,
+ const char* factoryFunctionName)
+ {
+ try
+ {
+ String^ mg_assemblyPath =
+ Apache::Geode::Client::ManagedString::Get(assemblyPath);
+ String^ mg_factoryFunctionName =
+ Apache::Geode::Client::ManagedString::Get(factoryFunctionName);
+ String^ mg_typeName = nullptr;
+
+ String^ mg_genericKey = nullptr;
+ String^ mg_genericVal = nullptr;
+
+ System::Int32 dotIndx = -1;
+ System::Int32 genericsOpenIndx = -1;
+ System::Int32 genericsCloseIndx = -1;
+ System::Int32 commaIndx = -1;
+
+ if (mg_factoryFunctionName == nullptr ||
+ (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain type name";
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain any generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 ||
+ genericsOpenIndx > genericsCloseIndx)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameters";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 ||
+ (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx))
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Factory function name '";
+ ex_str += factoryFunctionName;
+ ex_str += "' does not contain expected generic type parameter comma separator";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx));
+ mg_typeName = typeBuilder->ToString();
+ mg_genericKey = mg_factoryFunctionName->Substring(genericsOpenIndx + 1, commaIndx - genericsOpenIndx - 1);
+ mg_genericKey = mg_genericKey->Trim();
+ mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1);
+ mg_genericVal = mg_genericVal->Trim();
+ mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1);
+
+ Apache::Geode::Client::Log::Fine(
+ "Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.",
+ mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName);
+
+ typeBuilder->Append("`2");
+ mg_typeName = typeBuilder->ToString();
+
+ Assembly^ assmb = nullptr;
+ try
+ {
+ assmb = Assembly::Load(mg_assemblyPath);
+ }
+ catch (System::Exception^)
+ {
+ assmb = nullptr;
+ }
+ if (assmb == nullptr)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Could not load assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName);
+
+ Type^ typeInst = assmb->GetType(mg_typeName, false, true);
+
+ if (typeInst != nullptr)
+ {
+ array<Type^>^ types = gcnew array<Type^>(2);
+ types[0] = Type::GetType(mg_genericKey, false, true);
+ types[1] = Type::GetType(mg_genericVal, false, true);
+
+ if (types[0] == nullptr || types[1] == nullptr)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Could not get both generic type argument instances";
+ throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
+ }
+
+ typeInst = typeInst->MakeGenericType(types);
+ Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName);
+
+ MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName,
+ BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase);
+
+ if (mInfo != nullptr)
+ {
+ Object^ managedptr = nullptr;
+ try
+ {
+ managedptr = mInfo->Invoke(typeInst, nullptr);
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::Log::Debug("{0}: {1}", ex->GetType()->Name, ex->Message);
+ managedptr = nullptr;
+ }
+ if (managedptr == nullptr)
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Could not create "
+ "object on invoking factory function [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+
+ ManagedPartitionResolverGeneric * mgpr = new ManagedPartitionResolverGeneric(managedptr);
+
+ Type^ prgType = Type::GetType("Apache.Geode.Client.PartitionResolverGeneric`2");
+ prgType = prgType->MakeGenericType(types);
+ Object^ prg = Activator::CreateInstance(prgType);
+
+ mInfo = prgType->GetMethod("SetPartitionResolver");
+ array<Object^>^ params = gcnew array<Object^>(1);
+ params[0] = managedptr;
+ mInfo->Invoke(prg, params);
+
+ mgpr->setptr((Apache::Geode::Client::IPartitionResolverProxy^)prg);
+
+ return mgpr;
+ }
+ else
+ {
+ std::string ex_str = "ManagedPartitionResolverGeneric: Could not load "
+ "function with name [";
+ ex_str += factoryFunctionName;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ else
+ {
+ Apache::Geode::Client::ManagedString typeName(mg_typeName);
+ std::string ex_str = "ManagedPartitionResolverGeneric: Could not load type [";
+ ex_str += typeName.CharPtr;
+ ex_str += "] in assembly: ";
+ ex_str += assemblyPath;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ }
+ catch (const apache::geode::client::Exception&)
+ {
+ throw;
+ }
+ catch (System::Exception^ ex)
+ {
+ Apache::Geode::Client::ManagedString mg_exStr(ex->ToString());
+ std::string ex_str = "ManagedPartitionResolverGeneric: Got an exception while "
+ "loading managed library: ";
+ ex_str += mg_exStr.CharPtr;
+ throw IllegalArgumentException(ex_str.c_str());
+ }
+ return NULL;
+ }
+
+ CacheableKeyPtr ManagedPartitionResolverGeneric::getRoutingObject(const EntryEvent& key)
+ {
+ try {
+ return m_managedptr->getRoutingObject(key);
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return nullptr;
+ }
+
+ const char* ManagedPartitionResolverGeneric::getName()
+ {
+ try {
+ return m_managedptr->getName();
+ }
+ catch (Apache::Geode::Client::GeodeException^ ex) {
+ ex->ThrowNative();
+ }
+ catch (System::Exception^ ex) {
+ Apache::Geode::Client::GeodeException::ThrowNative(ex);
+ }
+ return NULL;
+ }
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/impl/ManagedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/impl/ManagedPartitionResolver.hpp b/clicache/src/impl/ManagedPartitionResolver.hpp
new file mode 100644
index 0000000..9640cf9
--- /dev/null
+++ b/clicache/src/impl/ManagedPartitionResolver.hpp
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+#include "begin_native.hpp"
+#include <geode/PartitionResolver.hpp>
+#include "end_native.hpp"
+
+
+#include "PartitionResolver.hpp"
+
+using namespace System;
+
+namespace apache {
+ namespace geode {
+ namespace client {
+
+ /// <summary>
+ /// Wraps the managed <see cref="Apache.Geode.Client.IPartitionResolver" />
+ /// object and implements the native <c>apache::geode::client::PartitionResolver</c> interface.
+ /// </summary>
+ class ManagedPartitionResolverGeneric
+ : public PartitionResolver
+ {
+ public:
+
+ /// <summary>
+ /// Constructor to initialize with the provided managed object.
+ /// </summary>
+ /// <param name="userptr">
+ /// The managed object.
+ /// </param>
+ inline ManagedPartitionResolverGeneric(Object^ userptr) : m_userptr(userptr) { }
+
+ /// <summary>
+ /// Static function to create a <c>ManagedPartitionResolver</c> using given
+ /// managed assembly path and given factory function.
+ /// </summary>
+ /// <param name="assemblyPath">
+ /// The path of the managed assembly that contains the <c>IPartitionResolver</c>
+ /// factory function.
+ /// </param>
+ /// <param name="factoryFunctionName">
+ /// The name of the factory function of the managed class for creating
+ /// an object that implements <c>IPartitionResolver</c>.
+ /// This should be a static function of the format
+ /// {Namespace}.{Class Name}.{Method Name}.
+ /// </param>
+ /// <exception cref="IllegalArgumentException">
+ /// If the managed library cannot be loaded or the factory function fails.
+ /// </exception>
+ static PartitionResolver* create(const char* assemblyPath,
+ const char* factoryFunctionName);
+
+ /// <summary>
+ /// Destructor -- does nothing.
+ /// </summary>
+ virtual ~ManagedPartitionResolverGeneric() { }
+
+ /// <summary>
+ /// return object associated with entry event which allows the Partitioned Region to store associated data together.
+ /// </summary>
+ /// <remarks>
+ /// throws RuntimeException - any exception thrown will terminate the operation and the exception will be passed to the
+ /// calling thread.
+ /// </remarks>
+ /// <param name="key">
+ /// key the detail of the entry event.
+ /// </param>
+
+ virtual CacheableKeyPtr getRoutingObject(const EntryEvent& key);
+
+ /// <summary>
+ /// Returns the name of the PartitionResolver.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This function does not throw any exception.
+ /// </para>
+ /// <returns>
+ /// the name of the PartitionResolver
+ /// </returns>
+ /// </remarks>
+ virtual const char* getName();
+
+
+ /// <summary>
+ /// Returns the wrapped managed object reference.
+ /// </summary>
+ inline Apache::Geode::Client::IPartitionResolverProxy^ ptr() const
+ {
+ return m_managedptr;
+ }
+
+ inline void setptr(Apache::Geode::Client::IPartitionResolverProxy^ managedptr)
+ {
+ m_managedptr = managedptr;
+ }
+
+ inline Object^ userptr() const
+ {
+ return m_userptr;
+ }
+
+ private:
+
+ /// <summary>
+ /// Using gcroot to hold the managed delegate pointer (since it cannot be stored directly).
+ /// Note: not using auto_gcroot since it will result in 'Dispose' of the IPartitionResolver
+ /// to be called which is not what is desired when this object is destroyed. Normally this
+ /// managed object may be created by the user and will be handled automatically by the GC.
+ /// </summary>
+ gcroot<Apache::Geode::Client::IPartitionResolverProxy^> m_managedptr;
+
+ gcroot<Object^> m_userptr;
+ };
+
+ } // namespace client
+ } // namespace geode
+} // namespace apache
[41/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientCallbackArgN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientCallbackArgN.cs b/clicache/integration-test/ThinClientCallbackArgN.cs
new file mode 100644
index 0000000..8d8ff5b
--- /dev/null
+++ b/clicache/integration-test/ThinClientCallbackArgN.cs
@@ -0,0 +1,726 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+
+ using Apache.Geode.Client;
+
+ using GIRegion = Apache.Geode.Client.IRegion<int, object>;
+ using System.Collections.Generic;
+
+ public class CallbackListener : CacheListenerAdapter<int, object>
+ {
+ int m_creates;
+ int m_updates;
+ int m_invalidates;
+ int m_destroys;
+ int m_regionInvalidate;
+ int m_regionDestroy;
+ int m_regionClear;
+ object m_callbackArg;
+
+ #region Getters
+
+ public int Creates
+ {
+ get { return m_creates; }
+ }
+
+ public int Updates
+ {
+ get { return m_updates; }
+ }
+
+ public int Invalidates
+ {
+ get { return m_invalidates; }
+ }
+
+ public int Destroys
+ {
+ get { return m_destroys; }
+ }
+
+ public int RegionInvalidates
+ {
+ get { return m_regionInvalidate; }
+ }
+
+ public int RegionDestroys
+ {
+ get { return m_regionDestroy; }
+ }
+ public int RegionClear
+ {
+ get { return m_regionClear; }
+ }
+ public object CallbackArg
+ {
+ get { return m_callbackArg; }
+ }
+ #endregion
+
+ public void SetCallbackArg(object callbackArg)
+ {
+ m_callbackArg = callbackArg;
+ }
+
+ private void check(object eventCallback, ref int updateCount)
+ {
+ Log.Fine("check..");
+ if (eventCallback != null)
+ {
+ string callbackArg = eventCallback as string;
+
+ if (callbackArg != null)
+ {
+ string cs = m_callbackArg as string;
+ if (cs != null)
+ {
+ if (callbackArg == cs)
+ {
+ Log.Fine("value matched");
+ updateCount++;
+ }
+ else
+ Log.Fine("value matched NOT");
+ }
+ }
+ else
+ {
+ Log.Fine("Callbackarg is not cacheable string");
+ Portfolio pfCallback = eventCallback as Portfolio;
+ if (pfCallback != null)
+ {
+ Portfolio pf = m_callbackArg as Portfolio;
+ if (pf != null)
+ {
+ if (pf.Pkid == pfCallback.Pkid && pfCallback.ArrayNull == null
+ && pfCallback.ArrayZeroSize != null && pfCallback.ArrayZeroSize.Length == 0)
+ {
+ Log.Fine("value matched");
+ updateCount++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void checkCallbackArg(EntryEvent<int, object> entryEvent, ref int updateCount)
+ {
+ check(entryEvent.CallbackArgument, ref updateCount);
+ }
+
+ private void checkCallbackArg(RegionEvent<int, object> regionEvent, ref int updateCount)
+ {
+ check(regionEvent.CallbackArgument, ref updateCount);
+ }
+
+ #region CacheListener Members
+
+ public override void AfterCreate(EntryEvent<int, object> ev)
+ {
+ checkCallbackArg(ev, ref m_creates);
+ }
+
+ public override void AfterUpdate(EntryEvent<int, object> ev)
+ {
+ checkCallbackArg(ev, ref m_updates);
+ }
+
+ public override void AfterInvalidate(EntryEvent<int, object> ev)
+ {
+ checkCallbackArg(ev, ref m_invalidates);
+ }
+
+ public override void AfterDestroy(EntryEvent<int, object> ev)
+ {
+ checkCallbackArg(ev, ref m_destroys);
+ }
+
+ public override void AfterRegionInvalidate(RegionEvent<int, object> rev)
+ {
+ checkCallbackArg(rev, ref m_regionInvalidate);
+ }
+
+ public override void AfterRegionDestroy(RegionEvent<int, object> rev)
+ {
+ checkCallbackArg(rev, ref m_regionDestroy);
+ }
+ public override void AfterRegionClear(RegionEvent<int, object> rev)
+ {
+ checkCallbackArg(rev, ref m_regionClear);
+ }
+
+ #endregion
+ }
+
+ [TestFixture]
+ [Category("generics")]
+ public class ThinClientCallbackArg : ThinClientRegionSteps
+ {
+ private TallyWriter<int, object> m_writer;
+ private TallyListener<int, object> m_listener;
+ private CallbackListener m_callbackListener;
+ RegionOperation o_region;
+ private UnitProcess m_client1, m_client2;
+ int key0 = 12;
+ object m_callbackarg = "Gemstone's Callback";
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ public void CreateRegion(string locators,
+ bool caching, bool listener, bool writer)
+ {
+ if (listener)
+ {
+ m_listener = new TallyListener<int, object>();
+
+ }
+ else
+ {
+ m_listener = null;
+ }
+ GIRegion region = null;
+ region = CacheHelper.CreateTCRegion_Pool<int, object>(RegionName, true, caching,
+ m_listener, locators, "__TESTPOOL1_", true);
+ if (listener)
+ m_listener.SetCallBackArg(key0);
+
+ if (writer)
+ {
+ m_writer = new TallyWriter<int, object>();
+
+ }
+ else
+ {
+ m_writer = null;
+ }
+ if (writer)
+ {
+ AttributesMutator<int, object> at = region.AttributesMutator;
+ at.SetCacheWriter(m_writer);
+ m_writer.SetCallBackArg(key0);
+ }
+ }
+
+ public void CreateRegion2(string locators,
+ bool caching, bool listener, bool writer)
+ {
+ CallbackListener callbackLis = null;
+ if (listener)
+ {
+ m_callbackListener = new CallbackListener();
+ m_callbackListener.SetCallbackArg(m_callbackarg);
+ callbackLis = m_callbackListener;
+ }
+ else
+ {
+ m_listener = null;
+ }
+ GIRegion region = null;
+ region = CacheHelper.CreateTCRegion_Pool<int, object>(RegionName, true, caching,
+ callbackLis, locators, "__TESTPOOL1_", true);
+ }
+
+ public void ValidateLocalListenerWriterData()
+ {
+ Thread.Sleep(2000);
+ Assert.AreEqual(true, m_writer.IsWriterInvoked, "Writer should be invoked");
+ Assert.AreEqual(true, m_listener.IsListenerInvoked, "Listener should be invoked");
+ Assert.AreEqual(true, m_writer.IsCallBackArgCalled, "Writer CallbackArg should be invoked");
+ Assert.AreEqual(true, m_listener.IsCallBackArgCalled, "Listener CallbackArg should be invoked");
+ m_listener.ShowTallies();
+ m_writer.ShowTallies();
+ }
+
+ public void ValidateEvents()
+ {
+ Assert.AreEqual(15, m_writer.Creates, "Should be 10 creates");
+ Assert.AreEqual(15, m_listener.Creates, "Should be 10 creates");
+ Assert.AreEqual(15, m_writer.Updates, "Should be 5 updates");
+ Assert.AreEqual(15, m_listener.Updates, "Should be 5 updates");
+ Assert.AreEqual(0, m_writer.Invalidates, "Should be 0 invalidates");
+ Assert.AreEqual(5, m_listener.Invalidates, "Should be 5 invalidates");
+ Assert.AreEqual(10, m_writer.Destroys, "Should be 10 destroys"); // 5 destroys + 5 removes
+ Assert.AreEqual(10, m_listener.Destroys, "Should be 10 destroys"); // 5 destroys + 5 removes
+ }
+
+ public void CallOp()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.PutOp(5, key0);
+ Thread.Sleep(1000); // let the events reach at other end.
+ o_region.PutOp(5, key0);
+ Thread.Sleep(1000);
+ o_region.InvalidateOp(5, key0);
+ Thread.Sleep(1000);
+ o_region.DestroyOp(5, key0);
+ Thread.Sleep(1000); // let the events reach at other end.
+ o_region.PutOp(5, key0);
+ Thread.Sleep(1000);
+ o_region.RemoveOp(5, key0);
+ Thread.Sleep(1000);
+ }
+
+ void RegisterPdxType8()
+ {
+ Serializable.RegisterPdxType(PdxTests.PdxTypes8.CreateDeserializable);
+ }
+
+ void runCallbackArgTest()
+ {
+ 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 client1, no-ack, cache-enabled, with listener and writer");
+ m_client1.Call(CreateRegion, CacheHelper.Locators,
+ true, true, true);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+
+ Util.Log("Creating region in client2 , no-ack, cache-enabled, with listener and writer");
+ m_client2.Call(CreateRegion, CacheHelper.Locators,
+ true, true, true);
+ m_client2.Call(RegisterAllKeys, new string[] { RegionName });
+
+ m_client2.Call(RegisterPdxType8);
+
+ m_client1.Call(CallOp);
+
+
+ m_client1.Call(ValidateLocalListenerWriterData);
+ m_client1.Call(ValidateEvents);
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ private bool m_isSet = false;
+ public void SetCallbackArg()
+ {
+ if (!m_isSet)
+ {
+ m_isSet = true;
+ m_callbackarg = new Portfolio(1, 1);
+ //TODO:;split
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ }
+ }
+
+ public void TestCreatesAndUpdates()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.Region.Add("Key-1", "Val-1", m_callbackarg);
+ o_region.Region.Put("Key-1", "NewVal-1", m_callbackarg);
+ Thread.Sleep(10000);
+ }
+
+ public void TestInvalidates()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.Region.GetLocalView().Add(1234, 1234, m_callbackarg);
+ o_region.Region.GetLocalView().Add(12345, 12345, m_callbackarg);
+ o_region.Region.GetLocalView().Add(12346, 12346, m_callbackarg);
+ o_region.Region.GetLocalView().Put(1234, "Val-1", m_callbackarg);
+ o_region.Region.GetLocalView().Invalidate(1234, m_callbackarg);
+ Assert.AreEqual(o_region.Region.GetLocalView().Remove(12345, 12345, m_callbackarg), true, "Result of remove should be true, as this value exists locally.");
+ Assert.AreEqual(o_region.Region.GetLocalView().ContainsKey(12345), false, "containsKey should be false");
+ Assert.AreEqual(o_region.Region.GetLocalView().Remove(12346, m_callbackarg), true, "Result of remove should be true, as this value exists locally.");
+ Assert.AreEqual(o_region.Region.GetLocalView().ContainsKey(12346), false, "containsKey should be false");
+ o_region.Region.Invalidate("Key-1", m_callbackarg);
+ o_region.Region.InvalidateRegion(m_callbackarg);
+ }
+
+ public void TestDestroy()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.Region.Remove("Key-1", m_callbackarg);
+ //o_region.Region.DestroyRegion(m_callbackarg);
+ }
+
+ public void TestRemove()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.Region.Remove("Key-1", "NewVal-1", m_callbackarg);
+ o_region.Region.DestroyRegion(m_callbackarg);
+ }
+
+ public void TestlocalClear()
+ {
+ o_region = new RegionOperation(RegionName);
+ o_region.Region.GetLocalView().Clear(m_callbackarg);
+ }
+ public void TestValidate()
+ {
+ Thread.Sleep(10000);
+ Assert.AreEqual(5, m_callbackListener.Creates, "Should be 5 creates");
+ Assert.AreEqual(3, m_callbackListener.Updates, "Should be 3 update");
+ Assert.AreEqual(2, m_callbackListener.Invalidates, "Should be 2 invalidate");
+ Assert.AreEqual(4, m_callbackListener.Destroys, "Should be 4 destroy");
+ Assert.AreEqual(1, m_callbackListener.RegionInvalidates, "Should be 1 region invalidates");
+ Assert.AreEqual(1, m_callbackListener.RegionDestroys, "Should be 1 regiondestroy");
+ Assert.AreEqual(1, m_callbackListener.RegionClear, "Should be 1 RegionClear");
+ }
+
+ void runCallbackArgTest2(int callbackArgChange)
+ {
+ if (callbackArgChange == 1)
+ {
+ //change now custom type
+ m_callbackarg = new Portfolio(1, 1);
+ m_client1.Call(SetCallbackArg);
+ m_client2.Call(SetCallbackArg);
+ }
+
+ m_callbackListener = new CallbackListener();
+ m_callbackListener.SetCallbackArg(m_callbackarg);
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription5N.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, cache-enabled, with listener and writer");
+ m_client1.Call(CreateRegion2, CacheHelper.Locators,
+ true, true, false);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+
+ Util.Log("Creating region in client2 , no-ack, cache-enabled, with listener and writer");
+ m_client2.Call(CreateRegion2, CacheHelper.Locators,
+ true, false, false);
+
+ m_client2.Call(TestCreatesAndUpdates);
+ m_client1.Call(TestInvalidates);
+ m_client2.Call(TestDestroy);
+ m_client2.Call(TestCreatesAndUpdates);
+ m_client1.Call(TestlocalClear);
+ m_client2.Call(TestRemove);
+ m_client1.Call(TestValidate);
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ private bool isRegistered = false;
+ public void registerDefaultCacheableType()
+ {
+ if (!isRegistered)
+ {
+ Serializable.RegisterTypeGeneric(DefaultType.CreateDeserializable, CacheHelper.DCache);
+ isRegistered = true;
+ }
+ }
+
+
+ public void CallOp2()
+ {
+ o_region = new RegionOperation(RegionName);
+ DefaultType dc = new DefaultType(true);
+ o_region.Region.Put("key-1", dc, null);
+ Thread.Sleep(1000); // let the events reach at other end.
+ }
+
+ public void ValidateData()
+ {
+ o_region = new RegionOperation(RegionName);
+ DefaultType dc = (DefaultType)o_region.Region.Get("key-1", null);
+
+ Assert.AreEqual(dc.CBool, true, "bool is not equal");
+ Assert.AreEqual(dc.CInt, 1000, "int is not equal");
+
+ int[] cia = dc.CIntArray;
+ Assert.IsNotNull(cia, "Int array is null");
+ Assert.AreEqual(3, cia.Length, "Int array are not three");
+
+ string[] csa = dc.CStringArray;
+ Assert.IsNotNull(csa, "String array is null");
+ Assert.AreEqual(2, csa.Length, "String array length is not two");
+
+ Assert.AreEqual(dc.CFileName, "geode.txt", "Cacheable filename is not equal");
+
+ /*
+ Assert.IsNotNull(dc.CHashSet, "hashset is null");
+ Assert.AreEqual(2, dc.CHashSet.Count, "hashset size is not two");
+ * */
+
+ Assert.IsNotNull(dc.CHashMap, "hashmap is null");
+ Assert.AreEqual(1, dc.CHashMap.Count, "hashmap size is not one");
+
+ //Assert.IsNotNull(dc.CDate, "Date is null");
+
+ Assert.IsNotNull(dc.CVector);
+ Assert.AreEqual(2, dc.CVector.Count, "Vector size is not two");
+
+ //Assert.IsNotNull(dc.CObject);
+ //Assert.AreEqual("key", ((CustomSerializableObject)dc.CObject).key, "Object key is not same");
+ //Assert.AreEqual("value", ((CustomSerializableObject)dc.CObject).value, "Object value is not same");
+ }
+
+ void runCallbackArgTest3()
+ {
+
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription6.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, cache-enabled, with listener and writer");
+ m_client1.Call(CreateRegion, CacheHelper.Locators,
+ true, false, false);
+ // m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+
+ Util.Log("Creating region in client2 , no-ack, cache-enabled, with listener and writer");
+ m_client2.Call(CreateRegion, CacheHelper.Locators,
+ true, false, false);
+
+ m_client1.Call(registerDefaultCacheableType);
+ m_client2.Call(registerDefaultCacheableType);
+
+ m_client2.Call(RegisterAllKeys, new string[] { RegionName });
+
+ m_client1.Call(CallOp2);
+
+ m_client2.Call(ValidateData);
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ public void TestRemoveAll()
+ {
+ o_region = new RegionOperation(RegionName);
+ ICollection<object> keys = new LinkedList<object>();
+ for(int i =0; i< 10; i++)
+ {
+ o_region.Region["Key-"+i] = "Value-"+i;
+ keys.Add("Key-" + i);
+ }
+ o_region.Region.RemoveAll(keys, m_callbackarg);
+ }
+
+ public void TestPutAll()
+ {
+ o_region = new RegionOperation(RegionName);
+ Dictionary<Object, Object> entryMap = new Dictionary<Object, Object>();
+ for (Int32 item = 0; item < 10; item++)
+ {
+ int K = item;
+ string value = item.ToString();
+ entryMap.Add(K, value);
+ }
+ o_region.Region.PutAll(entryMap, 15, m_callbackarg);
+ }
+
+ public void TestGetAll()
+ {
+ o_region = new RegionOperation(RegionName);
+ List<Object> keys = new List<Object>();
+ for (int item = 0; item < 10; item++)
+ {
+ Object K = item;
+ keys.Add(K);
+ }
+ Dictionary<Object, Object> values = new Dictionary<Object, Object>();
+ o_region.Region.GetAll(keys.ToArray(), values, null, true, m_callbackarg);
+
+ Dictionary<Object, Object>.Enumerator enumerator = values.GetEnumerator();
+ while (enumerator.MoveNext())
+ {
+ Util.Log("Values after getAll with CallBack Key = {0} Value = {1} ", enumerator.Current.Key.ToString(), enumerator.Current.Value.ToString());
+ }
+ }
+
+ public void TestValidateRemoveAllCallback()
+ {
+ Thread.Sleep(10000);
+ Assert.AreEqual(10, m_callbackListener.Destroys, "Should be 10 destroy");
+ }
+
+ public void TestValidatePutAllCallback()
+ {
+ Thread.Sleep(10000);
+ Assert.AreEqual(10, m_callbackListener.Creates, "Should be 10 creates");
+ Assert.AreEqual("Gemstone's Callback", m_callbackListener.CallbackArg, "CallBackArg for putAll should be same");
+ }
+
+ void runPutAllCallbackArgTest()
+ {
+ m_callbackListener = new CallbackListener();
+ m_callbackListener.SetCallbackArg(m_callbackarg);
+
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription5N.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, cache-enabled, with listener and writer");
+ m_client1.Call(CreateRegion2, CacheHelper.Locators,
+ true, true, false);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+ Util.Log("RegisterAllKeys completed..");
+
+ Util.Log("Creating region in client2 , no-ack, cache-enabled, with listener and writer");
+ m_client2.Call(CreateRegion2, CacheHelper.Locators,
+ true, false, false);
+ Util.Log("CreateRegion2 completed..");
+
+ m_client2.Call(TestPutAll);
+ Util.Log("TestPutAll completed..");
+ m_client1.Call(TestValidatePutAllCallback);
+ Util.Log("TestValidatePutAllCallback completed..");
+ m_client2.Call(TestGetAll);
+ Util.Log("TestGetAll completed..");
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ void runRemoveAllCallbackArgTest()
+ {
+
+ m_callbackListener = new CallbackListener();
+ m_callbackListener.SetCallbackArg(m_callbackarg);
+ CacheHelper.SetupJavaServers(true, "cacheserver_notify_subscription5N.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ Util.Log("Creating region in client1, no-ack, cache-enabled, with listener and writer");
+ m_client1.Call(CreateRegion2, CacheHelper.Locators,
+ true, true, false);
+ m_client1.Call(RegisterAllKeys, new string[] { RegionName });
+ Util.Log("RegisterAllKeys completed..");
+
+ Util.Log("Creating region in client2 , no-ack, cache-enabled, with listener and writer");
+ m_client2.Call(CreateRegion2,CacheHelper.Locators,
+ true, false, false);
+ Util.Log("CreateRegion2 completed..");
+
+ m_client2.Call(TestRemoveAll);
+ Util.Log("TestRemoveAll completed..");
+ m_client1.Call(TestValidateRemoveAllCallback);
+ Util.Log("TestValidateRemoveAllCallback completed..");
+
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ base.EndTest();
+ }
+
+ [Test]
+ public void ThinClientCallbackArgTest()
+ {
+ runCallbackArgTest();
+ }
+
+ [Test]
+ public void ThinClientCallbackArgTest2()
+ {
+ for (int i = 0; i < 2; i++)
+ {
+ runCallbackArgTest2(i);
+ }
+ }
+
+ [Test]
+ public void ThinClientCallbackArgTest3()
+ {
+ runCallbackArgTest3();
+ }
+
+ [Test]
+ public void RemoveAllCallbackArgTest()
+ {
+ runRemoveAllCallbackArgTest();
+ }
+
+ [Test]
+ public void PutAllCallbackArgTest()
+ {
+ runPutAllCallbackArgTest();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientConflationTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientConflationTestsN.cs b/clicache/integration-test/ThinClientConflationTestsN.cs
new file mode 100644
index 0000000..0672520
--- /dev/null
+++ b/clicache/integration-test/ThinClientConflationTestsN.cs
@@ -0,0 +1,354 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+ #region Listener
+ class ConflationListner<TKey, TValue> : ICacheListener<TKey, TValue>
+ {
+ #region Private members
+
+ private int m_events = 0;
+ private TValue m_value = default(TValue);
+ #endregion
+
+ public static ConflationListner<TKey, TValue> Create()
+ {
+ Util.Log(" ConflationListner Created");
+
+ return new ConflationListner<TKey, TValue>();
+ }
+
+ private void check(EntryEvent<TKey, TValue> ev)
+ {
+ m_events++;
+ TKey key = ev.Key;
+ TValue value = ev.NewValue;
+ m_value = value;
+ Util.Log("Region:{0}:: Key:{1}, Value:{2}", ev.Region.Name, key, value);
+
+ }
+
+ public void validate(bool conflation)
+ {
+ if (conflation)
+ {
+ string msg1 = string.Format("Conflation On: Expected 2 events but got {0}", m_events);
+ Assert.AreEqual(2, m_events, msg1);
+ }
+ else
+ {
+ string msg2 = string.Format("Conflation Off: Expected 5 events but got {0}", m_events);
+ Assert.AreEqual(5, m_events, msg2);
+ }
+
+ string msg3 = string.Format("Expected Value =5, Actual = {0}", m_value);
+ Assert.AreEqual(5, m_value, msg3);
+ }
+
+ #region ICacheListener Members
+
+ public virtual void AfterCreate(EntryEvent<TKey, TValue> ev)
+ {
+ check(ev);
+ }
+
+ public virtual void AfterUpdate(EntryEvent<TKey, TValue> ev)
+ {
+ check(ev);
+ }
+
+ public virtual void AfterDestroy(EntryEvent<TKey, TValue> ev) { }
+
+ public virtual void AfterInvalidate(EntryEvent<TKey, TValue> ev) { }
+
+ public virtual void AfterRegionDestroy(RegionEvent<TKey, TValue> ev) { }
+
+ public virtual void AfterRegionInvalidate(RegionEvent<TKey, TValue> ev) { }
+
+ public virtual void AfterRegionClear(RegionEvent<TKey, TValue> ev) { }
+
+ public virtual void AfterRegionLive(RegionEvent<TKey, TValue> ev)
+ {
+ Util.Log("DurableListener: Received AfterRegionLive event of region: {0}", ev.Region.Name);
+ }
+
+ public virtual void Close(IRegion<TKey, TValue> region) { }
+ public virtual void AfterRegionDisconnected(IRegion<TKey, TValue> region) { }
+
+ #endregion
+ }
+ #endregion
+
+ [TestFixture]
+ [Category("group1")]
+ [Category("unicast_only")]
+ [Category("generics")]
+
+ public class ThinClientConflationTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1, m_client2, m_feeder;
+ private string[] keys = { "Key-1", "Key-2", "Key-3", "Key-4", "Key-5" };
+
+ private static string[] DurableClientIds = { "DurableClientId1", "DurableClientId2" };
+
+ static string[] Regions = { "ConflatedRegion", "NonConflatedRegion" };
+
+ private static ConflationListner<object, object> m_listener1C1, m_listener2C1, m_listener1C2, m_listener2C2;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_feeder = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_feeder };
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ try
+ {
+ m_client1.Call(CacheHelper.Close);
+ m_client2.Call(CacheHelper.Close);
+ m_feeder.Call(CacheHelper.Close);
+ CacheHelper.ClearEndpoints();
+ }
+ finally
+ {
+ CacheHelper.StopJavaServers();
+ }
+ base.EndTest();
+ }
+
+ #region Common Functions
+
+ public void InitFeeder(string locators, int redundancyLevel)
+ {
+ CacheHelper.CreatePool<object, object>("__TESTPOOL1_", locators, (string)null, redundancyLevel, false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(Regions[0], false, false, null,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ CacheHelper.CreateTCRegion_Pool<object, object>(Regions[1], false, false, null,
+ CacheHelper.Locators, "__TESTPOOL1_", false);
+ }
+
+ public void InitDurableClient(int client, string locators, string conflation)
+ {
+ // Create DurableListener for first time and use same afterward.
+ ConflationListner<object, object> checker1 = null;
+ ConflationListner<object, object> checker2 = null;
+ string durableId = ThinClientConflationTests.DurableClientIds[client - 1];
+ if (client == 1)
+ {
+ ThinClientConflationTests.m_listener1C1 = ConflationListner<object, object>.Create();
+ ThinClientConflationTests.m_listener2C1 = ConflationListner<object, object>.Create();
+ checker1 = ThinClientConflationTests.m_listener1C1;
+ checker2 = ThinClientConflationTests.m_listener2C1;
+ }
+ else // client == 2
+ {
+ ThinClientConflationTests.m_listener1C2 = ConflationListner<object, object>.Create();
+ ThinClientConflationTests.m_listener2C2 = ConflationListner<object, object>.Create();
+ checker1 = ThinClientConflationTests.m_listener1C2;
+ checker2 = ThinClientConflationTests.m_listener2C2;
+ }
+ CacheHelper.InitConfigForConflation_Pool(locators, durableId, conflation);
+ CacheHelper.CreateTCRegion_Pool<object, object>(Regions[0], false, true, checker1,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(Regions[1], false, true, checker2,
+ CacheHelper.Locators, "__TESTPOOL1_", true);
+
+ //CacheHelper.DCache.ReadyForEvents();
+
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(Regions[0]);
+ region1.GetSubscriptionService().RegisterAllKeys(true);
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(Regions[1]);
+ region2.GetSubscriptionService().RegisterAllKeys(true);
+ }
+
+ public void ReadyForEvents()
+ {
+ CacheHelper.DCache.ReadyForEvents();
+ }
+
+ public void FeederUpdate(int keyIdx)
+ {
+ IRegion<object, object> region1 = CacheHelper.GetVerifyRegion<object, object>(Regions[0]);
+
+
+ region1[keys[keyIdx]] = 1;
+ region1[keys[keyIdx]] = 2;
+ region1[keys[keyIdx]] = 3;
+ region1[keys[keyIdx]] = 4;
+ region1[keys[keyIdx]] = 5;
+
+ IRegion<object, object> region2 = CacheHelper.GetVerifyRegion<object, object>(Regions[1]);
+
+ region2[keys[keyIdx]] = 1;
+ region2[keys[keyIdx]] = 2;
+ region2[keys[keyIdx]] = 3;
+ region2[keys[keyIdx]] = 4;
+ region2[keys[keyIdx]] = 5;
+ }
+
+ public void ClientDown()
+ {
+ CacheHelper.Close();
+ }
+
+
+ public void KillServer()
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ public delegate void KillServerDelegate();
+
+ #endregion
+
+
+ public void Validate(int client, int region, bool conflate)
+ {
+ ConflationListner<object, object> checker = null;
+ if (client == 1)
+ {
+ if (region == 1)
+ checker = ThinClientConflationTests.m_listener1C1;
+ else
+ checker = ThinClientConflationTests.m_listener2C1;
+ }
+ else // client == 2
+ {
+ if (region == 1)
+ checker = ThinClientConflationTests.m_listener1C2;
+ else
+ checker = ThinClientConflationTests.m_listener2C2;
+ }
+
+ if (checker != null)
+ {
+ checker.validate(conflate);
+ }
+ else
+ {
+ Assert.Fail("Checker is NULL!");
+ }
+ }
+
+ void runConflationBasic()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_conflation.xml");
+
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_feeder.Call(InitFeeder, CacheHelper.Locators, 0);
+ Util.Log("Feeder initialized.");
+
+ //Test "true" and "false" settings
+ m_client1.Call(InitDurableClient, 1, CacheHelper.Locators, "true");
+ m_client2.Call(InitDurableClient, 2, CacheHelper.Locators, "false");
+ Util.Log("Clients initialized for first time.");
+
+ m_feeder.Call(FeederUpdate, 0);
+ Util.Log("Feeder performed first update.");
+
+ Util.Log("Client1 sending readyForEvents().");
+ m_client1.Call(ReadyForEvents);
+ Thread.Sleep(5000);
+ Util.Log("Validating Client 1 Region 1.");
+ m_client1.Call(Validate, 1, 1, true);
+ Util.Log("Validating Client 1 Region 2.");
+ m_client1.Call(Validate, 1, 2, true);
+
+ Util.Log("Client2 sending readyForEvents().");
+ m_client2.Call(ReadyForEvents);
+ Thread.Sleep(5000);
+ Util.Log("Validating Client 2 Region 1.");
+ m_client2.Call(Validate, 2, 1, false);
+ Util.Log("Validating Client 2 Region 1.");
+ m_client2.Call(Validate, 2, 2, false);
+
+ //Close Clients.
+ m_client1.Call(ClientDown);
+ m_client2.Call(ClientDown);
+ Util.Log("First step complete, tested true/false options.");
+
+ //Test "server" and not set settings
+ m_client1.Call(InitDurableClient, 1, CacheHelper.Locators, "server");
+ m_client2.Call(InitDurableClient, 2, CacheHelper.Locators, "");
+ Util.Log("Clients initialized second times.");
+
+ m_feeder.Call(FeederUpdate, 1);
+ Util.Log("Feeder performed second update.");
+
+ Util.Log("Client1 sending readyForEvents().");
+ m_client1.Call(ReadyForEvents);
+ Thread.Sleep(5000);
+ Util.Log("Validating Client 1 Region 1.");
+ m_client1.Call(Validate, 1, 1, true);
+ Util.Log("Validating Client 1 Region 2.");
+ m_client1.Call(Validate, 1, 2, false);
+
+ Util.Log("Client2 sending readyForEvents().");
+ m_client2.Call(ReadyForEvents);
+ Thread.Sleep(5000);
+ Util.Log("Validating Client 2 Region 1.");
+ m_client2.Call(Validate, 2, 1, true);
+ Util.Log("Validating Client 2 Region 2.");
+ m_client2.Call(Validate, 2, 2, false);
+
+ //Close Clients.
+ m_client1.Call(ClientDown);
+ m_client2.Call(ClientDown);
+ m_feeder.Call(ClientDown);
+ Util.Log("Feeder and Clients closed.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+
+ CacheHelper.ClearLocators();
+ CacheHelper.ClearEndpoints();
+ }
+
+ [Test]
+ public void ConflationBasic()
+ {
+ runConflationBasic();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientCqIRTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientCqIRTestsN.cs b/clicache/integration-test/ThinClientCqIRTestsN.cs
new file mode 100644
index 0000000..ea90850
--- /dev/null
+++ b/clicache/integration-test/ThinClientCqIRTestsN.cs
@@ -0,0 +1,250 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+
+ [TestFixture]
+ [Category("group2")]
+ [Category("unicast_only")]
+ [Category("generics")]
+
+ public class ThinClientCqIRTests : ThinClientRegionSteps
+ {
+ #region Private members
+
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+ "Portfolios3" };
+ private static string QERegionName = "Portfolios";
+ private static string CqName = "MyCq";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ m_client1.Call(InitClient);
+ m_client2.Call(InitClient);
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTest();
+ }
+
+
+ public void InitClient()
+ {
+ CacheHelper.Init();
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ignore since we run multiple iterations for pool and non pool configs
+ }
+ }
+ public void StepOne(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+ region.CreateSubRegion(QueryRegionNames[1], regattrs);
+ }
+
+ public void StepTwo()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+ IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+ IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+
+ qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+
+ public void StepTwoQT()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ qh.PopulatePortfolioData(region0, 100, 20, 100);
+ qh.PopulatePositionData(subRegion0, 100, 20);
+ }
+
+ public void StepOneQE(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 100);
+ Portfolio p3 = new Portfolio(3, 100);
+ Portfolio p4 = new Portfolio(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ ICqListener<object, object> cqLstner = new MyCqListener<object, object>();
+ cqFac.AddCqListener(cqLstner);
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry = qs.NewCq(CqName, "select * from /" + QERegionName + " p where p.ID!=2", cqAttr, false);
+ ICqResults<object> results = qry.ExecuteWithInitialResults();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ Util.Log("Results size {0}.", results.Size);
+
+ SelectResultsIterator<object> iter = results.GetIterator();
+
+ while (iter.HasNext)
+ {
+ object item = iter.Next();
+ if (item != null)
+ {
+ Struct st = item as Struct;
+
+ string key = st["key"] as string;
+
+ Assert.IsNotNull(key, "key is null");
+
+ Portfolio port = st["value"] as Portfolio;
+
+ if (port == null)
+ {
+ Position pos = st["value"] as Position;
+ if (pos == null)
+ {
+ string cs = item as string;
+
+ if (cs == null)
+ {
+ Assert.Fail("value is null");
+ Util.Log("Query got other/unknown object.");
+ }
+ else
+ {
+ Util.Log("Query got string : {0}.", cs);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Position object with secId {0}, shares {1}.", pos.SecId, pos.SharesOutstanding);
+ }
+ }
+ else
+ {
+ Util.Log("Query got Portfolio object with ID {0}, pkid {1}.", port.ID, port.Pkid);
+ }
+ }
+ }
+ qry = qs.GetCq(CqName);
+ qry.Stop();
+ qry.Close();
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+
+ void runCqQueryIRTest()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwo);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepOneQE, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ [Test]
+ public void CqQueryIRTest()
+ {
+ runCqQueryIRTest();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ThinClientCqTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ThinClientCqTestsN.cs b/clicache/integration-test/ThinClientCqTestsN.cs
new file mode 100644
index 0000000..2dd8118
--- /dev/null
+++ b/clicache/integration-test/ThinClientCqTestsN.cs
@@ -0,0 +1,1025 @@
+/*
+ * 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.Collections.Generic;
+using System.Threading;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client.Tests;
+ using Apache.Geode.Client;
+
+ public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+ {
+ #region Private members
+ private bool m_failedOver = false;
+ private UInt32 m_eventCountBefore = 0;
+ private UInt32 m_errorCountBefore = 0;
+ private UInt32 m_eventCountAfter = 0;
+ private UInt32 m_errorCountAfter = 0;
+
+ #endregion
+
+ #region Public accessors
+
+ public void failedOver()
+ {
+ m_failedOver = true;
+ }
+ public UInt32 getEventCountBefore()
+ {
+ return m_eventCountBefore;
+ }
+ public UInt32 getErrorCountBefore()
+ {
+ return m_errorCountBefore;
+ }
+ public UInt32 getEventCountAfter()
+ {
+ return m_eventCountAfter;
+ }
+ public UInt32 getErrorCountAfter()
+ {
+ return m_errorCountAfter;
+ }
+ #endregion
+
+ public virtual void OnEvent(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("MyCqListener::OnEvent called");
+ if (m_failedOver == true)
+ m_eventCountAfter++;
+ else
+ m_eventCountBefore++;
+
+ //IGeodeSerializable val = ev.getNewValue();
+ //ICacheableKey key = ev.getKey();
+
+ TResult val = (TResult)ev.getNewValue();
+ /*ICacheableKey*/
+ TKey key = ev.getKey();
+
+ CqOperationType opType = ev.getQueryOperation();
+ //CacheableString keyS = key as CacheableString;
+ string keyS = key.ToString(); //as string;
+ Portfolio pval = val as Portfolio;
+ PortfolioPdx pPdxVal = val as PortfolioPdx;
+ Assert.IsTrue((pPdxVal != null) || (pval != null));
+ //string opStr = "DESTROY";
+ /*if (opType == CqOperationType.OP_TYPE_CREATE)
+ opStr = "CREATE";
+ else if (opType == CqOperationType.OP_TYPE_UPDATE)
+ opStr = "UPDATE";*/
+
+ //Util.Log("key {0}, value ({1},{2}), op {3}.", keyS,
+ // pval.ID, pval.Pkid, opStr);
+ }
+ public virtual void OnError(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("MyCqListener::OnError called");
+ if (m_failedOver == true)
+ m_errorCountAfter++;
+ else
+ m_errorCountBefore++;
+ }
+ public virtual void Close()
+ {
+ Util.Log("MyCqListener::close called");
+ }
+ public virtual void Clear()
+ {
+ Util.Log("MyCqListener::Clear called");
+ m_eventCountBefore = 0;
+ m_errorCountBefore = 0;
+ m_eventCountAfter = 0;
+ m_errorCountAfter = 0;
+ }
+ }
+
+ public class MyCqListener1<TKey, TResult> : ICqListener<TKey, TResult>
+ {
+ public static UInt32 m_cntEvents = 0;
+
+ public virtual void OnEvent(CqEvent<TKey, TResult> ev)
+ {
+ m_cntEvents++;
+ Util.Log("MyCqListener1::OnEvent called");
+ Object val = (Object)ev.getNewValue();
+ Object pkey = (Object)ev.getKey();
+ int value = (int)val;
+ int key = (int)pkey;
+ CqOperationType opType = ev.getQueryOperation();
+ String opStr = "Default";
+ if (opType == CqOperationType.OP_TYPE_CREATE)
+ opStr = "CREATE";
+ else if (opType == CqOperationType.OP_TYPE_UPDATE)
+ opStr = "UPDATE";
+
+ Util.Log("MyCqListener1::OnEvent called with {0} , key = {1}, value = {2} ",
+ opStr, key, value);
+ }
+ public virtual void OnError(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("MyCqListener1::OnError called");
+ }
+ public virtual void Close()
+ {
+ Util.Log("MyCqListener1::close called");
+ }
+ }
+
+
+
+ public class MyCqStatusListener<TKey, TResult> : ICqStatusListener<TKey, TResult>
+ {
+ #region Private members
+ private bool m_failedOver = false;
+ private UInt32 m_eventCountBefore = 0;
+ private UInt32 m_errorCountBefore = 0;
+ private UInt32 m_eventCountAfter = 0;
+ private UInt32 m_errorCountAfter = 0;
+ private UInt32 m_CqConnectedCount = 0;
+ private UInt32 m_CqDisConnectedCount = 0;
+
+ #endregion
+
+ #region Public accessors
+
+ public MyCqStatusListener(int id)
+ {
+ }
+
+ public void failedOver()
+ {
+ m_failedOver = true;
+ }
+ public UInt32 getEventCountBefore()
+ {
+ return m_eventCountBefore;
+ }
+ public UInt32 getErrorCountBefore()
+ {
+ return m_errorCountBefore;
+ }
+ public UInt32 getEventCountAfter()
+ {
+ return m_eventCountAfter;
+ }
+ public UInt32 getErrorCountAfter()
+ {
+ return m_errorCountAfter;
+ }
+ public UInt32 getCqConnectedCount()
+ {
+ return m_CqConnectedCount;
+ }
+ public UInt32 getCqDisConnectedCount()
+ {
+ return m_CqDisConnectedCount;
+ }
+ #endregion
+
+ public virtual void OnEvent(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("MyCqStatusListener::OnEvent called");
+ if (m_failedOver == true)
+ m_eventCountAfter++;
+ else
+ m_eventCountBefore++;
+
+ TResult val = (TResult)ev.getNewValue();
+ TKey key = ev.getKey();
+
+ CqOperationType opType = ev.getQueryOperation();
+ string keyS = key.ToString(); //as string;
+ }
+ public virtual void OnError(CqEvent<TKey, TResult> ev)
+ {
+ Util.Log("MyCqStatusListener::OnError called");
+ if (m_failedOver == true)
+ m_errorCountAfter++;
+ else
+ m_errorCountBefore++;
+ }
+ public virtual void Close()
+ {
+ Util.Log("MyCqStatusListener::close called");
+ }
+ public virtual void OnCqConnected()
+ {
+ m_CqConnectedCount++;
+ Util.Log("MyCqStatusListener::OnCqConnected called");
+ }
+ public virtual void OnCqDisconnected()
+ {
+ m_CqDisConnectedCount++;
+ Util.Log("MyCqStatusListener::OnCqDisconnected called");
+ }
+
+ public virtual void Clear()
+ {
+ Util.Log("MyCqStatusListener::Clear called");
+ m_eventCountBefore = 0;
+ m_errorCountBefore = 0;
+ m_eventCountAfter = 0;
+ m_errorCountAfter = 0;
+ m_CqConnectedCount = 0;
+ m_CqDisConnectedCount = 0;
+ }
+ }
+
+ [TestFixture]
+ [Category("group3")]
+ [Category("unicast_only")]
+ [Category("generics")]
+
+ public class ThinClientCqTests : ThinClientRegionSteps
+ {
+ #region Private members
+ private static bool m_usePdxObjects = false;
+ private UnitProcess m_client1;
+ private UnitProcess m_client2;
+ private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
+ "Portfolios3" };
+ private static string QERegionName = "Portfolios";
+ private static string CqName = "MyCq";
+
+ private static string CqName1 = "testCQAllServersLeave";
+ private static string CqName2 = "testCQAllServersLeave1";
+
+ private static string CqQuery1 = "select * from /DistRegionAck";
+ private static string CqQuery2 = "select * from /DistRegionAck1";
+ //private static string CqName1 = "MyCq1";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ m_client1.Call(InitClient);
+ m_client2.Call(InitClient);
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.StopJavaServers();
+ base.EndTest();
+ }
+
+
+ public void InitClient()
+ {
+ CacheHelper.Init();
+ try
+ {
+ Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable, CacheHelper.DCache);
+ Serializable.RegisterTypeGeneric(Position.CreateDeserializable, CacheHelper.DCache);
+ }
+ catch (IllegalStateException)
+ {
+ // ignore since we run multiple iterations for pool and non pool configs
+ }
+ }
+ public void StepOne(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[0], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[1], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[2], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>(QueryRegionNames[3], true, true,
+ null, locators, "__TESTPOOL1_", true);
+ CacheHelper.CreateTCRegion_Pool<object, object>("DistRegionAck", true, true,
+ null, locators, "__TESTPOOL1_", true);
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ Apache.Geode.Client.RegionAttributes<object, object> regattrs = region.Attributes;
+ region.CreateSubRegion(QueryRegionNames[1], regattrs);
+ }
+
+ public void StepTwo(bool usePdxObject)
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+ IRegion<object, object> region1 = CacheHelper.GetRegion<object, object>(QueryRegionNames[1]);
+ IRegion<object, object> region2 = CacheHelper.GetRegion<object, object>(QueryRegionNames[2]);
+ IRegion<object, object> region3 = CacheHelper.GetRegion<object, object>(QueryRegionNames[3]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+ Util.Log("Object type is pdx = " + m_usePdxObjects);
+
+ Util.Log("SetSize {0}, NumSets {1}.", qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+
+ if (!usePdxObject)
+ {
+ qh.PopulatePortfolioData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePositionData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+ else
+ {
+ Serializable.RegisterPdxType(PortfolioPdx.CreateDeserializable);
+ Serializable.RegisterPdxType(PositionPdx.CreateDeserializable);
+ qh.PopulatePortfolioPdxData(region0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(subRegion0, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region1, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region2, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ qh.PopulatePortfolioPdxData(region3, qh.PortfolioSetSize,
+ qh.PortfolioNumSets);
+ }
+ }
+
+ public void StepTwoQT()
+ {
+ IRegion<object, object> region0 = CacheHelper.GetRegion<object, object>(QueryRegionNames[0]);
+ IRegion<object, object> subRegion0 = region0.GetSubRegion(QueryRegionNames[1]);
+
+ QueryHelper<object, object> qh = QueryHelper<object, object>.GetHelper(CacheHelper.DCache);
+
+ qh.PopulatePortfolioData(region0, 100, 20, 100);
+ qh.PopulatePositionData(subRegion0, 100, 20);
+ }
+
+ public void StepOneQE(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 100);
+ Portfolio p3 = new Portfolio(3, 100);
+ Portfolio p4 = new Portfolio(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ ICqListener<object, object> cqLstner = new MyCqListener<object, object>();
+ cqFac.AddCqListener(cqLstner);
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry = qs.NewCq(CqName, "select * from /" + QERegionName + " p where p.ID!=2", cqAttr, false);
+ qry.Execute();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry = qs.GetCq(CqName);
+
+ CqServiceStatistics cqSvcStats = qs.GetCqStatistics();
+ Assert.AreEqual(1, cqSvcStats.numCqsActive());
+ Assert.AreEqual(1, cqSvcStats.numCqsCreated());
+ Assert.AreEqual(1, cqSvcStats.numCqsOnClient());
+
+ cqAttr = qry.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ Assert.IsNotNull(vl);
+ Assert.AreEqual(1, vl.Length);
+ cqLstner = vl[0];
+ Assert.IsNotNull(cqLstner);
+ MyCqListener<object, object> myLisner = (MyCqListener<object, object>)cqLstner;// as MyCqListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myLisner.getEventCountBefore(), myLisner.getErrorCountBefore());
+
+ CqStatistics cqStats = qry.GetStatistics();
+ Assert.AreEqual(cqStats.numEvents(), myLisner.getEventCountBefore());
+ if (myLisner.getEventCountBefore() + myLisner.getErrorCountBefore() == 0)
+ {
+ Assert.Fail("cq before count zero");
+ }
+ qry.Stop();
+ Assert.AreEqual(1, cqSvcStats.numCqsStopped());
+ qry.Close();
+ Assert.AreEqual(1, cqSvcStats.numCqsClosed());
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+
+ public void StepOnePdxQE(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ PortfolioPdx p1 = new PortfolioPdx(1, 100);
+ PortfolioPdx p2 = new PortfolioPdx(2, 100);
+ PortfolioPdx p3 = new PortfolioPdx(3, 100);
+ PortfolioPdx p4 = new PortfolioPdx(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ ICqListener<object, object> cqLstner = new MyCqListener<object, object>();
+ cqFac.AddCqListener(cqLstner);
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry = qs.NewCq(CqName, "select * from /" + QERegionName + " p where p.ID!=2", cqAttr, false);
+ qry.Execute();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry = qs.GetCq(CqName);
+
+ CqServiceStatistics cqSvcStats = qs.GetCqStatistics();
+ Assert.AreEqual(1, cqSvcStats.numCqsActive());
+ Assert.AreEqual(1, cqSvcStats.numCqsCreated());
+ Assert.AreEqual(1, cqSvcStats.numCqsOnClient());
+
+ cqAttr = qry.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ Assert.IsNotNull(vl);
+ Assert.AreEqual(1, vl.Length);
+ cqLstner = vl[0];
+ Assert.IsNotNull(cqLstner);
+ MyCqListener<object, object> myLisner = (MyCqListener<object, object>)cqLstner;// as MyCqListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myLisner.getEventCountBefore(), myLisner.getErrorCountBefore());
+
+ CqStatistics cqStats = qry.GetStatistics();
+ Assert.AreEqual(cqStats.numEvents(), myLisner.getEventCountBefore());
+ if (myLisner.getEventCountBefore() + myLisner.getErrorCountBefore() == 0)
+ {
+ Assert.Fail("cq before count zero");
+ }
+ qry.Stop();
+ Assert.AreEqual(1, cqSvcStats.numCqsStopped());
+ qry.Close();
+ Assert.AreEqual(1, cqSvcStats.numCqsClosed());
+ // Bring down the region
+ region.GetLocalView().DestroyRegion();
+ }
+ public void KillServer()
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ }
+
+ public delegate void KillServerDelegate();
+
+ /*
+ public void StepOneFailover()
+ {
+ // This is here so that Client1 registers information of the cacheserver
+ // that has been already started
+ CacheHelper.SetupJavaServers("remotequery.xml",
+ "cqqueryfailover.xml");
+ CacheHelper.StartJavaServer(1, "GFECS1");
+ Util.Log("Cacheserver 1 started.");
+
+ CacheHelper.CreateTCRegion(QueryRegionNames[0], true, true, null, true);
+
+ Region region = CacheHelper.GetVerifyRegion(QueryRegionNames[0]);
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 200);
+ Portfolio p3 = new Portfolio(3, 300);
+ Portfolio p4 = new Portfolio(4, 400);
+
+ region.Put("1", p1);
+ region.Put("2", p2);
+ region.Put("3", p3);
+ region.Put("4", p4);
+ }
+ */
+ /*
+ public void StepTwoFailover()
+ {
+ CacheHelper.StartJavaServer(2, "GFECS2");
+ Util.Log("Cacheserver 2 started.");
+
+ IAsyncResult killRes = null;
+ KillServerDelegate ksd = new KillServerDelegate(KillServer);
+ CacheHelper.CreateTCRegion(QueryRegionNames[0], true, true, null, true);
+
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QueryRegionNames[0]);
+
+ QueryService qs = CacheHelper.DCache.GetQueryService();
+ CqAttributesFactory cqFac = new CqAttributesFactory();
+ ICqListener cqLstner = new MyCqListener();
+ cqFac.AddCqListener(cqLstner);
+ CqAttributes cqAttr = cqFac.Create();
+ CqQuery qry = qs.NewCq(CqName1, "select * from /" + QERegionName + " p where p.ID!<4", cqAttr, true);
+ qry.Execute();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ qry = qs.GetCq(CqName1);
+ cqAttr = qry.GetCqAttributes();
+ ICqListener[] vl = cqAttr.getCqListeners();
+ Assert.IsNotNull(vl);
+ Assert.AreEqual(1, vl.Length);
+ cqLstner = vl[0];
+ Assert.IsNotNull(cqLstner);
+ MyCqListener myLisner = cqLstner as MyCqListener;
+ if (myLisner.getEventCountAfter() + myLisner.getErrorCountAfter() != 0)
+ {
+ Assert.Fail("cq after count not zero");
+ }
+
+ killRes = ksd.BeginInvoke(null, null);
+ Thread.Sleep(18000); // sleep 0.3min to allow failover complete
+ myLisner.failedOver();
+
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 200);
+ Portfolio p3 = new Portfolio(3, 300);
+ Portfolio p4 = new Portfolio(4, 400);
+
+ region.Put("4", p1);
+ region.Put("3", p2);
+ region.Put("2", p3);
+ region.Put("1", p4);
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry = qs.GetCq(CqName1);
+ cqAttr = qry.GetCqAttributes();
+ vl = cqAttr.getCqListeners();
+ cqLstner = vl[0];
+ Assert.IsNotNull(vl);
+ Assert.AreEqual(1, vl.Length);
+ cqLstner = vl[0];
+ Assert.IsNotNull(cqLstner);
+ myLisner = cqLstner as MyCqListener;
+ if (myLisner.getEventCountAfter() + myLisner.getErrorCountAfter() == 0)
+ {
+ Assert.Fail("no cq after failover");
+ }
+
+ killRes.AsyncWaitHandle.WaitOne();
+ ksd.EndInvoke(killRes);
+ qry.Stop();
+ qry.Close();
+ }
+ */
+
+ public void ProcessCQ(string locators)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(QERegionName, true, true,
+ null, locators, "__TESTPOOL1_", true);
+
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QERegionName);
+ Portfolio p1 = new Portfolio(1, 100);
+ Portfolio p2 = new Portfolio(2, 100);
+ Portfolio p3 = new Portfolio(3, 100);
+ Portfolio p4 = new Portfolio(4, 100);
+
+ region["1"] = p1;
+ region["2"] = p2;
+ region["3"] = p3;
+ region["4"] = p4;
+
+ QueryService<object, object> qs = null;
+
+ qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService<object, object>();
+
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ ICqListener<object, object> cqLstner = new MyCqListener<object, object>();
+ ICqStatusListener<object, object> cqStatusLstner = new MyCqStatusListener<object, object>(1);
+
+ ICqListener<object, object>[] v = new ICqListener<object, object>[2];
+ cqFac.AddCqListener(cqLstner);
+ v[0] = cqLstner;
+ v[1] = cqStatusLstner;
+ cqFac.InitCqListeners(v);
+ Util.Log("InitCqListeners called");
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry1 = qs.NewCq("CQ1", "select * from /" + QERegionName + " p where p.ID >= 1", cqAttr, false);
+ qry1.Execute();
+
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry1 = qs.GetCq("CQ1");
+ cqAttr = qry1.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ Assert.IsNotNull(vl);
+ Assert.AreEqual(2, vl.Length);
+ cqLstner = vl[0];
+ Assert.IsNotNull(cqLstner);
+ MyCqListener<object, object> myLisner = (MyCqListener<object, object>)cqLstner;// as MyCqListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myLisner.getEventCountBefore(), myLisner.getErrorCountBefore());
+ Assert.AreEqual(4, myLisner.getEventCountBefore());
+
+ cqStatusLstner = (ICqStatusListener<object, object>)vl[1];
+ Assert.IsNotNull(cqStatusLstner);
+ MyCqStatusListener<object, object> myStatLisner = (MyCqStatusListener<object, object>)cqStatusLstner;// as MyCqStatusListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myStatLisner.getEventCountBefore(), myStatLisner.getErrorCountBefore());
+ Assert.AreEqual(1, myStatLisner.getCqConnectedCount());
+ Assert.AreEqual(4, myStatLisner.getEventCountBefore());
+
+ CqAttributesMutator<object, object> mutator = qry1.GetCqAttributesMutator();
+ mutator.RemoveCqListener(cqLstner);
+ cqAttr = qry1.GetCqAttributes();
+ Util.Log("cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
+ Assert.AreEqual(1, cqAttr.getCqListeners().Length);
+
+ mutator.RemoveCqListener(cqStatusLstner);
+ cqAttr = qry1.GetCqAttributes();
+ Util.Log("1 cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
+ Assert.AreEqual(0, cqAttr.getCqListeners().Length);
+
+ ICqListener<object, object>[] v2 = new ICqListener<object, object>[2];
+ v2[0] = cqLstner;
+ v2[1] = cqStatusLstner;
+ MyCqListener<object, object> myLisner2 = (MyCqListener<object, object>)cqLstner;
+ myLisner2.Clear();
+ MyCqStatusListener<object, object> myStatLisner2 = (MyCqStatusListener<object, object>)cqStatusLstner;
+ myStatLisner2.Clear();
+ mutator.SetCqListeners(v2);
+ cqAttr = qry1.GetCqAttributes();
+ Assert.AreEqual(2, cqAttr.getCqListeners().Length);
+
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry1 = qs.GetCq("CQ1");
+ cqAttr = qry1.GetCqAttributes();
+ ICqListener<object, object>[] v3 = cqAttr.getCqListeners();
+ Assert.IsNotNull(v3);
+ Assert.AreEqual(2, vl.Length);
+ cqLstner = v3[0];
+ Assert.IsNotNull(cqLstner);
+ myLisner2 = (MyCqListener<object, object>)cqLstner;// as MyCqListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myLisner2.getEventCountBefore(), myLisner2.getErrorCountBefore());
+ Assert.AreEqual(4, myLisner2.getEventCountBefore());
+
+ cqStatusLstner = (ICqStatusListener<object, object>)v3[1];
+ Assert.IsNotNull(cqStatusLstner);
+ myStatLisner2 = (MyCqStatusListener<object, object>)cqStatusLstner;// as MyCqStatusListener<object, object>;
+ Util.Log("event count:{0}, error count {1}.", myStatLisner2.getEventCountBefore(), myStatLisner2.getErrorCountBefore());
+ Assert.AreEqual(0, myStatLisner2.getCqConnectedCount());
+ Assert.AreEqual(4, myStatLisner2.getEventCountBefore());
+
+ mutator = qry1.GetCqAttributesMutator();
+ mutator.RemoveCqListener(cqLstner);
+ cqAttr = qry1.GetCqAttributes();
+ Util.Log("cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
+ Assert.AreEqual(1, cqAttr.getCqListeners().Length);
+
+ mutator.RemoveCqListener(cqStatusLstner);
+ cqAttr = qry1.GetCqAttributes();
+ Util.Log("1 cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
+ Assert.AreEqual(0, cqAttr.getCqListeners().Length);
+
+ region["4"] = p1;
+ region["3"] = p2;
+ region["2"] = p3;
+ region["1"] = p4;
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+
+ qry1 = qs.GetCq("CQ1");
+ cqAttr = qry1.GetCqAttributes();
+ ICqListener<object, object>[] v4 = cqAttr.getCqListeners();
+ Assert.IsNotNull(v4);
+ Assert.AreEqual(0, v4.Length);
+ Util.Log("cqAttr.getCqListeners() done");
+ }
+
+ public void CreateAndExecuteCQ_StatusListener(string poolName, string cqName, string cqQuery, int id)
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(poolName).GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ cqFac.AddCqListener(new MyCqStatusListener<object, object>(id));
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry = qs.NewCq(cqName, cqQuery, cqAttr, false);
+ qry.Execute();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ }
+
+ public void CreateAndExecuteCQ_Listener(string poolName, string cqName, string cqQuery, int id)
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(poolName).GetQueryService<object, object>();
+ CqAttributesFactory<object, object> cqFac = new CqAttributesFactory<object, object>();
+ cqFac.AddCqListener(new MyCqListener<object, object>(/*id*/));
+ CqAttributes<object, object> cqAttr = cqFac.Create();
+ CqQuery<object, object> qry = qs.NewCq(cqName, cqQuery, cqAttr, false);
+ qry.Execute();
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ }
+
+ public void CheckCQStatusOnConnect(string poolName, string cqName, int onCqStatusConnect)
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(poolName).GetQueryService<object, object>();
+ CqQuery<object, object> query = qs.GetCq(cqName);
+ CqAttributes<object, object> cqAttr = query.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ MyCqStatusListener<object, object> myCqStatusLstr = (MyCqStatusListener<object, object>) vl[0];
+ Util.Log("CheckCQStatusOnConnect = {0} ", myCqStatusLstr.getCqConnectedCount());
+ Assert.AreEqual(onCqStatusConnect, myCqStatusLstr.getCqConnectedCount());
+ }
+
+ public void CheckCQStatusOnDisConnect(string poolName, string cqName, int onCqStatusDisConnect)
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(poolName).GetQueryService<object, object>();
+ CqQuery<object, object> query = qs.GetCq(cqName);
+ CqAttributes<object, object> cqAttr = query.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ MyCqStatusListener<object, object> myCqStatusLstr = (MyCqStatusListener<object, object>)vl[0];
+ Util.Log("CheckCQStatusOnDisConnect = {0} ", myCqStatusLstr.getCqDisConnectedCount());
+ Assert.AreEqual(onCqStatusDisConnect, myCqStatusLstr.getCqDisConnectedCount());
+ }
+
+ public void PutEntries(string regionName)
+ {
+ IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(regionName);
+ for (int i = 1; i <= 10; i++) {
+ region["key-" + i] = "val-" + i;
+ }
+ Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
+ }
+
+ public void CheckCQStatusOnPutEvent(string poolName, string cqName, int onCreateCount)
+ {
+ QueryService<object, object> qs = null;
+ qs = CacheHelper.DCache.GetPoolManager().Find(poolName).GetQueryService<object, object>();
+ CqQuery<object, object> query = qs.GetCq(cqName);
+ CqAttributes<object, object> cqAttr = query.GetCqAttributes();
+ ICqListener<object, object>[] vl = cqAttr.getCqListeners();
+ MyCqStatusListener<object, object> myCqStatusLstr = (MyCqStatusListener<object, object>)vl[0];
+ Util.Log("CheckCQStatusOnPutEvent = {0} ", myCqStatusLstr.getEventCountBefore());
+ Assert.AreEqual(onCreateCount, myCqStatusLstr.getEventCountBefore());
+ }
+
+ public void CreateRegion(string locators, string servergroup, string regionName, string poolName)
+ {
+ CacheHelper.CreateTCRegion_Pool<object, object>(regionName, true, true,
+ null, locators, poolName, true, servergroup);
+ }
+
+ void runCqQueryTest()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(StepTwo, m_usePdxObjects);
+ Util.Log("StepTwo complete.");
+
+ if (!m_usePdxObjects)
+ m_client1.Call(StepOneQE, CacheHelper.Locators);
+ else
+ m_client1.Call(StepOnePdxQE, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runCqQueryStatusTest()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(StepOne, CacheHelper.Locators);
+ Util.Log("StepOne complete.");
+
+ m_client1.Call(CreateAndExecuteCQ_StatusListener, "__TESTPOOL1_", CqName1, CqQuery1, 100);
+ Util.Log("CreateAndExecuteCQ complete.");
+
+ m_client1.Call(CheckCQStatusOnConnect, "__TESTPOOL1_", CqName1, 1);
+ Util.Log("CheckCQStatusOnConnect complete.");
+
+ m_client1.Call(PutEntries, "DistRegionAck");
+ Util.Log("PutEntries complete.");
+
+ m_client1.Call(CheckCQStatusOnPutEvent, "__TESTPOOL1_", CqName1, 10);
+ Util.Log("CheckCQStatusOnPutEvent complete.");
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("start server 2 complete.");
+
+ Thread.Sleep(20000);
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ Thread.Sleep(20000);
+ m_client1.Call(CheckCQStatusOnDisConnect, "__TESTPOOL1_", CqName1, 0);
+ Util.Log("CheckCQStatusOnDisConnect complete.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ Thread.Sleep(20000);
+ m_client1.Call(CheckCQStatusOnDisConnect, "__TESTPOOL1_", CqName1, 1);
+ Util.Log("CheckCQStatusOnDisConnect complete.");
+
+ CacheHelper.SetupJavaServers(true, "cacheserver.xml", "cacheserver2.xml");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+ Thread.Sleep(20000);
+
+ m_client1.Call(CheckCQStatusOnConnect, "__TESTPOOL1_", CqName1, 2);
+ Util.Log("CheckCQStatusOnConnect complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ Thread.Sleep(20000);
+
+ m_client1.Call(CheckCQStatusOnDisConnect, "__TESTPOOL1_", CqName1, 2);
+ Util.Log("CheckCQStatusOnDisConnect complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runCqQueryStatusTest2()
+ {
+ CacheHelper.SetupJavaServers(true, "cacheserver_servergroup.xml", "cacheserver_servergroup2.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("start server 1 complete.");
+ CacheHelper.StartJavaServerWithLocators(2, "GFECS2", 1);
+ Util.Log("start server 2 complete.");
+
+ m_client1.Call(CreateRegion, CacheHelper.Locators, "group1", "DistRegionAck", "__TESTPOOL1_");
+ Util.Log("CreateRegion DistRegionAck complete.");
+
+ m_client1.Call(CreateRegion, CacheHelper.Locators, "group2", "DistRegionAck1", "__TESTPOOL2_");
+ Util.Log("CreateRegion DistRegionAck1 complete.");
+
+ m_client1.Call(CreateAndExecuteCQ_StatusListener, "__TESTPOOL1_", CqName1, CqQuery1, 100);
+ Util.Log("CreateAndExecuteCQ1 complete.");
+
+ m_client1.Call(CreateAndExecuteCQ_StatusListener, "__TESTPOOL2_", CqName2, CqQuery2, 101);
+ Util.Log("CreateAndExecuteCQ2 complete.");
+
+ m_client1.Call(CheckCQStatusOnConnect, "__TESTPOOL1_", CqName1, 1);
+ Util.Log("CheckCQStatusOnConnect1 complete.");
+
+ m_client1.Call(CheckCQStatusOnConnect, "__TESTPOOL2_", CqName2, 1);
+ Util.Log("CheckCQStatusOnConnect2 complete.");
+
+ m_client1.Call(PutEntries, "DistRegionAck");
+ Util.Log("PutEntries1 complete.");
+
+ m_client1.Call(PutEntries, "DistRegionAck1");
+ Util.Log("PutEntries2 complete.");
+
+ m_client1.Call(CheckCQStatusOnPutEvent, "__TESTPOOL1_", CqName1, 10);
+ Util.Log("CheckCQStatusOnPutEvent complete.");
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ Thread.Sleep(20000);
+
+ m_client1.Call(CheckCQStatusOnDisConnect, "__TESTPOOL1_", CqName1, 1);
+ Util.Log("CheckCQStatusOnDisConnect complete.");
+
+ CacheHelper.StopJavaServer(2);
+ Util.Log("Cacheserver 2 stopped.");
+ Thread.Sleep(20000);
+
+ m_client1.Call(CheckCQStatusOnDisConnect, "__TESTPOOL2_", CqName2, 1);
+ Util.Log("CheckCQStatusOnDisConnect complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ void runCqQueryStatusTest3()
+ {
+ CacheHelper.SetupJavaServers(true, "remotequeryN.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator started");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ m_client1.Call(ProcessCQ, CacheHelper.Locators);
+ Util.Log("ProcessCQ complete.");
+
+ m_client1.Call(Close);
+
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+
+ CacheHelper.StopJavaLocator(1);
+ Util.Log("Locator stopped");
+ }
+
+ [Test]
+ public void CqQueryTest()
+ {
+ runCqQueryTest();
+ }
+
+ [Test]
+ public void CqQueryPdxTest()
+ {
+ m_usePdxObjects = true;
+ runCqQueryTest();
+ m_usePdxObjects = false;
+ }
+
+ // [Test]
+ // public void CqFailover()
+ // {
+ // try
+ // {
+ // m_client1.Call(StepOneFailover);
+ // Util.Log("StepOneFailover complete.");
+ //
+ // m_client1.Call(StepTwoFailover);
+ // Util.Log("StepTwoFailover complete.");
+ // }
+ // finally
+ // {
+ // m_client1.Call(CacheHelper.StopJavaServers);
+ // }
+ // }
+
+ [Test]
+ public void CqQueryStatusTest()
+ {
+ runCqQueryStatusTest();
+ }
+
+ [Test]
+ public void CqQueryStatusTest2()
+ {
+ runCqQueryStatusTest2();
+ }
+
+ [Test]
+ public void CqQueryStatusTest3()
+ {
+ runCqQueryStatusTest3();
+ }
+
+ }
+}
[49/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/BuiltinCacheableWrappersN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/BuiltinCacheableWrappersN.cs b/clicache/integration-test/BuiltinCacheableWrappersN.cs
new file mode 100644
index 0000000..444fe71
--- /dev/null
+++ b/clicache/integration-test/BuiltinCacheableWrappersN.cs
@@ -0,0 +1,2782 @@
+/*
+ * 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.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ #region Helper class
+
+ public class CacheableHelper
+ {
+ #region Constants and statics
+
+ private static uint[] CRC32Table = {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+ 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
+ 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
+ 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+ 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
+ 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
+ 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+ 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
+ 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
+ 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
+ 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
+ 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
+ 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+ 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
+ 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
+ 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+ 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
+ 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
+ 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+ 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
+ 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
+ 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
+ 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
+ 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
+ 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+ 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
+ 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+ };
+
+ #endregion
+
+ /// <summary>
+ /// Generate a random <c>CData</c> structure.
+ /// </summary>
+ public static CData RandCData()
+ {
+ long rnd = (long)Util.Rand(int.MaxValue);
+ rnd = (rnd << 32) + (long)Util.Rand(int.MaxValue);
+ return new CData(Util.Rand(int.MaxValue), rnd);
+ }
+
+ public static PdxCData RandPdxCData()
+ {
+ long rnd = (long)Util.Rand(int.MaxValue);
+ rnd = (rnd << 32) + (long)Util.Rand(int.MaxValue);
+ return new PdxCData(Util.Rand(int.MaxValue), rnd);
+ }
+
+ public static uint CRC32(byte[] buffer)
+ {
+ if (buffer == null || buffer.Length == 0)
+ {
+ return 0;
+ }
+
+ uint crc32 = 0xffffffff;
+
+ for (int i = 0; i < buffer.Length; i++)
+ {
+ crc32 = ((crc32 >> 8) & 0x00ffffff) ^
+ CRC32Table[(crc32 ^ buffer[i]) & 0xff];
+ }
+ return ~crc32;
+ }
+
+ public static bool IsContainerTypeId(uint typeId)
+ {
+ return (typeId == GeodeClassIds.CacheableObjectArray) ||
+ (typeId == GeodeClassIds.CacheableVector) ||
+ (typeId == GeodeClassIds.CacheableArrayList) ||
+ (typeId == GeodeClassIds.CacheableStack) ||
+ (typeId == GeodeClassIds.CacheableHashMap) ||
+ (typeId == GeodeClassIds.CacheableIdentityHashMap) ||
+ (typeId == GeodeClassIds.CacheableHashTable) ||
+ (typeId == GeodeClassIds.CacheableLinkedHashSet) ||
+ (typeId == GeodeClassIds.CacheableHashSet);
+ }
+
+ public static bool IsUnhandledType(uint typeId)
+ {
+ // TODO: [sumedh] skipping CacheableFileName for now since it will
+ // not work on Windows without significant workarounds; also see
+ // the corresponding comment in C++ testThinClientCacheables.
+ // Also skipping C# specific classes.
+ return (typeId == GeodeClassIds.CacheableFileName) ||
+ (typeId == GeodeClassIds.CacheableManagedObject) ||
+ (typeId == GeodeClassIds.CacheableManagedObjectXml);
+ }
+ public static long ConstantDateTime = 0;
+ public static void RegisterBuiltins(long dateTime)
+ {
+ ConstantDateTime = dateTime;
+ CacheableWrapperFactory.ClearStaticVaraiables();
+ #region Cacheable keys
+
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableBoolean,
+ typeof(CacheableBooleanWrapper), CacheableBooleanWrapper.Create, typeof(bool));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableByte,
+ typeof(CacheableByteWrapper), CacheableByteWrapper.Create, typeof(sbyte));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableCharacter,
+ typeof(CacheableCharacterWrapper), CacheableCharacterWrapper.Create, typeof(Char));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDate,
+ typeof(CacheableDateWrapper), CacheableDateWrapper.Create, typeof(DateTime));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDouble,
+ typeof(CacheableDoubleWrapper), CacheableDoubleWrapper.Create, typeof(Double));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFileName,
+ typeof(CacheableFileNameWrapper), CacheableFileNameWrapper.Create, typeof(CacheableFileName));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFloat,
+ typeof(CacheableFloatWrapper), CacheableFloatWrapper.Create, typeof(float));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt16,
+ typeof(CacheableInt16Wrapper), CacheableInt16Wrapper.Create, typeof(Int16));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt32,
+ typeof(CacheableInt32Wrapper), CacheableInt32Wrapper.Create, typeof(Int32));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt64,
+ typeof(CacheableInt64Wrapper), CacheableInt64Wrapper.Create, typeof(Int64));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIString,
+ typeof(CacheableStringWrapper), CacheableStringWrapper.Create, typeof(string));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableString,
+ typeof(CacheableUnicodeStringWrapper), CacheableUnicodeStringWrapper.Create);
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIStringHuge,
+ typeof(CacheableHugeStringWrapper), CacheableHugeStringWrapper.Create);
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableStringHuge,
+ typeof(CacheableHugeUnicodeStringWrapper), CacheableHugeUnicodeStringWrapper.Create);
+ CacheableWrapperFactory.RegisterKeyType(10001,
+ typeof(PdxCDataWrapper), PdxCDataWrapper.Create, typeof(PdxCData));
+
+ //need to register pdx type
+ Serializable.RegisterPdxType(PdxCData.CreateDeserializable);
+
+ #endregion
+
+ #region Other cacheables
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableBytes,
+ typeof(CacheableBytesWrapper), CacheableBytesWrapper.Create, typeof(byte[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableDoubleArray,
+ typeof(CacheableDoubleArrayWrapper), CacheableDoubleArrayWrapper.Create, typeof(Double[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableFloatArray,
+ typeof(CacheableFloatArrayWrapper), CacheableFloatArrayWrapper.Create, typeof(float[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashMap,
+ typeof(CacheableHashMapWrapper), CacheableHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashTable,
+ typeof(CacheableHashTableWrapper), CacheableHashTableWrapper.Create, typeof(System.Collections.Hashtable));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableIdentityHashMap,
+ typeof(CacheableIdentityHashMapWrapper), CacheableIdentityHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashSet,
+ typeof(CacheableHashSetWrapper), CacheableHashSetWrapper.Create, typeof(CacheableHashSet));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableLinkedHashSet,
+ typeof(CacheableLinkedHashSetWrapper), CacheableLinkedHashSetWrapper.Create, typeof(CacheableLinkedHashSet));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt16Array,
+ typeof(CacheableInt16ArrayWrapper), CacheableInt16ArrayWrapper.Create, typeof(Int16[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt32Array,
+ typeof(CacheableInt32ArrayWrapper), CacheableInt32ArrayWrapper.Create, typeof(Int32[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt64Array,
+ typeof(CacheableInt64ArrayWrapper), CacheableInt64ArrayWrapper.Create, typeof(Int64[]));
+ {//old one
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableNullString,
+ // typeof(CacheableNullStringWrapper), CacheableNullStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableASCIIString,
+ // typeof(CacheableEmptyStringWrapper), CacheableEmptyStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableString,
+ // typeof(CacheableEmptyUnicodeStringWrapper), CacheableEmptyUnicodeStringWrapper.Create);
+ }
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStringArray,
+ typeof(CacheableStringArrayWrapper), CacheableStringArrayWrapper.Create, typeof(string[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableUndefined,
+ typeof(CacheableUndefinedWrapper), CacheableUndefinedWrapper.Create, typeof(CacheableUndefined));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableVector,
+ typeof(CacheableVectorWrapper), CacheableVectorWrapper.Create, typeof(System.Collections.ArrayList));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableObjectArray,
+ typeof(CacheableObjectArrayWrapper), CacheableObjectArrayWrapper.Create, typeof(CacheableObjectArray));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableArrayList,
+ typeof(CacheableArrayListWrapper), CacheableArrayListWrapper.Create, typeof(List<object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStack,
+ typeof(CacheableStackWrapper), CacheableStackWrapper.Create, typeof(Stack<object>));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObject,
+ typeof(CacheableObjectWrapper), CacheableObjectWrapper.Create, typeof(CacheableObject));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObjectXml,
+ typeof(CacheableObjectXmlWrapper), CacheableObjectXmlWrapper.Create, typeof(CacheableObjectXml));
+
+
+
+ #endregion
+ }
+
+ public static void RegisterBuiltinsJavaHashCode(long dateTime)
+ {
+ ConstantDateTime = dateTime;
+ CacheableWrapperFactory.ClearStaticVaraiables();
+ #region Cacheable keys
+
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableBoolean,
+ typeof(CacheableBooleanWrapper), CacheableBooleanWrapper.Create, typeof(bool));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableByte,
+ typeof(CacheableByteWrapper), CacheableByteWrapper.Create, typeof(sbyte));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableCharacter,
+ typeof(CacheableCharacterWrapper), CacheableCharacterWrapper.Create, typeof(Char));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDate,
+ typeof(CacheableDateWrapper), CacheableDateWrapper.Create, typeof(DateTime));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDouble,
+ typeof(CacheableDoubleWrapper), CacheableDoubleWrapper.Create, typeof(Double));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFileName,
+ typeof(CacheableFileNameWrapper), CacheableFileNameWrapper.Create, typeof(CacheableFileName));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFloat,
+ typeof(CacheableFloatWrapper), CacheableFloatWrapper.Create, typeof(float));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt16,
+ typeof(CacheableInt16Wrapper), CacheableInt16Wrapper.Create, typeof(Int16));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt32,
+ typeof(CacheableInt32Wrapper), CacheableInt32Wrapper.Create, typeof(Int32));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt64,
+ typeof(CacheableInt64Wrapper), CacheableInt64Wrapper.Create, typeof(Int64));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIString,
+ typeof(CacheableStringWrapper), CacheableStringWrapper.Create, typeof(string));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableString,
+ typeof(CacheableUnicodeStringWrapper), CacheableUnicodeStringWrapper.Create);
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIStringHuge,
+ typeof(CacheableHugeStringWrapper), CacheableHugeStringWrapper.Create);
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableStringHuge,
+ typeof(CacheableHugeUnicodeStringWrapper), CacheableHugeUnicodeStringWrapper.Create);
+
+ //need to register pdx type
+ Serializable.RegisterPdxType(PdxCData.CreateDeserializable);
+
+ #endregion
+
+ #region Other cacheables
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableBytes,
+ typeof(CacheableBytesWrapper), CacheableBytesWrapper.Create, typeof(byte[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableDoubleArray,
+ typeof(CacheableDoubleArrayWrapper), CacheableDoubleArrayWrapper.Create, typeof(Double[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableFloatArray,
+ typeof(CacheableFloatArrayWrapper), CacheableFloatArrayWrapper.Create, typeof(float[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashMap,
+ typeof(CacheableHashMapWrapper), CacheableHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashTable,
+ typeof(CacheableHashTableWrapper), CacheableHashTableWrapper.Create, typeof(System.Collections.Hashtable));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableIdentityHashMap,
+ typeof(CacheableIdentityHashMapWrapper), CacheableIdentityHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashSet,
+ typeof(CacheableHashSetWrapper), CacheableHashSetWrapper.Create, typeof(CacheableHashSet));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableLinkedHashSet,
+ typeof(CacheableLinkedHashSetWrapper), CacheableLinkedHashSetWrapper.Create, typeof(CacheableLinkedHashSet));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt16Array,
+ typeof(CacheableInt16ArrayWrapper), CacheableInt16ArrayWrapper.Create, typeof(Int16[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt32Array,
+ typeof(CacheableInt32ArrayWrapper), CacheableInt32ArrayWrapper.Create, typeof(Int32[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt64Array,
+ typeof(CacheableInt64ArrayWrapper), CacheableInt64ArrayWrapper.Create, typeof(Int64[]));
+ {//old one
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableNullString,
+ // typeof(CacheableNullStringWrapper), CacheableNullStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableASCIIString,
+ // typeof(CacheableEmptyStringWrapper), CacheableEmptyStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableString,
+ // typeof(CacheableEmptyUnicodeStringWrapper), CacheableEmptyUnicodeStringWrapper.Create);
+ }
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStringArray,
+ typeof(CacheableStringArrayWrapper), CacheableStringArrayWrapper.Create, typeof(string[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableUndefined,
+ typeof(CacheableUndefinedWrapper), CacheableUndefinedWrapper.Create, typeof(CacheableUndefined));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableVector,
+ typeof(CacheableVectorWrapper), CacheableVectorWrapper.Create, typeof(System.Collections.ArrayList));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableObjectArray,
+ typeof(CacheableObjectArrayWrapper), CacheableObjectArrayWrapper.Create, typeof(CacheableObjectArray));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableArrayList,
+ typeof(CacheableArrayListWrapper), CacheableArrayListWrapper.Create, typeof(List<object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStack,
+ typeof(CacheableStackWrapper), CacheableStackWrapper.Create, typeof(Stack<object>));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObject,
+ typeof(CacheableObjectWrapper), CacheableObjectWrapper.Create, typeof(CacheableObject));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObjectXml,
+ typeof(CacheableObjectXmlWrapper), CacheableObjectXmlWrapper.Create, typeof(CacheableObjectXml));
+
+
+
+ #endregion
+ }
+
+ public static void RegisterBuiltinsAD(long dateTime)
+ {
+ ConstantDateTime = dateTime;
+ CacheableWrapperFactory.ClearStaticVaraiables();
+ #region Cacheable keys
+
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableBoolean,
+ typeof(CacheableBooleanWrapper), CacheableBooleanWrapper.Create, typeof(bool));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableByte,
+ typeof(CacheableByteWrapper), CacheableByteWrapper.Create, typeof(sbyte));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableCharacter,
+ typeof(CacheableCharacterWrapper), CacheableCharacterWrapper.Create, typeof(Char));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDate,
+ typeof(CacheableDateWrapper), CacheableDateWrapper.Create, typeof(DateTime));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableDouble,
+ typeof(CacheableDoubleWrapper), CacheableDoubleWrapper.Create, typeof(Double));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFileName,
+ typeof(CacheableFileNameWrapper), CacheableFileNameWrapper.Create, typeof(CacheableFileName));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableFloat,
+ typeof(CacheableFloatWrapper), CacheableFloatWrapper.Create, typeof(float));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt16,
+ typeof(CacheableInt16Wrapper), CacheableInt16Wrapper.Create, typeof(Int16));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt32,
+ typeof(CacheableInt32Wrapper), CacheableInt32Wrapper.Create, typeof(Int32));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableInt64,
+ typeof(CacheableInt64Wrapper), CacheableInt64Wrapper.Create, typeof(Int64));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIString,
+ typeof(CacheableStringWrapper), CacheableStringWrapper.Create, typeof(string));
+ CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableString,
+ typeof(CacheableUnicodeStringWrapper), CacheableUnicodeStringWrapper.Create);
+ {
+ //CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableASCIIStringHuge,
+ // typeof(CacheableHugeStringWrapper), CacheableHugeStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterKeyType(GeodeClassIds.CacheableStringHuge,
+ // typeof(CacheableHugeUnicodeStringWrapper), CacheableHugeUnicodeStringWrapper.Create);
+ }
+ CacheableWrapperFactory.RegisterKeyType(10001,
+ typeof(PdxCDataWrapper), PdxCDataWrapper.Create, typeof(PdxCData));
+
+ //need to register pdx type
+ Serializable.RegisterPdxType(PdxCData.CreateDeserializable);
+
+
+ #endregion
+
+ #region Other cacheables
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableBytes,
+ typeof(CacheableBytesWrapper), CacheableBytesWrapper.Create, typeof(byte[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableDoubleArray,
+ typeof(CacheableDoubleArrayWrapper), CacheableDoubleArrayWrapper.Create, typeof(Double[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableFloatArray,
+ typeof(CacheableFloatArrayWrapper), CacheableFloatArrayWrapper.Create, typeof(float[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashMap,
+ typeof(CacheableHashMapWrapper), CacheableHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashTable,
+ typeof(CacheableHashTableWrapper), CacheableHashTableWrapper.Create, typeof(System.Collections.Hashtable));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableIdentityHashMap,
+ typeof(CacheableIdentityHashMapWrapper), CacheableIdentityHashMapWrapper.Create, typeof(Dictionary<object, object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableHashSet,
+ typeof(CacheableHashSetWrapper), CacheableHashSetWrapper.Create, typeof(CacheableHashSet));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableLinkedHashSet,
+ typeof(CacheableLinkedHashSetWrapper), CacheableLinkedHashSetWrapper.Create, typeof(CacheableLinkedHashSet));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt16Array,
+ typeof(CacheableInt16ArrayWrapper), CacheableInt16ArrayWrapper.Create, typeof(Int16[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt32Array,
+ typeof(CacheableInt32ArrayWrapper), CacheableInt32ArrayWrapper.Create, typeof(Int32[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableInt64Array,
+ typeof(CacheableInt64ArrayWrapper), CacheableInt64ArrayWrapper.Create, typeof(Int64[]));
+ {//old one
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableNullString,
+ // typeof(CacheableNullStringWrapper), CacheableNullStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableASCIIString,
+ // typeof(CacheableEmptyStringWrapper), CacheableEmptyStringWrapper.Create);
+ //CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableString,
+ // typeof(CacheableEmptyUnicodeStringWrapper), CacheableEmptyUnicodeStringWrapper.Create);
+ }
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStringArray,
+ typeof(CacheableStringArrayWrapper), CacheableStringArrayWrapper.Create, typeof(string[]));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableUndefined,
+ typeof(CacheableUndefinedWrapper), CacheableUndefinedWrapper.Create, typeof(CacheableUndefined));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableVector,
+ typeof(CacheableVectorWrapper), CacheableVectorWrapper.Create, typeof(System.Collections.ArrayList));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableObjectArray,
+ typeof(CacheableObjectArrayWrapper), CacheableObjectArrayWrapper.Create, typeof(CacheableObjectArray));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableArrayList,
+ typeof(CacheableArrayListWrapper), CacheableArrayListWrapper.Create, typeof(List<object>));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableStack,
+ typeof(CacheableStackWrapper), CacheableStackWrapper.Create, typeof(Stack<object>));
+
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObject,
+ typeof(CacheableObjectWrapper), CacheableObjectWrapper.Create, typeof(CacheableObject));
+ CacheableWrapperFactory.RegisterType(GeodeClassIds.CacheableManagedObjectXml,
+ typeof(CacheableObjectXmlWrapper), CacheableObjectXmlWrapper.Create, typeof(CacheableObjectXml));
+
+
+ #endregion
+ }
+ }
+
+ #endregion
+
+ #region Builtin cacheable keys
+
+ public class CacheableBooleanWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableBooleanWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return 2;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ bool value = (keyIndex % 2 == 1 ? true : false);
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ bool value = (Util.Rand(byte.MaxValue) % 2 == 1 ? true : false);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //Util.Log("cacheableObject Type = {0}", cacheableObject.GetType());
+ bool value = (bool)cacheableObject;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+ return (uint)(value ? 1 : 0);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ bool val = (bool)cacheableObject;
+ if (val) return 1231;
+ else return 1237;
+ }
+
+ #endregion
+ }
+
+ public class CacheableByteWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableByteWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return byte.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ sbyte value = (sbyte)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ sbyte value = (sbyte)Util.Rand(byte.MaxValue);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ sbyte value = (sbyte)cacheableObject;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+ byte[] buffer = new byte[1];
+ buffer[0] = (byte)value;
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ sbyte val = (sbyte)cacheableObject;
+ return val;
+ }
+
+ #endregion
+ }
+
+ public class CacheableCharacterWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableCharacterWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return char.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ char value = (char)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ char value = (char)Util.Rand(char.MaxValue);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ char obj = (char)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+ char value = obj;
+ int numBytes = sizeof(char);
+ byte[] buffer = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++)
+ {
+ buffer[i] = (byte)(value & 0xff);
+ value = (char)(value >> 8);
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ char val = (char)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableDateWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableDateWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ //m_cacheableObject = DateTime.Today.AddMinutes(keyIndex % 0xFFFF);
+ DateTime dt = new DateTime(CacheableHelper.ConstantDateTime + keyIndex * TimeSpan.TicksPerMinute);
+ m_cacheableObject = dt;
+ Util.Log(" datevalue initkey " + dt.ToString());
+ }
+
+ private DateTime createRoundOffDTVal(DateTime dt)
+ {
+ long ticksToAdd = dt.Ticks % TimeSpan.TicksPerMillisecond;
+ ticksToAdd = (ticksToAdd >= (TimeSpan.TicksPerMillisecond / 2) ?
+ (TimeSpan.TicksPerMillisecond - ticksToAdd) : -ticksToAdd);
+ dt = dt.AddTicks(ticksToAdd);
+ return dt;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int rnd = Util.Rand(int.MaxValue);
+ //DateTime value = DateTime.Now.AddMilliseconds(rnd % 2 == 0 ? rnd : -rnd);
+ DateTime value = new DateTime(CacheableHelper.ConstantDateTime);
+ m_cacheableObject = value;
+ Util.Log(" datevalue InitRandomValue " + value.ToString());
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //CacheableDate obj = cacheableObject as CacheableDate;
+ DateTime obj = (DateTime)cacheableObject;
+ Util.Log(" datevalue getchecksum " + obj.ToString());
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ obj = createRoundOffDTVal(obj);
+ long value = obj.Ticks;
+ int numBytes = sizeof(long);
+ byte[] buffer = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++)
+ {
+ buffer[i] = (byte)(value & 0xff);
+ value = value >> 8;
+ }
+ uint cks = CacheableHelper.CRC32(buffer);
+ Util.Log(" datevalue getchecksum " + cks);
+ return cks;
+ }
+
+ #endregion
+ }
+
+ public class CacheableDoubleWrapper : CacheableKeyWrapper
+ {
+ #region Private constants
+
+ private const double MaxError = 1E-20;
+
+ #endregion
+
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableDoubleWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ double value = (double)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ double value = Util.Rand() * double.MaxValue;
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ double value = (double)cacheableObject;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+ return CacheableHelper.CRC32(BitConverter.GetBytes(value));
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ double val = (double)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableFileNameWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableFileNameWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of key should be greater than zero.");
+ if (maxSize < 11)
+ {
+ maxSize = 11;
+ }
+ string value = "C:\\" + new string('\x0905', maxSize - 13) +
+ keyIndex.ToString("D10");
+ m_cacheableObject = CacheableFileName.Create(value);
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of value should be greater than zero.");
+ byte[] buffer = Util.RandBytes(maxSize / 2);
+ char[] value = new char[maxSize / 2];
+ for (int i = 0; i < maxSize / 2; i++)
+ {
+ value[i] = (char)((int)buffer[i] + 0x0901);
+ }
+ m_cacheableObject = CacheableFileName.Create(value);
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableFileName obj = cacheableObject as CacheableFileName;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ string value = obj.Value;
+ byte[] buffer = new byte[value.Length * 2];
+ for (int i = 0; i < value.Length; i++)
+ {
+ char c = value[i];
+ buffer[i * 2] = (byte)(c & 0xff);
+ buffer[i * 2 + 1] = (byte)((c >> 8) & 0xff);
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ #endregion
+ }
+
+ public class CacheableFloatWrapper : CacheableKeyWrapper
+ {
+ #region Private constants
+
+ private const float MaxError = 1E-10F;
+
+ #endregion
+
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableFloatWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ float value = (float)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ float value = (float)Util.Rand() * float.MaxValue;
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ float value = (float)cacheableObject;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+ return CacheableHelper.CRC32(BitConverter.GetBytes(value));
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ float val = (float)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableInt16Wrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableInt16Wrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return short.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ short value = (short)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ short value = (short)Util.Rand(short.MaxValue);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int16 obj = (Int16)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+ short value = obj;
+ int numBytes = sizeof(short);
+ byte[] buffer = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++)
+ {
+ buffer[i] = (byte)(value & 0xff);
+ value = (short)(value >> 8);
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ Int16 val = (Int16)cacheableObject;
+ return val;
+ }
+ #endregion
+ }
+
+ public class CacheableInt32Wrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableInt32Wrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ int value = keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int value = Util.Rand(int.MaxValue);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int32 obj = (Int32)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ int value = obj;
+ int numBytes = sizeof(int);
+ byte[] buffer = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++)
+ {
+ buffer[i] = (byte)(value & 0xff);
+ value = value >> 8;
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ Int32 val = (Int32)cacheableObject;
+ return val;
+ }
+ #endregion
+ }
+
+ public class CacheableInt64Wrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableInt64Wrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ long value = (long)keyIndex;
+ m_cacheableObject = value;
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ long value = Util.Rand(int.MaxValue);
+ value = (value << 32) + Util.Rand(int.MaxValue);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int64 obj = (Int64)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+ long value = obj;
+ int numBytes = sizeof(long);
+ byte[] buffer = new byte[numBytes];
+ for (int i = 0; i < numBytes; i++)
+ {
+ buffer[i] = (byte)(value & 0xff);
+ value = value >> 8;
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ Int64 val = (Int64)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableStringWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of key should be greater than zero.");
+ if (maxSize < 11)
+ {
+ maxSize = 11;
+ }
+ if (keyIndex == 0)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ string value = new string('A', maxSize - 10) + keyIndex.ToString("D10");
+ m_cacheableObject = value;
+ }
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of value should be greater than zero.");
+ maxSize = (maxSize / 2) > 1 ? (maxSize / 2) : 2;
+ Util.Log(" in cacheable string wrapper maxsize = " + maxSize);
+ if (maxSize == 2)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ byte[] buffer = Util.RandBytes(maxSize);
+ string value = BitConverter.ToString(buffer).Replace("-", string.Empty);
+ Util.Log("cacheable string wrapper " + value);
+ m_cacheableObject = value;
+ }
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string obj = (string)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ string value = obj;
+ if (value != null)
+ {
+ byte[] buffer = new byte[value.Length];
+ for (int i = 0; i < value.Length; i++)
+ {
+ buffer[i] = (byte)value[i];
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+ return 0;
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ string val = (string)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableUnicodeStringWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableUnicodeStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of key should be greater than zero.");
+ if (maxSize < 11)
+ {
+ maxSize = 11;
+ }
+ if (keyIndex == 0)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ string value = new string('\x0905', maxSize - 10) + keyIndex.ToString("D10");
+ m_cacheableObject = value;
+ }
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of value should be greater than zero.");
+ if (maxSize == 2)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ byte[] buffer = Util.RandBytes(maxSize / 2);
+ char[] value = new char[maxSize / 2];
+ for (int i = 0; i < maxSize / 2; i++)
+ {
+ value[i] = (char)((int)buffer[i] + 0x0901);
+ }
+ m_cacheableObject = new string(value);
+ }
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string obj = (string)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ string value = obj;
+ byte[] buffer = new byte[value.Length * 2];
+ for (int i = 0; i < value.Length; i++)
+ {
+ char c = value[i];
+ buffer[i * 2] = (byte)(c & 0xff);
+ buffer[i * 2 + 1] = (byte)((c >> 8) & 0xff);
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ string val = (string)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableHugeStringWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableHugeStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of key should be greater than zero.");
+ if (maxSize < 0xFFFF)
+ {
+ maxSize += 0xFFFF + 1;
+ }
+ if (keyIndex == 0)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ string value = new string('A', maxSize - 10) + keyIndex.ToString("D10");
+ m_cacheableObject = value;
+ }
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ if (maxSize < 0xFFFF)
+ {
+ maxSize += 0xFFFF + 1;
+ }
+ Assert.Greater(maxSize, 0, "Size of value should be greater than zero.");
+ if (maxSize < 0xFFFF + 10)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ byte[] buffer = Util.RandBytes(maxSize);
+ string value = BitConverter.ToString(buffer).Replace("-", string.Empty);
+ m_cacheableObject = value;
+ }
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string obj = (string)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ string value = obj;
+ byte[] buffer = new byte[value.Length];
+ for (int i = 0; i < value.Length; i++)
+ {
+ buffer[i] = (byte)value[i];
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ string val = (string)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableHugeUnicodeStringWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new CacheableHugeUnicodeStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableKeyWrapper Members
+
+ public override int MaxKeys
+ {
+ get
+ {
+ return int.MaxValue;
+ }
+ }
+
+ public override void InitKey(int keyIndex, int maxSize)
+ {
+ Assert.Greater(maxSize, 0, "Size of key should be greater than zero.");
+ if (maxSize < 0xFFFF)
+ {
+ maxSize += 0xFFFF + 1;
+ }
+ if (keyIndex == 0)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ string value = new string('\x0905', maxSize - 10) + keyIndex.ToString("D10");
+ m_cacheableObject = value;
+ }
+ }
+
+ public override void InitRandomValue(int maxSize)
+ {
+ if (maxSize < 0xFFFF)
+ {
+ maxSize += 0xFFFF + 1;
+ }
+ Assert.Greater(maxSize, 0, "Size of value should be greater than zero.");
+ if (maxSize < 0xFFFF + 10)
+ {
+ m_cacheableObject = string.Empty;
+ }
+ else
+ {
+ byte[] buffer = Util.RandBytes(maxSize);
+ char[] value = new char[maxSize];
+ for (int i = 0; i < maxSize; i++)
+ {
+ value[i] = (char)((int)buffer[i] + 0x0901);
+ }
+ m_cacheableObject = new string(value);
+ }
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string obj = (string)cacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ string value = obj;
+ byte[] buffer = new byte[value.Length * 2];
+ for (int i = 0; i < value.Length; i++)
+ {
+ char c = value[i];
+ buffer[i * 2] = (byte)(c & 0xff);
+ buffer[i * 2 + 1] = (byte)((c >> 8) & 0xff);
+ }
+ return CacheableHelper.CRC32(buffer);
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ string val = (string)cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ #endregion
+
+ #region Builtin cacheables that are not keys
+
+ public class CacheableBytesWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableBytesWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ byte[] value = Util.RandBytes(maxSize);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ byte[] value = (byte[])cacheableObject;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ return CacheableHelper.CRC32(value);
+ }
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ byte[] val = (byte[])cacheableObject;
+ return val.GetHashCode();
+ }
+
+ #endregion
+ }
+
+ public class CacheableDoubleArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableDoubleArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = maxSize / sizeof(double);
+ arraySize = arraySize > 1 ? arraySize : 2;
+ double[] value = new double[arraySize];
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ value[arrayIndex] = Util.Rand() * double.MaxValue;
+ }
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Double[] obj = cacheableObject as Double[];
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ double[] value = obj;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (double v in value)
+ {
+ byte[] buffer = BitConverter.GetBytes(v);
+ ms.Write(buffer, 0, buffer.Length);
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ double[] val = (double[])cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableFloatArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableFloatArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = maxSize / sizeof(float);
+ arraySize = arraySize > 1 ? arraySize : 2;
+ float[] value = new float[arraySize];
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ value[arrayIndex] = (float)Util.Rand() * float.MaxValue;
+ }
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ float[] obj = cacheableObject as float[];
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ float[] value = obj;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (float v in value)
+ {
+ byte[] buffer = BitConverter.GetBytes(v);
+ ms.Write(buffer, 0, buffer.Length);
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ float[] val = (float[])cacheableObject;
+ return val.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableHashMapWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableHashMapWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableHashMap map = new CacheableHashMap();
+ Dictionary<object, object> map = new Dictionary<object, object>();
+ ICollection<UInt32> keyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ int keySize = 16;
+ maxSize = maxSize / (keyTypeIds.Count * valueTypeIds.Count) + 1;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (UInt32 keyTypeId in keyTypeIds)
+ {
+ int index = 0;
+ foreach (UInt32 valueTypeId in valueTypeIds)
+ {
+ if ((valueTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ valueTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(keyTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ if ((keyTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ keyTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(valueTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ // null object does not work on server side during deserialization
+ if (valueTypeId == GeodeClassIds.CacheableNullString)
+ {
+ continue;
+ }
+
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance(keyTypeId);
+ Assert.IsNotNull(keyWrapper, "CacheableHashMapWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", keyTypeId);
+ if (keyWrapper.MaxKeys <= index)
+ {
+ break;
+ }
+ keyWrapper.InitKey((int)(keyTypeId << 8) + index, keySize);
+ if (!CacheableHelper.IsContainerTypeId(valueTypeId) &&
+ !CacheableHelper.IsUnhandledType(valueTypeId))
+ {
+ valueWrapper = CacheableWrapperFactory.CreateInstance(valueTypeId);
+ Assert.IsNotNull(valueWrapper, "CacheableHashMapWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", valueTypeId);
+ valueWrapper.InitRandomValue(maxSize);
+ Util.Log(" updating map " + keyWrapper.CacheableKey + " : " + valueWrapper.Cacheable);
+ map.Add(keyWrapper.CacheableKey, valueWrapper.Cacheable);
+ }
+ index++;
+ }
+ }
+ m_cacheableObject = map;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //CacheableHashMap value = cacheableObject as CacheableHashMap;
+ Dictionary<object, object> value = cacheableObject as Dictionary<object, object>;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (KeyValuePair<object, object> pair in value)
+ {
+ Util.Log(" pair " + pair.Key.GetType() + " : " + pair.Value.GetType());
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance((pair.Key));
+ Assert.IsNotNull(keyWrapper, "CacheableHashMap.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ keyWrapper.TypeId);
+ valueWrapper = CacheableWrapperFactory.CreateInstance(
+ pair.Value);
+ Assert.IsNotNull(valueWrapper, "CacheableHashMap.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ valueWrapper.TypeId);
+
+ ckSum ^= (keyWrapper.GetChecksum(pair.Key) ^
+ valueWrapper.GetChecksum(pair.Value));
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableHashTableWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableHashTableWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableHashTable table = new CacheableHashTable();
+ System.Collections.Hashtable table = new System.Collections.Hashtable();
+ ICollection<UInt32> keyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ int keySize = 16;
+ maxSize = maxSize / (keyTypeIds.Count * valueTypeIds.Count) + 1;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (UInt32 keyTypeId in keyTypeIds)
+ {
+ int index = 0;
+ foreach (UInt32 valueTypeId in valueTypeIds)
+ {
+ if ((valueTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ valueTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(keyTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ if ((keyTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ keyTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(valueTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ if (valueTypeId == GeodeClassIds.CacheableNullString)
+ {
+ continue;
+ }
+
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance(keyTypeId);
+ Assert.IsNotNull(keyWrapper, "CacheableHashTableWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", keyTypeId);
+ if (keyWrapper.MaxKeys <= index)
+ {
+ break;
+ }
+ keyWrapper.InitKey((int)(keyTypeId << 8) + index, keySize);
+
+ if (!CacheableHelper.IsContainerTypeId(valueTypeId) &&
+ !CacheableHelper.IsUnhandledType(valueTypeId))
+ {
+ valueWrapper = CacheableWrapperFactory.CreateInstance(valueTypeId);
+ Assert.IsNotNull(valueWrapper, "CacheableHashTableWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", valueTypeId);
+ valueWrapper.InitRandomValue(maxSize);
+ if (valueWrapper.Cacheable == null)
+ {
+ Util.Log(" adding null value " + valueWrapper.GetType() + " : " + valueTypeId);
+ }
+ else
+ Util.Log(" adding value " + valueWrapper.GetType() + " : " + valueTypeId);
+ table.Add(keyWrapper.CacheableKey, valueWrapper.Cacheable);
+ }
+ index++;
+ }
+ }
+ m_cacheableObject = table;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //Dictionary<object, object> value = new Dictionary<object, object>();
+ System.Collections.Hashtable value = cacheableObject as System.Collections.Hashtable;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (System.Collections.DictionaryEntry pair in value)
+ {
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance(
+ pair.Key);
+ Assert.IsNotNull(keyWrapper, "CacheableHashTable.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ keyWrapper.TypeId);
+ valueWrapper = CacheableWrapperFactory.CreateInstance(
+ pair.Value);
+ Assert.IsNotNull(valueWrapper, "CacheableHashTable.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ valueWrapper.TypeId);
+
+ ckSum ^= (keyWrapper.GetChecksum(pair.Key) ^
+ valueWrapper.GetChecksum(pair.Value));
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableIdentityHashMapWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableIdentityHashMapWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableIdentityHashMap map = new CacheableIdentityHashMap();
+ Dictionary<object, object> map = new Dictionary<object, object>();
+ ICollection<UInt32> keyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ int keySize = 16;
+ maxSize = maxSize / (keyTypeIds.Count * valueTypeIds.Count) + 1;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (UInt32 keyTypeId in keyTypeIds)
+ {
+ int index = 0;
+ foreach (UInt32 valueTypeId in valueTypeIds)
+ {
+ if ((valueTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ valueTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(keyTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ if ((keyTypeId == GeodeClassIds.CacheableASCIIStringHuge ||
+ keyTypeId == GeodeClassIds.CacheableStringHuge)
+ && !(valueTypeId == GeodeClassIds.CacheableBoolean))
+ {
+ continue;
+ }
+ // null object does not work on server side during deserialization
+ if (valueTypeId == GeodeClassIds.CacheableNullString)
+ {
+ continue;
+ }
+
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance(keyTypeId);
+ Assert.IsNotNull(keyWrapper, "CacheableIdentityHashMapWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", keyTypeId);
+ if (keyWrapper.MaxKeys <= index)
+ {
+ break;
+ }
+ keyWrapper.InitKey((int)(keyTypeId << 8) + index, keySize);
+
+ if (!CacheableHelper.IsContainerTypeId(valueTypeId) &&
+ !CacheableHelper.IsUnhandledType(valueTypeId))
+ {
+ valueWrapper = CacheableWrapperFactory.CreateInstance(valueTypeId);
+ Assert.IsNotNull(valueWrapper, "CacheableIdentityHashMapWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", valueTypeId);
+ valueWrapper.InitRandomValue(maxSize);
+ map.Add(keyWrapper.CacheableKey, valueWrapper.Cacheable);
+ }
+ index++;
+ }
+ }
+ m_cacheableObject = map;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+
+ //CacheableHashMap value = cacheableObject as CacheableHashMap;
+ Dictionary<object, object> value = new Dictionary<object, object>();
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableKeyWrapper keyWrapper;
+ CacheableWrapper valueWrapper;
+ foreach (KeyValuePair<object, object> pair in value)
+ {
+ keyWrapper = CacheableWrapperFactory.CreateKeyInstance(
+ pair.Key);
+ Assert.IsNotNull(keyWrapper, "CacheableIdentityHashMap.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ keyWrapper.TypeId);
+ valueWrapper = CacheableWrapperFactory.CreateInstance(
+ pair.Value);
+ Assert.IsNotNull(valueWrapper, "CacheableIdentityHashMap.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].",
+ valueWrapper.TypeId);
+
+ ckSum ^= (keyWrapper.GetChecksum(pair.Key) ^
+ valueWrapper.GetChecksum(pair.Value));
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableHashSetWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableHashSetWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ CacheableHashSet set = new CacheableHashSet();
+ //List<object> set = new List<object>();
+
+ //Dictionary set = new Dictionary();
+ ICollection<UInt32> keyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ maxSize = maxSize / keyTypeIds.Count + 1;
+ CacheableKeyWrapper wrapper;
+ int keyIndex = 0;
+ foreach (UInt32 typeId in keyTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateKeyInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableHashSetWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitKey(keyIndex++, maxSize);
+
+
+ set.Add(wrapper.CacheableKey);
+ }
+ }
+ m_cacheableObject = set;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableHashSet value = cacheableObject as CacheableHashSet;
+ //List<object> value = cacheableObject as List<object>;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableKeyWrapper wrapper;
+ foreach (object key in value)
+ {
+ wrapper = CacheableWrapperFactory.CreateKeyInstance(key);
+ Assert.IsNotNull(wrapper, "CacheableHashSet.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(key);
+ }
+ return ckSum;
+ }
+
+ public override int GetHashCodeN(object cacheableObject)
+ {
+ CacheableHashSet value = cacheableObject as CacheableHashSet;
+
+ return value.GetHashCode();
+ }
+ #endregion
+ }
+
+ public class CacheableLinkedHashSetWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableLinkedHashSetWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ CacheableLinkedHashSet set = new CacheableLinkedHashSet();
+ //Dictionary<object, object> set = new Dictionary<object, object>();
+ //List<object> set = new List<object>();
+ ICollection<UInt32> keyTypeIds =
+ CacheableWrapperFactory.GetRegisteredKeyTypeIds();
+ maxSize = maxSize / keyTypeIds.Count + 1;
+ CacheableKeyWrapper wrapper;
+ int keyIndex = 0;
+ foreach (UInt32 typeId in keyTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateKeyInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableLinkedHashSetWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitKey(keyIndex++, maxSize);
+ set.Add(wrapper.CacheableKey);
+ }
+ }
+ m_cacheableObject = set;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //List<object> value = new List<object>();
+ CacheableLinkedHashSet value = cacheableObject as CacheableLinkedHashSet;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableKeyWrapper wrapper;
+ foreach (object key in value)
+ {
+ wrapper = CacheableWrapperFactory.CreateKeyInstance(key);
+ Assert.IsNotNull(wrapper, "CacheableLinkedHashSet.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(key);
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableInt16ArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableInt16ArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = maxSize / sizeof(short);
+ arraySize = arraySize > 1 ? arraySize : 2;
+ short[] value = new short[arraySize];
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ value[arrayIndex] = (short)Util.Rand(short.MaxValue);
+ }
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int16[] obj = cacheableObject as Int16[];
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ short[] value = obj;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (short v in value)
+ {
+ short conv = v;
+ int numBytes = sizeof(short);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(conv & 0xff));
+ conv = (short)(conv >> 8);
+ }
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ #endregion
+ }
+
+ public class CacheableInt32ArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableInt32ArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = maxSize / sizeof(int);
+ arraySize = arraySize > 1 ? arraySize : 2;
+ int[] value = new int[arraySize];
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ value[arrayIndex] = Util.Rand(int.MaxValue);
+ }
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int32[] obj = cacheableObject as Int32[];
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ int[] value = obj;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (int v in value)
+ {
+ int conv = v;
+ int numBytes = sizeof(int);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(conv & 0xff));
+ conv = conv >> 8;
+ }
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ #endregion
+ }
+
+ public class CacheableInt64ArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableInt64ArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = maxSize / sizeof(long);
+ arraySize = arraySize > 1 ? arraySize : 2;
+ long[] value = new long[arraySize];
+ long rnd;
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ rnd = (long)Util.Rand(int.MaxValue);
+ rnd = (rnd << 32) + (long)Util.Rand(int.MaxValue);
+ value[arrayIndex] = rnd;
+ }
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Int64[] obj = cacheableObject as Int64[];
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ long[] value = obj;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (long v in value)
+ {
+ long conv = v;
+ int numBytes = sizeof(long);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(conv & 0xff));
+ conv = conv >> 8;
+ }
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ #endregion
+ }
+
+ public class CacheableNullStringWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableNullStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //m_cacheableObject = CacheableString.Create((string)null);
+ m_cacheableObject = null;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ //CacheableString value = cacheableObject as CacheableString;
+ Assert.IsNull(cacheableObject, "GetChecksum: expected null object.");
+ return (uint)0;
+ }
+
+ #endregion
+ }
+
+ public class CacheableEmptyStringWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableEmptyStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //m_cacheableObject = CacheableString.Create(string.Empty);
+ m_cacheableObject = string.Empty;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string value = cacheableObject as string;
+ Assert.IsNotNull(value, "GetChecksum: expected non null object.");
+ Assert.IsTrue(value == string.Empty || value.Length == 0, "Expected IsNullOrEmpty " + value.Length);
+ return (uint)0;
+ }
+
+ #endregion
+ }
+
+ public class CacheableEmptyUnicodeStringWrapper : CacheableWrapper
+ {
+ // TODO : VJR : Is this a real UNICODE empty string?
+ // See bugs #324 and #356 to add this wrapper when tracking them.
+
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableEmptyUnicodeStringWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //m_cacheableObject = CacheableString.Create(string.Empty);
+ m_cacheableObject = string.Empty;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ string value = cacheableObject as string;
+ Assert.IsNotNull(value, "GetChecksum: expected non null object.");
+ Assert.IsTrue(value == string.Empty || value.Length == 0, "Expected IsNullOrEmpty");
+ return (uint)0;
+ }
+
+ #endregion
+ }
+
+ public class CacheableStringArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableStringArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ int arraySize = 16;
+ maxSize = maxSize / arraySize;
+ if (maxSize < 2)
+ {
+ maxSize = 2;
+ }
+ String[] value = new String[arraySize];
+ for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
+ {
+ if (arrayIndex % 2 == 0)
+ {
+ byte[] buffer = Util.RandBytes(maxSize / 2);
+ value[arrayIndex] = BitConverter.ToString(buffer).Replace("-", string.Empty);
+ }
+ else
+ {
+ byte[] buffer = Util.RandBytes(maxSize / 2);
+ char[] charArray = new char[maxSize / 2];
+ for (int i = 0; i < maxSize / 2; i++)
+ {
+ charArray[i] = (char)((int)buffer[i] + 0x0901);
+ }
+ value[arrayIndex] = new String(charArray);
+ }
+ }
+ //m_cacheableObject = CacheableStringArray.Create(value);
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ String[] value = cacheableObject as String[];
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ foreach (String str in value)
+ {
+ foreach (char c in str)
+ {
+ ms.WriteByte((byte)(c & 0xff));
+ byte uByte = (byte)((c >> 8) & 0xff);
+ if (uByte != 0x00)
+ ms.WriteByte(uByte);
+ }
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ #endregion
+ }
+
+ public class CacheableUndefinedWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableUndefinedWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ m_cacheableObject = new CacheableUndefined();
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableUndefined value = cacheableObject as CacheableUndefined;
+ // TODO: [sumedh] server sends back null; check this
+ //Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ return 0;
+ }
+
+ #endregion
+ }
+
+ public class CacheableVectorWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableVectorWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableVector vec = new CacheableVector();
+ System.Collections.ArrayList vec = new System.Collections.ArrayList();
+
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ maxSize = maxSize / valueTypeIds.Count + 1;
+ CacheableWrapper wrapper;
+ foreach (UInt32 typeId in valueTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableVectorWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitRandomValue(maxSize);
+ vec.Add(wrapper.Cacheable);
+ }
+ }
+ m_cacheableObject = vec;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ System.Collections.ArrayList value = cacheableObject as System.Collections.ArrayList;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableWrapper wrapper;
+ foreach (object obj in value)
+ {
+ if (obj == null)
+ {
+ continue;
+ }
+ wrapper = CacheableWrapperFactory.CreateInstance(obj);
+ Assert.IsNotNull(wrapper, "CacheableVectorWrapper.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(obj);
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableObjectArrayWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableObjectArrayWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ CacheableObjectArray arr = new CacheableObjectArray();
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ maxSize = maxSize / valueTypeIds.Count + 1;
+ CacheableWrapper wrapper;
+ foreach (UInt32 typeId in valueTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableObjectArrayWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitRandomValue(maxSize);
+
+ arr.Add(wrapper.Cacheable);
+ }
+ }
+ m_cacheableObject = arr;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableObjectArray value = cacheableObject as CacheableObjectArray;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableWrapper wrapper;
+ foreach (object obj in value)
+ {
+ if (obj == null)
+ {
+ continue;
+ }
+ wrapper = CacheableWrapperFactory.CreateInstance(obj);
+ Assert.IsNotNull(wrapper, "CacheableObjectArrayWrapper.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(obj);
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableArrayListWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableArrayListWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableArrayList arrayList = new CacheableArrayList();
+ List<object> arrayList = new List<object>();
+
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ maxSize = maxSize / valueTypeIds.Count + 1;
+ CacheableWrapper wrapper;
+ Util.Log(" arrayList size InitRandomValue ");
+ foreach (UInt32 typeId in valueTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableArrayListWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitRandomValue(maxSize);
+ arrayList.Add(wrapper.Cacheable);
+ }
+ }
+ m_cacheableObject = arrayList;
+ Util.Log(" arrayList size InitRandomValue " + arrayList.Count);
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ List<object> value = cacheableObject as List<object>;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableWrapper wrapper;
+ foreach (object obj in value)
+ {
+ if (obj == null)
+ {
+ continue;
+ }
+ wrapper = CacheableWrapperFactory.CreateInstance(obj);
+ Assert.IsNotNull(wrapper, "CacheableArrayListWrapper.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(obj);
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableStackWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableStackWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ //CacheableStack vec = new CacheableStack();
+ Stack<object> vec = new Stack<object>();
+
+ ICollection<UInt32> valueTypeIds =
+ CacheableWrapperFactory.GetRegisteredValueTypeIds();
+ maxSize = maxSize / valueTypeIds.Count + 1;
+ CacheableWrapper wrapper;
+ foreach (UInt32 typeId in valueTypeIds)
+ {
+ if (!CacheableHelper.IsContainerTypeId(typeId) &&
+ !CacheableHelper.IsUnhandledType(typeId))
+ {
+ wrapper = CacheableWrapperFactory.CreateInstance(typeId);
+ Assert.IsNotNull(wrapper, "CacheableStackWrapper.InitRandomValue:" +
+ " Could not create an instance of typeId [{0}].", typeId);
+ wrapper.InitRandomValue(maxSize);
+ vec.Push(wrapper.Cacheable);
+ }
+ }
+ m_cacheableObject = vec;
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ Stack<object> value = cacheableObject as Stack<object>;
+ Assert.IsNotNull(value, "GetChecksum: Null object.");
+
+ uint ckSum = 0;
+ CacheableWrapper wrapper;
+ foreach (Object obj in value)
+ {
+ if (obj == null)
+ {
+ continue;
+ }
+ wrapper = CacheableWrapperFactory.CreateInstance(obj);
+ Assert.IsNotNull(wrapper, "CacheableStackWrapper.GetChecksum:" +
+ " Could not create an instance of typeId [{0}].", wrapper.TypeId);
+ ckSum ^= wrapper.GetChecksum(obj);
+ }
+ return ckSum;
+ }
+
+ #endregion
+ }
+
+ public class CacheableObjectWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableObjectWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ CData value = CacheableHelper.RandCData();
+ m_cacheableObject = CacheableObject.Create(value);
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableObject obj = cacheableObject as CacheableObject;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ CData value = (CData)obj.Value;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ int first = value.First;
+ int numBytes = sizeof(int);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(first & 0xff));
+ first = first >> 8;
+ }
+ long second = value.Second;
+ numBytes = sizeof(long);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(second & 0xff));
+ second = second >> 8;
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+
+ #endregion
+ }
+
+ public class CacheableObjectXmlWrapper : CacheableWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableWrapper Create()
+ {
+ return new CacheableObjectXmlWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ CData value = CacheableHelper.RandCData();
+ m_cacheableObject = CacheableObjectXml.Create(value);
+ }
+
+ public override uint GetChecksum(object cacheableObject)
+ {
+ CacheableObjectXml obj = cacheableObject as CacheableObjectXml;
+ Assert.IsNotNull(obj, "GetChecksum: Null object.");
+
+ CData value = (CData)obj.Value;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ int first = value.First;
+ int numBytes = sizeof(int);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(first & 0xff));
+ first = first >> 8;
+ }
+ long second = value.Second;
+ numBytes = sizeof(long);
+ for (int i = 0; i < numBytes; i++)
+ {
+ ms.WriteByte((byte)(second & 0xff));
+ second = second >> 8;
+ }
+ return CacheableHelper.CRC32(ms.ToArray());
+ }
+
+ #endregion
+ }
+
+ public class PdxCDataWrapper : CacheableKeyWrapper
+ {
+ #region Static factory creation function
+
+ public static CacheableKeyWrapper Create()
+ {
+ return new PdxCDataWrapper();
+ }
+
+ #endregion
+
+ #region CacheableWrapper Members
+
+ public override void InitRandomValue(int maxSize)
+ {
+ PdxCData value = CacheableHelper.RandPdxCData();
+ m_cacheableObject = value;
+ }
+
+ public override uint GetChecksum(object ca
<TRUNCATED>
[44/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DistOpsTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DistOpsTests.cs b/clicache/integration-test/DistOpsTests.cs
new file mode 100644
index 0000000..ae6ac4c
--- /dev/null
+++ b/clicache/integration-test/DistOpsTests.cs
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ public class DistOpsTests : DistOpsSteps
+ {
+ #region Private statics/constants and members
+
+ private static string[] AckRegionNames = { "DistRegionAck1", "DistRegionNoAck1" };
+ private static string[] ILRegionNames = { "IL_DistRegionAck", "IL_DistRegionNoAck" };
+
+ private UnitProcess m_client1, m_client2, m_client3;
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ [Test]
+ public void DistOps()
+ {
+ m_client1.Call(CreateRegions, AckRegionNames);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateRegions, AckRegionNames);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThree);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFour);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFive, true);
+ Util.Log("StepFive complete.");
+
+ Util.Log("StepSix commencing.");
+ m_client2.Call(StepSix, true);
+ Util.Log("StepSix complete.");
+
+ m_client1.Call(StepSeven);
+ Util.Log("StepSeven complete.");
+
+ m_client2.Call(StepEight);
+ Util.Log("StepEight complete.");
+
+ m_client1.Call(StepNine);
+ Util.Log("StepNine complete.");
+
+ m_client2.Call(StepTen);
+ Util.Log("StepTen complete.");
+
+ m_client1.Call(StepEleven);
+ Util.Log("StepEleven complete.");
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DistributedSystemTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DistributedSystemTests.cs b/clicache/integration-test/DistributedSystemTests.cs
new file mode 100644
index 0000000..157eee2
--- /dev/null
+++ b/clicache/integration-test/DistributedSystemTests.cs
@@ -0,0 +1,136 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ [Category("unicast_only")]
+ public class DistributedSystemTests : UnitTests
+ {
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [Test]
+ public void Connect()
+ {
+ try
+ {
+ DistributedSystem.Disconnect(CacheHelper.getCache());
+ Assert.Fail("NotConnectedException should have occurred when "
+ + "disconnecting without having connected.");
+ }
+ catch (NotConnectedException ex)
+ {
+ Util.Log("Got an expected exception in DistributedSystem.disconnect: "
+ + ex);
+ }
+ try
+ {
+ CacheHelper.ConnectName("ConnTest");
+ }
+ finally
+ {
+ CacheHelper.Close();
+ }
+ }
+
+ [Test]
+ public void ConnectToNull()
+ {
+ Util.Log("Creating DistributedSytem with null name...");
+ try
+ {
+ CacheHelper.ConnectName(null);
+ CacheHelper.Close();
+ Assert.Fail("IllegalArgumentException should have occurred when "
+ + "connecting to a null DistributedSystem.");
+ }
+ catch (IllegalArgumentException ex)
+ {
+ Util.Log("Got an expected exception in DistributedSystem.connect: "
+ + ex);
+ }
+ }
+
+ [Test]
+ public void Reconnect()
+ {
+ string[] memberTypes = { "PEER", "SERVER" };
+ foreach (string memberType in memberTypes)
+ {
+ // Connect and disconnect 10 times
+
+ for (int i = 0; i < 10; i++)
+ {
+ CacheHelper.InitConfig(memberType, null);
+
+ try
+ {
+ Region region1 = CacheHelper.CreatePlainRegion("R1");
+ Region region2 = CacheHelper.CreatePlainRegion("R2");
+ }
+ finally
+ {
+ CacheHelper.Close();
+ }
+ }
+ }
+ }
+
+ [Test]
+ public void Example()
+ {
+ CacheableString cVal;
+
+ Region region = CacheHelper.CreateLRURegion("exampleRegion",
+ 1000, ScopeType.DistributedNoAck);
+ try
+ {
+ // put some values into the cache.
+ for (int i = 1; i <= 2000; i++)
+ {
+ region.Put("key-" + i, "value-" + i);
+ }
+
+ // do some gets... printing what we find in the cache.
+ for (int i = 1; i <= 2000; i += 100)
+ {
+ cVal = region.Get("key-" + i) as CacheableString;
+ if (cVal == null)
+ {
+ Util.Log("Didn't find key-{0} in the cache.", i);
+ }
+ else
+ {
+ Util.Log("Found key-{0} with value {1}.", i, cVal.Value);
+ }
+ }
+ }
+ finally
+ {
+ CacheHelper.Close();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DupListenerN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DupListenerN.cs b/clicache/integration-test/DupListenerN.cs
new file mode 100644
index 0000000..74eab9a
--- /dev/null
+++ b/clicache/integration-test/DupListenerN.cs
@@ -0,0 +1,117 @@
+/*
+ * 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 System.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+ class DupListener<TKey, TVal> : ICacheListener<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_ops = 0;
+ private Dictionary<object, object> m_map = new Dictionary<object, object>();
+ //ICacheableKey, IGeodeSerializable
+
+ #endregion
+
+ #region Public accessors
+
+ public int Ops
+ {
+ get
+ {
+ return m_ops;
+ }
+ }
+
+ #endregion
+
+ public static DupListener<TKey, TVal> Create()
+ {
+ return new DupListener<TKey, TVal>();
+ }
+
+ private void check(EntryEvent<TKey, TVal> ev)
+ {
+ m_ops++;
+
+ object key = (object)ev.Key;
+ object value = (object)ev.NewValue;
+
+ //string key = ev.Key();
+ //int value = ev.NewValue;
+ if (m_map.ContainsKey(key))
+ {
+ int old = (int)m_map[key];
+ Assert.AreEqual(value/*.Value*/, old/*.Value*/ + 1, "Duplicate or older value received");
+ }
+
+ m_map[key] = value;
+ }
+
+ public void validate()
+ {
+ Assert.AreEqual(4, m_map.Count, "Expected 4 keys for the region");
+ Assert.AreEqual(400, m_ops, "Expected 400 events (100 per key) for the region");
+
+ foreach (object item in m_map.Values)
+ {
+ //CacheableInt32 checkval = item as CacheableInt32;
+ int checkval = (int)item;
+ Assert.AreEqual(100, checkval, "Expected final value to be 100");
+ }
+ }
+
+ #region ICacheListener Members
+
+ public virtual void AfterCreate(EntryEvent<TKey, TVal> ev)
+ {
+ check(ev);
+ }
+
+ public virtual void AfterUpdate(EntryEvent<TKey, TVal> ev)
+ {
+ check(ev);
+ }
+
+ public virtual void AfterDestroy(EntryEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterInvalidate(EntryEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionDestroy(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionClear(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionInvalidate(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionLive(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void Close(IRegion<TKey, TVal> region) { }
+ public virtual void AfterRegionDisconnected(IRegion<TKey, TVal> region) { }
+
+ #endregion
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/DurableListenerN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/DurableListenerN.cs b/clicache/integration-test/DurableListenerN.cs
new file mode 100644
index 0000000..c01211d
--- /dev/null
+++ b/clicache/integration-test/DurableListenerN.cs
@@ -0,0 +1,199 @@
+/*
+ * 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 System.Collections.Generic;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+ using Apache.Geode.Client;
+
+ //using Com.Vmware.Cache;
+ //using Region = Com.Vmware.Cache.IRegion<object, object>;
+
+ class DurableListener<TKey, TVal> : ICacheListener<TKey, TVal>
+ {
+ #region Private members
+
+ private int m_ops = 0;
+ private Dictionary<object, object> m_map = new Dictionary<object, object>();
+
+ #endregion
+
+ #region Public accessors
+
+ public int Ops
+ {
+ get
+ {
+ return m_ops;
+ }
+ }
+
+ #endregion
+
+ public static DurableListener<TKey, TVal> Create()
+ {
+ Util.Log(" DurableListener Created");
+
+ return new DurableListener<TKey, TVal>();
+ }
+
+ private void check(EntryEvent<TKey, TVal> ev)
+ {
+ m_ops++;
+
+ //CacheableString key = ev.Key as CacheableString;
+ //ICacheableKey<TKey> key = ev.Key;
+ //TVal value = ev.NewValue;
+ object key = (object)ev.Key;
+ object value = (object)ev.NewValue;
+ //object key = (object)ev.Key;
+ //object value = (object)ev.NewValue;
+ //CacheableInt32 value = ev.NewValue as CacheableInt32;
+ //object value = (object)ev.NewValue;
+ //object key1 = key.Value;
+ //int value1 = (int)value;
+
+ //if (m_map.ContainsKey(key))
+ //{
+ // //CacheableInt32 old = m_map[key] as CacheableInt32;
+ // //TVal old =(TVal) m_map[(TKey)key];
+ // object old = m_map[key];
+ // Assert.AreEqual(value, old /*old + 1*/, "Duplicate or older value received");
+ //}
+
+ Util.Log("key={0} and Value={1}", key, value);
+ Util.Log("key={0} and Value={1}", key.GetType(), value.GetType());
+ m_map[key] = value;
+ }
+
+ // this method for the ThinClientDurableTests
+ public void validate(int keys, int durable, int nondurable)
+ {
+ string msg1 = string.Format("Expected {0} keys but got {1}", keys, m_map.Count);
+ Assert.AreEqual(keys, m_map.Count, msg1);
+
+ int total = keys * (durable + nondurable) / 2;
+
+ string msg2 = string.Format("Expected {0} events but got {1}", total, m_ops);
+ Assert.AreEqual(total, m_ops, msg2);
+
+ foreach (KeyValuePair<object, object> item in m_map)
+ {
+ string key = (string)item.Key;
+ int checkvalue = (int)item.Value;
+ int finalvalue = durable;
+ if (key.StartsWith("Key"))
+ {
+ finalvalue = nondurable;
+ }
+ string msg3 = string.Format("Expected final value for key {0} to be {1} but was {2}", key, finalvalue, checkvalue);
+ Assert.AreEqual(finalvalue, checkvalue, msg3);
+ }
+ }
+
+ // this method for the ThinClientDurableTests
+ public void validate(int keys, int total)
+ {
+ string msg1 = string.Format("Expected {0} keys but got {1}", keys, m_map.Count);
+ Assert.AreEqual(keys, m_map.Count, msg1);
+
+ string msg2 = string.Format("Expected {0} events but got {1}", total, m_ops);
+ Assert.AreEqual(total, m_ops, msg2);
+
+ int finalvalue = total/keys;
+
+ foreach (KeyValuePair<object, object> item in m_map)
+ {
+ string key = (string)item.Key;
+ int checkvalue = (int)item.Value;
+ string msg3 = string.Format("Expected final value for key {0} to be {1} but was {2}", key, finalvalue, checkvalue);
+ Assert.AreEqual(finalvalue, checkvalue, msg3);
+ }
+ }
+ //Used for DurableAndNonDurableBasic
+ public void validateBasic(int keyCount, int eventCount, int durableValue, int nonDurableValue)
+ {
+ string msg1 = string.Format("Expected {0} keys but got {1}", keyCount, m_map.Count);
+ Assert.AreEqual(keyCount, m_map.Count, msg1);
+
+ string msg2 = string.Format("Expected {0} events but got {1}", eventCount, m_ops);
+ Assert.AreEqual(eventCount, m_ops, msg2);
+
+ foreach (KeyValuePair<object, object> item in m_map)
+ {
+ string key = (string)item.Key;
+ int checkvalue = (int)item.Value;
+
+ int finalvalue;
+ if (key.StartsWith("D-") || key.StartsWith("LD-")) { // durable key
+ finalvalue = durableValue;
+ }
+ else {
+ finalvalue = nonDurableValue;
+ }
+
+ string msg3 = string.Format("Expected final value for key {0} to be {1} but was {2}", key, finalvalue, checkvalue);
+
+ Assert.AreEqual(finalvalue, checkvalue, msg3);
+ }
+ }
+
+ #region ICacheListener Members
+
+ public virtual void AfterCreate(EntryEvent<TKey, TVal> ev)
+ {
+ Util.Log("Called AfterCreate()");
+ check(ev);
+ }
+
+ public virtual void AfterUpdate(EntryEvent<TKey, TVal> ev)
+ {
+ Util.Log("Called AfterUpdate()");
+ check(ev);
+ }
+
+ public virtual void AfterDestroy(EntryEvent<TKey, TVal> ev)
+ {
+ //Increment only count
+ Util.Log("Called AfterDestroy()");
+ m_ops++;
+ }
+
+ public virtual void AfterInvalidate(EntryEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionDestroy(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionClear(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionInvalidate(RegionEvent<TKey, TVal> ev) { }
+
+ public virtual void AfterRegionLive(RegionEvent<TKey, TVal> ev)
+ {
+ Util.Log("DurableListener: Received AfterRegionLive event of region: {0}", ev.Region.Name);
+ }
+
+ public virtual void Close(IRegion<TKey, TVal> region) { }
+ public void AfterRegionDisconnected(IRegion<TKey, TVal> region) { }
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/ExpirationTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/ExpirationTestsN.cs b/clicache/integration-test/ExpirationTestsN.cs
new file mode 100644
index 0000000..419a43e
--- /dev/null
+++ b/clicache/integration-test/ExpirationTestsN.cs
@@ -0,0 +1,339 @@
+/*
+ * 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 System.Collections.Generic;
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("group2")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class ExpirationTests : UnitTests
+ {
+ #region Private members
+
+ private IRegion<object, object> m_region = null;
+ private string m_key = "KeyA - 1";
+ private string m_value = "Value - AAAAAAA";
+ private string m_regionName = "R";
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ Properties<string, string> config = new Properties<string, string>();
+ CacheHelper.InitConfig(config);
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ try
+ {
+ CacheHelper.Close();
+ }
+ finally
+ {
+ base.EndTests();
+ }
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ base.EndTest();
+ }
+
+ #region Private functions
+
+ private int GetNumOfEntries()
+ {
+ try
+ {
+ ICollection<object> keys = m_region.GetLocalView().Keys;
+
+ if (keys != null)
+ {
+ return keys.Count;
+ }
+ }
+ catch (RegionDestroyedException)
+ {
+ }
+ return 0;
+ }
+
+ private void DoNPuts(int n)
+ {
+ for (int index = 0; index < n; index++)
+ {
+ m_region[string.Format("KeyA - {0}", index + 1)] = m_value;
+ }
+ }
+
+ private void Do1Put()
+ {
+ m_region[m_key] = m_value;
+ }
+
+ private void SetupRegion(uint entryTTL, uint entryIdleTimeout,
+ uint regionTTL, uint regionIdleTimeout)
+ {
+ const ExpirationAction action = ExpirationAction.Destroy;
+
+ RegionFactory rf = CacheHelper.DCache.CreateRegionFactory(RegionShortcut.LOCAL);
+
+ rf.SetEntryTimeToLive(action, entryTTL);
+ rf.SetEntryIdleTimeout(action, entryIdleTimeout);
+ rf.SetRegionTimeToLive(action, regionTTL);
+ rf.SetRegionIdleTimeout(action, regionIdleTimeout);
+
+ CacheHelper.Init();
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(m_regionName);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", m_regionName);
+ }
+ m_region = rf.Create<object, object>(m_regionName);
+ Assert.IsNotNull(m_region, "IRegion<object, object> was not created.");
+
+ }
+ private void PutKeyTouch(int sleepSecs)
+ {
+ Do1Put();
+ Thread.Sleep(sleepSecs * 1000);
+ object val = m_region[m_key];
+ }
+
+ private void PutNKeysNoExpire(int numKeys, int sleepSecs)
+ {
+ int n;
+
+ DoNPuts(numKeys);
+ Thread.Sleep(sleepSecs * 1000);
+ if (numKeys > 0)
+ {
+ n = GetNumOfEntries();
+ Assert.AreEqual(numKeys, n, "Expected " + numKeys + " entries");
+ }
+ }
+
+ private void PutNKeysExpire(int numKeys, int sleepSecs)
+ {
+ int n;
+
+ DoNPuts(numKeys);
+ Thread.Sleep(sleepSecs * 1000);
+ n = GetNumOfEntries();
+ Assert.AreEqual(0, n, "Expected 0 entry");
+ }
+
+ private void CheckRegion(bool expectedDead, int sleepSecs)
+ {
+ if (sleepSecs > 0)
+ {
+ Thread.Sleep(sleepSecs * 1000);
+ }
+ if (expectedDead)
+ {
+ Assert.IsTrue(m_region.IsDestroyed, "Expected {0} to be dead",
+ m_regionName);
+ }
+ else
+ {
+ Assert.IsFalse(m_region.IsDestroyed, "Expected {0} to be alive",
+ m_regionName);
+ }
+ }
+
+ #endregion
+
+ /*
+ [Test]
+ public void KeyDestroy()
+ {
+ m_regionName = "RT1";
+ SetupRegion(0, 0, 0, 0);
+ PutKeyTouch(5);
+ IGeodeSerializable val = m_region.Get(m_key);
+ m_region.Destroy(m_key);
+ val = m_region.Get(m_key);
+ CheckRegion(false, 0);
+
+ m_regionName = "RT2";
+ SetupRegion(0, 0, 0, 0);
+ PutNKeysNoExpire(5, 1);
+ m_region.DestroyRegion();
+ CheckRegion(true, 0);
+
+ m_regionName = "RT3";
+ SetupRegion(0, 0, 0, 0);
+ PutKeyTouch(5);
+ val = m_region.Get(m_key);
+ CheckRegion(false, 0);
+ m_region.DestroyRegion();
+ try
+ {
+ val = m_region.Get(m_key);
+ Util.Log("The key fetched has value: {0}", val);
+ Assert.Fail("The region should have been destroyed.");
+ }
+ catch (RegionDestroyedException)
+ {
+ }
+ CheckRegion(true, 0);
+ }
+ * */
+
+ [Test]
+ public void KeyExpiration()
+ {
+ m_regionName = "R1";
+ SetupRegion(0, 0, 0, 0);
+ PutNKeysNoExpire(100, 10);
+ CheckRegion(false, 0);
+
+ m_regionName = "R2";
+ SetupRegion(20, 2, 0, 0);
+ PutNKeysNoExpire(1, 5);
+ CheckRegion(false, 0);
+
+ m_regionName = "R3";
+ SetupRegion(5, 0, 0, 0);
+ PutNKeysExpire(1, 10);
+ CheckRegion(false, 0);
+
+ m_regionName = "R4";
+ SetupRegion(0, 5, 0, 0);
+ PutKeyTouch(2);
+ Thread.Sleep(3000);
+ Assert.AreEqual(1, GetNumOfEntries(), "Expected 1 entry");
+ Thread.Sleep(5000);
+ Assert.AreEqual(0, GetNumOfEntries(), "Expected 0 entry");
+ CheckRegion(false, 0);
+
+ m_regionName = "R5";
+ SetupRegion(10, 0, 0, 0);
+ PutKeyTouch(5);
+ PutNKeysNoExpire(0, 6);
+ CheckRegion(false, 0);
+
+ m_regionName = "R6";
+ SetupRegion(5, 0, 0, 0);
+ PutNKeysExpire(1, 6);
+ CheckRegion(false, 0);
+
+ m_regionName = "R7";
+ SetupRegion(0, 5, 0, 0);
+ PutKeyTouch(2);
+ m_region.GetLocalView().Remove(m_key);
+ CheckRegion(false, 5);
+
+ m_regionName = "R8";
+ SetupRegion(6, 3, 0, 0);
+ PutNKeysNoExpire(1, 4);
+ Thread.Sleep(4000);
+ Assert.AreEqual(0, GetNumOfEntries(), "ttl is over so it should be 0");
+ CheckRegion(false, 5);
+ }
+
+ [Test]
+ public void RegionExpiration()
+ {
+ m_regionName = "RR1";
+ SetupRegion(0, 0, 20, 2);
+ CheckRegion(false, 5);
+
+ m_regionName = "RR2";
+ SetupRegion(0, 0, 5, 0);
+ PutNKeysNoExpire(1, 2);
+ DoNPuts(1);
+ CheckRegion(true, 7);
+
+ m_regionName = "RR3";
+ SetupRegion(0, 0, 0, 5);
+ PutNKeysNoExpire(1, 2);
+ DoNPuts(1);
+ CheckRegion(true, 10);
+
+ m_regionName = "RR4";
+ SetupRegion(0, 0, 0, 8);
+ PutKeyTouch(5);
+ Thread.Sleep(5000);
+ Assert.AreEqual(1, GetNumOfEntries(), "Expected 1 entry");
+ CheckRegion(false, 0);
+
+ m_regionName = "RR5";
+ SetupRegion(0, 0, 10, 0);
+ Do1Put();
+ CheckRegion(true, 12);
+
+ m_regionName = "RR6";
+ SetupRegion(0, 0, 6, 3);
+ Thread.Sleep(4000);
+ Do1Put();
+ CheckRegion(false, 4);
+ CheckRegion(true, 4);
+ }
+
+ [Test]
+ public void RegionAndKeyExpiration()
+ {
+ /*
+ m_regionName = "RK1";
+ SetupRegion(5, 0, 0, 0);
+ PutNKeysNoExpire(1, 2);
+ m_region.DestroyRegion();
+ CheckRegion(true, 0);
+
+ m_regionName = "RK2";
+ SetupRegion(0, 5, 0, 0);
+ PutNKeysNoExpire(1, 1);
+ m_region.DestroyRegion();
+ CheckRegion(true, 6);
+ * */
+
+ m_regionName = "RK3";
+ SetupRegion(6, 0, 0, 12);
+ PutNKeysExpire(1, 10);
+ CheckRegion(true, 11);
+
+ m_regionName = "RK4";
+ SetupRegion(0, 4, 0, 7);
+ PutNKeysNoExpire(1, 3);
+ object val = m_region[m_key];
+ CheckRegion(false, 5);
+ CheckRegion(true, 5);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/LogTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/LogTests.cs b/clicache/integration-test/LogTests.cs
new file mode 100644
index 0000000..45f2ec8
--- /dev/null
+++ b/clicache/integration-test/LogTests.cs
@@ -0,0 +1,182 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+
+ [TestFixture]
+ [Category("unicast_only")]
+ public class LogTests : UnitTests
+ {
+ #region constants
+ const int LENGTH_OF_BANNER = 53;
+ #endregion
+
+ #region Private functions
+
+ private int NumOfLinesInFile(string fName)
+ {
+ try
+ {
+ int numLines = 0;
+ FileStream fs = new FileStream(fName, FileMode.Open,
+ FileAccess.Read, FileShare.ReadWrite);
+ if (fs == null)
+ {
+ return -1;
+ }
+ StreamReader sr = new StreamReader(fs);
+ string s;
+ while ((s = sr.ReadLine()) != null && s.Length > 0)
+ {
+ numLines++;
+ }
+ sr.Close();
+ fs.Close();
+ return numLines;
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+
+ private int LinesAtLevel(LogLevel level)
+ {
+ int expected = (int)level;
+ if ( level != LogLevel.Null ) {
+ expected += LENGTH_OF_BANNER;
+ }
+ if (level >= LogLevel.Default)
+ {
+ expected--;
+ }
+ return expected;
+ }
+
+ private void LogAll(string logFileName,
+ LogLevel level, int expectedLines)
+ {
+ string logFile = logFileName + ".log";
+
+ Log.Close();
+ File.Delete(logFile);
+ Log.Init(level, logFileName);
+
+ Log.Write(LogLevel.Error, "Error Message");
+ Log.Write(LogLevel.Warning, "Warning Message");
+ Log.Write(LogLevel.Info, "Info Message");
+ Log.Write(LogLevel.Config, "Config Message");
+ Log.Write(LogLevel.Fine, "Fine Message");
+ Log.Write(LogLevel.Finer, "Finer Message");
+ Log.Write(LogLevel.Finest, "Finest Message");
+ Log.Write(LogLevel.Debug, "Debug Message");
+
+ Log.Close();
+ int lines = NumOfLinesInFile(logFile);
+ Assert.AreEqual(expectedLines, lines, "Expected " + expectedLines.ToString() + " lines");
+
+ File.Delete(logFile);
+ }
+
+ private void LogSome(string logFileName,
+ LogLevel level, int expectedLines)
+ {
+ string logFile = logFileName + ".log";
+
+ Log.Close();
+ File.Delete(logFile);
+ Log.Init(level, logFileName);
+
+ Log.Write(LogLevel.Debug, "Debug Message");
+ Log.Write(LogLevel.Config, "Config Message");
+ Log.Write(LogLevel.Info, "Info Message");
+ Log.Write(LogLevel.Warning, "Warning Message");
+ Log.Write(LogLevel.Error, "Error Message");
+
+ Log.Close();
+ int lines = NumOfLinesInFile(logFile);
+ Assert.AreEqual(expectedLines, lines, "Expected " + expectedLines.ToString() + " lines");
+
+ File.Delete(logFile);
+ }
+
+ #endregion
+
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [Test]
+ public void AllLevels()
+ {
+ for (LogLevel level = LogLevel.Error;
+ level <= LogLevel.Debug; level = (LogLevel)((int)level + 1))
+ {
+ LogAll("all_logfile", level, LinesAtLevel(level));
+ }
+ }
+
+ [Test]
+ public void AllLevelsMacro()
+ {
+ for (LogLevel level = LogLevel.Error;
+ level <= LogLevel.Debug; level = (LogLevel)((int)level + 1))
+ {
+ LogAll("logleveltest" + (int)level,
+ level, LinesAtLevel(level));
+ }
+ }
+
+ [Test]
+ public void ConfigOnwards()
+ {
+ LogSome("logfile", LogLevel.Config, 4 + LENGTH_OF_BANNER );
+ }
+
+ [Test]
+ public void InfoOnwards()
+ {
+ LogSome("logfile", LogLevel.Info, 3 + LENGTH_OF_BANNER );
+ }
+
+ [Test]
+ public void WarningOnwards()
+ {
+ LogSome("logfile", LogLevel.Warning, 2 + LENGTH_OF_BANNER );
+ }
+
+ [Test]
+ public void ErrorOnwards()
+ {
+ LogSome("logfile", LogLevel.Error, 1 + LENGTH_OF_BANNER );
+ }
+
+ [Test]
+ public void NoLog()
+ {
+ LogSome("logfile", LogLevel.Null, 0);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/NetTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/NetTests.cs b/clicache/integration-test/NetTests.cs
new file mode 100644
index 0000000..e31d9b4
--- /dev/null
+++ b/clicache/integration-test/NetTests.cs
@@ -0,0 +1,173 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ public class NetTests : UnitTests
+ {
+ private const string TestRegion = "TestRegion";
+ private const string TestRegionWrite = "TestRegionWrite";
+ private const int NumEntries = 200;
+
+ private Region m_region;
+ private Region m_netWriteRegion;
+
+ private TallyLoader m_ldr = new TallyLoader();
+ private TallyWriter m_lwr = new TallyWriter();
+
+ private UnitProcess m_client1, m_client2, m_client3;
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ m_client3 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2, m_client3 };
+ }
+
+ #region Functions invoked by the tests
+
+ public void DoGets(Region region, int num)
+ {
+ for(int i = 0; i < num; i++)
+ {
+ CacheableInt32 val = region.Get(i) as CacheableInt32;
+ Assert.AreEqual(i, val.Value);
+ }
+ }
+
+ public void CreateRegionWithTallyLoader(ScopeType scope)
+ {
+ AttributesFactory af = new AttributesFactory();
+ af.SetCacheLoader(m_ldr);
+ af.SetScope(scope);
+ af.SetCachingEnabled(true);
+
+ m_region = CacheHelper.CreateRegion(TestRegion,
+ af.CreateRegionAttributes());
+ }
+
+ public void CreateRegionAndGetNEntries(int num)
+ {
+ CacheHelper.CreateDistribRegion(TestRegion, false, true);
+ m_region = CacheHelper.GetVerifyRegion(TestRegion);
+ DoGets(m_region, num);
+ IGeodeSerializable[] arr = m_region.GetKeys();
+ Assert.AreEqual(num, arr.Length);
+ }
+
+ public void VerifyLoaderCallsAfterGets(int num)
+ {
+ Assert.AreEqual(num, m_ldr.Loads);
+ Util.Log("Calling doGets for verify");
+ //Thread.Sleep(2000);
+ //doGets(m_region, load);
+ IGeodeSerializable[] arr = m_region.GetKeys();
+ Assert.AreEqual(num, arr.Length);
+ }
+
+ public void RegionThreeLoadEntries(int num)
+ {
+ AttributesFactory af = new AttributesFactory();
+ af.SetScope(ScopeType.Local);
+ af.SetCacheLoader(m_ldr);
+ m_region = CacheHelper.CreateRegion(TestRegion, af.CreateRegionAttributes());
+ m_ldr.Reset();
+ Thread.Sleep(100);
+ DoGets(m_region, num);
+ Assert.AreEqual(num, m_ldr.Loads);
+ IGeodeSerializable[] arr = m_region.GetKeys();
+ Assert.AreEqual(num, arr.Length);
+ }
+
+ public void CreateRegionWithTallyWriter(ScopeType scope)
+ {
+ AttributesFactory af = new AttributesFactory();
+ af.SetCacheWriter(m_lwr);
+ af.SetScope(scope);
+ af.SetCachingEnabled(true);
+
+ m_netWriteRegion = CacheHelper.CreateRegion(TestRegionWrite,
+ af.CreateRegionAttributes());
+ }
+
+ public void RegionTwoCreateEntries(int num)
+ {
+ CacheHelper.CreateDistribRegion(TestRegionWrite, false, true);
+ m_netWriteRegion = CacheHelper.GetVerifyRegion(TestRegionWrite);
+ Thread.Sleep(100);
+ TestCreateEntryActions(num);
+ }
+
+ public void TestCreateEntryActions(int num)
+ {
+ for (int i = 0; i < num; i++)
+ {
+ CacheableInt32 key = new CacheableInt32(i);
+ m_netWriteRegion.Put(key, key);
+ }
+ }
+
+ public void TestUpdateActions(int num)
+ {
+ for (int i = 0; i < num; i++)
+ {
+ CacheableInt32 key = new CacheableInt32(i);
+ m_netWriteRegion.Put(key, key);
+ }
+ }
+
+ public void VerifyWriterCallsAfterCreate(int num)
+ {
+ Assert.AreEqual(num, m_lwr.Creates);
+ }
+
+ public void VerifyWriterCallsAfterUpdates(int num)
+ {
+ Assert.AreEqual(num, m_lwr.Creates);
+ Assert.AreEqual(num, m_lwr.Updates);
+ }
+
+ #endregion
+
+ [Test]
+ public void LoaderTest()
+ {
+ m_client1.Call(CreateRegionWithTallyLoader, ScopeType.DistributedNoAck);
+ m_client2.Call(CreateRegionAndGetNEntries, NumEntries);
+ m_client1.Call(VerifyLoaderCallsAfterGets, NumEntries);
+ m_client3.Call(RegionThreeLoadEntries, NumEntries);
+ }
+
+ [Test]
+ public void WriterTest()
+ {
+ m_client1.Call(CreateRegionWithTallyWriter, ScopeType.DistributedNoAck);
+ m_client2.Call(RegionTwoCreateEntries, NumEntries);
+ m_client1.Call(VerifyWriterCallsAfterCreate, NumEntries);
+ m_client2.Call(TestUpdateActions, NumEntries);
+ m_client1.Call(VerifyWriterCallsAfterUpdates, NumEntries);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/OverflowTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/OverflowTestsN.cs b/clicache/integration-test/OverflowTestsN.cs
new file mode 100644
index 0000000..8980ab6
--- /dev/null
+++ b/clicache/integration-test/OverflowTestsN.cs
@@ -0,0 +1,664 @@
+/*
+ * 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.Threading;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ [TestFixture]
+ [Category("group4")]
+ [Category("unicast_only")]
+ [Category("generics")]
+
+ public class OverflowTests : UnitTests
+ {
+ private DistributedSystem m_dsys = null;
+
+ private const string DSYSName = "OverflowTest";
+
+ protected override ClientBase[] GetClients()
+ {
+ return null;
+ }
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+ m_dsys = CacheHelper.DSYS;
+ }
+
+ [TestFixtureTearDown]
+ public override void EndTests()
+ {
+ try
+ {
+ CacheHelper.Close();
+ }
+ finally
+ {
+ base.EndTests();
+ }
+ }
+
+ [SetUp]
+ public void StartTest()
+ {
+ CacheHelper.Init();
+ }
+
+ [TearDown]
+ public override void EndTest()
+ {
+ CacheHelper.Close();
+ base.EndTest();
+ }
+
+ #region Private functions used by the tests
+
+ private IRegion<object, object> CreateOverflowRegion(string regionName, string libraryName, string factoryFunctionName)
+ {
+
+ RegionFactory rf = CacheHelper.DCache.CreateRegionFactory(RegionShortcut.LOCAL);
+ rf.SetCachingEnabled(true);
+ rf.SetLruEntriesLimit(20);
+ rf.SetInitialCapacity(1000);
+ rf.SetDiskPolicy(DiskPolicyType.Overflows);
+
+ Properties<string, string> sqliteProperties = new Properties<string, string>();
+ sqliteProperties.Insert("PageSize", "65536");
+ sqliteProperties.Insert("MaxFileSize", "512000000");
+ String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
+ sqliteProperties.Insert("PersistenceDirectory", sqlite_dir);
+
+ rf.SetPersistenceManager(libraryName, factoryFunctionName, sqliteProperties);
+
+ CacheHelper.Init();
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>(regionName);
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> {0} was not destroyed.", regionName);
+ }
+ region = rf.Create<object, object>(regionName);
+ Assert.IsNotNull(region, "IRegion<object, object> was not created.");
+
+ return region;
+
+ }
+
+ // Testing for attibute validation.
+ private void ValidateAttributes(IRegion<object, object> region)
+ {
+ Apache.Geode.Client.RegionAttributes<object, object> regAttr = region.Attributes;
+ int initialCapacity = regAttr.InitialCapacity;
+ Assert.AreEqual(1000, initialCapacity, "Expected initial capacity to be 1000");
+ Assert.AreEqual(DiskPolicyType.Overflows, regAttr.DiskPolicy,
+ "Expected Action to be overflow to disk");
+ }
+
+
+ private string GetSqLiteFileName(string sqliteDir, string regionName)
+ {
+ return Path.Combine(Directory.GetCurrentDirectory(), sqliteDir, regionName, regionName + ".db");
+ }
+
+ private IRegion<object, object> CreateSubRegion(IRegion<object, object> region, string subRegionName, string libraryName, string factoryFunctionName)
+ {
+ AttributesFactory<object, object> attrsFact = new AttributesFactory<object, object>(region.Attributes);
+ Properties<string, string> sqliteProperties = new Properties<string, string>();
+ sqliteProperties.Insert("PageSize", "65536");
+ sqliteProperties.Insert("MaxPageCount", "512000000");
+ String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
+ sqliteProperties.Insert("PersistenceDirectory", sqlite_dir);
+ attrsFact.SetPersistenceManager(libraryName, factoryFunctionName, sqliteProperties);
+ IRegion<object, object> subRegion = region.CreateSubRegion(subRegionName,
+ attrsFact.CreateRegionAttributes());
+ Assert.IsNotNull(subRegion, "Expected region to be non null");
+ Assert.IsTrue(File.Exists(GetSqLiteFileName(sqlite_dir, subRegionName)), "Persistence file is not present");
+ DoNput(subRegion, 50);
+ DoNget(subRegion, 50);
+ return subRegion;
+ }
+
+ private void DoNput(IRegion<object, object> region, int num)
+ {
+ //CacheableString cVal = new CacheableString(new string('A', 1024));
+ string cVal = new string('A', 1024);
+ for (int i = 0; i < num; i++)
+ {
+ Util.Log("Putting key = key-{0}", i);
+ region["key-" + i.ToString()] = cVal;
+ }
+ }
+
+ private void DoNget(IRegion<object, object> region, int num)
+ {
+ string cVal;
+ string expectVal = new string('A', 1024);
+ for (int i = 0; i < num; i++)
+ {
+ cVal = region["key-" + i.ToString()] as string;
+ Util.Log("Getting key = key-{0}", i);
+ Assert.IsNotNull(cVal, "Key[key-{0}] not found.", i);
+ Assert.AreEqual(expectVal, cVal, "Did not find the expected value.");
+ }
+ }
+
+ private bool IsOverflowed(/*IGeodeSerializable*/ object cVal)
+ {
+ //Util.Log("IsOverflowed:: value is: {0}; type is: {1}", cVal.ToString(), cVal.GetType());
+ return cVal.ToString() == "CacheableToken::OVERFLOWED";
+ }
+
+ private void CheckOverflowToken(IRegion<object, object> region, int num, int lruLimit)
+ {
+ //IGeodeSerializable cVal;
+ //ICacheableKey[] cKeys = region.GetKeys();
+
+ object cVal;
+ ICollection<object> cKeys = region.GetLocalView().Keys;
+ Assert.AreEqual(num, cKeys.Count, "Number of keys does not match.");
+ int count = 0;
+ foreach (object cKey in cKeys)
+ {
+ RegionEntry<object, object> entry = region.GetEntry(cKey);
+ cVal = entry.Value;
+ if (IsOverflowed(cVal))
+ {
+ count++;
+ }
+ }
+ Assert.AreEqual(0, count, "Number of overflowed entries should be zero");
+ }
+
+ private void CheckNumOfEntries(IRegion<object, object> region, int lruLimit)
+ {
+ //ICollection<object> cVals = region.GetLocalView().Values;
+ ICollection<object> cVals = region.Values;
+ Assert.AreEqual(lruLimit, cVals.Count, "Number of values does not match.");
+ }
+
+ private void TestGetOp(IRegion<object, object> region, int num)
+ {
+ DoNput(region, num);
+
+ ICollection<object> cKeys = region.GetLocalView().Keys;
+ object cVal;
+
+ Assert.AreEqual(num, cKeys.Count, "Number of keys does not match.");
+ foreach (object cKey in cKeys)
+ {
+ RegionEntry<object, object> entry = region.GetEntry(cKey);
+ cVal = entry.Value;
+ if (IsOverflowed(cVal))
+ {
+ cVal = region[cKey];
+ Assert.IsFalse(IsOverflowed(cVal), "Overflow token even after a Region.Get");
+ }
+ }
+ }
+
+ private void TestEntryDestroy(IRegion<object, object> region)
+ {
+ //ICollection<object> cKeys = region.Keys;
+ ICollection<object> cKeys = region.GetLocalView().Keys;
+ string[] arrKeys = new string[cKeys.Count];
+ cKeys.CopyTo(arrKeys, 0);
+
+ for (int i = 50; i < 60; i++)
+ {
+ try
+ {
+ region.GetLocalView().Remove(arrKeys[i]);
+ }
+ catch (Exception ex)
+ {
+ Util.Log("Entry missing for {0}. Exception: {1}", arrKeys[i], ex.ToString());
+ }
+ }
+ cKeys = region.GetLocalView().Keys;
+
+ Assert.AreEqual(90, cKeys.Count, "Number of keys is not correct.");
+ }
+
+ #endregion
+
+ [Test]
+ public void OverflowPutGet()
+ {
+ IRegion<object, object> region = CreateOverflowRegion("OverFlowRegion", "SqLiteImpl", "createSqLiteInstance");
+ ValidateAttributes(region);
+
+ //Console.WriteLine("TEST-2");
+ // put some values into the cache.
+ DoNput(region, 100);
+ //Console.WriteLine("TEST-2.1 All PUts Donee");
+
+ CheckNumOfEntries(region, 100);
+
+ //Console.WriteLine("TEST-3");
+ // check whether value get evicted and token gets set as overflow
+ CheckOverflowToken(region, 100, 20);
+ // do some gets... printing what we find in the cache.
+ DoNget(region, 100);
+ TestEntryDestroy(region);
+ TestGetOp(region, 100);
+
+ //Console.WriteLine("TEST-4");
+ // test to verify same region repeatedly to ensure that the persistece
+ // files are created and destroyed correctly
+
+ IRegion<object, object> subRegion;
+ String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
+ for (int i = 0; i < 1; i++)
+ {
+ subRegion = CreateSubRegion(region, "SubRegion", "SqLiteImpl", "createSqLiteInstance");
+ subRegion.DestroyRegion();
+ Assert.IsTrue(subRegion.IsDestroyed, "Expected region to be destroyed");
+ Assert.IsFalse(File.Exists(GetSqLiteFileName(sqlite_dir, "SubRegion")), "Persistence file present after region destroy");
+ }
+ //Console.WriteLine("TEST-5");
+ }
+
+ [Test]
+ public void OverflowPutGetManaged()
+ {
+ IRegion<object, object> region = CreateOverflowRegion("OverFlowRegion", "Apache.Geode.Plugins.SqLite",
+ "Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object,System.Object>.Create");
+ ValidateAttributes(region);
+
+ //Console.WriteLine("TEST-2");
+ // put some values into the cache.
+ DoNput(region, 100);
+ //Console.WriteLine("TEST-2.1 All PUts Donee");
+
+ CheckNumOfEntries(region, 100);
+
+ //Console.WriteLine("TEST-3");
+ // check whether value get evicted and token gets set as overflow
+ CheckOverflowToken(region, 100, 20);
+ // do some gets... printing what we find in the cache.
+ DoNget(region, 100);
+ TestEntryDestroy(region);
+ TestGetOp(region, 100);
+
+ //Console.WriteLine("TEST-4");
+ // test to verify same region repeatedly to ensure that the persistece
+ // files are created and destroyed correctly
+
+ IRegion<object, object> subRegion;
+ String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
+ for (int i = 0; i < 10; i++)
+ {
+ subRegion = CreateSubRegion(region, "SubRegion", "Apache.Geode.Plugins.SqLite",
+ "Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object,System.Object>.Create");
+ subRegion.DestroyRegion();
+ Assert.IsTrue(subRegion.IsDestroyed, "Expected region to be destroyed");
+ Assert.IsFalse(File.Exists(GetSqLiteFileName(sqlite_dir, "SubRegion")), "Persistence file present after region destroy");
+ }
+ //Console.WriteLine("TEST-5");
+ }
+
+ [Test]
+ public void OverflowPutGetManagedMT()
+ {
+ IRegion<object, object> region = CreateOverflowRegion("OverFlowRegion", "Apache.Geode.Plugins.SqLite",
+ "Apache.Geode.Plugins.SqLite.SqLiteImpl<System.Object,System.Object>.Create");
+ ValidateAttributes(region);
+
+ List<Thread> threadsList = new List<Thread>();
+ for (int i = 0; i < 10; i++)
+ {
+ Thread t = new Thread(delegate()
+ {
+ // put some values into the cache.
+ DoNput(region, 100);
+ CheckNumOfEntries(region, 100);
+
+ // check whether value get evicted and token gets set as overflow
+ CheckOverflowToken(region, 100, 20);
+ // do some gets... printing what we find in the cache.
+ DoNget(region, 100);
+ TestEntryDestroy(region);
+ TestGetOp(region, 100);
+ });
+ threadsList.Add(t);
+ t.Start();
+ }
+
+ for (int i = 0; i < 10; i++)
+ {
+ threadsList[i].Join();
+ }
+ region.DestroyRegion();
+ //Console.WriteLine("TEST-5");
+ }
+
+ [Test]
+ public void OverflowPutGetManagedSetInstance()
+ {
+ RegionFactory rf = CacheHelper.DCache.CreateRegionFactory(RegionShortcut.LOCAL);
+ rf.SetCachingEnabled(true);
+ rf.SetLruEntriesLimit(20);
+ rf.SetInitialCapacity(1000);
+ rf.SetDiskPolicy(DiskPolicyType.Overflows);
+
+ Properties<string, string> sqliteProperties = new Properties<string, string>();
+ sqliteProperties.Insert("PageSize", "65536");
+ sqliteProperties.Insert("MaxFileSize", "512000000");
+ String sqlite_dir = "SqLiteDir" + Process.GetCurrentProcess().Id.ToString();
+ sqliteProperties.Insert("PersistenceDirectory", sqlite_dir);
+
+ //rf.SetPersistenceManager(new Apache.Geode.Plugins.SQLite.SqLiteImpl<object, object>(), sqliteProperties);
+ rf.SetPersistenceManager("SqLiteImpl", "createSqLiteInstance", sqliteProperties);
+
+ CacheHelper.Init();
+ IRegion<object, object> region = CacheHelper.GetRegion<object, object>("OverFlowRegion");
+ if ((region != null) && !region.IsDestroyed)
+ {
+ region.GetLocalView().DestroyRegion();
+ Assert.IsTrue(region.IsDestroyed, "IRegion<object, object> OverFlowRegion was not destroyed.");
+ }
+ region = rf.Create<object, object>("OverFlowRegion");
+ Assert.IsNotNull(region, "IRegion<object, object> was not created.");
+ ValidateAttributes(region);
+
+ //Console.WriteLine("TEST-2");
+ // put some values into the cache.
+ DoNput(region, 100);
+ //Console.WriteLine("TEST-2.1 All PUts Donee");
+
+ CheckNumOfEntries(region, 100);
+
+ //Console.WriteLine("TEST-3");
+ // check whether value get evicted and token gets set as overflow
+ CheckOverflowToken(region, 100, 20);
+ // do some gets... printing what we find in the cache.
+ DoNget(region, 100);
+ TestEntryDestroy(region);
+ TestGetOp(region, 100);
+
+ //Console.WriteLine("TEST-4");
+ // test to verify same region repeatedly to ensure that the persistece
+ // files are created and destroyed correctly
+
+ IRegion<object, object> subRegion;
+ for (int i = 0; i < 1; i++)
+ {
+ subRegion = CreateSubRegion(region, "SubRegion", "Apache.Geode.Plugins.SqLite", "SqLiteImpl<object,object>.Create()");
+ subRegion.DestroyRegion();
+ Assert.IsTrue(subRegion.IsDestroyed, "Expected region to be destroyed");
+ Assert.IsFalse(File.Exists(GetSqLiteFileName(sqlite_dir, "SubRegion")), "Persistence file present after region destroy");
+ }
+ //Console.WriteLine("TEST-5");
+ }
+
+
+ [Test]
+ public void XmlCacheCreationWithOverflow()
+ {
+ Cache cache = null;
+ IRegion<object, object> region1;
+ IRegion<object, object> region2;
+ IRegion<object, object> region3;
+ IRegion<object, object>[] rootRegions;
+ //Region<object, object>[] subRegions;
+ ICollection<IRegion<object, object>> subRegions;
+ /*string host_name = "XML_CACHE_CREATION_TEST";*/
+ const UInt32 totalSubRegionsRoot1 = 2;
+ const UInt32 totalRootRegions = 3;
+
+ try
+ {
+ CacheHelper.CloseCache();
+ Util.Log("Creating cache with the configurations provided in valid_overflowAttr.xml");
+ string cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "valid_overflowAttr.xml";
+ cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
+ Util.Log("Successfully created the cache.");
+ rootRegions = cache.RootRegions<object, object>();
+ Assert.IsNotNull(rootRegions);
+ Assert.AreEqual(totalRootRegions, rootRegions.Length);
+
+ Util.Log("Root regions in Cache: ");
+ foreach (IRegion<object, object> rg in rootRegions)
+ {
+ Util.Log('\t' + rg.Name);
+ }
+
+ region1 = rootRegions[0];
+ //subRegions = region1.SubRegions(true);
+ subRegions = region1.SubRegions(true);
+ Assert.IsNotNull(subRegions);
+ Assert.AreEqual(subRegions.Count, totalSubRegionsRoot1);
+
+ Util.Log("SubRegions for the root region: ");
+ foreach (IRegion<object, object> rg in subRegions)
+ {
+ Util.Log('\t' + rg.Name);
+ }
+
+ Util.Log("Testing if the nesting of regions is correct...");
+ region2 = rootRegions[1];
+ subRegions = region2.SubRegions(true);
+ string childName;
+ string parentName;
+ foreach (IRegion<object, object> rg in subRegions)
+ {
+ childName = rg.Name;
+ IRegion<object, object> parent = rg.ParentRegion;
+ parentName = parent.Name;
+ if (childName == "SubSubRegion221")
+ {
+ Assert.AreEqual("SubRegion22", parentName);
+ }
+ }
+
+ region3 = rootRegions[2];
+ //subRegions = region1.SubRegions(true);
+ subRegions = region3.SubRegions(true);
+ Assert.IsNotNull(subRegions);
+ Assert.AreEqual(subRegions.Count, totalSubRegionsRoot1);
+
+ Util.Log("SubRegions for the root region: ");
+ foreach (IRegion<object, object> rg in subRegions)
+ {
+ Util.Log('\t' + rg.Name);
+ }
+
+ Apache.Geode.Client.RegionAttributes<object, object> attrs = region1.Attributes;
+ //Util.Log("Attributes of root region Root1 are: ");
+
+ bool cachingEnabled = attrs.CachingEnabled;
+ Assert.IsTrue(cachingEnabled);
+
+ uint lruEL = attrs.LruEntriesLimit;
+ Assert.AreEqual(35, lruEL);
+
+ int concurrency = attrs.ConcurrencyLevel;
+ Assert.AreEqual(10, concurrency);
+
+ int initialCapacity = attrs.InitialCapacity;
+ Assert.AreEqual(25, initialCapacity);
+
+ int regionIdleTO = attrs.RegionIdleTimeout;
+ Assert.AreEqual(20, regionIdleTO);
+
+ ExpirationAction action1 = attrs.RegionIdleTimeoutAction;
+ Assert.AreEqual(ExpirationAction.Destroy, action1);
+
+ DiskPolicyType type = attrs.DiskPolicy;
+ Assert.AreEqual(DiskPolicyType.Overflows, type);
+ string persistenceDir, maxPageCount, pageSize;
+
+ string lib = attrs.PersistenceLibrary;
+ string libFun = attrs.PersistenceFactory;
+ Util.Log(" persistence library1 = " + lib);
+ Util.Log(" persistence function1 = " + libFun);
+ Properties<string, string> pconfig = attrs.PersistenceProperties;
+ Assert.IsNotNull(pconfig, "Persistence properties should not be null for root1.");
+ persistenceDir = (string)pconfig.Find("PersistenceDirectory");
+ maxPageCount = (string)pconfig.Find("MaxPageCount");
+ pageSize = (string)pconfig.Find("PageSize");
+ Assert.IsNotNull(persistenceDir, "Persistence directory should not be null.");
+ Assert.AreNotEqual(0, persistenceDir.Length, "Persistence directory should not be empty.");
+ Assert.IsNotNull(maxPageCount, "Persistence MaxPageCount should not be null.");
+ Assert.AreNotEqual(0, maxPageCount.Length, "Persistence MaxPageCount should not be empty.");
+ Assert.IsNotNull(pageSize, "Persistence PageSize should not be null.");
+ Assert.AreNotEqual(0, pageSize.Length, "Persistence PageSize should not be empty.");
+ Util.Log("****Attributes of Root1 are correctly set****");
+
+ Apache.Geode.Client.RegionAttributes<object, object> attrs2 = region2.Attributes;
+ string lib2 = attrs2.PersistenceLibrary;
+ string libFun2 = attrs2.PersistenceFactory;
+ Util.Log(" persistence library2 = " + lib2);
+ Util.Log(" persistence function2 = " + libFun2);
+ Properties<string, string> pconfig2 = attrs2.PersistenceProperties;
+ Assert.IsNotNull(pconfig2, "Persistence properties should not be null for root2.");
+ persistenceDir = (string)pconfig2.Find("PersistenceDirectory");
+ maxPageCount = (string)pconfig2.Find("MaxPageCount");
+ maxPageCount = (string)pconfig2.Find("PageSize");
+ Assert.IsNotNull(persistenceDir, "Persistence directory should not be null.");
+ Assert.AreNotEqual(0, persistenceDir.Length, "Persistence directory should not be empty.");
+ Assert.IsNotNull(maxPageCount, "Persistence MaxPageCount should not be null.");
+ Assert.AreNotEqual(0, maxPageCount.Length, "Persistence MaxPageCount should not be empty.");
+ Assert.IsNotNull(pageSize, "Persistence PageSize should not be null.");
+ Assert.AreNotEqual(0, pageSize.Length, "Persistence PageSize should not be empty.");
+
+ Util.Log("****Attributes of Root2 are correctly set****");
+
+ Apache.Geode.Client.RegionAttributes<object, object> attrs3 = region3.Attributes;
+ //Util.Log("Attributes of root region Root1 are: ");
+
+ Assert.IsTrue(attrs3.CachingEnabled);
+ Assert.AreEqual(35, attrs3.LruEntriesLimit);
+ Assert.AreEqual(10, attrs3.ConcurrencyLevel);
+ Assert.AreEqual(25, attrs3.InitialCapacity);
+ Assert.AreEqual(20, attrs3.RegionIdleTimeout);
+ Assert.AreEqual(ExpirationAction.Destroy, attrs3.RegionIdleTimeoutAction);
+ Assert.AreEqual(DiskPolicyType.Overflows, attrs3.DiskPolicy);
+
+ Util.Log(" persistence library1 = " + attrs3.PersistenceLibrary);
+ Util.Log(" persistence function1 = " + attrs3.PersistenceFactory);
+ Properties<string, string> pconfig3 = attrs.PersistenceProperties;
+ Assert.IsNotNull(pconfig3, "Persistence properties should not be null for root1.");
+ Assert.IsNotNull(pconfig3.Find("PersistenceDirectory"), "Persistence directory should not be null.");
+ Assert.AreNotEqual(0, pconfig3.Find("PersistenceDirectory").Length, "Persistence directory should not be empty.");
+ Assert.IsNotNull(pconfig3.Find("MaxPageCount"), "Persistence MaxPageCount should not be null.");
+ Assert.AreNotEqual(0, pconfig3.Find("MaxPageCount").Length, "Persistence MaxPageCount should not be empty.");
+ Assert.IsNotNull(pconfig3.Find("PageSize"), "Persistence PageSize should not be null.");
+ Assert.AreNotEqual(0, pconfig3.Find("PageSize"), "Persistence PageSize should not be empty.");
+ Util.Log("****Attributes of Root1 are correctly set****");
+
+ region1.DestroyRegion(null);
+ region2.DestroyRegion(null);
+ region3.DestroyRegion(null);
+
+ if (!cache.IsClosed)
+ {
+ cache.Close();
+ }
+
+ ////////////////////////////testing of cache.xml completed///////////////////
+
+
+ Util.Log("Create cache with the configurations provided in the invalid_overflowAttr1.xml.");
+
+ Util.Log("Non existent XML; exception should be thrown");
+
+ try
+ {
+ cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "non-existent.xml";
+ cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
+ Assert.Fail("Creation of cache with non-existent.xml should fail!");
+ }
+ catch (CacheXmlException ex)
+ {
+ Util.Log("Expected exception with non-existent.xml: {0}", ex);
+ }
+
+ Util.Log("This is a well-formed xml....attributes not provided for persistence manager. exception should be thrown");
+
+ try
+ {
+ cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr1.xml";
+ cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
+ Assert.Fail("Creation of cache with invalid_overflowAttr1.xml should fail!");
+ }
+ catch (IllegalStateException ex)
+ {
+ Util.Log("Expected exception with invalid_overflowAttr1.xml: {0}", ex);
+ }
+
+ ///////////////testing of invalid_overflowAttr1.xml completed///////////////////
+
+ Util.Log("Create cache with the configurations provided in the invalid_overflowAttr2.xml.");
+ Util.Log("This is a well-formed xml....attribute values is not provided for persistence library name......should throw an exception");
+
+ try
+ {
+ cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr2.xml";
+ cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
+ Assert.Fail("Creation of cache with invalid_overflowAttr2.xml should fail!");
+ }
+ catch (CacheXmlException ex)
+ {
+ Util.Log("Expected exception with invalid_overflowAttr2.xml: {0}", ex);
+ }
+
+ ///////////////testing of invalid_overflowAttr2.xml completed///////////////////
+
+ Util.Log("Create cache with the configurations provided in the invalid_overflowAttr3.xml.");
+ Util.Log("This is a well-formed xml....but region-attributes for persistence invalid......should throw an exception");
+
+ try
+ {
+ cachePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "invalid_overflowAttr3.xml";
+ cache = CacheFactory.CreateCacheFactory().Set("cache-xml-file", cachePath).Create();
+ Assert.Fail("Creation of cache with invalid_overflowAttr3.xml should fail!");
+ }
+ catch (CacheXmlException ex)
+ {
+ Util.Log("Expected exception with invalid_overflowAttr3.xml: {0}", ex);
+ }
+
+ ///////////////testing of invalid_overflowAttr3.xml completed///////////////////
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("Caught exception: {0}", ex);
+ }
+ finally
+ {
+ if (cache != null && !cache.IsClosed)
+ {
+ cache.Close();
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/PutGetPerfTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/PutGetPerfTests.cs b/clicache/integration-test/PutGetPerfTests.cs
new file mode 100644
index 0000000..8268742
--- /dev/null
+++ b/clicache/integration-test/PutGetPerfTests.cs
@@ -0,0 +1,333 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ public class PutGetPerfTests : UnitTests
+ {
+ #region Constants
+
+ private const int MaxKeys = 25000;
+ private const bool Mirrored = false;
+
+ #endregion
+
+ private CacheableString[] keysA = null;
+ private CacheableString[] keysB = null;
+ private CacheableString[] valuesA = null;
+ private CacheableString[] valuesB = null;
+
+ private CacheableInt32[] intKeysA = null;
+ private CacheableInt32[] intKeysB = null;
+ private CacheableInt32[] intValuesA = null;
+ private CacheableInt32[] intValuesB = null;
+
+ 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 };
+ }
+
+ #region Private functions
+
+ private void InitStringObjects(int num, string prefix,
+ ref CacheableString[] strings)
+ {
+ if (num > 0)
+ {
+ strings = new CacheableString[num];
+ for (int i = 1; i <= num; i++)
+ {
+ strings[i - 1] = new CacheableString(prefix + i.ToString());
+ }
+ }
+ }
+
+ private void InitIntObjects(int num, int offset, int factor,
+ ref CacheableInt32[] ints)
+ {
+ if (num > 0)
+ {
+ ints = new CacheableInt32[num];
+ for (int i = 1; i <= num; i++)
+ {
+ ints[i - 1] = new CacheableInt32(offset + i * factor);
+ }
+ }
+ }
+
+ private void Puts(CacheableKey[] keys, Serializable[] values,
+ int offset, int numIters, int step)
+ {
+ if (keys != null && values != null && keys.Length == values.Length)
+ {
+ int numKeys = keys.Length;
+ if (numIters <= 0)
+ {
+ numIters = numKeys;
+ }
+ for (int i = offset; i < offset + numIters; i += step)
+ {
+ CacheHelper.CurrentRegion.Put(keys[i % numKeys], values[i % numKeys]);
+ }
+ }
+ }
+
+ private void Gets(CacheableKey[] keys,
+ int offset, int numIters, int step)
+ {
+ if (keys != null)
+ {
+ int numKeys = keys.Length;
+ if (numIters <= 0)
+ {
+ numIters = numKeys;
+ }
+ for (int i = offset; i < offset + numIters; i += step)
+ {
+ CacheHelper.CurrentRegion.Get(keys[i % numKeys]);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Functions that are invoked by the tests
+
+ public enum RegionOp { Put, Get }
+ public enum KeysSelect { KeysA, KeysB, IntKeysA, IntKeysB }
+
+ public void InitKeysValues(int num)
+ {
+ InitStringObjects(num, "KeysA - ", ref keysA);
+ InitStringObjects(num, "KeysB - ", ref keysB);
+ InitStringObjects(num, "ValuesA - ", ref valuesA);
+ InitStringObjects(num, "ValuesB - ", ref valuesB);
+
+ InitIntObjects(num, 1, 2, ref intKeysA);
+ InitIntObjects(num, 0, 2, ref intKeysB);
+ InitIntObjects(num, 0, 2, ref intValuesA);
+ InitIntObjects(num, 1, 2, ref intValuesB);
+ }
+
+ public void RegionOpsAB(RegionOp op, KeysSelect sel,
+ int offset, int numIters, int step)
+ {
+ CacheableKey[] keys = null;
+ Serializable[] values = null;
+ switch (sel)
+ {
+ case KeysSelect.KeysA:
+ keys = (CacheableKey[])keysA;
+ values = (Serializable[])valuesA;
+ break;
+ case KeysSelect.KeysB:
+ keys = (CacheableKey[])keysB;
+ values = (Serializable[])valuesB;
+ break;
+ case KeysSelect.IntKeysA:
+ keys = (CacheableKey[])intKeysA;
+ values = (Serializable[])intValuesA;
+ break;
+ case KeysSelect.IntKeysB:
+ keys = (CacheableKey[])intKeysB;
+ values = (Serializable[])intValuesB;
+ break;
+ }
+ switch (op)
+ {
+ case RegionOp.Put:
+ Puts(keys, values, offset, numIters, step);
+ break;
+ case RegionOp.Get:
+ Gets(keys, offset, numIters, step);
+ break;
+ }
+ }
+
+ public void CheckNumKeys(int numExpected)
+ {
+ int numKeys = 0;
+ string message;
+ IGeodeSerializable[] keys = CacheHelper.CurrentRegion.GetKeys();
+ if (keys != null)
+ {
+ numKeys = keys.Length;
+ }
+ if (numExpected == 0)
+ {
+ message = "Region is not empty.";
+ }
+ else
+ {
+ message = "Region does not contain the expected number of entries.";
+ }
+ Assert.AreEqual(numExpected, numKeys, message);
+ }
+
+ #endregion
+
+ [TestFixtureSetUp]
+ public override void InitTests()
+ {
+ base.InitTests();
+
+ m_client1.Call(InitKeysValues, MaxKeys);
+ m_client2.Call(InitKeysValues, MaxKeys);
+ m_client3.Call(InitKeysValues, MaxKeys);
+ m_client4.Call(InitKeysValues, MaxKeys);
+ }
+
+ private void DoCommonDistribTests(string putTestName, int putIters,
+ string failTestName, int failIters, string proc2TestName)
+ {
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Put, KeysSelect.KeysA, 0, putIters, 1);
+ LogTaskTiming(m_client1, putTestName, putIters);
+
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Get, KeysSelect.KeysB, 0, failIters, 1);
+ LogTaskTiming(m_client1, failTestName, failIters);
+
+
+ m_client2.Call(CheckNumKeys, 0);
+ StartTimer();
+ m_client2.Call(RegionOpsAB, RegionOp.Get, KeysSelect.KeysA, 0, MaxKeys, 1);
+ LogTaskTiming(m_client2, proc2TestName, MaxKeys);
+ m_client2.Call(CheckNumKeys, MaxKeys);
+ }
+
+ [Test]
+ public void NoPeers()
+ {
+ int numIters = 50 * MaxKeys;
+
+ m_client1.Call(CacheHelper.CreateScopeRegion, "LocalOnly", ScopeType.Local, true);
+
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Put, KeysSelect.KeysA, 0, numIters, 1);
+ LogTaskTiming(m_client1, "LocalPuts", numIters);
+
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Get, KeysSelect.KeysA, 0, numIters, 1);
+ LogTaskTiming(m_client1, "LocalGets", numIters);
+
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Get, KeysSelect.KeysB, 0, numIters, 1);
+ LogTaskTiming(m_client1, "LocalFailGets", numIters);
+
+ m_client1.Call(CacheHelper.DestroyRegion, "LocalOnly", false, true);
+
+ m_client1.Call(CacheHelper.CreateScopeRegion, "DistNoPeers", ScopeType.DistributedNoAck, true);
+
+ StartTimer();
+ m_client1.Call(RegionOpsAB, RegionOp.Put, KeysSelect.KeysA, 0, numIters, 1);
+ LogTaskTiming(m_client1, "DistNoPeersPuts", numIters);
+
+ m_client1.Call(CacheHelper.DestroyRegion, "DistNoPeers", false, true);
+ }
+
+ [Test]
+ public void NoAck2Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "NoAck2Proc", ScopeType.DistributedNoAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "NoAck2Proc", ScopeType.DistributedNoAck, true);
+
+ DoCommonDistribTests("NoAck2ProcPuts", 10 * MaxKeys,
+ "NoAck2ProcNetsearchFail", 2 * MaxKeys, "NoAck2ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "NoAck2Proc", false, true);
+ }
+
+ [Test]
+ public void Ack2Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "Ack2Proc", ScopeType.DistributedAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "Ack2Proc", ScopeType.DistributedAck, true);
+
+ DoCommonDistribTests("Ack2ProcPuts", 2 * MaxKeys,
+ "Ack2ProcNetsearchFail", MaxKeys, "Ack2ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "Ack2Proc", false, true);
+ }
+
+ [Test]
+ public void NoAck3Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "NoAck3Proc", ScopeType.DistributedNoAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "NoAck3Proc", ScopeType.DistributedNoAck, true);
+ m_client3.Call(CacheHelper.CreateScopeRegion, "NoAck3Proc", ScopeType.DistributedNoAck, true);
+
+ DoCommonDistribTests("NoAck3ProcPuts", 2 * MaxKeys,
+ "NoAck3ProcNetsearchFail", MaxKeys, "NoAck3ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "NoAck3Proc", false, true);
+ }
+
+ [Test]
+ public void Ack3Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "Ack3Proc", ScopeType.DistributedAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "Ack3Proc", ScopeType.DistributedAck, true);
+ m_client3.Call(CacheHelper.CreateScopeRegion, "Ack3Proc", ScopeType.DistributedAck, true);
+
+ DoCommonDistribTests("Ack3ProcPuts", MaxKeys,
+ "Ack3ProcNetsearchFail", MaxKeys, "Ack3ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "Ack3Proc", false, true);
+ }
+
+ [Test]
+ public void NoAck4Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "NoAck4Proc", ScopeType.DistributedNoAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "NoAck4Proc", ScopeType.DistributedNoAck, true);
+ m_client3.Call(CacheHelper.CreateScopeRegion, "NoAck4Proc", ScopeType.DistributedNoAck, true);
+ m_client4.Call(CacheHelper.CreateScopeRegion, "NoAck4Proc", ScopeType.DistributedNoAck, true);
+
+ DoCommonDistribTests("NoAck4ProcPuts", MaxKeys,
+ "NoAck4ProcNetsearchFail", MaxKeys, "NoAck4ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "NoAck4Proc", false, true);
+ }
+
+ [Test]
+ public void Ack4Proc()
+ {
+ m_client1.Call(CacheHelper.CreateScopeRegion, "Ack4Proc", ScopeType.DistributedAck, true);
+ m_client2.Call(CacheHelper.CreateScopeRegion, "Ack4Proc", ScopeType.DistributedAck, true);
+ m_client3.Call(CacheHelper.CreateScopeRegion, "Ack4Proc", ScopeType.DistributedAck, true);
+ m_client4.Call(CacheHelper.CreateScopeRegion, "Ack4Proc", ScopeType.DistributedAck, true);
+
+ DoCommonDistribTests("Ack4ProcPuts", MaxKeys,
+ "Ack4ProcNetsearchFail", MaxKeys, "Ack4ProcNetsearch");
+
+ m_client1.Call(CacheHelper.DestroyRegion, "Ack4Proc", false, true);
+ }
+ }
+}
[08/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticsFactory.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticsFactory.hpp b/clicache/src/StatisticsFactory.hpp
new file mode 100644
index 0000000..efce9c5
--- /dev/null
+++ b/clicache/src/StatisticsFactory.hpp
@@ -0,0 +1,273 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/StatisticsFactory.hpp>
+#include <geode/statistics/StatisticsType.hpp>
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include <geode/statistics/Statistics.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class StatisticDescriptor;
+ ref class StatisticsType;
+ ref class Statistics;
+
+ /// <summary>
+ /// Instances of this interface provide methods that create instances
+ /// of <see cref="StatisticDescriptor" /> and <see cref="StatisticsType" />.
+ /// Every <see cref="StatisticsFactory" /> is also a type factory.
+ /// </summary>
+ /// <para>
+ /// A <c>StatisticsFactory</c> can create a <see cref="StatisticDescriptor" />
+ /// statistic of three numeric types:
+ /// <c>int</c>, <c>long</c>, and <c>double</c>. A
+ /// statistic (<c>StatisticDescriptor</c>) can either be a
+ /// <I>gauge</I> meaning that its value can increase and decrease or a
+ /// <I>counter</I> meaning that its value is strictly increasing.
+ /// Marking a statistic as a counter allows the Geode Manager Console
+ /// to properly display a statistics whose value "wraps around" (that
+ /// is, exceeds its maximum value).
+ /// </para>
+ public ref class StatisticsFactory sealed
+ {
+ protected:
+ StatisticsFactory(){}
+ StatisticsFactory(StatisticsFactory^){}
+ public:
+ /// <summary>
+ /// Return a pre-existing statistics factory. Typically configured through
+ /// creation of a distributed system.
+ /// </summary>
+ //static StatisticsFactory^ GetExistingInstance();
+
+ /// <summary>
+ /// Creates and returns an int counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with larger values indicating better performance.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateIntCounter(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an int counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateIntCounter(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns an long counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with larger values indicating better performance.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateLongCounter(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an long counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateLongCounter(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns an double counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with larger values indicating better performance.
+ /// </summary>
+
+ virtual StatisticDescriptor^ CreateDoubleCounter(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an double counter <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateDoubleCounter(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns an int gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with smaller values indicating better performance.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateIntGauge(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an int gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateIntGauge(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns an long gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with smaller values indicating better performance.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateLongGauge(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an long gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateLongGauge(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns an double gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>, and with smaller values indicating better performance.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateDoubleGauge(String^ name, String^ description, String^ units, bool largerBetter);
+
+ /// <summary>
+ /// Creates and returns an double gauge <see cref="StatisticDescriptor" />
+ /// with the given <c>name</c>, <c>description</c>,
+ /// <c>units</c>.
+ /// </summary>
+ virtual StatisticDescriptor^ CreateDoubleGauge(String^ name, String^ description, String^ units);
+
+ /// <summary>
+ /// Creates and returns a <see cref="StatisticsType" />
+ /// with the given <c>name</c>, <c>description</c>,and <see cref="StatisticDescriptor" />
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// if a type with the given <c>name</c> already exists.
+ /// </exception>
+ virtual StatisticsType^ CreateType(String^ name, String^ description,
+ array<StatisticDescriptor^>^ stats, System::Int32 statsLength);
+
+ /// <summary>
+ /// Finds and returns an already created <see cref="StatisticsType" />
+ /// with the given <c>name</c>. Returns <c>null</c> if the type does not exist.
+ /// </summary>
+ virtual StatisticsType^ FindType(String^ name);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and with default ids.
+ /// </summary>
+ /// <para>
+ /// The created instance may not be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateStatistics(StatisticsType^ type);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and with a default numeric id.
+ /// </summary>
+ /// <para>
+ /// The created instance may not be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateStatistics(StatisticsType^ type, String^ textId);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and <c>numericId</c>.
+ /// </summary>
+ /// <para>
+ /// The created instance may not be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and with default ids.
+ /// </summary>
+ /// <para>
+ /// The created instance will be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateAtomicStatistics(StatisticsType^ type);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and with a default numeric id.
+ /// </summary>
+ /// <para>
+ /// The created instance will be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateAtomicStatistics(StatisticsType^ type, String^ textId);
+
+ /// <summary>
+ /// Creates and returns a <see cref="Statistics" /> instance of the given <see cref="StatisticsType" /> type, <c>textId</c>, and <c>numericId</c>.
+ /// </summary>
+ /// <para>
+ /// The created instance will be <see cref="Statistics#isAtomic" /> atomic.
+ /// </para>
+ virtual Statistics^ CreateAtomicStatistics(StatisticsType^ type, String^ textId, System::Int64 numericId);
+
+ /// <summary>
+ /// Return the first instance that matches the type, or NULL
+ /// </summary>
+ virtual Statistics^ FindFirstStatisticsByType(StatisticsType^ type);
+
+ /// <summary>
+ /// Returns a name that can be used to identify the manager
+ /// </summary>
+ virtual property String^ Name
+ {
+ virtual String^ get();
+ }
+
+ /// <summary>
+ /// Returns a numeric id that can be used to identify the manager
+ /// </summary>
+ virtual property System::Int64 ID
+ {
+ virtual System::Int64 get();
+ }
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static StatisticsFactory^ Create(
+ apache::geode::statistics::StatisticsFactory* nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticsFactory( nativeptr );
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline StatisticsFactory(apache::geode::statistics::StatisticsFactory* nativeptr)
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticsFactory* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticsType.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticsType.cpp b/clicache/src/StatisticsType.cpp
new file mode 100644
index 0000000..117f7ee
--- /dev/null
+++ b/clicache/src/StatisticsType.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+
+
+//#include "geode_includes.hpp"
+#include "StatisticsType.hpp"
+#include "StatisticDescriptor.hpp"
+
+#include "impl/ManagedString.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ String^ StatisticsType::Name::get()
+ {
+ return ManagedString::Get( m_nativeptr->getName() );
+ }
+
+ String^ StatisticsType::Description::get()
+ {
+ return ManagedString::Get( m_nativeptr->getDescription() );
+ }
+
+ array<StatisticDescriptor^>^ StatisticsType::Statistics::get()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ apache::geode::statistics::StatisticDescriptor ** nativedescriptors = m_nativeptr->getStatistics();
+ array<StatisticDescriptor^>^ descriptors = gcnew array<StatisticDescriptor^>(m_nativeptr->getDescriptorsCount());
+ for (int item = 0; item < m_nativeptr->getDescriptorsCount(); item++)
+ {
+ descriptors[item] = StatisticDescriptor::Create(nativedescriptors[item]);
+ }
+ return descriptors;
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 StatisticsType::NameToId( String^ name )
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return m_nativeptr->nameToId(mg_name.CharPtr);
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ StatisticDescriptor^ StatisticsType::NameToDescriptor( String^ name )
+ {
+ ManagedString mg_name( name );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr));
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ System::Int32 StatisticsType::DescriptorsCount::get()
+ {
+ return m_nativeptr->getDescriptorsCount();
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StatisticsType.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/StatisticsType.hpp b/clicache/src/StatisticsType.hpp
new file mode 100644
index 0000000..6644b34
--- /dev/null
+++ b/clicache/src/StatisticsType.hpp
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/statistics/StatisticsType.hpp>
+#include <geode/statistics/StatisticDescriptor.hpp>
+#include "end_native.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ ref class StatisticDescriptor;
+
+ /// <summary>
+ /// This class is used to describe a logical collection of StatisticDescriptors.These descriptions
+ /// are used to create an instance of <see cref="Statistics" /> class.
+ /// </summary>
+ /// <para>
+ /// To get an instance of this interface use an instance of
+ /// <see cref="StatisticsFactory" /> class.
+ /// </para>
+ public ref class StatisticsType sealed
+ {
+ public:
+ /// <summary>
+ /// Returns the name of this statistics type.
+ /// </summary>
+ virtual property String^ Name
+ {
+ virtual String^ get( );
+ }
+
+ /// <summary>
+ /// Returns a description of this statistics type.
+ /// </summary>
+ virtual property String^ Description
+ {
+ virtual String^ get( );
+ }
+
+ /// <summary>
+ /// Returns descriptions of the statistics that this statistics type
+ /// gathers together.
+ /// </summary>
+ virtual property array<StatisticDescriptor^>^ Statistics
+ {
+ virtual array<StatisticDescriptor^>^ get( );
+ }
+
+ /// <summary>
+ /// Returns the id of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the id of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistic instance.
+ /// </exception>
+ virtual System::Int32 NameToId(String^ name);
+
+ /// <summary>
+ /// Returns the descriptor of the statistic with the given name in this
+ /// statistics instance.
+ /// </summary>
+ /// <param name="name">the statistic name</param>
+ /// <returns>the descriptor of the statistic with the given name</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if no statistic named <c>name</c> exists in this
+ /// statistic instance.
+ /// </exception>
+ virtual StatisticDescriptor^ NameToDescriptor(String^ name);
+
+ /// <summary>
+ /// Returns the total number of statistics descriptors in the type.
+ /// </summary>
+ virtual property System::Int32 DescriptorsCount
+ {
+ virtual System::Int32 get( );
+ }
+
+ internal:
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static StatisticsType^ Create(
+ apache::geode::statistics::StatisticsType* nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticsType( nativeptr );
+ }
+
+ apache::geode::statistics::StatisticsType* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ private:
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline StatisticsType( apache::geode::statistics::StatisticsType* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticsType* m_nativeptr;
+
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Struct.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Struct.cpp b/clicache/src/Struct.cpp
new file mode 100644
index 0000000..213703f
--- /dev/null
+++ b/clicache/src/Struct.cpp
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+ //#include "geode_includes.hpp"
+#include "begin_native.hpp"
+#include <geode/Struct.hpp>
+#include "end_native.hpp"
+
+#include "Struct.hpp"
+#include "StructSet.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ Object^ Struct::default::get(size_t index)
+ {
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ Object^ Struct::default::get(String^ fieldName)
+ {
+ ManagedString mg_fieldName(fieldName);
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->operator[](mg_fieldName.CharPtr)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ StructSet<Object^>^ Struct::Set::get()
+ {
+ try
+ {
+ return StructSet</*TResult*/Object^>::Create(
+ static_cast<native::Struct*>(m_nativeptr->get())->getStructSet());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+
+ bool Struct/*<TResult>*/::HasNext()
+ {
+ try
+ {
+ return static_cast<native::Struct*>(m_nativeptr->get())->hasNext();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ size_t Struct/*<TResult>*/::Length::get()
+ {
+ try
+ {
+ return static_cast<native::Struct*>(m_nativeptr->get())->length();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ Object^ Struct/*<TResult>*/::Next()
+ {
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->next()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Struct.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/Struct.hpp b/clicache/src/Struct.hpp
new file mode 100644
index 0000000..9b43820
--- /dev/null
+++ b/clicache/src/Struct.hpp
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "Serializable.hpp"
+#include "begin_native.hpp"
+#include <geode/Struct.hpp>
+#include "end_native.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ ref class StructSet;
+
+ /// <summary>
+ /// Encapsulates a row of query struct set.
+ /// </summary>
+ /// <remarks>
+ /// A Struct has a StructSet as its parent. It contains the field values
+ /// returned after executing a Query obtained from a QueryService which in turn
+ /// is obtained from a Cache.
+ /// </remarks>
+ //generic<class TResult>
+ public ref class Struct sealed
+ : public Apache::Geode::Client::Serializable
+ {
+ public:
+
+ /// <summary>
+ /// Get the field value for the given index number.
+ /// </summary>
+ /// <returns>
+ /// The value of the field or null if index is out of bounds.
+ /// </returns>
+ property /*Apache::Geode::Client::IGeodeSerializable^*//*TResult*/ Object^ GFINDEXER( size_t )
+ {
+ /*Apache::Geode::Client::IGeodeSerializable^*/ /*TResult*/ Object^ get( size_t index );
+ }
+
+ /// <summary>
+ /// Get the field value for the given field name.
+ /// </summary>
+ /// <returns>The value of the field.</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if the field name is not found.
+ /// </exception>
+ property /*Apache::Geode::Client::IGeodeSerializable^*//*TResult*/Object^ GFINDEXER( String^ )
+ {
+ /*Apache::Geode::Client::IGeodeSerializable^*//*TResult*/Object^ get( String^ fieldName );
+ }
+
+ /// <summary>
+ /// Get the parent <c>StructSet</c> of this <c>Struct</c>.
+ /// </summary>
+ /// <returns>
+ /// A reference to the parent <c>StructSet</c> of this <c>Struct</c>.
+ /// </returns>
+ property Apache::Geode::Client::StructSet</*TResult*/Object^>^ Set
+ {
+ Apache::Geode::Client::StructSet</*TResult*/Object^>^ get( );
+ }
+
+ /// <summary>
+ /// Check whether another field value is available to iterate over
+ /// in this <c>Struct</c>.
+ /// </summary>
+ /// <returns>true if available otherwise false.</returns>
+ bool HasNext( );
+
+ /// <summary>
+ /// Get the number of field values available.
+ /// </summary>
+ /// <returns>the number of field values available.</returns>
+ property size_t Length
+ {
+ size_t get( );
+ }
+
+ /// <summary>
+ /// Get the next field value item available in this <c>Struct</c>.
+ /// </summary>
+ /// <returns>
+ /// A reference to the next item in the <c>Struct</c>
+ /// or null if no more available.
+ /// </returns>
+ /*Apache::Geode::Client::IGeodeSerializable^*//*TResult*/Object^ Next( );
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline Apache::Geode::Client::Struct/*<TResult>*/( apache::geode::client::SerializablePtr nativeptr )
+ : Apache::Geode::Client::Serializable( nativeptr ) { }
+
+ inline Apache::Geode::Client::Struct/*<TResult>*/( )
+ : Apache::Geode::Client::Serializable( std::shared_ptr<apache::geode::client::Serializable>(apache::geode::client::Struct::createDeserializable())) { }
+
+ internal:
+
+ /// <summary>
+ /// Factory function to register wrapper
+ /// </summary>
+ inline static Apache::Geode::Client::IGeodeSerializable^ /*Struct^*/ /*<TResult>*/ Create( ::apache::geode::client::SerializablePtr obj )
+ {
+ return ( obj != nullptr ?
+ gcnew Apache::Geode::Client::Struct/*<TResult>*/( obj ) : nullptr );
+ /*return ( obj != nullptr ?
+ gcnew Struct( obj ) : nullptr );*/
+ }
+
+ inline static Apache::Geode::Client::IGeodeSerializable^ CreateDeserializable( )
+ {
+ return gcnew Apache::Geode::Client::Struct/*<TResult>*/( ) ;
+ //return gcnew Struct( ) ;
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StructSet.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/StructSet.cpp b/clicache/src/StructSet.cpp
new file mode 100644
index 0000000..ef134e8
--- /dev/null
+++ b/clicache/src/StructSet.cpp
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+//#include "geode_includes.hpp"
+#include "StructSet.hpp"
+#include "SelectResultsIterator.hpp"
+#include "ExceptionTypes.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TResult>
+ bool StructSet<TResult>::IsModifiable::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->isModifiable( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Int32 StructSet<TResult>::Size::get( )
+ {
+ try
+ {
+ return m_nativeptr->get()->size( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ TResult StructSet<TResult>::default::get( size_t index )
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>((m_nativeptr->get()->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ SelectResultsIterator<TResult>^ StructSet<TResult>::GetIterator( )
+ {
+ try
+ {
+ return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(m_nativeptr->get()->getIterator()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+
+ generic<class TResult>
+ System::Collections::Generic::IEnumerator<TResult>^ StructSet<TResult>::GetEnumerator( )
+ {
+ return GetIterator( );
+ }
+
+ generic<class TResult>
+ System::Collections::IEnumerator^ StructSet<TResult>::GetIEnumerator( )
+ {
+ return GetIterator( );
+ }
+
+ generic<class TResult>
+ size_t StructSet<TResult>::GetFieldIndex( String^ fieldName )
+ {
+ ManagedString mg_fieldName( fieldName );
+
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+
+ try
+ {
+ return m_nativeptr->get()->getFieldIndex( mg_fieldName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ String^ StructSet<TResult>::GetFieldName(size_t index)
+ {
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getFieldName(static_cast<System::Int32> (index)).c_str());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/StructSet.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/StructSet.hpp b/clicache/src/StructSet.hpp
new file mode 100644
index 0000000..ae81b76
--- /dev/null
+++ b/clicache/src/StructSet.hpp
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/StructSet.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "ICqResults.hpp"
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ namespace native = apache::geode::client;
+ interface class IGeodeSerializable;
+
+ generic<class TResult>
+ ref class SelectResultsIterator;
+
+ /// <summary>
+ /// Encapsulates a query struct set.
+ /// </summary>
+ generic<class TResult>
+ public ref class StructSet sealed
+ : public ICqResults<TResult>
+ {
+ public:
+
+ /// <summary>
+ /// True if this <c>StructSet</c> is modifiable.
+ /// </summary>
+ /// <returns>returns false always at this time.</returns>
+ virtual property bool IsModifiable
+ {
+ virtual bool get( );
+ }
+
+ /// <summary>
+ /// The size of the <c>StructSet</c>.
+ /// </summary>
+ /// <returns>
+ /// the number of items in the <c>StructSet</c>.
+ /// </returns>
+ virtual property System::Int32 Size
+ {
+ virtual System::Int32 get( );
+ }
+
+ /// <summary>
+ /// Index operator to directly access an item in the <c>StructSet</c>.
+ /// </summary>
+ /// <exception cref="IllegalArgumentException">
+ /// if the index is out of bounds.
+ /// </exception>
+ /// <returns>Item at the given index.</returns>
+ virtual property /*Apache::Geode::Client::IGeodeSerializable^*/TResult GFINDEXER( size_t )
+ {
+ virtual /*Apache::Geode::Client::IGeodeSerializable^*/TResult get( size_t index );
+ }
+
+ /// <summary>
+ /// Get a <c>SelectResultsIterator</c> with which to iterate
+ /// over the items in the <c>StructSet</c>.
+ /// </summary>
+ /// <returns>
+ /// The <c>SelectResultsIterator</c> with which to iterate.
+ /// </returns>
+ virtual SelectResultsIterator<TResult>^ GetIterator( );
+
+ /// <summary>
+ /// Get the index number of the specified field name
+ /// in the <c>StructSet</c>.
+ /// </summary>
+ /// <param name="fieldName">
+ /// the field name for which the index is required.
+ /// </param>
+ /// <returns>the index number of the specified field name.</returns>
+ /// <exception cref="IllegalArgumentException">
+ /// if the field name is not found.
+ /// </exception>
+ size_t GetFieldIndex( String^ fieldName );
+
+ /// <summary>
+ /// Get the field name of the <c>StructSet</c> from the
+ /// specified index number.
+ /// </summary>
+ /// <param name="index">
+ /// the index number of the field name to get.
+ /// </param>
+ /// <returns>
+ /// the field name from the specified index number or null if not found.
+ /// </returns>
+ String^ GetFieldName( size_t index );
+
+
+ // Region: IEnumerable<IGeodeSerializable^> Members
+
+ /// <summary>
+ /// Returns an enumerator that iterates through the <c>StructSet</c>.
+ /// </summary>
+ /// <returns>
+ /// A <c>System.Collections.Generic.IEnumerator</c> that
+ /// can be used to iterate through the <c>StructSet</c>.
+ /// </returns>
+ virtual System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>^
+ GetEnumerator( );
+
+ // End Region: IEnumerable<IGeodeSerializable^> Members
+
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ /// <returns>
+ /// The managed wrapper object; null if the native pointer is null.
+ /// </returns>
+ inline static StructSet<TResult>^ Create(native::StructSetPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StructSet<TResult>( nativeptr );
+ }
+
+
+ private:
+
+ virtual System::Collections::IEnumerator^ GetIEnumerator( ) sealed
+ = System::Collections::IEnumerable::GetEnumerator;
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline StructSet(native::StructSetPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::StructSet>(nativeptr);
+ }
+
+ native_shared_ptr<native::StructSet>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/SystemProperties.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/SystemProperties.cpp b/clicache/src/SystemProperties.cpp
new file mode 100644
index 0000000..8683548
--- /dev/null
+++ b/clicache/src/SystemProperties.cpp
@@ -0,0 +1,220 @@
+/*
+ * 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.
+ */
+
+#include "SystemProperties.hpp"
+#include "impl/SafeConvert.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ void SystemProperties::LogSettings( )
+ {
+ m_nativeptr->logSettings( );
+ }
+
+ System::Int32 SystemProperties::StatisticsSampleInterval::get( )
+ {
+ return m_nativeptr->statisticsSampleInterval( );
+ }
+
+ bool SystemProperties::StatisticsEnabled::get( )
+ {
+ return m_nativeptr->statisticsEnabled( );
+ }
+
+ String^ SystemProperties::StatisticsArchiveFile::get( )
+ {
+ return ManagedString::Get( m_nativeptr->statisticsArchiveFile( ) );
+ }
+
+ String^ SystemProperties::LogFileName::get( )
+ {
+ return ManagedString::Get( m_nativeptr->logFilename( ) );
+ }
+
+ LogLevel SystemProperties::GFLogLevel::get( )
+ {
+ return static_cast<LogLevel>( m_nativeptr->logLevel( ) );
+ }
+
+ bool SystemProperties::HeapLRULimitEnabled::get( )
+ {
+ return m_nativeptr->heapLRULimitEnabled( );
+ }
+
+ size_t SystemProperties::HeapLRULimit::get( )
+ {
+ return m_nativeptr->heapLRULimit( );
+ }
+
+ System::Int32 SystemProperties::HeapLRUDelta::get( )
+ {
+ return m_nativeptr->heapLRUDelta( );
+ }
+
+ System::Int32 SystemProperties::MaxSocketBufferSize::get( )
+ {
+ return m_nativeptr->maxSocketBufferSize( );
+ }
+
+ System::Int32 SystemProperties::PingInterval::get( )
+ {
+ return m_nativeptr->pingInterval( );
+ }
+
+ System::Int32 SystemProperties::RedundancyMonitorInterval::get( )
+ {
+ return m_nativeptr->redundancyMonitorInterval( );
+ }
+
+ System::Int32 SystemProperties::NotifyAckInterval::get( )
+ {
+ return m_nativeptr->notifyAckInterval( );
+ }
+
+ System::Int32 SystemProperties::NotifyDupCheckLife::get( )
+ {
+ return m_nativeptr->notifyDupCheckLife( );
+ }
+
+ bool SystemProperties::DebugStackTraceEnabled::get( )
+ {
+ return m_nativeptr->debugStackTraceEnabled( );
+ }
+
+ bool SystemProperties::CrashDumpEnabled::get( )
+ {
+ return m_nativeptr->crashDumpEnabled();
+ }
+
+ bool SystemProperties::AppDomainEnabled::get( )
+ {
+ return m_nativeptr->isAppDomainEnabled();
+ }
+
+ String^ SystemProperties::Name::get( )
+ {
+ return ManagedString::Get( m_nativeptr->name( ) );
+ }
+
+ String^ SystemProperties::CacheXmlFile::get( )
+ {
+ return ManagedString::Get( m_nativeptr->cacheXMLFile( ) );
+ }
+
+ System::Int32 SystemProperties::LogFileSizeLimit::get( )
+ {
+ return m_nativeptr->logFileSizeLimit( );
+ }
+
+ System::Int32 SystemProperties::LogDiskSpaceLimit::get( )
+ {
+ return m_nativeptr->logDiskSpaceLimit( );
+ }
+
+ System::Int32 SystemProperties::StatsFileSizeLimit::get( )
+ {
+ return m_nativeptr->statsFileSizeLimit( );
+ }
+
+ System::Int32 SystemProperties::StatsDiskSpaceLimit::get( )
+ {
+ return m_nativeptr->statsDiskSpaceLimit( );
+ }
+
+ System::UInt32 SystemProperties::MaxQueueSize::get( )
+ {
+ return m_nativeptr->maxQueueSize( );
+ }
+
+ bool SystemProperties::SSLEnabled::get( )
+ {
+ return m_nativeptr->sslEnabled();
+ }
+
+ String^ SystemProperties::SSLKeyStore::get()
+ {
+ return ManagedString::Get(m_nativeptr->sslKeyStore());
+ }
+
+ String^ SystemProperties::SSLTrustStore::get()
+ {
+ return ManagedString::Get(m_nativeptr->sslTrustStore());
+ }
+
+ // adongre
+ String^ SystemProperties::SSLKeystorePassword::get()
+ {
+ return ManagedString::Get(m_nativeptr->sslKeystorePassword());
+ }
+
+
+ bool SystemProperties::IsSecurityOn::get( )
+ {
+ return m_nativeptr->isSecurityOn( );
+ }
+
+ Properties<String^, String^>^ SystemProperties::GetSecurityProperties::get( )
+ {
+ return Properties<String^, String^>::Create(m_nativeptr->getSecurityProperties());
+ }
+
+ String^ SystemProperties::DurableClientId::get( )
+ {
+ return ManagedString::Get( m_nativeptr->durableClientId( ) );
+ }
+
+ System::UInt32 SystemProperties::DurableTimeout::get( )
+ {
+ return m_nativeptr->durableTimeout( );
+ }
+
+ System::UInt32 SystemProperties::ConnectTimeout::get( )
+ {
+ return m_nativeptr->connectTimeout( );
+ }
+
+ String^ SystemProperties::ConflateEvents::get( )
+ {
+ return ManagedString::Get( m_nativeptr->conflateEvents( ) );
+ }
+
+ System::UInt32 SystemProperties::SuspendedTxTimeout::get( )
+ {
+ return m_nativeptr->suspendedTxTimeout( );
+ }
+
+ bool SystemProperties::ReadTimeoutUnitInMillis::get( )
+ {
+ return m_nativeptr->readTimeoutUnitInMillis( );
+ }
+
+ bool SystemProperties::OnClientDisconnectClearPdxTypeIds::get( )
+ {
+ return m_nativeptr->onClientDisconnectClearPdxTypeIds( );
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/SystemProperties.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/SystemProperties.hpp b/clicache/src/SystemProperties.hpp
new file mode 100644
index 0000000..507035b
--- /dev/null
+++ b/clicache/src/SystemProperties.hpp
@@ -0,0 +1,428 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/SystemProperties.hpp>
+#include "end_native.hpp"
+
+#include "Log.hpp"
+#include "Properties.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// A class for internal use, that encapsulates the properties that can be
+ /// set through <see cref="DistributedSystem.Connect" />
+ /// or a geode.properties file.
+ /// </summary>
+ public ref class SystemProperties sealed
+ {
+ public:
+
+ /// <summary>
+ /// Prints all settings to the process log.
+ /// </summary>
+ void LogSettings();
+
+ /// <summary>
+ /// Returns the sampling interval, that is,
+ /// how often the statistics thread writes to disk, in seconds.
+ /// </summary>
+ /// <returns>the statistics sampling interval</returns>
+ property System::Int32 StatisticsSampleInterval
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// True if statistics are enabled (archived).
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool StatisticsEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the name of the statistics archive file.
+ /// </summary>
+ /// <returns>the filename</returns>
+ property String^ StatisticsArchiveFile
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the name of the message log file.
+ /// </summary>
+ /// <returns>the filename</returns>
+ property String^ LogFileName
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the message logging level.
+ /// </summary>
+ /// <returns>the log level</returns>
+ property LogLevel GFLogLevel
+ {
+ LogLevel get();
+ }
+
+ /// <summary>
+ /// Returns a boolean that specifies if heapLRULimit has been enabled for the
+ /// process. If enabled, the HeapLRULimit specifies the maximum amount of memory
+ /// that values in a cache can use to store data before overflowing to disk or
+ /// destroying entries to ensure that the server process never runs out of
+ /// memory
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool HeapLRULimitEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the HeapLRULimit value (in bytes), the maximum memory that values
+ /// in a cache can use to store data before overflowing to disk or destroying
+ /// entries to ensure that the server process never runs out of memory due to
+ /// cache memory usage
+ /// </summary>
+ /// <returns>the HeapLRULimit value</returns>
+ property size_t HeapLRULimit
+ {
+ size_t get();
+ }
+
+ /// <summary>
+ /// Returns the HeapLRUDelta value (a percent value). This specifies the
+ /// percentage of entries the system will evict each time it detects that
+ /// it has exceeded the HeapLRULimit. Defaults to 10%
+ /// </summary>
+ /// <returns>the HeapLRUDelta value</returns>
+ property System::Int32 HeapLRUDelta
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum socket buffer size to use
+ /// </summary>
+ /// <returns>the MaxSocketBufferSize value</returns>
+ property System::Int32 MaxSocketBufferSize
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the time between two consecutive ping to servers
+ /// </summary>
+ /// <returns>the PingInterval value</returns>
+ property System::Int32 PingInterval
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the time between two consecutive checks for redundancy for HA
+ /// </summary>
+ /// <returns>the RedundancyMonitorInterval value</returns>
+ property System::Int32 RedundancyMonitorInterval
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the periodic notify ack interval
+ /// </summary>
+ /// <returns>the NotifyAckInterval value</returns>
+ property System::Int32 NotifyAckInterval
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the expiry time of an idle event id map entry for duplicate notification checking
+ /// </summary>
+ /// <returns>the NotifyDupCheckLife value</returns>
+ property System::Int32 NotifyDupCheckLife
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// True if the stack trace is enabled.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool DebugStackTraceEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// True if the crash dump generation for unhandled fatal exceptions
+ /// is enabled. If "log-file" property has been specified then they are
+ /// created in the same directory as the log file, and having the same
+ /// prefix as log file. By default crash dumps are created in the
+ /// current working directory and have the "geode_cpp" prefix.
+ ///
+ /// The actual dump file will have timestamp and process ID
+ /// in the full name.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool CrashDumpEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Whether client is running in multiple AppDomain or not.
+ /// Default value is "false".
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool AppDomainEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the system name.
+ /// </summary>
+ /// <returns>the name</returns>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the name of the "cache.xml" file.
+ /// </summary>
+ /// <returns>the filename</returns>
+ property String^ CacheXmlFile
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the maximum log file size, in bytes, or 0 if unlimited.
+ /// </summary>
+ /// <returns>the maximum limit</returns>
+ property System::Int32 LogFileSizeLimit
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum log Disk size, in bytes, or 0 if unlimited.
+ /// </summary>
+ /// <returns>the maximum limit</returns>
+ property System::Int32 LogDiskSpaceLimit
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum statistics file size, in bytes, or 0 if unlimited.
+ /// </summary>
+ /// <returns>the maximum limit</returns>
+ property System::Int32 StatsFileSizeLimit
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the maximum statistics Disk size, in bytes, or 0 if unlimited.
+ /// </summary>
+ /// <returns>the maximum limit</returns>
+ property System::Int32 StatsDiskSpaceLimit
+ {
+ System::Int32 get();
+ }
+
+ /// <summary>
+ /// Returns the max queue size for notification messages
+ /// </summary>
+ /// <returns>the max queue size</returns>
+ property System::UInt32 MaxQueueSize
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// True if ssl connection support is enabled.
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool SSLEnabled
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns the SSL private keystore file path.
+ /// </summary>
+ /// <returns>the SSL private keystore file path</returns>
+ property String^ SSLKeyStore
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the SSL public certificate trust store file path.
+ /// </summary>
+ /// <returns>the SSL public certificate trust store file path</returns>
+ property String^ SSLTrustStore
+ {
+ String^ get();
+ }
+
+ // adongre
+ /// <summary>
+ /// Returns the client keystore password..
+ /// </summary>
+ /// <returns>Returns the client keystore password.</returns>
+ property String^ SSLKeystorePassword
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// True if client needs to be authenticated
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool IsSecurityOn
+ {
+ bool get();
+ }
+
+ /// <summary>
+ /// Returns all the security properties
+ /// </summary>
+ /// <returns>the security properties</returns>
+ //generic <class TPropKey, class TPropValue>
+ property Properties<String^, String^>^ GetSecurityProperties {
+ Properties<String^, String^>^ get();
+ }
+
+ /// <summary>
+ /// Returns the durable client's ID.
+ /// </summary>
+ /// <returns>the durable client ID</returns>
+ property String^ DurableClientId
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the durable client's timeout.
+ /// </summary>
+ /// <returns>the durable client timeout</returns>
+ property System::UInt32 DurableTimeout
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the connect timeout used for server and locator handshakes.
+ /// </summary>
+ /// <returns>the connect timeout used for server and locator handshakes</returns>
+ property System::UInt32 ConnectTimeout
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// Returns the conflate event's option
+ /// </summary>
+ /// <returns>the conflate event option</returns>
+ property String^ ConflateEvents
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// Returns the timeout after which suspended transactions are rolled back.
+ /// </summary>
+ /// <returns>the timeout for suspended transactions</returns>
+ property System::UInt32 SuspendedTxTimeout
+ {
+ System::UInt32 get();
+ }
+
+ /// <summary>
+ /// This can be called to know whether read timeout unit is in milli second.
+ /// </summary>
+ /// <returns>true if enabled or false by default.</returns>
+ property bool ReadTimeoutUnitInMillis
+ {
+ bool get();
+ }
+ /// <summary>
+ /// True if app want to clear pdx types ids on client disconnect
+ /// </summary>
+ /// <returns>true if enabled</returns>
+ property bool OnClientDisconnectClearPdxTypeIds
+ {
+ bool get();
+ }
+
+ internal:
+
+ /// <summary>
+ /// Internal factory function to wrap a native object pointer inside
+ /// this managed class, with null pointer check.
+ /// </summary>
+ /// <param name="nativeptr">native object pointer</param>
+ /// <returns>
+ /// the managed wrapper object, or null if the native pointer is null.
+ /// </returns>
+ inline static SystemProperties^ Create(
+ native::SystemProperties* nativeptr)
+ {
+ return (nativeptr != nullptr ?
+ gcnew SystemProperties(nativeptr) : nullptr);
+ }
+
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline SystemProperties(native::SystemProperties* nativeptr)
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ native::SystemProperties* m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/TransactionEvent.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/TransactionEvent.cpp b/clicache/src/TransactionEvent.cpp
new file mode 100644
index 0000000..d4d694c
--- /dev/null
+++ b/clicache/src/TransactionEvent.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+//#include "geode_includes.hpp"
+#include "TransactionEvent.hpp"
+#include "Log.hpp"
+#include "impl/SafeConvert.hpp"
+#include "TransactionId.hpp"
+#include "Cache.hpp"
+#include "EntryEvent.hpp"
+#include "Cache.hpp"
+
+
+using namespace System;
+using namespace Apache::Geode::Client;
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ generic<class TKey, class TValue>
+ Cache^ TransactionEvent<TKey, TValue>::Cache::get( )
+ {
+ apache::geode::client::CachePtr & nativeptr(
+ NativePtr->getCache( ) );
+
+ return Apache::Geode::Client::Cache::Create(
+ nativeptr.get() );
+ }
+
+ generic<class TKey, class TValue>
+ Apache::Geode::Client::TransactionId^ TransactionEvent<TKey, TValue>::TransactionId::get( )
+ {
+ apache::geode::client::TransactionIdPtr & nativeptr(
+ NativePtr->getTransactionId( ) );
+
+ return Apache::Geode::Client::TransactionId::Create(
+ nativeptr.get() );
+ }
+
+ generic<class TKey, class TValue>
+ array<EntryEvent<TKey, TValue>^>^ TransactionEvent<TKey, TValue>::Events::get( )
+ {
+ apache::geode::client::VectorOfEntryEvent vee;
+ vee = NativePtr->getEvents();
+ array<EntryEvent<TKey, TValue>^>^ events =
+ gcnew array<EntryEvent<TKey, TValue>^>( vee.size( ) );
+ // Loop through the unmanaged event objects to convert them to the managed generic objects.
+ for( System::Int32 index = 0; index < vee.size( ); index++ )
+ {
+ apache::geode::client::EntryEventPtr& nativeptr( vee[ index ] );
+ EntryEvent<TKey, TValue> entryEvent( nativeptr.get() );
+ events[ index ] = (%entryEvent);
+ }
+ return events;
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+ } //namespace
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/TransactionEvent.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/TransactionEvent.hpp b/clicache/src/TransactionEvent.hpp
new file mode 100644
index 0000000..80680c2
--- /dev/null
+++ b/clicache/src/TransactionEvent.hpp
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "geode_defs.hpp"
+#include <cppcache/TransactionEvent.hpp>
+
+//#include "TransactionId.hpp"
+//#include "Cache.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ ref class TransactionId;
+ ref class Cache;
+
+ generic<class TKey, class TValue>
+ ref class EntryEvent;
+
+ /// <summary>
+ /// This class encapsulates events that occur for an transaction in a cache.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class TransactionEvent sealed
+ : public Internal::UMWrap<apache::geode::client::TransactionEvent>
+ {
+ public:
+ /// <summary>
+ /// Gets the transaction id for this transaction.
+ /// </summary>
+ property Apache::Geode::Client::TransactionId^ TransactionId
+ {
+ Apache::Geode::Client::TransactionId^ get( );
+ }
+
+ /// <summary>
+ /// Returns an ordered list of every event for this transaction.
+ /// The event order is consistent with the order in which the operations were
+ /// performed during the transaction.
+ /// </summary>
+ property array<EntryEvent<TKey, TValue>^>^ Events
+ {
+ array<EntryEvent<TKey, TValue>^>^ get( );
+ }
+
+ /// <summary>
+ /// Gets the Cache for this transaction event
+ /// </summary>
+ property Apache::Geode::Client::Cache^ Cache
+ {
+ Apache::Geode::Client::Cache^ get( );
+ }
+
+ internal:
+ /// <summary>
+ /// Internal constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline TransactionEvent( apache::geode::client::TransactionEvent* nativeptr )
+ : UMWrap( nativeptr, false ) { }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/TransactionId.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/TransactionId.hpp b/clicache/src/TransactionId.hpp
new file mode 100644
index 0000000..29ceeb8
--- /dev/null
+++ b/clicache/src/TransactionId.hpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "geode_defs.hpp"
+#include "begin_native.hpp"
+#include <geode/TransactionId.hpp>
+#include "end_native.hpp"
+
+
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// This class encapsulates Id of a transaction.
+ /// </summary>
+ public ref class TransactionId sealed
+ {
+ internal:
+
+ inline static TransactionId^ Create(native::TransactionIdPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew TransactionId( nativeptr );
+ }
+
+ std::shared_ptr<native::TransactionId> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
+ private:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline TransactionId( native::TransactionIdPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::TransactionId>(nativeptr);
+ }
+
+ native_shared_ptr<native::TransactionId>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+ //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/TransactionListenerAdapter.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/TransactionListenerAdapter.hpp b/clicache/src/TransactionListenerAdapter.hpp
new file mode 100644
index 0000000..7f1f86f
--- /dev/null
+++ b/clicache/src/TransactionListenerAdapter.hpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ITransactionListener.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ITransactionListener</c>
+ /// with empty implementations. Applications can subclass this class
+ /// and only override the methods for the events of interest.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class TransactionListenerAdapter
+ : public Apache::Geode::Client::ITransactionListener<TKey, TValue>
+ {
+ public:
+ virtual void AfterCommit(Apache::Geode::Client::TransactionEvent<TKey, TValue>^ te)
+ {
+ }
+
+ virtual void AfterFailedCommit(Apache::Geode::Client::TransactionEvent<TKey, TValue>^ te)
+ {
+ }
+
+ virtual void AfterRollback(Apache::Geode::Client::TransactionEvent<TKey, TValue>^ te)
+ {
+ }
+
+ virtual void Close()
+ {
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/TransactionWriterAdapte.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/TransactionWriterAdapte.hpp b/clicache/src/TransactionWriterAdapte.hpp
new file mode 100644
index 0000000..04d4183
--- /dev/null
+++ b/clicache/src/TransactionWriterAdapte.hpp
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+#ifdef CSTX_COMMENTED
+#pragma once
+
+#include "geode_defs.hpp"
+#include "ITransactionWriter.hpp"
+
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Utility class that implements all methods in <c>ITransactionWriter</c>
+ /// with empty implementations.
+ /// </summary>
+ generic<class TKey, class TValue>
+ public ref class TransactionWriterAdapter
+ : public Apache::Geode::Client::ITransactionWriter<TKey, TValue>
+ {
+ public:
+ virtual void BeforeCommit(TransactionEvent<TKey, TValue>^ te)
+ {
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/UserFunctionExecutionException.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/UserFunctionExecutionException.cpp b/clicache/src/UserFunctionExecutionException.cpp
new file mode 100644
index 0000000..306919e
--- /dev/null
+++ b/clicache/src/UserFunctionExecutionException.cpp
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+
+#include "UserFunctionExecutionException.hpp"
+#include "CacheableString.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ // IGeodeSerializable methods
+
+ void UserFunctionExecutionException::ToData(DataOutput^ output)
+ {
+ throw gcnew IllegalStateException("UserFunctionExecutionException::ToData is not intended for use.");
+ }
+
+ IGeodeSerializable^ UserFunctionExecutionException::FromData(DataInput^ input)
+ {
+ throw gcnew IllegalStateException("UserFunctionExecutionException::FromData is not intended for use.");
+ return this;
+ }
+
+ System::UInt32 UserFunctionExecutionException::ObjectSize::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+ throw gcnew IllegalStateException("UserFunctionExecutionException::ObjectSize is not intended for use.");
+ try
+ {
+ return m_nativeptr->get()->objectSize();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ String^ UserFunctionExecutionException::Message::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ auto value = m_nativeptr->get()->getMessage();
+ return CacheableString::GetString(value.get());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ String^ UserFunctionExecutionException::Name::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ auto value = m_nativeptr->get()->getName();
+ return CacheableString::GetString(value.get());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/UserFunctionExecutionException.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/UserFunctionExecutionException.hpp b/clicache/src/UserFunctionExecutionException.hpp
new file mode 100644
index 0000000..dd9e74d
--- /dev/null
+++ b/clicache/src/UserFunctionExecutionException.hpp
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+
+#include "geode_defs.hpp"
+
+#include "begin_native.hpp"
+#include <geode/UserFunctionExecutionException.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
+#include "IGeodeSerializable.hpp"
+#include "DataInput.hpp"
+#include "DataOutput.hpp"
+
+using namespace System;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+ namespace native = apache::geode::client;
+
+ /// <summary>
+ /// UserFunctionExecutionException class is used to encapsulate geode sendException in case of Function execution.
+ /// </summary>
+ public ref class UserFunctionExecutionException sealed
+ : public IGeodeSerializable
+ {
+ public:
+ // IGeodeSerializable members
+
+ /// <summary>
+ /// Serializes this object.
+ /// Users should not implement/call this api as it is only intended for internal use.
+ /// </summary>
+ /// <param name="output">
+ /// the DataOutput stream to use for serialization
+ /// </param>
+ /// <exception cref="IllegalStateException">
+ /// If this api is called from User code.
+ /// </exception>
+ virtual void ToData(DataOutput^ output);
+
+ /// <summary>
+ /// Deserializes this object.
+ /// Users should not implement/call this api as it is only intended for internal use.
+ /// </summary>
+ /// <param name="input">
+ /// the DataInput stream to use for reading data
+ /// </param>
+ /// <exception cref="IllegalStateException">
+ /// If this api is called from User code.
+ /// </exception>
+ /// <returns>the deserialized object</returns>
+ virtual IGeodeSerializable^ FromData(DataInput^ input);
+
+ /// <summary>
+ /// Returns the classId of this class for serialization.
+ /// Users should not implement/call this api as it is only intended for internal use.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// If this api is called from User code.
+ /// </exception>
+ /// <returns>classId of this class</returns>
+ /// <seealso cref="IGeodeSerializable.ClassId" />
+ virtual property System::UInt32 ClassId
+ {
+ inline virtual System::UInt32 get()
+ {
+ throw gcnew IllegalStateException("UserFunctionExecutionException::ClassId is not intended for use.");
+ return 0;
+ }
+ }
+
+ /// <summary>
+ /// return the size of this object in bytes
+ /// Users should not implement/call this api as it is only intended for internal use.
+ /// </summary>
+ /// <exception cref="IllegalStateException">
+ /// If this api is called from User code.
+ /// </exception>
+ virtual property System::UInt32 ObjectSize
+ {
+ virtual System::UInt32 get();
+ }
+
+ // End: IGeodeSerializable members
+
+ /// <summary>
+ /// return as String the Exception message returned from geode sendException api.
+ /// </summary>
+ /// <returns>the String Exception Message</returns>
+ property String^ Message
+ {
+ String^ get();
+ }
+
+ /// <summary>
+ /// return as String the Exception name returned from geode sendException api.
+ /// </summary>
+ /// <returns>the String Exception Name</returns>
+ property String^ Name
+ {
+ String^ get();
+ }
+
+ internal:
+
+ /// <summary>
+ /// Private constructor to wrap a native object pointer.
+ /// </summary>
+ /// <param name="nativeptr">The native object pointer</param>
+ inline UserFunctionExecutionException(apache::geode::client::UserFunctionExecutionExceptionPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::UserFunctionExecutionException>(nativeptr);
+ }
+
+ native_shared_ptr<native::UserFunctionExecutionException>^ m_nativeptr;
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/Utils.cpp
----------------------------------------------------------------------
diff --git a/clicache/src/Utils.cpp b/clicache/src/Utils.cpp
new file mode 100644
index 0000000..e293b52
--- /dev/null
+++ b/clicache/src/Utils.cpp
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+
+#include "gfcli/Utils.hpp"
+#include "begin_native.hpp"
+#include <Utils.hpp>
+#include "end_native.hpp"
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ MethodInfo^ Utils::LoadMethod( String^ assemblyName,
+ String^ typeName, String^ methodName)
+ {
+ Type^ loadType;
+
+ loadType = Type::GetType( typeName + ',' + assemblyName, false, true );
+ if (loadType != nullptr)
+ {
+ return loadType->GetMethod( methodName, BindingFlags::Public |
+ BindingFlags::Static | BindingFlags::IgnoreCase );
+ }
+ return nullptr;
+ }
+
+ MethodInfo^ Utils::LoadMethodFrom( String^ assemblyPath,
+ String^ typeName, String^ methodName)
+ {
+ String^ assemblyName;
+ Type^ loadType;
+
+ assemblyName = System::IO::Path::GetFileNameWithoutExtension(
+ assemblyPath );
+ loadType = Type::GetType( typeName + ',' + assemblyName, false, true );
+ if (loadType == nullptr)
+ {
+ Assembly^ assmb = Assembly::LoadFrom( assemblyPath );
+ if (assmb != nullptr)
+ {
+ loadType = assmb->GetType(typeName, false, true);
+ }
+ }
+ if (loadType != nullptr)
+ {
+ return loadType->GetMethod( methodName, BindingFlags::Public |
+ BindingFlags::Static | BindingFlags::IgnoreCase );
+ }
+ return nullptr;
+ }
+
+ System::Int32 Utils::LastError::get( )
+ {
+ return apache::geode::client::Utils::getLastError( );
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/begin_native.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/begin_native.hpp b/clicache/src/begin_native.hpp
new file mode 100644
index 0000000..5ee5877
--- /dev/null
+++ b/clicache/src/begin_native.hpp
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#if defined(__begin_native__hpp__)
+#error Including begin_native.hpp mulitple times without end_native.hpp
+#endif
+#define __begin_native__hpp__
+
+#pragma push_macro("_ALLOW_KEYWORD_MACROS")
+#undef _ALLOW_KEYWORD_MACROS
+#define _ALLOW_KEYWORD_MACROS
+
+#pragma push_macro("nullptr")
+#undef nullptr
+#define nullptr __nullptr
+
+#pragma warning(push)
+
+// Disable XML warnings
+#pragma warning(disable: 4635)
+#pragma warning(disable: 4638)
+#pragma warning(disable: 4641)
+
+// Disable native code generation warning
+#pragma warning(disable: 4793)
+
+#pragma managed(push, off)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/src/end_native.hpp
----------------------------------------------------------------------
diff --git a/clicache/src/end_native.hpp b/clicache/src/end_native.hpp
new file mode 100644
index 0000000..8a8a4ae
--- /dev/null
+++ b/clicache/src/end_native.hpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+#pragma managed(pop)
+
+#pragma warning(pop)
+
+#pragma pop_macro("nullptr")
+#pragma pop_macro("_ALLOW_KEYWORD_MACROS")
+
+#undef __begin_native__hpp__
\ No newline at end of file
[50/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..bb40517
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,263 @@
+# 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.
+cmake_minimum_required(VERSION 3.4)
+project(nativeclient)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+if(CMAKE_GENERATOR MATCHES Win64*)
+ if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_GENERATOR_TOOLSET STREQUAL ""))
+ message(WARNING "GEODE expects that a user must provode -Thost=x64 if you are using a"
+ " 64-bit toolset, otherwise you may get a linker error when DLLs are larger"
+ " than 2GB saying \"Unable to open file apache-geode-static.dll.\" This is due"
+ " to the 32bit toolset being used by default.")
+ endif()
+endif()
+
+set(BUILD_BITS 64 CACHE STRING "Build for 64 (default) or 32 bit.")
+
+set(PRODUCT_VENDOR "Apache" CACHE STRING "Product vendor")
+set(PRODUCT_VENDOR_NAME "The Apache Software Foundation" CACHE STRING "Product vendor full legal name")
+set(PRODUCT_NAME "Geode Native" CACHE STRING "Product name")
+set(PRODUCT_VERSION "0.0.42-build.0" CACHE STRING "Product version")
+set(PRODUCT_PACKAGE_NAME "apache-geode-native" CACHE STRING "Product package name")
+
+set(PRODUCT_BITS "${BUILD_BITS}bit")
+
+set(PRODUCT_LIB_NAME "apache-geode" CACHE STRING "Binary name")
+set(PRODUCT_DLL_NAME "Apache.Geode" CACHE STRING ".Net Binary name")
+
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "sparc")
+ set(PRODUCT_SYSTEM_NAME "solaris-sparc")
+ else()
+ set(PRODUCT_SYSTEM_NAME "solaris-x86")
+ endif()
+else()
+ set(PRODUCT_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}" CACHE STRING "Product built for system name")
+endif()
+
+string(REGEX REPLACE "-build" "" PRODUCT_VERSION_DOTTED ${PRODUCT_VERSION})
+string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" PRODUCT_VERSION_LONG ${PRODUCT_VERSION})
+string(REGEX MATCH "^[0-9]+\\.[0-9]+" PRODUCT_VERSION_SHORT ${PRODUCT_VERSION})
+string(REGEX REPLACE "\\." ";" PRODUCT_VERSION_LIST ${PRODUCT_VERSION_DOTTED})
+list(LENGTH PRODUCT_VERSION_LIST _length)
+if (_length LESS 4)
+ foreach(_index RANGE ${_length} 3)
+ list(APPEND PRODUCT_VERSION_LIST 0)
+ endforeach()
+endif()
+list(GET PRODUCT_VERSION_LIST 0 PRODUCT_VERSION_MAJOR)
+list(GET PRODUCT_VERSION_LIST 1 PRODUCT_VERSION_MINOR)
+list(GET PRODUCT_VERSION_LIST 2 PRODUCT_VERSION_PATCH)
+list(GET PRODUCT_VERSION_LIST 3 PRODUCT_VERSION_BUILD)
+
+# Please note that attempts to set CMAKE_INSTALL_PREFIX to a *ROOTED*
+# path here will fail due to the design of CMake according to its
+# development team. Setting it to a relative path appears to work.
+# To override the install location, CMAKE_INSTALL_PREFIX must be
+# specified at the time of generation, e.g.:
+# $ cmake -G Xcode -DCMAKE_INSTALL_PREFIX=/my/favorite/location ..
+set(CMAKE_INSTALL_PREFIX "nativeclient" CACHE STRING "Install prefix")
+
+set(CMAKE_CONFIGURATION_TYPES Debug Release)
+if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+# TODO this doesn't seem to have effect
+set(CMAKE_ECLIPSE_VERSION Mars)
+
+#TODO this check is failing to fail properly on solaris with sun CC 5.10
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+set(CPACK_PACKAGE_VERSION_MAJOR ${PRODUCT_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${PRODUCT_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${PRODUCT_VERSION_PATCH})
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PRODUCT_VENDOR} ${PRODUCT_NAME}")
+set(CPACK_PACKAGE_VENDOR "${PRODUCT_VENDOR}")
+set(CPACK_PACKAGE_NAME "${PRODUCT_PACKAGE_NAME}")
+set(CPACK_SYSTEM_NAME "${PRODUCT_SYSTEM_NAME}-${PRODUCT_BITS}")
+set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PRODUCT_VERSION}-${CPACK_SYSTEM_NAME})
+set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
+set(CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_NAME}")
+#set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/dist/LICENSE")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
+set(CPACK_GENERATOR TGZ;ZIP)
+
+option(ENABLE_CLANG_TIDY "Enable clang-tidy checks." false)
+if(ENABLE_CLANG_TIDY)
+ find_program(CLANG_TIDY "clang-tidy")
+ if(CLANG_TIDY)
+ set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} -header-filter=${CMAKE_CURRENT_SOURCE_DIR})
+ option(ENABLE_CLANG_TIDY_FIX "Enable clang-tidy fix." false)
+ if(ENABLE_CLANG_TIDY_FIX)
+ set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY} -fix -fix-errors)
+ endif()
+ message(STATUS "clang-tidy enabled.")
+ else()
+ message(SEND_ERROR "clang-tidy enabled but not found.")
+ endif()
+endif()
+
+file(GLOB_RECURSE ALL_CXX_SOURCE_FILES *.[chi]pp *.[chi]xx *.cc *.hh *.ii *.[CHI])
+find_program(CLANG_FORMAT "clang-format")
+if(CLANG_FORMAT)
+ add_custom_target(format)
+ set_target_properties(format PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+
+ foreach(_file ${ALL_CXX_SOURCE_FILES})
+ add_custom_command(TARGET format PRE_BUILD COMMAND ${CLANG_FORMAT} -i -style=file -fallback-style=Google ${_file})
+ endforeach()
+endif()
+
+if(CMAKE_GENERATOR MATCHES Win64*)
+ set(CMAKE_GENERATOR_TOOLSET "host=x64")
+else()
+ set(CMAKE_GENERATOR_TOOLSET )
+endif()
+
+include(CPack)
+include(CheckCXXCompilerFlag)
+include(CheckCCompilerFlag)
+
+set(CMAKE_REQUIRED_LIBRARIES -m64)
+check_c_compiler_flag(-m64 CFLAGS_M64_ALLOWED)
+check_cxx_compiler_flag(-m64 CXXFLAGS_M64_ALLOWED)
+set(CMAKE_REQUIRED_LIBRARIES)
+
+check_c_compiler_flag(-mt CFLAGS_mt_ALLOWED)
+
+if (CFLAGS_M64_ALLOWED AND CXXFLAGS_M64_ALLOWED)
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -m64)
+ add_compile_options(-m64)
+#TODO cmake find better way to set linker flags
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -m64")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
+endif()
+
+if (CFLAGS_mt_ALLOWED)
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -mt)
+ add_compile_options(-mt)
+endif()
+
+#TODO remove this debugging for NMake
+set(CMAKE_VERBOSE_MAKEFILE 0)
+
+add_library(c++11 INTERFACE)
+
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+ # Force linker to error on undefined symbols in shared libraries
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z defs -xatomic=none")
+ # TODO cmake find a better way to set runtime libraries
+ # C++11 requires these libraries, treat -std=c++11 as library
+ #TODO look into CMAKE_CXX_STANDARD_LIBRARIES
+ target_link_libraries(c++11 INTERFACE -std=c++11 stdc++ gcc_s CrunG3 m c)
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+endif()
+if(MSVC)
+ # TODO error on warnings
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+ set(BUILD_CLI 1)
+ set(STRONG_NAME_KEY "" CACHE FILEPATH "Strong Name Key File")
+ if(EXISTS "${STRONG_NAME_KEY}")
+ set(SHARED_LINKER_FLAGS_STRONG_KEY "/keyfile:${STRONG_NAME_KEY}")
+ execute_process(COMMAND sn -p ${STRONG_NAME_KEY} ${CMAKE_CURRENT_BINARY_DIR}/public.snk)
+ execute_process(COMMAND sn -tp ${CMAKE_CURRENT_BINARY_DIR}/public.snk OUTPUT_VARIABLE STRONG_NAME_PUBLIC_KEY)
+ string(REPLACE "\n" "" STRONG_NAME_PUBLIC_KEY ${STRONG_NAME_PUBLIC_KEY})
+ string(REGEX REPLACE ".*sha1\\):([a-f0-9]+).*" "\\1" STRONG_NAME_PUBLIC_KEY ${STRONG_NAME_PUBLIC_KEY})
+ endif()
+endif()
+
+find_package(Java 1.8.0.60 REQUIRED COMPONENTS Development)
+
+if ("${CMAKE_AR}" STREQUAL "CMAKE_AR-NOTFOUND")
+ message(FATAL_ERROR "Utility ar not found.")
+endif()
+
+if (WIN32 OR ${CMAKE_GENERATOR} STREQUAL "Xcode")
+ set(CMAKE_USES_BUILDTYPE TRUE)
+ set ( _DEBUG_OR_RELEASE $<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release>)
+else()
+ set(CMAKE_USES_BUILDTYPE FALSE)
+ set ( _DEBUG_OR_RELEASE )
+endif()
+
+# Since RPATH embeds path information into the executables that
+# may not be valid in all execution contexts, do not use RPATH.
+set(CMAKE_SKIP_RPATH TRUE)
+set(CMAKE_MACOSX_RPATH FALSE)
+
+# Default to only showing output on failure for unit tests but allow
+# overriding with the CTEST_UNITTEST_VERBOSITY environment variable.
+set(CTEST_UNITTEST_VERBOSITY --output-on-failure)
+if(DEFINED ENV{CTEST_UNITTEST_VERBOSITY})
+ set(CTEST_UNITTEST_VERBOSITY $ENV{CTEST_UNITTEST_VERBOSITY})
+endif()
+
+find_package(Geode 1.0 REQUIRED)
+
+add_custom_target(client-libraries)
+
+add_custom_target(unit-tests)
+add_custom_target(run-unit-tests)
+add_dependencies(run-unit-tests unit-tests)
+set_target_properties(run-unit-tests PROPERTIES
+ EXCLUDE_FROM_ALL TRUE
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE
+)
+
+add_custom_target(integration-tests)
+add_custom_target(run-integration-tests)
+add_dependencies(run-integration-tests integration-tests)
+set_target_properties(run-integration-tests PROPERTIES
+ EXCLUDE_FROM_ALL TRUE
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE
+)
+
+add_subdirectory(dependencies)
+add_subdirectory(cppcache)
+add_subdirectory(cryptoimpl)
+add_subdirectory(dhimpl)
+add_subdirectory(sqliteimpl)
+add_subdirectory(tests)
+add_subdirectory(templates/security)
+add_subdirectory(docs/api)
+if (${BUILD_CLI})
+ add_subdirectory(clicache)
+ add_subdirectory(plugins/SQLiteCLI)
+endif()
+
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/quickstart/ DESTINATION SampleCode/quickstart USE_SOURCE_PERMISSIONS)
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cppcache/integration-test/keystore/ DESTINATION SampleCode/quickstart/keystore)
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/xsds/ DESTINATION xsds)
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/defaultSystem/ DESTINATION defaultSystem)
+
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dist/ DESTINATION .)
+
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/templates/ DESTINATION templates
+ PATTERN "templates/security/CMakeLists.txt" EXCLUDE
+ PATTERN "templates/security/CMakeLists.txt.forInstall" EXCLUDE)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/security/CMakeLists.txt.forInstall RENAME CMakeLists.txt DESTINATION templates/security)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tests/javaobject/javaobject.jar DESTINATION SampleCode/quickstart/lib)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/FindNativeClient.cmake
----------------------------------------------------------------------
diff --git a/FindNativeClient.cmake b/FindNativeClient.cmake
new file mode 100644
index 0000000..f180891
--- /dev/null
+++ b/FindNativeClient.cmake
@@ -0,0 +1,277 @@
+# 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.
+#.rst:
+# FindJava
+# --------
+#
+# Find Java
+#
+# This module finds if Java is installed and determines where the
+# include files and libraries are. The caller may set variable JAVA_HOME
+# to specify a Java installation prefix explicitly.
+#
+#
+# Specify one or more of the following components as you call this find module. See example below.
+#
+# ::
+#
+# Runtime = User just want to execute some Java byte-compiled
+# Development = Development tools (java, javac, javah and javadoc), includes Runtime component
+# IdlJ = idl compiler for Java
+# JarSigner = signer tool for jar
+#
+#
+# This module sets the following result variables:
+#
+# ::
+#
+# Java_JAVA_EXECUTABLE = the full path to the Java runtime
+# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
+# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
+# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
+# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
+# Java_JAR_EXECUTABLE = the full path to the Java archiver
+# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
+# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
+# Java_VERSION_MAJOR = The major version of the package found.
+# Java_VERSION_MINOR = The minor version of the package found.
+# Java_VERSION_PATCH = The patch version of the package found.
+# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
+# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
+#
+#
+#
+# The minimum required version of Java can be specified using the
+# standard CMake syntax, e.g. find_package(Java 1.5)
+#
+# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to
+# be identical. For example some java version may return:
+# Java_VERSION_STRING = 1.5.0_17 and Java_VERSION = 1.5.0.17
+#
+# another example is the Java OEM, with: Java_VERSION_STRING = 1.6.0-oem
+# and Java_VERSION = 1.6.0
+#
+# For these components the following variables are set:
+#
+# ::
+#
+# Java_FOUND - TRUE if all components are found.
+# Java_INCLUDE_DIRS - Full paths to all include dirs.
+# Java_LIBRARIES - Full paths to all libraries.
+# Java_<component>_FOUND - TRUE if <component> is found.
+#
+#
+#
+# Example Usages:
+#
+# ::
+#
+# find_package(Java)
+# find_package(Java COMPONENTS Runtime)
+# find_package(Java COMPONENTS Development)
+
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+
+# The HINTS option should only be used for values computed from the system.
+set(_JAVA_HINTS)
+if(_JAVA_HOME)
+ list(APPEND _JAVA_HINTS ${_JAVA_HOME}/bin)
+endif()
+list(APPEND _JAVA_HINTS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
+ )
+# Hard-coded guesses should still go in PATHS. This ensures that the user
+# environment can always override hard guesses.
+set(_JAVA_PATHS
+ /usr/lib/java/bin
+ /usr/share/java/bin
+ /usr/local/java/bin
+ /usr/local/java/share/bin
+ /usr/java/j2sdk1.4.2_04
+ /usr/lib/j2sdk1.4-sun/bin
+ /usr/java/j2sdk1.4.2_09/bin
+ /usr/lib/j2sdk1.5-sun/bin
+ /opt/sun-jdk-1.5.0.04/bin
+ /usr/local/jdk-1.7.0/bin
+ /usr/local/jdk-1.6.0/bin
+ )
+find_program(Java_JAVA_EXECUTABLE
+ NAMES java
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+if(Java_JAVA_EXECUTABLE)
+ execute_process(COMMAND ${Java_JAVA_EXECUTABLE} -version
+ RESULT_VARIABLE res
+ OUTPUT_VARIABLE var
+ ERROR_VARIABLE var # sun-java output to stderr
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ if( res )
+ if(var MATCHES "No Java runtime present, requesting install")
+ set_property(CACHE Java_JAVA_EXECUTABLE
+ PROPERTY VALUE "Java_JAVA_EXECUTABLE-NOTFOUND")
+ elseif(${Java_FIND_REQUIRED})
+ message( FATAL_ERROR "Error executing java -version" )
+ else()
+ message( STATUS "Warning, could not run java -version")
+ endif()
+ else()
+ # extract major/minor version and patch level from "java -version" output
+ # Tested on linux using
+ # 1. Sun / Sun OEM
+ # 2. OpenJDK 1.6
+ # 3. GCJ 1.5
+ # 4. Kaffe 1.4.2
+ # 5. OpenJDK 1.7.x on OpenBSD
+ if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"")
+ # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"")
+ # Kaffe style
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+.*)\"")
+ # OpenJDK ver 1.7.x on OpenBSD
+ set(Java_VERSION_STRING "${CMAKE_MATCH_1}")
+ else()
+ if(NOT Java_FIND_QUIETLY)
+ message(WARNING "regex not supported: ${var}. Please report")
+ endif()
+ endif()
+ string( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" )
+ string( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" )
+ string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" )
+ # warning tweak version can be empty:
+ string( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+[_\\.]?([0-9]*).*$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" )
+ if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined
+ set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH})
+ else()
+ set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK})
+ endif()
+ endif()
+
+endif()
+
+
+find_program(Java_JAR_EXECUTABLE
+ NAMES jar
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_JAVAC_EXECUTABLE
+ NAMES javac
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_JAVAH_EXECUTABLE
+ NAMES javah
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_JAVADOC_EXECUTABLE
+ NAMES javadoc
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_IDLJ_EXECUTABLE
+ NAMES idlj
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+find_program(Java_JARSIGNER_EXECUTABLE
+ NAMES jarsigner
+ HINTS ${_JAVA_HINTS}
+ PATHS ${_JAVA_PATHS}
+)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+if(Java_FIND_COMPONENTS)
+ set(_JAVA_REQUIRED_VARS)
+ foreach(component ${Java_FIND_COMPONENTS})
+ # User just want to execute some Java byte-compiled
+ If(component STREQUAL "Runtime")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE)
+ if(Java_JAVA_EXECUTABLE)
+ set(Java_Runtime_FOUND TRUE)
+ endif()
+ elseif(component STREQUAL "Development")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
+ if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE
+ AND Java_JAVAH_EXECUTABLE AND Java_JAVADOC_EXECUTABLE)
+ set(Java_Development_FOUND TRUE)
+ endif()
+ elseif(component STREQUAL "IdlJ")
+ list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE)
+ if(Java_IdlJ_EXECUTABLE)
+ set(Java_Extra_FOUND TRUE)
+ endif()
+ elseif(component STREQUAL "JarSigner")
+ list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE)
+ if(Java_IDLJ_EXECUTABLE)
+ set(Java_JarSigner_FOUND TRUE)
+ endif()
+ else()
+ message(FATAL_ERROR "Comp: ${component} is not handled")
+ endif()
+ endforeach()
+ list (REMOVE_DUPLICATES _JAVA_REQUIRED_VARS)
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS ${_JAVA_REQUIRED_VARS} HANDLE_COMPONENTS
+ VERSION_VAR Java_VERSION
+ )
+ if(Java_FOUND)
+ foreach(component ${Java_FIND_COMPONENTS})
+ set(Java_${component}_FOUND TRUE)
+ endforeach()
+ endif()
+else()
+ # Check for Development
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
+ VERSION_VAR Java_VERSION
+ )
+endif()
+
+
+mark_as_advanced(
+ Java_JAVA_EXECUTABLE
+ Java_JAR_EXECUTABLE
+ Java_JAVAC_EXECUTABLE
+ Java_JAVAH_EXECUTABLE
+ Java_JAVADOC_EXECUTABLE
+ Java_IDLJ_EXECUTABLE
+ Java_JARSIGNER_EXECUTABLE
+ )
+
+# LEGACY
+set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE})
+set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE})
+set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE})
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/FindNativeClientCPPCache.cmake
----------------------------------------------------------------------
diff --git a/FindNativeClientCPPCache.cmake b/FindNativeClientCPPCache.cmake
new file mode 100644
index 0000000..6ea6143
--- /dev/null
+++ b/FindNativeClientCPPCache.cmake
@@ -0,0 +1,68 @@
+# 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.
+#.rst:
+# FindNativeClientCPPCache
+# ------------------------
+#
+# Try to find the NativeClient cppcache library
+#
+# Once done this will define
+#
+# ::
+#
+# NATIVECLIENT_CPPCACHE_FOUND - true when cmake has found the NativeClient CPPCache library
+# NATIVECLIENT_CPPCACHE_INCLUDE_DIR - The NativeClient include directory
+# NATIVECLIENT_CPPCACHE_LIBRARIES - The libraries needed to use NativeClient CPPCache library
+# NATIVECLIENT_CPPCACH_DEFINITIONS - Compiler switches required for using NativeClient CPPCache library
+# NATIVECLIENT_CPPCACH_VERSION_STRING - the version of NativeClient CPPCache library found
+
+find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
+ HINTS
+ ${PC_LIBXML_INCLUDEDIR}
+ ${PC_LIBXML_INCLUDE_DIRS}
+ PATH_SUFFIXES libxml2
+ )
+
+find_library(LIBXML2_LIBRARIES NAMES xml2 libxml2
+ HINTS
+ ${PC_LIBXML_LIBDIR}
+ ${PC_LIBXML_LIBRARY_DIRS}
+ )
+
+find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
+
+set( NATIVECLIENT_CPPCACHE_VERSION_STRING "9.0" )
+set( NATIVECLIENT_CPPCACHE_FOUND "YES" )
+set( NATIVECLIENT_CPPCACHE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIRECTORY}/include ) # TODO: Replace with install directory
+set( NATIVECLIENT_CPPCACHE_LIBRARIES ${GTK_gtk_LIBRARY}
+ ${GTK_gdk_LIBRARY}
+ ${GTK_glib_LIBRARY} )
+elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+ file(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
+ REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
+
+ string(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXML2_VERSION_STRING "${libxml2_version_str}")
+ unset(libxml2_version_str)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
+ REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
+ VERSION_VAR LIBXML2_VERSION_STRING)
+
+mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/.clang-format
----------------------------------------------------------------------
diff --git a/clicache/.clang-format b/clicache/.clang-format
new file mode 100644
index 0000000..23a15d5
--- /dev/null
+++ b/clicache/.clang-format
@@ -0,0 +1,5 @@
+# C++/CLI sources not supported in clang-format
+---
+Language: Cpp
+DisableFormat: true
+SortIncludes: false
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/clicache/CMakeLists.txt b/clicache/CMakeLists.txt
new file mode 100644
index 0000000..9ea4f82
--- /dev/null
+++ b/clicache/CMakeLists.txt
@@ -0,0 +1,20 @@
+# 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.
+cmake_minimum_required(VERSION 3.4)
+project(clicache_src)
+
+add_subdirectory(src)
+add_subdirectory(test)
+add_subdirectory(integration-test)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/include/gfcli/Utils.hpp
----------------------------------------------------------------------
diff --git a/clicache/include/gfcli/Utils.hpp b/clicache/include/gfcli/Utils.hpp
new file mode 100644
index 0000000..86808f7
--- /dev/null
+++ b/clicache/include/gfcli/Utils.hpp
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+
+
+#pragma once
+
+#include <geode/geode_base.hpp>
+#include "geode_defs.hpp"
+//#include "SystemProperties.hpp"
+//#include "../../impl/NativeWrapper.hpp"
+//#include "../../Log.hpp"
+
+using namespace System;
+using namespace System::Reflection;
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ /// <summary>
+ /// Some static utility methods.
+ /// </summary>
+ public ref class Utils STATICCLASS
+ {
+ public:
+
+ /// <summary>
+ /// Load a method from the given assembly path using the default
+ /// constructor (if not a static method) of the given type.
+ /// </summary>
+ /// <param name="assemblyPath">The path of the assembly.</param>
+ /// <param name="typeName">
+ /// The name of the class containing the method.
+ /// </param>
+ /// <param name="methodName">The name of the method.</param>
+ /// <returns>
+ /// The <c>System.Reflection.MethodInfo</c> for the given method,
+ /// or null if the method is not found.
+ /// </returns>
+ static MethodInfo^ LoadMethod( String^ assemblyPath,
+ String^ typeName, String^ methodName);
+
+ /// <summary>
+ /// Load a method from the given assembly name using the default
+ /// constructor (if not a static method) of the given type.
+ /// </summary>
+ /// <param name="assemblyName">The name of the assembly.</param>
+ /// <param name="typeName">
+ /// The name of the class containing the method.
+ /// </param>
+ /// <param name="methodName">The name of the method.</param>
+ /// <returns>
+ /// The <c>System.Reflection.MethodInfo</c> for the given method,
+ /// or null if the method is not found.
+ /// </returns>
+ static MethodInfo^ LoadMethodFrom( String^ assemblyName,
+ String^ typeName, String^ methodName);
+
+ /// <summary>
+ /// Utility method to get the calling thread's last system error code.
+ /// </summary>
+ static property System::Int32 LastError
+ {
+ System::Int32 get( );
+ }
+ };
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/AckMixTests.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/AckMixTests.cs b/clicache/integration-test/AckMixTests.cs
new file mode 100644
index 0000000..8cf394d
--- /dev/null
+++ b/clicache/integration-test/AckMixTests.cs
@@ -0,0 +1,264 @@
+/*
+ * 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;
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+
+ [TestFixture]
+ [Category("unicast_only")]
+ public class AckMixTests : UnitTests
+ {
+ private TallyListener m_listener = new TallyListener();
+ private AckMixRegionWrapper m_regionw;
+ private const string RegionName = "ConfusedScope";
+
+ private UnitProcess m_client1, m_client2;
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ #region Private functions
+
+ private void Init()
+ {
+ Properties dsysConfig = new Properties();
+ dsysConfig.Insert("ack-wait-threshold", "5");
+ CacheHelper.InitConfig(dsysConfig);
+ }
+
+ #endregion
+
+ #region Functions called by the tests
+
+ public void CreateRegionNOIL(int clientNum, bool ack)
+ {
+ Init();
+ string ackStr;
+ if (ack)
+ {
+ ackStr = "with-ack";
+ }
+ else
+ {
+ ackStr = "no-ack";
+ }
+ Util.Log("Creating region in client {0}, " + ackStr +
+ ", no-mirror, cache, no-interestlist, with-listener", clientNum);
+ CacheHelper.CreateILRegion(RegionName, ack, true, m_listener);
+ m_regionw = new AckMixRegionWrapper(RegionName);
+ }
+
+ //Verify no events received by the process
+ public void VerifyNoEvents()
+ {
+ 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 SendCreate()
+ {
+ Util.Log("put(1,1) from Client 1 noack");
+ m_regionw.Put(1, 1);
+ m_listener.ShowTallies();
+ }
+
+ //Test cache didn't stored update
+ public void TestCreateFromAck()
+ {
+ Util.Log("test(1, -1) in Client 2 ack");
+ m_regionw.Test(1, -1);
+
+ // now define something of our own to test create going the other way.
+ Util.Log("put(2,2) from Client 2");
+ m_regionw.Put(2, 2);
+ Assert.AreEqual(1, m_listener.Creates, "Should be 1 create.");
+ // send update from ACK to NOACK
+ Util.Log("put(1,3) from Client 2");
+
+ Thread.Sleep(10000); // see if we can drop the incoming create before we define the key.
+ m_regionw.Test(1, -1);
+
+ m_regionw.Put(1, 3);
+ Assert.AreEqual(2, m_listener.Creates, "Should be 2 creates.");
+ m_listener.ShowTallies();
+ }
+
+ public void TestCreateFromNoAck()
+ {
+ Util.Log("test( 2, -1 ) in Client 1");
+ m_regionw.Test(2, -1);
+ Util.Log("test( 1, 3 ) in Client 1");
+ m_regionw.Test(1, 3);
+
+ // Now Updates from Client 1 to Client 2.
+ Util.Log("put( 1, 5) from Client 1");
+ m_regionw.Put(1, 5);
+ m_listener.ShowTallies();
+ }
+
+ public void TestUpdateFromAck()
+ {
+ Util.Log("test( 1, 5 ) in Client 2");
+ m_regionw.Test(1, 5, true);
+ }
+
+ public void TestEventCount(int clientNum)
+ {
+ Util.Log("check Client {0} event count.", clientNum);
+ m_listener.ShowTallies();
+ Assert.AreEqual(2, m_listener.ExpectCreates(2), "Should have been 2 creates.");
+ Assert.AreEqual(1, m_listener.ExpectUpdates(1), "Should have been 1 update.");
+ }
+
+ public void TestTimeoutSetup()
+ {
+ Util.Log("creating after timeout key to verify.");
+ m_regionw.Put(40000, 1);
+ m_regionw.SetupTimeout(m_listener);
+ }
+
+ public void TestPutTimeout(int newVal)
+ {
+ Util.Log("checking that timeout works.");
+ try
+ {
+ m_listener.IgnoreTimeout = true;
+ m_regionw.RequestTimeout();
+ Assert.Fail("Should have thrown TimeoutException.");
+ }
+ catch (TimeoutException)
+ {
+ // good.. expected this... now sleep a bit and move on.
+ Util.Log("Expected: Received TimeoutException ( good news. )");
+ m_listener.IgnoreTimeout = false;
+ Thread.Sleep(10000); // other process should be clear by now.
+ m_regionw.Put(40000, newVal); // Make sure we succeed with this next put.
+ Util.Log("Sent update to key 40000.");
+ }
+ catch (Exception ex)
+ {
+ Util.Log(ex.ToString());
+ Assert.Fail(ex.Message);
+ }
+ }
+
+ public void TestAfterPutTimeout(int newVal)
+ {
+ Util.Log("verifing values made it through from TestTimeout.");
+ m_regionw.CheckTimeout();
+ m_regionw.Test(40000, newVal);
+ }
+
+ #endregion
+
+ [Test]
+ public void AckMix()
+ {
+ m_client1.Call(CreateRegionNOIL, 1, false);
+ m_client2.Call(CreateRegionNOIL, 2, true);
+
+ m_client1.Call(VerifyNoEvents);
+ m_client2.Call(VerifyNoEvents);
+
+ m_client1.Call(SendCreate);
+ m_client2.Call(TestCreateFromAck);
+
+ m_client1.Call(TestCreateFromNoAck);
+ m_client2.Call(TestUpdateFromAck);
+
+ m_client1.Call(TestEventCount, 1);
+ m_client2.Call(TestEventCount, 2);
+
+ m_client1.Call(TestTimeoutSetup);
+ m_client2.Call(TestPutTimeout, 4000);
+
+ m_client1.Call(TestAfterPutTimeout, 4000);
+ m_client2.Call(TestPutTimeout, 5000);
+
+ m_client1.Call(TestAfterPutTimeout, 5000);
+ }
+ }
+
+ class AckMixRegionWrapper : RegionWrapper
+ {
+ private bool m_timeoutUpdate;
+
+ private static CacheableString timeoutKey =
+ new CacheableString("timeout");
+
+ public AckMixRegionWrapper(string name)
+ : base(name)
+ {
+ m_timeoutUpdate = false;
+ }
+
+ public void RequestTimeout()
+ {
+ string timeoutValue = "timeout";
+ if (m_timeoutUpdate)
+ {
+ timeoutValue = "timeoutUpdate";
+ }
+ DateTime start = DateTime.Now;
+ TimeSpan span;
+ try
+ {
+ m_region.Put(timeoutKey, timeoutValue);
+ span = DateTime.Now - start;
+ Util.Log("put took {0} millis value({1})", span.TotalMilliseconds, timeoutValue);
+ }
+ catch
+ {
+ span = DateTime.Now - start;
+ Util.Log("put took {0} millis value({1})", span.TotalMilliseconds, timeoutValue);
+ m_timeoutUpdate = true;
+ throw;
+ }
+ }
+
+ public void CheckTimeout()
+ {
+ string timeoutValue = "timeout";
+ if (m_timeoutUpdate)
+ {
+ timeoutValue = "timeoutUpdate";
+ }
+ CacheableString val = m_region.Get(timeoutKey) as CacheableString;
+ Assert.AreEqual(timeoutValue, val.ToString());
+ m_timeoutUpdate = true;
+ }
+
+ public void SetupTimeout(TallyListener listener)
+ {
+ listener.IgnoreTimeout = true;
+ m_region.Put(timeoutKey, timeoutKey);
+ listener.IgnoreTimeout = false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/AssemblyInfo.cs b/clicache/integration-test/AssemblyInfo.cs
new file mode 100644
index 0000000..e54a2f7
--- /dev/null
+++ b/clicache/integration-test/AssemblyInfo.cs
@@ -0,0 +1,49 @@
+/*
+ * 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("UnitTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyProduct("UnitTests")]
+[assembly: AssemblyCopyright("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.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("182f654f-12a7-4355-b31c-bd54bea9eb29")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/AttributesFactoryTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/AttributesFactoryTestsN.cs b/clicache/integration-test/AttributesFactoryTestsN.cs
new file mode 100644
index 0000000..a570ac7
--- /dev/null
+++ b/clicache/integration-test/AttributesFactoryTestsN.cs
@@ -0,0 +1,108 @@
+/*
+ * 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.Reflection;
+
+//#pragma warning disable 618
+
+//namespace Apache.Geode.Client.UnitTests
+//{
+// using NUnit.Framework;
+// using Apache.Geode.DUnitFramework;
+// // using Apache.Geode.Client;
+// using Apache.Geode.Client;
+// //using Region = Apache.Geode.Client.IRegion<Object, Object>;
+
+// [TestFixture]
+// [Category("group1")]
+// [Category("unicast_only")]
+// [Category("generics")]
+// public class AttributesFactoryTests : UnitTests
+// {
+// protected override ClientBase[] GetClients()
+// {
+// return null;
+// }
+
+// [Test]
+// public void InvalidTCRegionAttributes()
+// {
+// Properties<string, string> config = new Properties<string, string>();
+// CacheHelper.InitConfig(config);
+// IRegion<object, object> region;
+// RegionAttributes<object, object> attrs;
+// AttributesFactory<object, object> af = new AttributesFactory<object, object>();
+// af.SetScope(ScopeType.Local);
+// af.SetEndpoints("bass:1234");
+// attrs = af.CreateRegionAttributes();
+// region = CacheHelper.CreateRegion<object, object>("region1", attrs);
+// try
+// {
+// IRegion<Object, Object> localRegion = region.GetLocalView();
+// Assert.Fail(
+// "LOCAL scope is incompatible with a native client region");
+// }
+// catch (UnsupportedOperationException)
+// {
+// Util.Log("Got expected UnsupportedOperationException for " +
+// "LOCAL scope for native client region");
+// }
+
+// af.SetScope(ScopeType.Local);
+// af.SetClientNotificationEnabled(true);
+// attrs = af.CreateRegionAttributes();
+// try
+// {
+// region = CacheHelper.CreateRegion<object, object>("region2", attrs);
+// Assert.Fail(
+// "LOCAL scope is incompatible with clientNotificationEnabled");
+// }
+// catch (UnsupportedOperationException)
+// {
+// Util.Log("Got expected UnsupportedOperationException for " +
+// "clientNotificationEnabled for non native client region");
+// }
+
+// // Checks for HA regions
+
+// CacheHelper.CloseCache();
+// af.SetScope(ScopeType.Local);
+// af.SetEndpoints("bass:3434");
+// af.SetClientNotificationEnabled(false);
+// attrs = af.CreateRegionAttributes();
+// try
+// {
+// region = CacheHelper.CreateRegion<object, object>("region2", attrs);
+// Assert.Fail(
+// "LOCAL scope is incompatible with a native client HA region");
+// }
+// catch (UnsupportedOperationException)
+// {
+// Util.Log("Got expected UnsupportedOperationException for " +
+// "LOCAL scope for native client region");
+// }
+
+// af.SetScope(ScopeType.Local);
+// af.SetEndpoints("none");
+// af.SetClientNotificationEnabled(false);
+// attrs = af.CreateRegionAttributes();
+// region = CacheHelper.CreateRegion<object, object>("region1", attrs);
+// Util.Log("C++ local region created with HA cache specification.");
+// }
+// }
+//}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/AttributesMutatorTestsN.cs
----------------------------------------------------------------------
diff --git a/clicache/integration-test/AttributesMutatorTestsN.cs b/clicache/integration-test/AttributesMutatorTestsN.cs
new file mode 100644
index 0000000..dbd2327
--- /dev/null
+++ b/clicache/integration-test/AttributesMutatorTestsN.cs
@@ -0,0 +1,329 @@
+/*
+ * 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;
+
+#pragma warning disable 618
+
+namespace Apache.Geode.Client.UnitTests
+{
+ using NUnit.Framework;
+ using Apache.Geode.DUnitFramework;
+ using Apache.Geode.Client;
+
+ using GIRegion = Apache.Geode.Client.IRegion<string, string>;
+
+ class ThinClientTallyLoader : TallyLoader<string, string>
+ {
+ // Note this just returns default(TVal) hence null or empty string, use
+ // GetLoadCount() to get the load count int value.
+ public override string Load(GIRegion region, string key, object callbackArg)
+ {
+ base.Load(region, key, callbackArg);
+ int loadCount = GetLoadCount();
+ if (key != null)
+ {
+ Util.Log(Util.LogLevel.Debug,
+ "Putting the value ({0}) for local region clients only.",
+ loadCount);
+ region[key] = loadCount.ToString();
+ }
+ return loadCount.ToString();
+ }
+ }
+
+ [TestFixture]
+ [Category("group2")]
+ [Category("unicast_only")]
+ [Category("generics")]
+ public class AttributesMutatorTests : ThinClientRegionSteps
+ {
+ private UnitProcess m_client1, m_client2;
+ private const string Key = "one";
+ private const int Val = 1;
+ private const int TimeToLive = 5;
+ private const string PeerRegionName = "PEER1";
+ TallyListener<string, string> m_reg1Listener1, m_reg1Listener2;
+ TallyListener<string, string> m_reg2Listener1, m_reg2Listener2;
+ TallyListener<string, string> m_reg3Listener1, m_reg3Listener2;
+ TallyLoader<string, string> m_reg1Loader1, m_reg1Loader2;
+ TallyLoader<string, string> m_reg2Loader1, m_reg2Loader2;
+ TallyLoader<string, string> m_reg3Loader1, m_reg3Loader2;
+ TallyWriter<string, string> m_reg1Writer1, m_reg1Writer2;
+ TallyWriter<string, string> m_reg2Writer1, m_reg2Writer2;
+ TallyWriter<string, string> m_reg3Writer1, m_reg3Writer2;
+
+ protected override ClientBase[] GetClients()
+ {
+ m_client1 = new UnitProcess();
+ m_client2 = new UnitProcess();
+ return new ClientBase[] { m_client1, m_client2 };
+ }
+
+ protected override string ExtraPropertiesFile
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ #region Private methods
+
+ private void SetCacheListener(string regionName, ICacheListener<string, string> listener)
+ {
+ GIRegion region = CacheHelper.GetVerifyRegion<string, string>(regionName);
+ AttributesMutator<string, string> attrMutator = region.AttributesMutator;
+ attrMutator.SetCacheListener(listener);
+ }
+
+ private void SetCacheLoader(string regionName, ICacheLoader<string, string> loader)
+ {
+ GIRegion region = CacheHelper.GetVerifyRegion<string, string>(regionName);
+ AttributesMutator<string, string> attrMutator = region.AttributesMutator;
+ attrMutator.SetCacheLoader(loader);
+ }
+
+ private void SetCacheWriter(string regionName, ICacheWriter<string, string> writer)
+ {
+ GIRegion region = CacheHelper.GetVerifyRegion<string, string>(regionName);
+ AttributesMutator<string, string> attrMutator = region.AttributesMutator;
+ attrMutator.SetCacheWriter(writer);
+ }
+
+ private void RegisterKeys()
+ {
+ GIRegion region0 = CacheHelper.GetRegion<string, string>(m_regionNames[0]);
+ GIRegion region1 = CacheHelper.GetRegion<string, string>(m_regionNames[1]);
+ string cKey1 = m_keys[1];
+ string cKey2 = m_keys[3];
+ region0.GetSubscriptionService().RegisterKeys(new string[] { cKey1 });
+ region1.GetSubscriptionService().RegisterKeys(new string[] { cKey2 });
+ }
+
+ #endregion
+
+ #region Public methods invoked by the tests
+
+ public void StepOneCallbacks()
+ {
+ m_reg1Listener1 = new TallyListener<string, string>();
+ m_reg2Listener1 = new TallyListener<string, string>();
+ m_reg1Loader1 = new ThinClientTallyLoader();
+ m_reg2Loader1 = new ThinClientTallyLoader();
+ m_reg1Writer1 = new TallyWriter<string, string>();
+ m_reg2Writer1 = new TallyWriter<string, string>();
+
+ SetCacheListener(RegionNames[0], m_reg1Listener1);
+ SetCacheLoader(RegionNames[0], m_reg1Loader1);
+ SetCacheWriter(RegionNames[0], m_reg1Writer1);
+
+ SetCacheListener(RegionNames[1], m_reg2Listener1);
+ SetCacheLoader(RegionNames[1], m_reg2Loader1);
+ SetCacheWriter(RegionNames[1], m_reg2Writer1);
+
+ RegisterKeys();
+ m_reg3Listener1 = new TallyListener<string, string>();
+ //m_reg3Loader1 = new TallyLoader<string, string>();
+ m_reg3Loader1 = new ThinClientTallyLoader();
+ m_reg3Writer1 = new TallyWriter<string, string>();
+ AttributesFactory<string, string> af = new AttributesFactory<string, string>();
+
+ GIRegion region = CacheHelper.CreateRegion<string, string>(PeerRegionName,
+ af.CreateRegionAttributes());
+
+ SetCacheListener(PeerRegionName, m_reg3Listener1);
+ SetCacheLoader(PeerRegionName, m_reg3Loader1);
+ SetCacheWriter(PeerRegionName, m_reg3Writer1);
+
+ // Call the loader and writer
+ Assert.IsNotNull(GetEntry(RegionNames[0], m_keys[0]),
+ "Found null value.");
+ Assert.IsNotNull(GetEntry(RegionNames[1], m_keys[0]),
+ "Found null value.");
+ Assert.IsNotNull(GetEntry(PeerRegionName, m_keys[0]),
+ "Found null value.");
+
+ CreateEntry(PeerRegionName, m_keys[1], m_vals[1]);
+ }
+
+ public void StepTwoCallbacks()
+ {
+ AttributesFactory<string, string> af = new AttributesFactory<string, string>();
+
+ GIRegion region = CacheHelper.CreateRegion<string, string>(PeerRegionName,
+ af.CreateRegionAttributes());
+
+ CreateEntry(RegionNames[0], m_keys[1], m_vals[1]);
+ CreateEntry(RegionNames[1], m_keys[3], m_vals[3]);
+
+ SetCacheLoader(RegionNames[0], new ThinClientTallyLoader());
+ SetCacheLoader(RegionNames[1], new ThinClientTallyLoader());
+
+ Assert.IsNotNull(GetEntry(RegionNames[0], m_keys[0]),
+ "Found null value in region0.");
+ Assert.IsNotNull(GetEntry(RegionNames[1], m_keys[0]),
+ "Found null value in region1.");
+
+ }
+
+ public void StepThreeCallbacks()
+ {
+ Assert.AreEqual(2, m_reg1Listener1.ExpectCreates(2),
+ "Two creation events were expected for region1.");
+ Assert.AreEqual(2, m_reg2Listener1.ExpectCreates(2),
+ "Two creation events were expected for region2.");
+
+ Assert.AreEqual(0, m_reg1Listener1.ExpectUpdates(0),
+ "No update event was expected for region1.");
+ Assert.AreEqual(0, m_reg2Listener1.ExpectUpdates(0),
+ "No update event was expected for region2.");
+
+ Assert.AreEqual(1, m_reg1Loader1.ExpectLoads(1),
+ "One loader event was expected for region1.");
+ Assert.AreEqual(1, m_reg2Loader1.ExpectLoads(1),
+ "One loader event was expected for region2.");
+
+ Assert.AreEqual(1, m_reg1Writer1.ExpectCreates(1),
+ "One writer create event was expected for region1.");
+ Assert.AreEqual(1, m_reg2Writer1.ExpectCreates(1),
+ "One writer create event was expected for region2.");
+ }
+
+ public void StepFourCallbacks()
+ {
+ UpdateEntry(m_regionNames[0], m_keys[1], m_nvals[1], true);
+ UpdateEntry(m_regionNames[1], m_keys[3], m_nvals[3], true);
+ }
+
+ public void StepFiveCallbacks()
+ {
+ Assert.AreEqual(1, m_reg1Listener1.Updates,
+ "One update event was expected for region.");
+ Assert.AreEqual(1, m_reg2Listener1.Updates,
+ "One update event was expected for region.");
+
+ m_reg1Listener2 = new TallyListener<string, string>();
+ m_reg2Listener2 = new TallyListener<string, string>();
+ m_reg1Loader2 = new ThinClientTallyLoader();
+ m_reg2Loader2 = new ThinClientTallyLoader();
+ m_reg1Writer2 = new TallyWriter<string, string>();
+ m_reg2Writer2 = new TallyWriter<string, string>();
+
+ SetCacheListener(RegionNames[0], m_reg1Listener2);
+ SetCacheLoader(RegionNames[0], m_reg1Loader2);
+ SetCacheWriter(RegionNames[0], m_reg1Writer2);
+
+ SetCacheListener(RegionNames[1], m_reg2Listener2);
+ SetCacheLoader(RegionNames[1], m_reg2Loader2);
+ SetCacheWriter(RegionNames[1], m_reg2Writer2);
+
+ m_reg3Listener2 = new TallyListener<string, string>();
+ //m_reg3Loader2 = new TallyLoader<string, string>();
+ m_reg3Loader2 = new ThinClientTallyLoader();
+ m_reg3Writer2 = new TallyWriter<string, string>();
+
+ SetCacheListener(PeerRegionName, m_reg3Listener2);
+ SetCacheLoader(PeerRegionName, m_reg3Loader2);
+ SetCacheWriter(PeerRegionName, m_reg3Writer2);
+
+ // Force a fresh key get to trigger the new loaders
+ Assert.IsNotNull(GetEntry(RegionNames[0], m_keys[2]),
+ "Found null value.");
+ Assert.IsNotNull(GetEntry(RegionNames[1], m_keys[2]),
+ "Found null value.");
+ }
+
+
+
+ #endregion
+
+ [TearDown]
+ public override void EndTest()
+ {
+ base.EndTest();
+ }
+
+ [Test]
+ public void CreateAndVerifyExpiry()
+ {
+ try
+ {
+ IRegion<string, int> region = CacheHelper.CreateLocalRegionWithETTL<string, int>(RegionName,
+ ExpirationAction.LocalInvalidate, TimeToLive);
+
+ Apache.Geode.Client.RegionAttributes<string, int> newAttrs = region.Attributes;
+ int ttl = newAttrs.EntryTimeToLive;
+ Assert.AreEqual(TimeToLive, ttl);
+
+ region[Key] = Val;
+
+ // countdown begins... it is ttl so access should not play into it..
+ Thread.Sleep(2000); // sleep for some time, expect value to still be there.
+ int res = region[Key];
+ Assert.IsNotNull(res);
+ Assert.AreEqual(Val, res);
+ Thread.Sleep(6000); // sleep for 6 more seconds, expect value to be invalid.
+ bool containsKey = region.ContainsValueForKey(Key);
+ Assert.IsFalse(containsKey, "The region should not contain the key");
+ }
+ finally
+ {
+ CacheHelper.Close();
+ }
+ }
+
+ [Test]
+ public void Callbacks()
+ {
+ CacheHelper.SetupJavaServers("cacheserver_notify_subscription.xml");
+ CacheHelper.StartJavaLocator(1, "GFELOC");
+ Util.Log("Locator 1 started.");
+ CacheHelper.StartJavaServerWithLocators(1, "GFECS1", 1);
+ Util.Log("Cacheserver 1 started.");
+
+ try
+ {
+ m_client1.Call(CreateTCRegions, RegionNames, CacheHelper.Locators, true);
+ m_client1.Call(StepOneCallbacks);
+ Util.Log("StepOne complete.");
+
+ m_client2.Call(CreateTCRegions, RegionNames, CacheHelper.Locators, true);
+ m_client2.Call(StepTwoCallbacks);
+ Util.Log("StepTwo complete.");
+
+ m_client1.Call(StepThreeCallbacks);
+ Util.Log("StepThree complete.");
+
+ m_client2.Call(StepFourCallbacks);
+ Util.Log("StepFour complete.");
+
+ m_client1.Call(StepFiveCallbacks);
+ Util.Log("StepFive complete.");
+ }
+ finally
+ {
+ CacheHelper.StopJavaServer(1);
+ Util.Log("Cacheserver 1 stopped.");
+ m_client2.Call(DestroyRegions);
+ CacheHelper.StopJavaLocator(1);
+ CacheHelper.ClearEndpoints();
+ }
+ }
+ }
+}
[52/52] geode-native git commit: GEODE-3165: Fixes Travis CI to build
from new source root.
Posted by jb...@apache.org.
GEODE-3165: Fixes Travis CI to build from new source root.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/44635ffa
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/44635ffa
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/44635ffa
Branch: refs/heads/develop
Commit: 44635ffa95926c9cffecc1dcaac02fb3012d1eef
Parents: 6cbd424
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Fri Aug 11 16:04:40 2017 -0700
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Fri Aug 11 16:27:24 2017 -0700
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/44635ffa/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c5375a4..54e94ec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,10 +25,10 @@ services:
install:
- docker pull apachegeode/geode-native-build
-script:
+script:
- DOCKER_ARGS="--volume=${TRAVIS_BUILD_DIR}:/geode-native --workdir=/geode-native"
- docker run ${DOCKER_ARGS} apachegeode/geode-native-build bash -c "java -jar /apache-rat-0.12/apache-rat-0.12.jar -E .ratignore -d ."
- - docker run ${DOCKER_ARGS} apachegeode/geode-native-build bash -c "mkdir build && cd build && cmake ../src && cmake --build . -- -j 8 && ./cppcache/test/apache-geode_unittests"
+ - docker run ${DOCKER_ARGS} apachegeode/geode-native-build bash -c 'mkdir build && cd build && cmake .. && cmake --build . -- -j $((`nproc`+1)) && ./cppcache/test/apache-geode_unittests'
- docker stop $(docker ps -l -q)
notifications:
[27/52] [partial] geode-native git commit: GEODE-3165: Reogranized
sources relative to the root for better CMake IDE integration.
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_Loader.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_Loader.xml b/clicache/integration-test/client_Loader.xml
new file mode 100644
index 0000000..274ac12
--- /dev/null
+++ b/clicache/integration-test/client_Loader.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+<region name = "root" >
+ <region-attributes scope="local" caching-enabled="true"/>
+ <region name = "exampleRegion" >
+ <region-attributes scope="local" caching-enabled="true" client-notification="true"/>
+ </region>
+ </region>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_generics_plugins.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_generics_plugins.xml b/clicache/integration-test/client_generics_plugins.xml
new file mode 100644
index 0000000..435600b
--- /dev/null
+++ b/clicache/integration-test/client_generics_plugins.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0"
+ redundancy-level="1" >
+
+
+ <root-region name='DistRegionAck'>
+ <region-attributes pool-name="__TESTPOOL1_">
+ <cache-listener library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyListener<System.Object, System.Object>.Create"/>
+ <cache-loader library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyLoader<System.Object, System.Object>.Create"/>
+ <cache-writer library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyWriter<System.Object, System.Object>.Create"/>
+ <partition-resolver library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyResolver<System.Object, System.Object>.Create"/>
+ </region-attributes>
+ </root-region>
+
+ <root-region name='DistRegionNoAck'>
+ <region-attributes pool-name="__TESTPOOL1_">
+ <cache-listener library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyListener<System.Object, System.Object>.Create"/>
+ <cache-loader library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyLoader<System.Object, System.Object>.Create"/>
+ <cache-writer library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyWriter<System.Object, System.Object>.Create"/>
+ <partition-resolver library-name="UnitTests" library-function-name="Apache.Geode.Client.UnitTests.TallyResolver<System.Object, System.Object>.Create"/>
+ </region-attributes>
+ </root-region>
+
+ <pool
+ name="__TESTPOOL1_"
+ subscription-enabled="true"
+ subscription-redundancy="1"
+ pr-single-hop-enabled="true"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+
+ </pool>
+
+</client-cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_pdx.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_pdx.xml b/clicache/integration-test/client_pdx.xml
new file mode 100644
index 0000000..39add41
--- /dev/null
+++ b/clicache/integration-test/client_pdx.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0"
+ redundancy-level="1" >
+
+ <pdx read-serialized="true" />
+ <root-region name='DistRegionAck'>
+ <region-attributes pool-name="__TESTPOOL1_" caching-enabled="false" />
+ </root-region>
+
+ <root-region name='DistRegionNoAck'>
+ <region-attributes pool-name="__TESTPOOL1_" caching-enabled="false" />
+ </root-region>
+
+ <pool
+ name="__TESTPOOL1_"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+
+ </pool>
+
+</client-cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_pool.xml b/clicache/integration-test/client_pool.xml
new file mode 100644
index 0000000..b02791f
--- /dev/null
+++ b/clicache/integration-test/client_pool.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0"
+ redundancy-level="1" >
+
+
+ <root-region name='DistRegionAck'>
+ <region-attributes pool-name="__TESTPOOL1_" />
+ </root-region>
+
+ <root-region name='DistRegionNoAck'>
+ <region-attributes pool-name="__TESTPOOL1_" />
+ </root-region>
+
+ <pool
+ name="__TESTPOOL1_"
+ subscription-enabled="true"
+ subscription-redundancy="1"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+
+ </pool>
+
+</client-cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_server_persistent_transactions.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_server_persistent_transactions.xml b/clicache/integration-test/client_server_persistent_transactions.xml
new file mode 100644
index 0000000..a287c04
--- /dev/null
+++ b/clicache/integration-test/client_server_persistent_transactions.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+ <pdx persistent="true"/>
+ <region name='cstx1'>
+ <region-attributes data-policy="persistent-partition"></region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/client_server_transactions.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/client_server_transactions.xml b/clicache/integration-test/client_server_transactions.xml
new file mode 100644
index 0000000..b104b83
--- /dev/null
+++ b/clicache/integration-test/client_server_transactions.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT1"/>
+
+ <region name='cstx1'>
+ <region-attributes scope="distributed-ack" data-policy="replicate"></region-attributes>
+ </region>
+ <region name='cstx2'>
+ <region-attributes scope="distributed-ack" data-policy="replicate"></region-attributes>
+ </region>
+ <region name='cstx3'>
+ <region-attributes scope="distributed-ack" data-policy="replicate"></region-attributes>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/cqqueryfailover.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/cqqueryfailover.xml b/clicache/integration-test/cqqueryfailover.xml
new file mode 100644
index 0000000..4bf36af
--- /dev/null
+++ b/clicache/integration-test/cqqueryfailover.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24681" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+
+ <!-- making sub-regions -->
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ </region>
+ </region>
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/func_cacheserver1_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/func_cacheserver1_pool.xml b/clicache/integration-test/func_cacheserver1_pool.xml
new file mode 100644
index 0000000..039750d
--- /dev/null
+++ b/clicache/integration-test/func_cacheserver1_pool.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1">
+ <group>ServerGroup1</group>
+ </cache-server>
+ <pdx read-serialized="true" />
+ <region name='partition_region'>
+ <region-attributes data-policy="partition" >
+ <partition-attributes redundant-copies="1" startup-recovery-delay="1"/>
+ </region-attributes>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.MultiGetFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction2</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.ExceptionHandlingFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAExceptionFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAShutdownFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.PdxFunctionTest</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.SingleStrGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.executeFunction_SendException</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunctionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FunctionExecutionTimeOut</class-name>
+ </function>
+ </function-service>
+ <serialization-registration>
+ <instantiator id="5200" >
+ <class-name>javaobject.InstantiatorTest</class-name>
+ </instantiator>
+ </serialization-registration>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/func_cacheserver2_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/func_cacheserver2_pool.xml b/clicache/integration-test/func_cacheserver2_pool.xml
new file mode 100644
index 0000000..ec90576
--- /dev/null
+++ b/clicache/integration-test/func_cacheserver2_pool.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT2">
+ <group>ServerGroup1</group>
+ </cache-server>
+ <pdx read-serialized="true" />
+ <region name='partition_region'>
+ <region-attributes data-policy="partition" >
+ <partition-attributes redundant-copies="1" startup-recovery-delay="1"/>
+ </region-attributes>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.MultiGetFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction2</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.ExceptionHandlingFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAExceptionFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAShutdownFunction</class-name>
+ </function>
+
+ <function>
+ <class-name>javaobject.SingleStrGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.executeFunction_SendException</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunctionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.PdxFunctionTest</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FunctionExecutionTimeOut</class-name>
+ </function>
+ </function-service>
+ <serialization-registration>
+ <instantiator id="5200" >
+ <class-name>javaobject.InstantiatorTest</class-name>
+ </instantiator>
+ </serialization-registration>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/func_cacheserver3_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/func_cacheserver3_pool.xml b/clicache/integration-test/func_cacheserver3_pool.xml
new file mode 100644
index 0000000..263dcc0
--- /dev/null
+++ b/clicache/integration-test/func_cacheserver3_pool.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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 port="HOST_PORT3">
+ <group>ServerGroup1</group>
+ </cache-server>
+ <region name='partition_region'>
+ <region-attributes data-policy="partition" >
+ <partition-attributes redundant-copies="1" startup-recovery-delay="1"/>
+ </region-attributes>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.MultiGetFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.ExceptionHandlingFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAExceptionFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.OnServerHAShutdownFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.SingleStrGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.executeFunction_SendException</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FEOnRegionPrSHOP_OptimizeForWrite</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.RegionOperationsHAFunctionPrSHOP</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.FunctionExecutionTimeOut</class-name>
+ </function>
+ </function-service>
+ <serialization-registration>
+ <instantiator id="5200" >
+ <class-name>javaobject.InstantiatorTest</class-name>
+ </instantiator>
+ </serialization-registration>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/gateway1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/gateway1.xml b/clicache/integration-test/gateway1.xml
new file mode 100644
index 0000000..2d142a8
--- /dev/null
+++ b/clicache/integration-test/gateway1.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<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" copy-on-read="false" >
+
+
+ <gateway-sender id="sender1" remote-distributed-system-id="2" batch-size="20"
+ batch-time-interval="1000"
+ enable-persistence="true" maximum-queue-memory="10" parallel="false"
+ >
+ </gateway-sender>
+
+ <cache-server port="HOST_PORT1" >
+ </cache-server>
+
+ <region name="exampleRegion" >
+ <region-attributes data-policy="partition" gateway-sender-ids="sender1" >
+ <partition-attributes redundant-copies="0" total-num-buckets="113" >
+ </partition-attributes>
+ </region-attributes>
+
+
+ </region>
+</cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/gateway2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/gateway2.xml b/clicache/integration-test/gateway2.xml
new file mode 100644
index 0000000..fabbedb
--- /dev/null
+++ b/clicache/integration-test/gateway2.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<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" copy-on-read="false" >
+
+
+ <!-- gateway-sender id="sender1" remote-distributed-system-id="2" batch-size="1000"
+ batch-time-interval="1000"
+ enable-persistence="true" maximum-queue-memory="10" parallel="false"
+ >
+ </gateway-sender -->
+
+ <gateway-receiver bind-address="localhost" >
+
+ </gateway-receiver>
+
+ <cache-server port="HOST_PORT2" >
+ </cache-server>
+
+ <!-- pdx read-serialized="true" persistent="true" disk-store-name="myDiskStore" / -->
+ <region name="exampleRegion" >
+ <region-attributes data-policy="partition" gateway-sender-ids="sender1" >
+ <partition-attributes redundant-copies="0" total-num-buckets="113" >
+ </partition-attributes>
+
+ </region-attributes>
+
+ </region>
+</cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/geode.properties.mixed
----------------------------------------------------------------------
diff --git a/clicache/integration-test/geode.properties.mixed b/clicache/integration-test/geode.properties.mixed
new file mode 100644
index 0000000..2fed614
--- /dev/null
+++ b/clicache/integration-test/geode.properties.mixed
@@ -0,0 +1,16 @@
+# 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.
+#cache-server-version=5.0
+#license-file=../../../../hidden/internal.license.nativeclientonly.zip
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/geode.properties.nativeclient
----------------------------------------------------------------------
diff --git a/clicache/integration-test/geode.properties.nativeclient b/clicache/integration-test/geode.properties.nativeclient
new file mode 100644
index 0000000..2fed614
--- /dev/null
+++ b/clicache/integration-test/geode.properties.nativeclient
@@ -0,0 +1,16 @@
+# 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.
+#cache-server-version=5.0
+#license-file=../../../../hidden/internal.license.nativeclientonly.zip
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache1.xml b/clicache/integration-test/invalid_cache1.xml
new file mode 100644
index 0000000..9ec65ad
--- /dev/null
+++ b/clicache/integration-test/invalid_cache1.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!--'region- attributes' is an incorrect element name. Element names cannot contain spaces. Hence this xml is not well-formed-->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <region>
+ <region- attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35">
+ </region-attributes>
+ </region> </client-cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache2.xml b/clicache/integration-test/invalid_cache2.xml
new file mode 100644
index 0000000..1f32738
--- /dev/null
+++ b/clicache/integration-test/invalid_cache2.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- 'distributed' is an unknown scope -->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+ <root-region name = "root1" >
+ <region-attributes scope="local" caching-enabled="true" lru-entries-limit = "35">
+ </region-attributes>
+ </root-region>
+</client-cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache3.xml b/clicache/integration-test/invalid_cache3.xml
new file mode 100644
index 0000000..290c566
--- /dev/null
+++ b/clicache/integration-test/invalid_cache3.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35">
+ </region-attributes>
+ </root-region>
+</client-cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache_pool.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache_pool.xml b/clicache/integration-test/invalid_cache_pool.xml
new file mode 100644
index 0000000..3d65334
--- /dev/null
+++ b/clicache/integration-test/invalid_cache_pool.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes caching-enabled="true" pool-name="test_pool_1" />
+
+ <region name="SubRegion1">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </region>
+
+ </root-region>
+
+ <root-region name= "Root2">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </root-region>
+
+ <pool
+ free-connection-timeout = "12345"
+ idle-timeout = "5555"
+ load-conditioning-interval = "23456"
+ max-connections = "7"
+ min-connections = "3"
+ name = "test_pool_common"
+ ping-interval = "12345"
+ read-timeout = "23456"
+ retry-attempts = "3"
+ server-group = "ServerGroup1"
+ socket-buffer-size = "32768"
+ statistic-interval = "10123"
+ subscription-ack-interval = "567"
+ subscription-enabled = "true"
+ subscription-message-tracking-timeout = "900123"
+ subscription-redundancy = "0"
+ thread-local-connections = "5"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ <!-- locator host="localhost" port="34757" / -->
+ </pool>
+
+ <pool
+ free-connection-timeout = "23456"
+ idle-timeout = "6666"
+ load-conditioning-interval = "34567"
+ max-connections = "8"
+ min-connections = "2"
+ name = "test_pool_common"
+ ping-interval = "23456"
+ read-timeout = "34567"
+ retry-attempts = "5"
+ server-group = "ServerGroup2"
+ socket-buffer-size = "65536"
+ statistic-interval = "20345"
+ subscription-ack-interval = "678"
+ subscription-enabled = "false"
+ subscription-message-tracking-timeout = "800222"
+ subscription-redundancy = "1"
+ thread-local-connections = "3"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ </pool>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache_pool2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache_pool2.xml b/clicache/integration-test/invalid_cache_pool2.xml
new file mode 100644
index 0000000..059bc24
--- /dev/null
+++ b/clicache/integration-test/invalid_cache_pool2.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+
+ <root-region name = "Root1" >
+ <region-attributes caching-enabled="true" pool-name="test_pool_nonexistent" />
+
+ <region name="SubRegion1">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </region>
+
+ </root-region>
+
+ <root-region name= "Root2">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </root-region>
+
+ <pool
+ free-connection-timeout = "12345"
+ idle-timeout = "5555"
+ load-conditioning-interval = "23456"
+ max-connections = "7"
+ min-connections = "3"
+ name = "test_pool_3"
+ ping-interval = "12345"
+ read-timeout = "23456"
+ retry-attempts = "3"
+ server-group = "ServerGroup1"
+ socket-buffer-size = "32768"
+ statistic-interval = "10123"
+ subscription-ack-interval = "567"
+ subscription-enabled = "true"
+ subscription-message-tracking-timeout = "900123"
+ subscription-redundancy = "0"
+ thread-local-connections = "5"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ <!-- locator host="localhost" port="34757" / -->
+ </pool>
+
+ <pool
+ free-connection-timeout = "23456"
+ idle-timeout = "6666"
+ load-conditioning-interval = "34567"
+ max-connections = "8"
+ min-connections = "2"
+ name = "test_pool_4"
+ ping-interval = "23456"
+ read-timeout = "34567"
+ retry-attempts = "5"
+ server-group = "ServerGroup2"
+ socket-buffer-size = "65536"
+ statistic-interval = "20345"
+ subscription-ack-interval = "678"
+ subscription-enabled = "false"
+ subscription-message-tracking-timeout = "800222"
+ subscription-redundancy = "1"
+ thread-local-connections = "3"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ </pool>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache_pool3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache_pool3.xml b/clicache/integration-test/invalid_cache_pool3.xml
new file mode 100644
index 0000000..d7da20b
--- /dev/null
+++ b/clicache/integration-test/invalid_cache_pool3.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0"
+ endpoints="must_fail_with_pool:12345">
+
+ <root-region name = "Root1" >
+ <region-attributes caching-enabled="true" pool-name="test_pool_3" />
+
+ <region name="SubRegion1">
+ <region-attributes caching-enabled="false" pool-name="test_pool_4" />
+ </region>
+
+ </root-region>
+
+ <root-region name= "Root2">
+ <region-attributes caching-enabled="false" pool-name="test_pool_2" />
+ </root-region>
+
+ <pool
+ free-connection-timeout = "12345"
+ idle-timeout = "5555"
+ load-conditioning-interval = "23456"
+ max-connections = "7"
+ min-connections = "3"
+ name = "test_pool_5"
+ ping-interval = "12345"
+ read-timeout = "23456"
+ retry-attempts = "3"
+ server-group = "ServerGroup1"
+ socket-buffer-size = "32768"
+ statistic-interval = "10123"
+ subscription-ack-interval = "567"
+ subscription-enabled = "true"
+ subscription-message-tracking-timeout = "900123"
+ subscription-redundancy = "0"
+ thread-local-connections = "5"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ <!-- locator host="localhost" port="34757" / -->
+ </pool>
+
+ <pool
+ free-connection-timeout = "23456"
+ idle-timeout = "6666"
+ load-conditioning-interval = "34567"
+ max-connections = "8"
+ min-connections = "2"
+ name = "test_pool_6"
+ ping-interval = "23456"
+ read-timeout = "34567"
+ retry-attempts = "5"
+ server-group = "ServerGroup2"
+ socket-buffer-size = "65536"
+ statistic-interval = "20345"
+ subscription-ack-interval = "678"
+ subscription-enabled = "false"
+ subscription-message-tracking-timeout = "800222"
+ subscription-redundancy = "1"
+ thread-local-connections = "3"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ </pool>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_cache_pool4.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_cache_pool4.xml b/clicache/integration-test/invalid_cache_pool4.xml
new file mode 100644
index 0000000..7f8fb79
--- /dev/null
+++ b/clicache/integration-test/invalid_cache_pool4.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Well-formed and valid xml file -->
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+
+ <root-region name = "Root1" >
+ <region-attributes caching-enabled="true" pool-name="test_pool_7" />
+
+ <region name="SubRegion1">
+ <region-attributes caching-enabled="false" pool-name="test_pool_8" />
+ </region>
+
+ </root-region>
+
+ <root-region name= "Root2">
+ <region-attributes caching-enabled="false" pool-name="test_pool_8" />
+ </root-region>
+
+ <pool
+ free-connection-timeout = "12345"
+ idle-timeout = "5555"
+ load-conditioning-interval = "23456"
+ max-connections = "7"
+ min-connections = "3"
+ name = "test_pool_7"
+ ping-interval = "12345"
+ read-timeout = "23456"
+ retry-attempts = "3"
+ server-group = "ServerGroup1"
+ socket-buffer-size = "32768"
+ statistic-interval = "10123"
+ subscription-ack-interval = "567"
+ subscription-enabled = "true"
+ subscription-message-tracking-timeout = "900123"
+ subscription-redundancy = "0"
+ thread-local-connections = "5"
+ >
+ <locator host="localhost" port="LOC_PORT1" />
+ <!--locator host="localhost" port="34757" /-->
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ </pool>
+
+ <pool
+ free-connection-timeout = "23456"
+ idle-timeout = "6666"
+ load-conditioning-interval = "34567"
+ max-connections = "8"
+ min-connections = "2"
+ name = "test_pool_8"
+ ping-interval = "23456"
+ read-timeout = "34567"
+ retry-attempts = "5"
+ server-group = "ServerGroup2"
+ socket-buffer-size = "65536"
+ statistic-interval = "20345"
+ subscription-ack-interval = "678"
+ subscription-enabled = "false"
+ subscription-message-tracking-timeout = "800222"
+ subscription-redundancy = "1"
+ thread-local-connections = "3"
+ >
+ <server host="localhost" port="HOST_PORT1" />
+ <server host="localhost" port="HOST_PORT2" />
+ <locator host="localhost" port="LOC_PORT1" />
+ </pool>
+
+</client-cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_overflowAttr1.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_overflowAttr1.xml b/clicache/integration-test/invalid_overflowAttr1.xml
new file mode 100644
index 0000000..dd9c5e8
--- /dev/null
+++ b/clicache/integration-test/invalid_overflowAttr1.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!--'region- attributes' is an incorrect element name. Element names cannot contain spaces. Hence this xml is not well-formed-->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+ <root-region name = "Root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ </region-attributes>
+ </root-region>
+</client-cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_overflowAttr2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_overflowAttr2.xml b/clicache/integration-test/invalid_overflowAttr2.xml
new file mode 100644
index 0000000..4af0b4b
--- /dev/null
+++ b/clicache/integration-test/invalid_overflowAttr2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- library function name is not mentioned for persistence -->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+ <root-region name = "root1" >
+ <region-attributes scope="local" caching-enabled="true" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteRegionData"/>
+ <property name="PageSize" value="32500"/>
+ </properties>
+ </region-attributes>
+ </root-region>
+</client-cache>
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/invalid_overflowAttr3.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/invalid_overflowAttr3.xml b/clicache/integration-test/invalid_overflowAttr3.xml
new file mode 100644
index 0000000..9b0732f
--- /dev/null
+++ b/clicache/integration-test/invalid_overflowAttr3.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Property value not persent for persistence -->
+
+<client-cache
+ xmlns="http://schema.pivotal.io/gemfire/gfcpp-cache"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.pivotal.io/gemfire/gfcpp-cache
+ http://schema.pivotal.io/gemfire/gfcpp-cache/gfcpp-cache-9.0.xsd"
+ version="9.0">
+ <root-region name = "root1" >
+ <region-attributes scope="local" caching-enabled="true" initial-capacity="25" load-factor="0.32" concurrency-level="10" lru-entries-limit = "35" disk-policy="overflows">
+ <persistence-manager library-name="SqLiteImpl" library-function-name="createSqLiteInstance">
+ <properties>
+ <property name="PersistenceDirectory" value="SqLiteRegionData"/>
+ <property name="PageSize"/>
+ </properties>
+ </persistence-manager>
+
+ </region-attributes>
+ </root-region>
+</client-cache>
+
+
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/multi_get_function_server.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/multi_get_function_server.xml b/clicache/integration-test/multi_get_function_server.xml
new file mode 100644
index 0000000..dcee5a7
--- /dev/null
+++ b/clicache/integration-test/multi_get_function_server.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+<!-- Initializes a cache to serve the /root/bridge_region region,
+ waiting for bridge client communication on port 24680 -->
+
+<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" is-server="false">
+ <cache-server hostname-for-clients="localhost" port="HOST_PORT1"/>
+ <region name="partition_region">
+ <region-attributes data-policy="partition">
+ </region-attributes>
+ </region>
+ <function-service>
+ <function>
+ <class-name>javaobject.MultiGetFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunctionI</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiGetFunction</class-name>
+ </function>
+ <function>
+ <class-name>javaobject.MultiPutFunction</class-name>
+ </function>
+ </function-service>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfig.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfig.xml b/clicache/integration-test/regionquery_diffconfig.xml
new file mode 100644
index 0000000..ba9992e
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfig.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfig2.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfig2.xml b/clicache/integration-test/regionquery_diffconfig2.xml
new file mode 100644
index 0000000..cf5ed2c
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfig2.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfig2N.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfig2N.xml b/clicache/integration-test/regionquery_diffconfig2N.xml
new file mode 100644
index 0000000..5c70b52
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfig2N.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2"/>
+
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfig2_SG.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfig2_SG.xml b/clicache/integration-test/regionquery_diffconfig2_SG.xml
new file mode 100644
index 0000000..2e3028f
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfig2_SG.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT2">
+ <group>ServerGroup2</group>
+ </cache-server>
+
+ <region name="Portfolios2">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="Portfolios3">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Positions">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+</cache>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6cbd424f/clicache/integration-test/regionquery_diffconfigN.xml
----------------------------------------------------------------------
diff --git a/clicache/integration-test/regionquery_diffconfigN.xml b/clicache/integration-test/regionquery_diffconfigN.xml
new file mode 100644
index 0000000..7d59828
--- /dev/null
+++ b/clicache/integration-test/regionquery_diffconfigN.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+
+
+<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="24680" /-->
+ <cache-server port="HOST_PORT1"/>
+
+ <region name="DistRegionAck">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+ </region>
+ <region name="Portfolios">
+ <region-attributes scope="distributed-ack" data-policy="replicate"/>
+
+ <!-- making entries -->
+ <entry>
+ <key><string>port1-1</string></key>
+ <value>
+ <declarable>
+ <class-name>javaobject.newapi.Portfolio</class-name>
+ <parameter name="ID">
+ <string>1</string>
+ </parameter>
+ <parameter name="pkid">
+ <string>A0</string>
+ </parameter>
+ <parameter name="type">
+ <string>type1</string>
+ </parameter>
+ <parameter name="status">
+ <string>active</string>
+ </parameter>
+ <parameter name="position1">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>SUN</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>3400</string>
+ </parameter>
+ <parameter name="secType">
+ <string>r</string>
+ </parameter>
+ <parameter name="pid">
+ <string>345</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ <parameter name="position2">
+ <declarable>
+ <class-name>javaobject.newapi.Position</class-name>
+ <parameter name="secId">
+ <string>IBM</string>
+ </parameter>
+ <parameter name="sharesOutstanding">
+ <string>8765</string>
+ </parameter>
+ <parameter name="secType">
+ <string>p</string>
+ </parameter>
+ <parameter name="pid">
+ <string>123</string>
+ </parameter>
+ </declarable>
+ </parameter>
+ </declarable>
+ </value>
+ </entry>
+ </region>
+ <region name="DistRegionNoAck">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate"/>
+ </region>
+</cache>