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/05/17 17:50:12 UTC
[30/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/clicache/test/CMakeLists.txt b/src/clicache/test/CMakeLists.txt
new file mode 100644
index 0000000..d590078
--- /dev/null
+++ b/src/clicache/test/CMakeLists.txt
@@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 3.4)
+project(Apache.Geode.Test)
+
+file(GLOB SOURCES "*.cpp")
+
+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}/AssemblyInfo.cpp.in)
+list(APPEND CONFIGURE_OUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/AssemblyInfo.cpp)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/AssemblyInfo.cpp)
+
+set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
+
+add_library(${PROJECT_NAME} MODULE
+ ${SOURCES}
+ ${CONFIGURE_IN_FILES}
+ ${CONFIGURE_OUT_FILES}
+ ${RESOURCES}
+)
+#add_dependencies(unit-tests ${PROJECT_NAME})
+
+add_definitions(-DUNICODE -D_UNICODE)
+target_compile_definitions(${PROJECT_NAME}
+ PUBLIC
+ -DUNICODE -D_UNICODE
+)
+
+target_link_libraries(${PROJECT_NAME}
+ PRIVATE
+ Apache.Geode
+ PUBLIC
+ c++11
+)
+
+set_target_properties(${PROJECT_NAME} PROPERTIES
+ COMPILE_FLAGS "/clr"
+ VS_GLOBAL_CLRSupport "true"
+ VS_GLOBAL_KEYWORD "ManagedCProj"
+ VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
+ VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
+ VS_DOTNET_REFERENCES "System;System.Xml;Microsoft.VisualStudio.QualityTools.UnitTestFramework"
+)
+
+string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SHARED_LINKER_FLAGS_STRONG_KEY}")
+
+include_directories(${CMAKE_SOURCE_DIR}/clicache/src)
+include_directories(${CMAKE_SOURCE_DIR}/cppcache/src)
+#PCH issues
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+# 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/6027574a/src/clicache/test/Utils.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/Utils.hpp b/src/clicache/test/Utils.hpp
new file mode 100644
index 0000000..6388398
--- /dev/null
+++ b/src/clicache/test/Utils.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+using namespace System;
+
+namespace cliunittests
+{
+ private ref class Utils {
+ internal:
+ static void GCCollectAndWait() {
+ GC::Collect();
+ GC::WaitForPendingFinalizers();
+ }
+ };
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
new file mode 100644
index 0000000..74cdf34
--- /dev/null
+++ b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
@@ -0,0 +1,229 @@
+#include <memory>
+#include <functional>
+#include <native_conditional_unique_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class UniqueDestructNativeTestClass {
+ public:
+ int i;
+ UniqueDestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~UniqueDestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_conditional_unique_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(std::unique_ptr<NativeTestClass>(__nullptr));
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void NullptrInstanceUnowned()
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_unique<NativeTestClass>(1);
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(std::move(n));
+
+ Assert::IsTrue(__nullptr == n);
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ };
+
+ [TestMethod]
+ void AnInstanceUnowned()
+ {
+ auto n = new NativeTestClass(1);
+ try
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(n);
+
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ }
+ finally
+ {
+ delete n;
+ }
+ };
+
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorNotCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto n = new UniqueDestructNativeTestClass(1, destructorCalled);
+ try
+ {
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(n);
+ auto w = gcnew WeakReference(p);
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(w->IsAlive);
+ Assert::IsFalse(destructorCalled);
+ }
+ finally
+ {
+ delete n;
+ Assert::IsTrue(destructorCalled);
+ }
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterNativeUniquePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ auto n = std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::move(n));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n does not have a ref on our native pointer, so native not deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_shared_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_shared_ptrTests.cpp b/src/clicache/test/native_shared_ptrTests.cpp
new file mode 100644
index 0000000..6cddd97
--- /dev/null
+++ b/src/clicache/test/native_shared_ptrTests.cpp
@@ -0,0 +1,189 @@
+#include <memory>
+#include <functional>
+#include <native_shared_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class DestructNativeTestClass {
+ public:
+ int i;
+ DestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~DestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_shared_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_shared_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_shared<NativeTestClass>(1);
+ auto p = gcnew native_shared_ptr<NativeTestClass>(n);
+
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+
+ auto x = p->get_shared_ptr();
+ Assert::IsTrue(x == n);
+ };
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterAllSharedPtrDescopesButNotAfterNativeSharePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ {
+ auto n = std::make_shared<DestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(n);
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n should still have a ref on our native pointer, so native not deleted
+ Assert::IsFalse(destructorCalled);
+ }
+
+ // n has descoped so ref on native pointer is zero, should be deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ native_shared_ptr<DestructNativeTestClass>^ make_shared(int i, bool& destructorCalled) {
+ return gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = make_shared(1, destructorCalled);
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = make_shared(1, destructorCalled);
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_unique_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_unique_ptrTests.cpp b/src/clicache/test/native_unique_ptrTests.cpp
new file mode 100644
index 0000000..393aed5
--- /dev/null
+++ b/src/clicache/test/native_unique_ptrTests.cpp
@@ -0,0 +1,178 @@
+#include <memory>
+#include <functional>
+#include <native_unique_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class UniqueDestructNativeTestClass {
+ public:
+ int i;
+ UniqueDestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~UniqueDestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_unique_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_unique_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_unique<NativeTestClass>(1);
+ auto p = gcnew native_unique_ptr<NativeTestClass>(std::move(n));
+
+ Assert::IsTrue(__nullptr == n);
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ };
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterNativeUniquePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ auto n = std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::move(n));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n does not have a ref on our native pointer, so native not deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheFactory.hpp b/src/cppcache/include/geode/CacheFactory.hpp
index 5d519bb..ab3cbe0 100644
--- a/src/cppcache/include/geode/CacheFactory.hpp
+++ b/src/cppcache/include/geode/CacheFactory.hpp
@@ -494,7 +494,6 @@ class CPPCACHE_EXPORT CacheFactory
bool closeOk, CachePtr& cptr);
// Set very first time some creates cache
- static CacheFactoryPtr default_CacheFactory;
static PoolPtr createOrGetDefaultPool();
static void* m_cacheMap;
static void init();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionEntry.hpp b/src/cppcache/include/geode/RegionEntry.hpp
index 0f50951..b6f2443 100644
--- a/src/cppcache/include/geode/RegionEntry.hpp
+++ b/src/cppcache/include/geode/RegionEntry.hpp
@@ -67,7 +67,7 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
*
* @return the Region that contains this entry
*/
- void getRegion(Region* region);
+ RegionPtr getRegion();
/** Returns the statistics for this entry.
*
@@ -95,14 +95,16 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
* @brief constructors
* created by region
*/
- RegionEntry(Region* region, const CacheableKeyPtr& key,
+ RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
const CacheablePtr& value);
- Region* m_region;
+ RegionPtr m_region;
CacheableKeyPtr m_key;
CacheablePtr m_value;
CacheStatisticsPtr m_statistics;
bool m_destroyed;
friend class RegionInternal;
+
+ FRIEND_STD_SHARED_PTR(RegionEntry)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/TransactionId.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/TransactionId.hpp b/src/cppcache/include/geode/TransactionId.hpp
index 7723668..63a4c14 100644
--- a/src/cppcache/include/geode/TransactionId.hpp
+++ b/src/cppcache/include/geode/TransactionId.hpp
@@ -19,12 +19,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TransactionId.h
- *
- * Created on: 04-Feb-2011
- * Author: ankurs
- */
+
+#include <memory>
#include "SharedBase.hpp"
@@ -41,6 +37,8 @@ class CPPCACHE_EXPORT TransactionId : public apache::geode::client::SharedBase {
protected:
TransactionId();
virtual ~TransactionId();
+
+ FRIEND_STD_SHARED_PTR(TransactionId)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/geode_base.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/geode_base.hpp b/src/cppcache/include/geode/geode_base.hpp
index 369f830..dc0bc80 100644
--- a/src/cppcache/include/geode/geode_base.hpp
+++ b/src/cppcache/include/geode/geode_base.hpp
@@ -325,9 +325,17 @@ void operator delete[](void *p);
#define FRIEND_STD_SHARED_PTR(_T) \
friend __gnu_cxx::new_allocator<_T>;
#elif defined(_MSC_VER)
+#if defined(_MANAGED)
#define FRIEND_STD_SHARED_PTR(_T) \
friend std::_Ref_count_obj<_T>; \
- friend std::default_delete<_T>;
+ friend std::_Ref_count<_T>; \
+ friend std::_Ptr_base<_T>; \
+ friend std::default_delete<_T>; \
+ friend std::shared_ptr<_T>;
+#else
+#define FRIEND_STD_SHARED_PTR(_T) \
+ friend std::_Ref_count_obj<_T>;
+#endif
#else
#define FRIEND_STD_SHARED_PTR(_T)
#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp b/src/cppcache/src/CacheFactory.cpp
index ec332e5..43da0d0 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,7 +55,8 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
void* CacheFactory::m_cacheMap = (void*)NULL;
-CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
+// TODO: Why can't this be a shared_ptr?
+CacheFactory* default_CacheFactory = nullptr;
PoolPtr CacheFactory::createOrGetDefaultPool() {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
@@ -225,7 +226,7 @@ CachePtr CacheFactory::create() {
cache = getAnyInstance(false);
if (cache == nullptr) {
- default_CacheFactory = shared_from_this();
+ default_CacheFactory = this;
Cache_CreatedFromCacheFactory = true;
cache = create(DEFAULT_CACHE_NAME, dsPtr,
dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/CacheImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheImpl.cpp b/src/cppcache/src/CacheImpl.cpp
index abfab22..40f0cc9 100644
--- a/src/cppcache/src/CacheImpl.cpp
+++ b/src/cppcache/src/CacheImpl.cpp
@@ -365,6 +365,8 @@ void CacheImpl::close(bool keepalive) {
m_adminRegion = nullptr;
}
+ CacheImpl::s_versionStampMemIdList = nullptr;
+
// The TCCM gets destroyed when CacheImpl is destroyed, but after that there
// is still a window for the ping related registered task to get activated
// because expiryTaskManager is closed in DS::disconnect. If this happens
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PdxTypeRegistry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxTypeRegistry.cpp b/src/cppcache/src/PdxTypeRegistry.cpp
index 6f34b9f..0efbb3a 100644
--- a/src/cppcache/src/PdxTypeRegistry.cpp
+++ b/src/cppcache/src/PdxTypeRegistry.cpp
@@ -80,6 +80,8 @@ void PdxTypeRegistry::cleanup() {
GF_SAFE_DELETE(remoteTypeIdToMergedPdxType);
GF_SAFE_DELETE(localTypeToPdxType);
GF_SAFE_DELETE(pdxTypeToTypeIdMap);
+ intToEnum = nullptr;
+ enumToInt = nullptr;
// GF_SAFE_DELETE(preserveData);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBase.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBase.cpp b/src/cppcache/src/PooledBase.cpp
deleted file mode 100644
index c892eb3..0000000
--- a/src/cppcache/src/PooledBase.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-// util/PooledBase.cpp -*- mode: c++ -*-
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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 "PooledBase.hpp"
-#include "HostAsm.hpp"
-#include "PooledBasePool.hpp"
-
-#include <typeinfo>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-PooledBase::PooledBase(PooledBasePool* pool) : m_refCount(0), m_pool(pool) {
- GF_D_ASSERT(m_pool != NULL);
-}
-
-PooledBase::~PooledBase() { m_pool = NULL; }
-
-void PooledBase::preserveSB() const {
- PooledBase* self = const_cast<PooledBase*>(this);
- HostAsm::atomicAdd(self->m_refCount, 1);
-}
-
-void PooledBase::releaseSB() const {
- PooledBase* self = const_cast<PooledBase*>(this);
- if (HostAsm::atomicAdd(self->m_refCount, -1) == 0) {
- m_pool->returnToPool(self);
- }
-}
-
-void PooledBase::prePool() {}
-
-void PooledBase::postPool() {}
-} // namespace client
-} // namespace geode
-} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBase.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBase.hpp b/src/cppcache/src/PooledBase.hpp
deleted file mode 100644
index efdb7f4..0000000
--- a/src/cppcache/src/PooledBase.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#pragma once
-
-#ifndef GEODE_POOLEDBASE_H_
-#define GEODE_POOLEDBASE_H_
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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/geode_globals.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class PooledBasePool;
-
-/**
- * @class PooledBase PooledBase.hpp
- *
- * This abstract base class is the base class of all user objects
- * that have the shared capability of reference counting.
- */
-class CPPCACHE_EXPORT PooledBase {
- public:
- PooledBase(PooledBasePool* pool);
-
- void preserveSB() const;
- void releaseSB() const;
-
- inline int32_t refCount() { return m_refCount; }
-
- virtual ~PooledBase();
-
- /** called just prior to inserting an object back into the pool. */
- virtual void prePool();
-
- /** called just after removing an object from the pool. */
- virtual void postPool();
-
- private:
- volatile int32_t m_refCount;
- PooledBasePool* m_pool;
-
- void operator=(const PooledBase& rhs);
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_POOLEDBASE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBasePool.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBasePool.hpp b/src/cppcache/src/PooledBasePool.hpp
deleted file mode 100644
index f065cb1..0000000
--- a/src/cppcache/src/PooledBasePool.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-
-#ifndef GEODE_POOLEDBASEPOOL_H_
-#define GEODE_POOLEDBASEPOOL_H_
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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/geode_globals.hpp>
-#include <geode/SharedPtr.hpp>
-#include "SpinLock.hpp"
-#include "PooledBase.hpp"
-#include <deque>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class CPPCACHE_EXPORT PooledBasePool {
- SpinLock m_poolLock;
- std::deque<PooledBase*> m_pooldata;
-
- public:
- PooledBasePool() : m_poolLock(), m_pooldata() {}
-
- ~PooledBasePool() {
- SpinLockGuard guard(m_poolLock);
- while (!m_pooldata.empty()) {
- PooledBase* item = m_pooldata.front();
- m_pooldata.pop_front();
- delete item;
- }
- }
-
- inline void returnToPool(PooledBase* poolable) {
- poolable->prePool();
- {
- SpinLockGuard guard(m_poolLock);
- m_pooldata.push_back(const_cast<PooledBase*>(poolable));
- }
- }
-
- inline PooledBase* takeFromPool() {
- PooledBase* result = NULL;
- {
- SpinLockGuard guard(m_poolLock);
- if (!m_pooldata.empty()) {
- result = m_pooldata.front();
- m_pooldata.pop_front();
- }
- }
- if (result != NULL) {
- result->postPool();
- }
- return result;
- }
-
- inline void clear() {
- SpinLockGuard guard(m_poolLock);
- while (!m_pooldata.empty()) {
- PooledBase* item = m_pooldata.front();
- m_pooldata.pop_front();
- delete item;
- }
- }
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_POOLEDBASEPOOL_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionEntry.cpp b/src/cppcache/src/RegionEntry.cpp
index fbf6246..6f52986 100644
--- a/src/cppcache/src/RegionEntry.cpp
+++ b/src/cppcache/src/RegionEntry.cpp
@@ -19,18 +19,30 @@
#include <geode/CacheableKey.hpp>
#include <CacheableToken.hpp>
-using namespace apache::geode::client;
+namespace apache {
+namespace geode {
+namespace client {
-RegionEntry::RegionEntry(Region* region, const CacheableKeyPtr& key,
+RegionEntry::RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
const CacheablePtr& value)
: m_region(region), m_key(key), m_value(value), m_destroyed(false) {}
+
RegionEntry::~RegionEntry() {}
+
CacheableKeyPtr RegionEntry::getKey() { return m_key; }
+
CacheablePtr RegionEntry::getValue() {
return CacheableToken::isInvalid(m_value) ? nullptr : m_value;
}
-void RegionEntry::getRegion(Region* region) { region = m_region; }
+
+RegionPtr RegionEntry::getRegion() { return m_region; }
+
void RegionEntry::getStatistics(CacheStatisticsPtr& csptr) {
csptr = m_statistics;
}
+
bool RegionEntry::isDestroyed() const { return m_destroyed; }
+
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/RegionInternal.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionInternal.cpp b/src/cppcache/src/RegionInternal.cpp
index 512cf1d..0dc47cb 100644
--- a/src/cppcache/src/RegionInternal.cpp
+++ b/src/cppcache/src/RegionInternal.cpp
@@ -105,7 +105,7 @@ TombstoneListPtr RegionInternal::getTombstoneList() {
RegionEntryPtr RegionInternal::createRegionEntry(const CacheableKeyPtr& key,
const CacheablePtr& value) {
- return RegionEntryPtr(new RegionEntry(this, key, value));
+ return std::make_shared<RegionEntry>(shared_from_this(), key, value);
}
void RegionInternal::setLruEntriesLimit(uint32_t limit) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
index d2ebf45..b5fbac8 100644
--- a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
+++ b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
@@ -16,7 +16,9 @@
*/
#include "PkcsAuthInitMN.hpp"
+#include "begin_native.hpp"
#include <geode/Properties.hpp>
+#include "end_native.hpp"
#include "impl/ManagedString.hpp"
using namespace System;
@@ -42,13 +44,14 @@ Apache::Geode::Client::Properties<String^, Object^>^
PkcsAuthInit::GetCredentials(
Apache::Geode::Client::Properties<String^, String^> ^props, System::String ^server)
{
- Apache::Geode::Client::ManagedString mg_server( server );
- apache::geode::client::PropertiesPtr propsPtr = nullptr;
- if (props != nullptr) {
- propsPtr = (apache::geode::client::Properties*)props->NativeIntPtr;
- }
- apache::geode::client::PKCSAuthInitInternal* nativeptr = new apache::geode::client::PKCSAuthInitInternal(true);
- apache::geode::client::PropertiesPtr& newPropsPtr = nativeptr->getCredentials(propsPtr, mg_server.CharPtr);
- return Apache::Geode::Client::Properties<String^, Object^>::
- CreateFromVoidPtr<String^, Object^>(newPropsPtr.get());
+ throw gcnew System::NotImplementedException();
+ //Apache::Geode::Client::ManagedString mg_server( server );
+ //apache::geode::client::PropertiesPtr propsPtr = __nullptr;
+ //if (props != nullptr) {
+ // propsPtr = props->GetNative();
+ //}
+ //apache::geode::client::PKCSAuthInitInternal* nativeptr = new apache::geode::client::PKCSAuthInitInternal(true);
+ //apache::geode::client::PropertiesPtr& newPropsPtr = nativeptr->getCredentials(propsPtr, mg_server.CharPtr);
+ //return Apache::Geode::Client::Properties<String^, Object^>::
+ // CreateFromVoidPtr<String^, Object^>(newPropsPtr.get());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
index 1a9d00f..249863a 100644
--- a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
+++ b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
@@ -17,8 +17,9 @@
#pragma once
+#include <memory>
+#include "native_shared_ptr.hpp"
#include "PkcsAuthInit.hpp"
-#include "impl/NativeWrapper.hpp"
using namespace System;
@@ -33,8 +34,7 @@ namespace Apache
namespace Tests
{
public ref class PkcsAuthInit sealed
- : public Internal::SBWrap<apache::geode::client::PKCSAuthInitInternal>,
- public Apache::Geode::Client::IAuthInitialize/*<String^, Object^>*/
+ : public Apache::Geode::Client::IAuthInitialize
{
public:
@@ -50,8 +50,13 @@ namespace Apache
virtual void Close();
internal:
- PkcsAuthInit(apache::geode::client::PKCSAuthInitInternal* nativeptr)
- : SBWrap(nativeptr) { }
+ PkcsAuthInit(const std::shared_ptr<apache::geode::client::PKCSAuthInitInternal>& nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<apache::geode::client::PKCSAuthInitInternal>(nativeptr);
+ }
+
+ private:
+ native_shared_ptr<apache::geode::client::PKCSAuthInitInternal>^ m_nativeptr;
};
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/QueryHelper/QueryStringsM.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/QueryHelper/QueryStringsM.cpp b/src/tests/cli/QueryHelper/QueryStringsM.cpp
index ae7f1cf..da40374 100644
--- a/src/tests/cli/QueryHelper/QueryStringsM.cpp
+++ b/src/tests/cli/QueryHelper/QueryStringsM.cpp
@@ -25,7 +25,7 @@ namespace Apache
{
namespace Client
{
-namespace Tests
+ namespace Tests
{
// Region: QueryStrings method definitions
@@ -35,10 +35,10 @@ namespace Tests
{
Apache::Geode::Client::ManagedString mg_pquery( pquery );
- testData::QueryStrings* nativeptr = new testData::QueryStrings(
+ auto nativeptr = std::make_unique<testData::QueryStrings>(
static_cast<testData::queryCategory>( pcategory ),
mg_pquery.CharPtr, pisLargeResultset );
- SetPtr( nativeptr, true );
+ m_nativeptr = gcnew native_conditional_unique_ptr<testData::QueryStrings>(std::move(nativeptr));
}
Int32 QueryStrings::RSsize::get( )
@@ -73,17 +73,38 @@ namespace Tests
QueryCategory QueryStrings::Category::get()
{
- return static_cast<QueryCategory>( NativePtr->category );
+ try
+ {
+ return static_cast<QueryCategory>( m_nativeptr->get()->category );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
String^ QueryStrings::Query::get( )
{
- return Apache::Geode::Client::ManagedString::Get( NativePtr->query( ) );
+ try
+ {
+ return Apache::Geode::Client::ManagedString::Get( m_nativeptr->get()->query( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
bool QueryStrings::IsLargeResultset::get( )
{
- return NativePtr->haveLargeResultset;
+ try
+ {
+ return m_nativeptr->get()->haveLargeResultset;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// End Region: QueryStrings method definitions
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/QueryHelper/QueryStringsM.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/QueryHelper/QueryStringsM.hpp b/src/tests/cli/QueryHelper/QueryStringsM.hpp
index e4004b2..e43eb9f 100644
--- a/src/tests/cli/QueryHelper/QueryStringsM.hpp
+++ b/src/tests/cli/QueryHelper/QueryStringsM.hpp
@@ -18,7 +18,7 @@
#pragma once
#include "QueryStrings.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "native_conditional_unique_ptr.hpp"
using namespace System;
@@ -29,7 +29,7 @@ namespace Apache
{
namespace Client
{
-namespace Tests
+ namespace Tests
{
/// <summary>
@@ -60,7 +60,6 @@ namespace Tests
/// Encapsulates a query string.
/// </summary>
public ref class QueryStrings sealed
- : public Apache::Geode::Client::Internal::UMWrap<testData::QueryStrings>
{
public:
@@ -125,6 +124,7 @@ namespace Tests
void Init( QueryCategory pcategory, String^ pquery,
Boolean pisLargeResultset );
+ native_conditional_unique_ptr<testData::QueryStrings>^ m_nativeptr;
internal:
@@ -132,8 +132,10 @@ namespace Tests
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline QueryStrings( testData::QueryStrings* nativeptr )
- : UMWrap( nativeptr, false ) { }
+ inline QueryStrings(testData::QueryStrings* nativeptr)
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<testData::QueryStrings>(nativeptr);
+ }
};
/// <summary>