From e0b29f93940ce6f2472f2a344c916208126348eb Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Tue, 26 Nov 2024 13:03:48 +0300 Subject: [PATCH 01/12] Created branch [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 112518] From e0389009a339052bcf69febf1b1009058b86be37 Mon Sep 17 00:00:00 2001 From: "joe.fialli" Date: Thu, 5 Dec 2024 14:39:29 -0500 Subject: [PATCH 02/12] Bug 37315344 - [37264961->14.1.2.0.1] CQC constructor with fCacheValues of false should configure lite mapListener (main.cpp->cpp-v14.1.2.0) Verified with shelf build on Coh_CPP-14.1.2.0-Linux-aarch64, #2 (Dec 5, 2024, 12:38:53 PM) Changelist: 112518, Shelf: 112721 [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 112740] --- .../net/cache/ContinuousQueryCache.hpp | 21 ++++- .../net/cache/ContinuousQueryCache.cpp | 15 ++-- .../coherence/net/cache/CQCProxyTest.hpp | 2 +- .../net/cache/ContinuousQueryCacheTest.hpp | 83 ++++++++++++++++++- tests/unit/coherence/net/ViewBuilderTest.hpp | 6 ++ .../net/cache/ContinuousQueryCacheTest.hpp | 34 ++++++++ 6 files changed, 150 insertions(+), 11 deletions(-) diff --git a/include/public/coherence/net/cache/ContinuousQueryCache.hpp b/include/public/coherence/net/cache/ContinuousQueryCache.hpp index fa6448bf..cce0d276 100644 --- a/include/public/coherence/net/cache/ContinuousQueryCache.hpp +++ b/include/public/coherence/net/cache/ContinuousQueryCache.hpp @@ -72,7 +72,8 @@ class COH_EXPORT ContinuousQueryCache * @param vFilter the Filter that defines the view * @param fCacheValues pass true to cache both the keys and values of * the materialized view locally, or false to - * only cache the keys + * only cache the keys. Override of false described + * in isCacheValues() * @param hListener an initial MapListener that will receive all * the events from the ContinuousQueryCache, * including those corresponding to its initial @@ -80,6 +81,9 @@ class COH_EXPORT ContinuousQueryCache * @param vTransformer the transformer that should be used to convert * values from the underlying cache before storing * them locally + * Note: When parameter fCacheValues is false, it is inferred that provided parameter + * listener is a lite listener as described by fLite parameter of + * addMapListener(MapListener, Filter, boolean). */ ContinuousQueryCache(NamedCache::Handle hCache, Filter::View vFilter, bool fCacheValues = false, @@ -101,7 +105,8 @@ class COH_EXPORT ContinuousQueryCache * @param vFilter the Filter that defines the view * @param fCacheValues pass true to cache both the keys and values of * the materialized view locally, or false to - * only cache the keys + * only cache the keys. Override of false described + * in isCacheValues() * @param hListener an initial MapListener that will receive all * the events from the ContinuousQueryCache, * including those corresponding to its initial @@ -109,6 +114,9 @@ class COH_EXPORT ContinuousQueryCache * @param vTransformer the transformer that should be used to convert * values from the underlying cache before storing * them locally + * Note: When parameter fCacheValues is false, it is inferred that provided parameter + * listener is a lite listener as described by fLite parameter of + * addMapListener(MapListener, Filter, boolean). */ ContinuousQueryCache(Supplier::View vCacheSupplier, Filter::View vFilter, bool fCacheValues, @@ -169,6 +177,12 @@ class COH_EXPORT ContinuousQueryCache * * @return true if this object caches values locally, and false if it * relies on the underlying NamedCache + * + * Note: if addMapListener(MapListener, Filter, boolean) adds a standard + * (non-lite) listener or a filter to this ObservableMap, cache values are + * always maintained locally. The locally cached values are used to filter events + * and to supply the old and new values for the events that it raises. + * Additionally, a non-null transformer infers caches values being stored locally. */ virtual bool isCacheValues() const; @@ -182,7 +196,8 @@ class COH_EXPORT ContinuousQueryCache * cached data and rely on the underlying NamedCache. * * @param fCacheValues pass true to enable local caching, or false to - * disable it + * disable it. Override of false described + * in isCacheValues() */ virtual void setCacheValues(bool fCacheValues); diff --git a/src/coherence/net/cache/ContinuousQueryCache.cpp b/src/coherence/net/cache/ContinuousQueryCache.cpp index 072dcb82..5e4bdc57 100644 --- a/src/coherence/net/cache/ContinuousQueryCache.cpp +++ b/src/coherence/net/cache/ContinuousQueryCache.cpp @@ -248,7 +248,8 @@ MapListener::View ContinuousQueryCache::getMapListener() const bool ContinuousQueryCache::isCacheValues() const { - return m_fCacheValues || isObserved(); + // standard listener or non-null transformer override initial fCacheValue + return m_fCacheValues || isObserved() || f_vTransformer != NULL; } void ContinuousQueryCache::setCacheValues(bool fCacheValues) @@ -332,11 +333,13 @@ ObservableMap::Handle ContinuousQueryCache::ensureInternalCache() const if (hMapLocal == NULL) { hMapLocal = m_hMapLocal = instantiateInternalCache(); - if (m_fListeners) + + MapListener::Handle hListener = m_hListener; + bool fLite = !isCacheValues(); + if (hListener != NULL) { - MapListener::Handle hListener = m_hListener; ensureEventQueue(); - hMapLocal->addFilterListener(instantiateEventRouter(m_hListener, false)); + hMapLocal->addFilterListener(instantiateEventRouter(hListener, fLite), NULL, fLite); } } return hMapLocal; @@ -1584,8 +1587,8 @@ void ContinuousQueryCache::onInit() initialize(f_hSetKeys, instantiateKeySet()); initialize(f_hSetEntries, instantiateEntrySet()); - // was a listener passed at construction time? - m_fListeners = m_hListener != NULL; + // was a standard (non-lite) listener passed at construction time? + m_fListeners = m_hListener != NULL && isCacheValues(); ensureInternalCache(); ensureSynchronized(false); diff --git a/tests/functional/coherence/net/cache/CQCProxyTest.hpp b/tests/functional/coherence/net/cache/CQCProxyTest.hpp index a636c151..6aa6a1cd 100644 --- a/tests/functional/coherence/net/cache/CQCProxyTest.hpp +++ b/tests/functional/coherence/net/cache/CQCProxyTest.hpp @@ -213,7 +213,7 @@ class CQCProxyTest : public CxxTest::TestSuite // instantiate the CQC, will start the test running. ContinuousQueryCache::Handle hCQC = - ContinuousQueryCache::create(hTestCache, AlwaysFilter::create(), false, hListener); + ContinuousQueryCache::create(hTestCache, AlwaysFilter::create(), true, hListener); // add member listener to inner cache to receive memberLeft // event; intermittently, the "get" which restarts the diff --git a/tests/functional/coherence/net/cache/ContinuousQueryCacheTest.hpp b/tests/functional/coherence/net/cache/ContinuousQueryCacheTest.hpp index d2280b4f..4cc7c09e 100644 --- a/tests/functional/coherence/net/cache/ContinuousQueryCacheTest.hpp +++ b/tests/functional/coherence/net/cache/ContinuousQueryCacheTest.hpp @@ -122,6 +122,44 @@ class ContinuousQueryCacheTest : public CxxTest::TestSuite } }; + // validating lite cache listener for CQC instance + class ValidateLiteMapListener : public class_spec, implements > + { + friend class factory; + + protected: + ValidateLiteMapListener(bool fLite) + { + m_fLite = fLite; + } + + public: + void entryInserted(MapEvent::View vEvt) + { + TS_ASSERT(m_fLite ? vEvt->getNewValue() == NULL : vEvt->getNewValue() != NULL); + } + + void entryUpdated(MapEvent::View vEvt) + { + TS_ASSERT(m_fLite ? vEvt->getNewValue() == NULL : vEvt->getNewValue() != NULL); + TS_ASSERT(m_fLite ? vEvt->getOldValue() == NULL : vEvt->getOldValue() != NULL); + } + + void entryDeleted(MapEvent::View vEvt) + { + TS_ASSERT(m_fLite ? vEvt->getOldValue() == NULL : vEvt->getOldValue() != NULL); + } + + // ----- data members ----------------------------------------------- + + protected: + /** + * If true, validate a lite MapListener, get old and new value are NULL. + */ + bool m_fLite; + }; + // ----- local class: TestCQCListener ----------------------------------- /** @@ -510,7 +548,7 @@ class ContinuousQueryCacheTest : public CxxTest::TestSuite // create CQC ContinuousQueryCache::Handle hCqc = ContinuousQueryCache::create( - hCache, AlwaysFilter::create(), false, hMockListener); + hCache, AlwaysFilter::create(), true, hMockListener); Object::View vKey = String::create("key1"); Object::View vVal = String::create("val1"); @@ -1891,6 +1929,49 @@ class ContinuousQueryCacheTest : public CxxTest::TestSuite hCqc->release(); } + /* + * Test for COH-31325 + */ + void testCOH31325() + { + NamedCache::Handle hCache = ensureCleanCache("TestCache"); + + // test fCacheValues of false and lite map listener + ContinuousQueryCache::Handle hCqc = ContinuousQueryCache::create( + hCache, AlwaysFilter::create(), false, ValidateLiteMapListener::create(true)); + TS_ASSERT(!hCqc->isCacheValues()); + hCache->put(String::create("Key31325"), String::create("Value31325")); + hCache->put(String::create("Key31325"), String::create("UpdateValue31325")); + hCache->remove(String::create("Key31325")); + TS_ASSERT(!hCqc->isCacheValues()); + hCqc->release(); + + // test fCacheValues of false initially with map listener, first non-lite listener converts isCacheValues to true + hCqc = ContinuousQueryCache::create( + hCache, AlwaysFilter::create(), false, SampleMapListener::create()); + TS_ASSERT(!hCqc->isCacheValues()); + hCache->put(String::create("Key31325"), String::create("Value31325")); + hCache->put(String::create("Key31325"), String::create("UpdateValue31325")); + hCache->remove(String::create("Key31325")); + TS_ASSERT(!hCqc->isCacheValues()); + // add a standard listener and verify isCacheValues after + hCqc->addFilterListener(ValidateLiteMapListener::create(false), AlwaysFilter::create(), false); + hCache->put(String::create("Key31325"), String::create("SecondUpdateValue31325")); + TS_ASSERT(hCqc->isCacheValues()); + hCqc->release(); + + // validate standard listener when fCacheValues is true + hCache = ensureCleanCache("TestCache"); + hCqc = ContinuousQueryCache::create( + hCache, AlwaysFilter::create(), true, ValidateLiteMapListener::create(false)); + TS_ASSERT(hCqc->isCacheValues()); + hCache->put(String::create("Key31325"), String::create("Value31325")); + hCache->put(String::create("Key31325"), String::create("UpdateValue31325")); + hCache->remove(String::create("Key31325")); + TS_ASSERT(hCqc->isCacheValues()); + hCqc->release(); + } + /* * Test for COH-10013 */ diff --git a/tests/unit/coherence/net/ViewBuilderTest.hpp b/tests/unit/coherence/net/ViewBuilderTest.hpp index f36308ff..6418accb 100644 --- a/tests/unit/coherence/net/ViewBuilderTest.hpp +++ b/tests/unit/coherence/net/ViewBuilderTest.hpp @@ -154,6 +154,12 @@ class ViewBuilderTest : public CxxTest::TestSuite hCache->entrySet((Filter::View) NULL); hCache->lastExpectation()->ignoreArguments(); hCache->setObjectReturn(HashSet::create()); + hCache->invokeAll((Filter::View) NULL, (InvocableMap::EntryProcessor::Handle) NULL); + hCache->lastExpectation()->ignoreArguments(); + hCache->setObjectReturn(HashMap::create()); + hCache->getAll((Collection::View) NULL); + hCache->lastExpectation()->ignoreArguments(); + hCache->setObjectReturn(HashSet::create()); //replay hCache->replay(); diff --git a/tests/unit/coherence/net/cache/ContinuousQueryCacheTest.hpp b/tests/unit/coherence/net/cache/ContinuousQueryCacheTest.hpp index cbff029c..a1552245 100644 --- a/tests/unit/coherence/net/cache/ContinuousQueryCacheTest.hpp +++ b/tests/unit/coherence/net/cache/ContinuousQueryCacheTest.hpp @@ -96,6 +96,40 @@ class ContinuousQueryCacheTest : public CxxTest::TestSuite TS_ASSERT(hCqc->isCacheValues()); } + void testIsCacheValuesWithListener() + { + MockNamedCache::Handle hMockNamedCache = MockNamedCache::create(); + MockMapListener::Handle hMockListener = MockMapListener::create(); + Filter::Handle hFilter = DummyFilter::create(); + + //set expectations + hMockNamedCache->entrySet(hFilter); + hMockNamedCache->setMatcher(&matchAll); + hMockNamedCache->setObjectReturn(Collections::emptySet()); + + hMockNamedCache->keySet(hFilter); + hMockNamedCache->setMatcher(&matchAll); + hMockNamedCache->setObjectReturn(Collections::emptySet()); + + hMockNamedCache->entrySet(hFilter); + hMockNamedCache->setMatcher(&matchAll); + hMockNamedCache->setObjectReturn(Collections::emptySet()); + + hMockNamedCache->keySet(hFilter); + hMockNamedCache->setMatcher(&matchAll); + hMockNamedCache->setObjectReturn(Collections::emptySet()); + + //replay + hMockNamedCache->replay(); + + ContinuousQueryCache::Handle hCqc = ContinuousQueryCache::create(hMockNamedCache, hFilter, false, hMockListener); + TS_ASSERT(!hCqc->isCacheValues()); + + hCqc = ContinuousQueryCache::create(hMockNamedCache, hFilter, true, hMockListener); + TS_ASSERT(hCqc->isCacheValues()); + } + + void testSetCacheValues() { From 4ed111bec9f10c46168d9fbbf2c56633bf69d889 Mon Sep 17 00:00:00 2001 From: "parthiban.thilagar" Date: Mon, 23 Dec 2024 14:19:25 -0500 Subject: [PATCH 03/12] Bump version to 14.1.2.0.1 [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 113071] --- prj/build.properties | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prj/build.properties b/prj/build.properties index d48e85b1..9970ebb1 100644 --- a/prj/build.properties +++ b/prj/build.properties @@ -12,6 +12,8 @@ build.description= build.type=debug -build.version=14.1.2.0.0 +build.version=14.1.2.0.1 + +# Set the version of latest Coherence CE version (server/java) to test with build.groupId_maven=com.oracle.coherence.ce -build.version_maven=22.06.8 +build.version_maven=14.1.2-0-0 From d5f791235c979289cb053f5492ce8e5f3c223ab3 Mon Sep 17 00:00:00 2001 From: "patrick.fry" Date: Thu, 2 Jan 2025 01:55:56 -0500 Subject: [PATCH 04/12] Update the copyright year to 2025 (main.cpp cl 113098 --> 14.1.2.0) [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 113099] --- prj/build-import.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prj/build-import.xml b/prj/build-import.xml index 59a07f80..12cf30b6 100644 --- a/prj/build-import.xml +++ b/prj/build-import.xml @@ -1,6 +1,6 @@ 14.1.2.0) [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 113409] --- src/coherence/net/AddressProvider.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/coherence/net/AddressProvider.cpp diff --git a/src/coherence/net/AddressProvider.cpp b/src/coherence/net/AddressProvider.cpp new file mode 100644 index 00000000..ca3cda8d --- /dev/null +++ b/src/coherence/net/AddressProvider.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. + * + * Licensed under the Universal Permissive License v 1.0 as shown at + * https://oss.oracle.com/licenses/upl. + */ +#include "coherence/net/AddressProvider.hpp" + +COH_OPEN_NAMESPACE2(coherence,net) + +// ----- ClassLoader registration ------------------------------------------- + +COH_REGISTER_CLASS(TypedBarrenClass::create()); + +COH_CLOSE_NAMESPACE2 From f06058415b3d6346c82f1337c78182982d3128a6 Mon Sep 17 00:00:00 2001 From: Chinmay Patel Date: Fri, 17 Jan 2025 13:33:34 -0500 Subject: [PATCH 06/12] nobug80: COH-31547: DOC: update the header for C++ API doc reference [git-p4: depot-paths = "//dev/release.cpp/coherence-cpp-v14.1.2.0/": change = 113621] --- prj/apidoc/api.html | 6 +++--- prj/apidoc/doxygen.cfg | 6 +++--- prj/apidoc/doxygen_private.cfg | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/prj/apidoc/api.html b/prj/apidoc/api.html index c1706c68..dda11de4 100644 --- a/prj/apidoc/api.html +++ b/prj/apidoc/api.html @@ -1,11 +1,11 @@ -Oracle\u00AE Fusion Middleware C++ API Reference for Oracle Coherence: +C++ Client API Reference for Oracle Coherence: