You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2022/04/07 17:09:47 UTC
[geode] branch support/1.13 updated: [1.13] GEODE-9980: Revert serialization filter changes from 1.13 (#7562)
This is an automated email from the ASF dual-hosted git repository.
klund pushed a commit to branch support/1.13
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/support/1.13 by this push:
new 01a101c3e4 [1.13] GEODE-9980: Revert serialization filter changes from 1.13 (#7562)
01a101c3e4 is described below
commit 01a101c3e479a50b9cca26b8c836e7ba10d1a60c
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Thu Apr 7 10:09:41 2022 -0700
[1.13] GEODE-9980: Revert serialization filter changes from 1.13 (#7562)
* Revert "GEODE-9980: Improve error handling of serial filters (#7299)"
This reverts commit 240feb88cdfbc2db44bec28ff23b079dc07b0c41.
* Revert "GEODE-9758: Add internal serial filter API (#7217)"
This reverts commit 220ea534973edbb2643df6476e349d783b04b21e.
* Revert "GEODE-9879: Extract SystemProperty to geode-common (#7177)"
This reverts commit 06bb3a66125e0c9f8c5dbe7ee579e44d462d802d.
* Revert "GEODE-9758: Move ClassUtils to geode-common (#7166)"
This reverts commit 31810b5bd6fdd09b60890b427af60a9542bac954.
* Revert "GEODE-9758: Move SanctionedSerializables to filter package (#7165)"
This reverts commit 1c21af7561fc52ee771203c33d321124adbc4b25.
* Revert "GEODE-9817: Enable customized source set paths for ClassAnalysisRule (#7121)"
This reverts commit 68e7d6e577ffc6c2b98d6611d05c6a6e98bd3358.
---
...erConfiguresJmxSerialFilterAcceptanceTest.java} | 58 ++--
...erConfiguresJmxSerialFilterAcceptanceTest.java} | 55 ++--
...artLocatorGlobalSerialFilterAcceptanceTest.java | 138 --------
...tartServerGlobalSerialFilterAcceptanceTest.java | 150 ---------
geode-common/build.gradle | 6 -
.../apache/geode/internal/lang/SystemProperty.java | 118 -------
.../geode/internal/lang/SystemPropertyTest.java | 107 -------
...lyzeConnectorsSerializablesIntegrationTest.java | 2 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../ConnectorsSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
geode-core/build.gradle | 16 +-
...ValidateSerializableObjectsDistributedTest.java | 320 -------------------
.../geode/distributed/LocatorLauncherTest.java | 2 +-
...okenSerializationConsistencyRegressionTest.java | 6 +-
...entDeserializationCopyOnReadRegressionTest.java | 7 +-
.../internal/cache/DeltaPropagationDUnitTest.java | 2 +-
.../cache/PartitionedRegionSingleHopDUnitTest.java | 2 +-
.../RebalanceOperationComplexDistributedTest.java | 4 +-
.../cache/ha/HARQueueNewImplDUnitTest.java | 5 +-
.../ha/HARegionQueueExpiryRegressionTest.java | 5 +-
.../HARegionQueueThreadIdExpiryRegressionTest.java | 8 +-
.../sockets/RedundancyLevelPart1DUnitTest.java | 2 +-
.../AnalyzeCoreSerializablesIntegrationTest.java | 3 +-
.../geode/distributed/LocatorIntegrationTest.java | 185 +++++------
...catorLauncherJmxManagerLocalRegressionTest.java | 22 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../internal/cache/ha/HARegionQueueJUnitTest.java | 4 +-
.../DefaultDiskDirsIntegrationTest.java | 4 +-
...cherGlobalSerialFilterBlankIntegrationTest.java | 55 ----
...herGlobalSerialFilterExistsIntegrationTest.java | 55 ----
...rLauncherGlobalSerialFilterIntegrationTest.java | 52 ---
...alSerialFilterPropertyBlankIntegrationTest.java | 54 ----
...alSerialFilterPropertyEmptyIntegrationTest.java | 54 ----
...atorLauncherJmxSerialFilterIntegrationTest.java | 84 -----
...mxSerialFilterPropertyBlankIntegrationTest.java | 88 ------
...mxSerialFilterPropertyEmptyIntegrationTest.java | 88 ------
...xSerialFilterPropertyExistsIntegrationTest.java | 90 ------
.../filter/LocatorLauncherWithJmxManager.java | 82 -----
.../filter/SerialFilterAssertions.java | 58 ----
...cherGlobalSerialFilterBlankIntegrationTest.java | 55 ----
...herGlobalSerialFilterExistsIntegrationTest.java | 55 ----
...rLauncherGlobalSerialFilterIntegrationTest.java | 51 ---
...alSerialFilterPropertyBlankIntegrationTest.java | 53 ----
...alSerialFilterPropertyEmptyIntegrationTest.java | 53 ----
...rverLauncherJmxSerialFilterIntegrationTest.java | 87 -----
...mxSerialFilterPropertyBlankIntegrationTest.java | 88 ------
...mxSerialFilterPropertyEmptyIntegrationTest.java | 88 ------
...xSerialFilterPropertyExistsIntegrationTest.java | 90 ------
.../filter/ServerLauncherWithJmxManager.java | 77 -----
...erConfiguresJmxSerialFilterIntegrationTest.java | 204 ++++++++++++
.../internal/ManagementAgentIntegrationTest.java | 6 +-
...erConfiguresJmxSerialFilterIntegrationTest.java | 201 ++++++++++++
.../apache/geode/distributed/AbstractLauncher.java | 2 +-
.../apache/geode/distributed/LocatorLauncher.java | 20 --
.../apache/geode/distributed/ServerLauncher.java | 19 --
.../distributed/internal/DistributionConfig.java | 4 +-
.../CoreSanctionedSerializablesService.java | 2 +-
.../DistributedSerializableObjectConfig.java | 51 ---
.../geode/internal/EmptyInputStreamFilter.java | 10 +-
.../apache/geode/internal/InputStreamFilter.java | 12 +-
.../geode/internal/InternalDataSerializer.java | 56 ++--
.../internal/ObjectInputStreamFilterWrapper.java | 233 ++++++++++++++
.../internal/cache/EntryEventSerialization.java | 2 +-
.../cache/eviction/EvictionListBuilder.java | 3 +-
.../cache/eviction/LRUListWithAsyncSorting.java | 5 +-
.../cache/eviction/LRUListWithSyncSorting.java | 3 +-
.../geode/internal/cache/ha/HARegionQueue.java | 2 +-
.../cache/persistence/DefaultDiskDirs.java | 2 +-
.../apache/geode/internal/config/JAXBService.java | 6 +-
.../org/apache/geode/internal/lang/ClassUtils.java | 2 +-
.../geode/internal/lang/SystemPropertyHelper.java | 89 ++++--
.../internal/logging/CoreLoggingExecutors.java | 2 +-
.../geode/logging/internal/Configuration.java | 6 +-
.../logging/internal/LoggingProviderLoader.java | 5 +-
.../internal/JmxRmiOpenTypesSerialFilter.java | 148 +++++++++
.../management/internal/JmxRmiSerialFilter.java | 9 +-
.../geode/management/internal/ManagementAgent.java | 15 +-
.../internal/ManagementAgentFactory.java | 3 +-
.../internal/SystemManagementService.java | 9 +-
...l.serialization.SanctionedSerializablesService} | 0
.../internal/DistributionConfigJUnitTest.java | 8 -
.../DistributedSerializableObjectConfigTest.java | 62 ----
...lDataSerializerSerializationAcceptlistTest.java | 153 +++------
.../InternalDataSerializerShiroAcceptListTest.java | 34 +-
.../cache/EntryEventSerializationTest.java | 4 +-
.../cache/persistence/DefaultDiskDirsTest.java | 6 +-
.../PersistenceInitialImageAdvisorTest.java | 5 +-
.../geode/internal/lang/ClassUtilsJUnitTest.java | 8 +-
.../internal/lang/SystemPropertyHelperTest.java | 101 +++---
.../internal/JmxRmiOpenTypesSerialFilterTest.java | 351 +++++++++++++++++++++
geode-core/src/test/resources/expected-pom.xml | 10 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../AnalyzeCQSerializablesIntegrationTest.java | 3 +-
.../internal/CQSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
.../DistributedDiskDirRuleDistributedTest.java | 17 +-
.../AnalyzeDUnitSerializablesIntegrationTest.java | 4 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../junit/rules/DiskDirRuleIntegrationTest.java | 5 +-
.../DUnitSanctionedSerializablesService.java | 2 +-
.../test/dunit/rules/DistributedDiskDirRule.java | 16 +-
.../apache/geode/test/junit/rules/DiskDirRule.java | 14 +-
...l.serialization.SanctionedSerializablesService} | 0
.../AnalyzeGfshSerializablesIntegrationTest.java | 5 +-
...ctionedSerializablesServiceIntegrationTest.java | 4 +-
.../GfshSanctionedSerializablesService.java | 4 +-
.../cli/commands/DescribeDiskStoreCommand.java | 2 +-
.../geode/management/internal/cli/shell/Gfsh.java | 2 +-
...al.serialization.SanctionedSerializablesService | 2 +-
...alization.filter.SanctionedSerializablesService | 15 -
.../sanctioned-geode-gfsh-serializables.txt | 0
geode-http-service/build.gradle | 1 -
.../AnalyzeJUnitSerializablesIntegrationTest.java | 3 +-
...ctionedSerializablesServiceIntegrationTest.java | 5 +-
... => AnalyzeDataSerializablesJUnitTestBase.java} | 74 +++--
...SerializablesWithClassAnalysisRuleTestBase.java | 40 ---
...java => AnalyzeSerializablesJUnitTestBase.java} | 47 +--
...SerializablesWithClassAnalysisRuleTestBase.java | 43 ---
.../geode/codeAnalysis/CompiledClassUtils.java | 8 +-
...nedSerializablesServiceIntegrationTestBase.java | 22 +-
.../categories/SanctionedSerializablesTest.java | 5 +-
.../JUnitSanctionedSerializablesService.java | 2 +-
.../geode/test/junit/rules/ClassAnalysisRule.java | 23 +-
...l.serialization.SanctionedSerializablesService} | 0
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../AnalyzeLuceneSerializablesIntegrationTest.java | 3 +-
.../LuceneSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
...lyzeManagementSerializablesIntegrationTest.java | 2 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../ManagementSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
...lyzeMembershipSerializablesIntegrationTest.java | 2 +-
.../MembershipDependenciesJUnitTest.java | 1 +
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../MembershipSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
...alyzeMemcachedSerializablesIntegrationTest.java | 2 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../MemcachedSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
.../AnalyzePulseSerializablesIntegrationTest.java | 3 +-
.../AnalyzeRedisSerializablesIntegrationTest.java | 3 +-
.../RedisSanctionedSerializablesService.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
geode-serialization/build.gradle | 4 -
...eSerializationSerializablesIntegrationTest.java | 2 +-
...ctionedSerializablesServiceIntegrationTest.java | 1 -
...ationWhenFilterIsAlreadySetIntegrationTest.java | 53 ----
...enObjectInputFilterNotFoundIntegrationTest.java | 108 -------
...nputFilterApiSetFilterBlankIntegrationTest.java | 62 ----
...jectInputFilterApiSetFilterIntegrationTest.java | 60 ----
...InputFilterApiSetFilterNullIntegrationTest.java | 61 ----
.../apache/geode/codeAnalysis/excludedClasses.txt | 0
.../{filter => }/SanctionedSerializables.java | 42 +--
.../SanctionedSerializablesService.java | 8 +-
...erializationSanctionedSerializablesService.java | 2 -
.../internal/serialization/filter/ApiPackage.java | 41 ---
.../filter/FilterAlreadyConfiguredException.java | 36 ---
.../serialization/filter/FilterConfiguration.java | 27 --
.../serialization/filter/FilterPattern.java | 28 --
.../serialization/filter/GlobalSerialFilter.java | 30 --
.../filter/GlobalSerialFilterConfiguration.java | 123 --------
.../GlobalSerialFilterConfigurationFactory.java | 29 --
.../filter/GlobalSerialFilterFactory.java | 30 --
.../Java9ReflectiveObjectInputFilterApi.java | 64 ----
.../filter/JmxSerialFilterConfiguration.java | 73 -----
.../JmxSerialFilterConfigurationFactory.java | 28 --
.../serialization/filter/ObjectInputFilterApi.java | 85 -----
.../filter/ObjectInputFilterInvocationHandler.java | 109 -------
.../filter/ObjectInputFilterUtils.java | 61 ----
.../filter/OpenMBeanFilterPattern.java | 68 ----
.../filter/ReflectiveFacadeGlobalSerialFilter.java | 102 ------
.../ReflectiveFacadeGlobalSerialFilterFactory.java | 46 ---
.../filter/ReflectiveFacadeStreamSerialFilter.java | 109 -------
.../ReflectiveFacadeStreamSerialFilterFactory.java | 39 ---
.../filter/ReflectiveObjectInputFilterApi.java | 238 --------------
.../ReflectiveObjectInputFilterApiFactory.java | 45 ---
.../SanctionedSerializablesFilterPattern.java | 111 -------
.../filter/SerializableObjectConfig.java | 31 --
.../serialization/filter/StreamSerialFilter.java | 32 --
...ertyGlobalSerialFilterConfigurationFactory.java | 68 ----
...ropertyJmxSerialFilterConfigurationFactory.java | 55 ----
.../filter/UnableToSetSerialFilterException.java | 36 ---
...l.serialization.SanctionedSerializablesService} | 0
...anctioned-geode-serialization-serializables.txt | 3 -
...ava => SerializationDependenciesJUnitTest.java} | 18 +-
.../serialization/filter/ApiPackageTest.java | 61 ----
.../GlobalSerialFilterConfigurationTest.java | 118 -------
.../JmxSerialFilterConfigurationFactoryTest.java | 74 -----
.../filter/JmxSerialFilterConfigurationTest.java | 165 ----------
.../filter/NullObjectInputFilterTest.java | 35 --
.../ObjectInputFilterInvocationHandlerTest.java | 97 ------
.../filter/ObjectInputFilterUtilsTest.java | 94 ------
.../filter/OpenMBeanFilterPatternTest.java | 142 ---------
...lectiveFacadeGlobalSerialFilterFactoryTest.java | 76 -----
.../ReflectiveFacadeGlobalSerialFilterTest.java | 168 ----------
...flectiveFacadeObjectInputFilterFactoryTest.java | 84 -----
.../ReflectiveFacadeObjectInputFilterTest.java | 175 ----------
.../ReflectiveObjectInputFilterApiFactoryTest.java | 69 ----
.../filter/ReflectiveObjectInputFilterApiTest.java | 228 -------------
.../SanctionedSerializablesFilterPatternTest.java | 206 ------------
.../filter/SanctionedSerializablesTest.java | 95 ------
.../filter/SerialFilterAssertions.java | 69 ----
.../filter/SerializableObjectConfigTest.java | 46 ---
...GlobalSerialFilterConfigurationFactoryTest.java | 144 ---------
...rtyJmxSerialFilterConfigurationFactoryTest.java | 94 ------
.../src/test/resources/expected-pom.xml | 10 -
.../AnalyzeWANSerializablesIntegrationTest.java | 5 +-
...ctionedSerializablesServiceIntegrationTest.java | 4 +-
.../wan}/WANSanctionedSerializablesService.java | 4 +-
...l.serialization.SanctionedSerializablesService} | 2 +-
.../wan}/sanctioned-geode-wan-serializables.txt | 0
.../AnalyzeWebApiSerializablesIntegrationTest.java | 3 +-
...ctionedSerializablesServiceIntegrationTest.java | 2 +-
.../WebApiSanctionedSerializablesService.java | 2 +-
.../geode/rest/internal/web/util/NumberUtils.java | 2 +-
...l.serialization.SanctionedSerializablesService} | 0
220 files changed, 1717 insertions(+), 7702 deletions(-)
diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorJmxSerialFilterAcceptanceTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/management/LocatorManagerConfiguresJmxSerialFilterAcceptanceTest.java
similarity index 66%
rename from geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorJmxSerialFilterAcceptanceTest.java
rename to geode-assembly/src/acceptanceTest/java/org/apache/geode/management/LocatorManagerConfiguresJmxSerialFilterAcceptanceTest.java
index f6d50c2f36..de0b8c8ffb 100644
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorJmxSerialFilterAcceptanceTest.java
+++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/management/LocatorManagerConfiguresJmxSerialFilterAcceptanceTest.java
@@ -12,61 +12,65 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.serialization.filter;
+package org.apache.geode.management;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.test.assertj.LogFileAssert.assertThat;
+import static org.apache.geode.management.internal.JmxRmiOpenTypesSerialFilter.PROPERTY_NAME;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assumptions.assumeThat;
import java.nio.file.Path;
+import org.apache.commons.lang3.JavaVersion;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.apache.geode.test.assertj.LogFileAssert;
import org.apache.geode.test.junit.rules.RequiresGeodeHome;
import org.apache.geode.test.junit.rules.gfsh.GfshRule;
-public class StartLocatorJmxSerialFilterAcceptanceTest {
+public class LocatorManagerConfiguresJmxSerialFilterAcceptanceTest {
- private static final String PROPERTY_NAME = "jmx.remote.rmi.server.serial.filter.pattern";
+ private static final String NAME = "the-locator";
+
+ private Path workingDir;
+ private int locatorPort;
+ private int jmxPort;
+ private Path locatorLogFile;
@Rule
public RequiresGeodeHome requiresGeodeHome = new RequiresGeodeHome();
@Rule
public GfshRule gfshRule = new GfshRule();
- private Path locatorFolder;
- private int locatorPort;
- private int jmxPort;
- private Path locatorLogFile;
-
@Before
- public void setUpFiles() {
- locatorFolder = gfshRule.getTemporaryFolder().getRoot().toPath().toAbsolutePath();
- locatorLogFile = locatorFolder.resolve("locator.log");
+ public void setUpOutputFiles() {
+ TemporaryFolder temporaryFolder = gfshRule.getTemporaryFolder();
+
+ workingDir = temporaryFolder.getRoot().toPath().toAbsolutePath();
+ locatorLogFile = workingDir.resolve(NAME + ".log");
}
@Before
- public void setUpPorts() {
+ public void setUpRandomPorts() {
int[] ports = getRandomAvailableTCPPorts(2);
+
locatorPort = ports[0];
jmxPort = ports[1];
}
@Test
- public void startWithJmxManagerConfiguresJmxSerialFilter_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
+ public void startingLocatorWithJmxManager_configuresSerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
String startLocatorCommand = String.join(" ",
"start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
+ "--name=" + NAME,
+ "--dir=" + workingDir,
"--port=" + locatorPort,
"--J=-Dgemfire.enable-cluster-configuration=false",
"--J=-Dgemfire.http-service-port=0",
@@ -77,21 +81,21 @@ public class StartLocatorJmxSerialFilterAcceptanceTest {
gfshRule.execute(startLocatorCommand);
await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
+ LogFileAssert.assertThat(locatorLogFile.toFile())
.as(locatorLogFile.toFile().getAbsolutePath())
.exists()
- .contains("System property '" + PROPERTY_NAME + "' is now configured with");
+ .contains("System property " + PROPERTY_NAME + " is now configured with");
});
}
@Test
- public void startWithJmxManagerDoesNotConfigureJmxSerialFilter_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
+ public void startingLocatorWithJmxManager_configuresSerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
String startLocatorCommand = String.join(" ",
"start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
+ "--name=" + NAME,
+ "--dir=" + workingDir,
"--port=" + locatorPort,
"--J=-Dgemfire.enable-cluster-configuration=false",
"--J=-Dgemfire.http-service-port=0",
@@ -102,10 +106,10 @@ public class StartLocatorJmxSerialFilterAcceptanceTest {
gfshRule.execute(startLocatorCommand);
await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
+ LogFileAssert.assertThat(locatorLogFile.toFile())
.as(locatorLogFile.toFile().getAbsolutePath())
.exists()
- .doesNotContain("System property '" + PROPERTY_NAME + "' is now configured with");
+ .doesNotContain("System property " + PROPERTY_NAME + " is now configured with");
});
}
}
diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerJmxSerialFilterAcceptanceTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/management/ServerManagerConfiguresJmxSerialFilterAcceptanceTest.java
similarity index 66%
rename from geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerJmxSerialFilterAcceptanceTest.java
rename to geode-assembly/src/acceptanceTest/java/org/apache/geode/management/ServerManagerConfiguresJmxSerialFilterAcceptanceTest.java
index bf03b22c71..7754decfb3 100644
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerJmxSerialFilterAcceptanceTest.java
+++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/management/ServerManagerConfiguresJmxSerialFilterAcceptanceTest.java
@@ -12,58 +12,61 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.serialization.filter;
+package org.apache.geode.management;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPort;
-import static org.apache.geode.test.assertj.LogFileAssert.assertThat;
+import static org.apache.geode.management.internal.JmxRmiOpenTypesSerialFilter.PROPERTY_NAME;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assumptions.assumeThat;
import java.nio.file.Path;
+import org.apache.commons.lang3.JavaVersion;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.apache.geode.test.assertj.LogFileAssert;
import org.apache.geode.test.junit.rules.RequiresGeodeHome;
import org.apache.geode.test.junit.rules.gfsh.GfshRule;
-public class StartServerJmxSerialFilterAcceptanceTest {
+public class ServerManagerConfiguresJmxSerialFilterAcceptanceTest {
- private static final String PROPERTY_NAME = "jmx.remote.rmi.server.serial.filter.pattern";
+ private static final String NAME = "the-server";
+
+ private Path workingDir;
+ private int jmxPort;
+ private Path serverLogFile;
@Rule
public RequiresGeodeHome requiresGeodeHome = new RequiresGeodeHome();
@Rule
public GfshRule gfshRule = new GfshRule();
- private Path serverFolder;
- private int jmxPort;
- private Path serverLogFile;
-
@Before
- public void setUpFiles() {
- serverFolder = gfshRule.getTemporaryFolder().getRoot().toPath().toAbsolutePath();
- serverLogFile = serverFolder.resolve("server.log");
+ public void setUpOutputFiles() {
+ TemporaryFolder temporaryFolder = gfshRule.getTemporaryFolder();
+
+ workingDir = temporaryFolder.getRoot().toPath().toAbsolutePath();
+ serverLogFile = workingDir.resolve(NAME + ".log");
}
@Before
- public void setUpPorts() {
+ public void setUpRandomPorts() {
jmxPort = getRandomAvailableTCPPort();
}
@Test
- public void startWithJmxManagerConfiguresJmxSerialFilter_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
+ public void startingServerWithJmxManager_configuresSerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
String startServerCommand = String.join(" ",
"start server",
- "--name=server",
- "--dir=" + serverFolder,
+ "--name=" + NAME,
+ "--dir=" + workingDir,
"--disable-default-server",
"--J=-Dgemfire.enable-cluster-configuration=false",
"--J=-Dgemfire.http-service-port=0",
@@ -74,21 +77,21 @@ public class StartServerJmxSerialFilterAcceptanceTest {
gfshRule.execute(startServerCommand);
await().untilAsserted(() -> {
- assertThat(serverLogFile.toFile())
+ LogFileAssert.assertThat(serverLogFile.toFile())
.as(serverLogFile.toFile().getAbsolutePath())
.exists()
- .contains("System property '" + PROPERTY_NAME + "' is now configured with");
+ .contains("System property " + PROPERTY_NAME + " is now configured with");
});
}
@Test
- public void startWithJmxManagerDoesNotConfigureJmxSerialFilter_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
+ public void startingServerWithJmxManager_configuresSerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
String startServerCommand = String.join(" ",
"start server",
- "--name=server",
- "--dir=" + serverFolder,
+ "--name=" + NAME,
+ "--dir=" + workingDir,
"--disable-default-server",
"--J=-Dgemfire.enable-cluster-configuration=false",
"--J=-Dgemfire.http-service-port=0",
@@ -99,10 +102,10 @@ public class StartServerJmxSerialFilterAcceptanceTest {
gfshRule.execute(startServerCommand);
await().untilAsserted(() -> {
- assertThat(serverLogFile.toFile())
+ LogFileAssert.assertThat(serverLogFile.toFile())
.as(serverLogFile.toFile().getAbsolutePath())
.exists()
- .doesNotContain("System property '" + PROPERTY_NAME + "' is now configured with");
+ .doesNotContain("System property " + PROPERTY_NAME + " is now configured with");
});
}
}
diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorGlobalSerialFilterAcceptanceTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorGlobalSerialFilterAcceptanceTest.java
deleted file mode 100644
index e4cc254d02..0000000000
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartLocatorGlobalSerialFilterAcceptanceTest.java
+++ /dev/null
@@ -1,138 +0,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.
- */
-package org.apache.geode.serialization.filter;
-
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.test.assertj.LogFileAssert.assertThat;
-import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
-
-import java.nio.file.Path;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.geode.test.junit.rules.RequiresGeodeHome;
-import org.apache.geode.test.junit.rules.gfsh.GfshRule;
-
-public class StartLocatorGlobalSerialFilterAcceptanceTest {
-
- @Rule
- public RequiresGeodeHome requiresGeodeHome = new RequiresGeodeHome();
- @Rule
- public GfshRule gfshRule = new GfshRule();
-
- private Path locatorFolder;
- private int locatorPort;
- private int locatorJmxPort;
- private Path locatorLogFile;
-
- @Before
- public void setUpFiles() {
- locatorFolder = gfshRule.getTemporaryFolder().getRoot().toPath().toAbsolutePath();
- locatorLogFile = locatorFolder.resolve("locator.log");
- }
-
- @Before
- public void setUpPorts() {
- int[] ports = getRandomAvailableTCPPorts(2);
- locatorPort = ports[0];
- locatorJmxPort = ports[1];
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_byDefault() {
- String startLocatorCommand = String.join(" ",
- "start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
- "--port=" + locatorPort,
- "--J=-Dgemfire.jmx-manager-port=" + locatorJmxPort);
-
- gfshRule.execute(startLocatorCommand);
-
- await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
- .as(locatorLogFile.toFile().getAbsolutePath())
- .exists()
- .doesNotContain("Global serial filter is now configured.")
- .doesNotContain("jdk.serialFilter");
- });
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenJdkSerialFilterIsNotBlank() {
- String startLocatorCommand = String.join(" ",
- "start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
- "--port=" + locatorPort,
- "--J=-Dgemfire.jmx-manager-port=" + locatorJmxPort,
- "--J=-Djdk.serialFilter=*");
-
- gfshRule.execute(startLocatorCommand);
-
- await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
- .as(locatorLogFile.toFile().getAbsolutePath())
- .exists()
- .doesNotContain("Global serial filter is now configured.")
- .contains("jdk.serialFilter");
- });
- }
-
- @Test
- public void startConfiguresGlobalSerialFilter_whenEnableGlobalSerialFilterIsTrue() {
- String startLocatorCommand = String.join(" ",
- "start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
- "--port=" + locatorPort,
- "--J=-Dgemfire.jmx-manager-port=" + locatorJmxPort,
- "--J=-Dgeode.enableGlobalSerialFilter=true");
-
- gfshRule.execute(startLocatorCommand);
-
- await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
- .as(locatorLogFile.toFile().getAbsolutePath())
- .exists()
- .contains("Global serial filter is now configured.")
- .doesNotContain("jdk.serialFilter");
- });
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenEnableGlobalSerialFilterIsTrue_andJdkSerialFilterIsNotBlank() {
- String startLocatorCommand = String.join(" ",
- "start locator",
- "--name=locator",
- "--dir=" + locatorFolder,
- "--port=" + locatorPort,
- "--J=-Dgemfire.jmx-manager-port=" + locatorJmxPort,
- "--J=-Dgeode.enableGlobalSerialFilter=true",
- "--J=-Djdk.serialFilter=*");
-
- gfshRule.execute(startLocatorCommand);
-
- await().untilAsserted(() -> {
- assertThat(locatorLogFile.toFile())
- .as(locatorLogFile.toFile().getAbsolutePath())
- .exists()
- .doesNotContain("Global serial filter is now configured.")
- .contains("jdk.serialFilter");
- });
- }
-}
diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerGlobalSerialFilterAcceptanceTest.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerGlobalSerialFilterAcceptanceTest.java
deleted file mode 100644
index 06bd7e2987..0000000000
--- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/serialization/filter/StartServerGlobalSerialFilterAcceptanceTest.java
+++ /dev/null
@@ -1,150 +0,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.
- */
-package org.apache.geode.serialization.filter;
-
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPort;
-import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
-
-import java.io.File;
-import java.nio.file.Path;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.geode.test.assertj.LogFileAssert;
-import org.apache.geode.test.junit.rules.RequiresGeodeHome;
-import org.apache.geode.test.junit.rules.gfsh.GfshRule;
-
-public class StartServerGlobalSerialFilterAcceptanceTest {
-
- @Rule
- public RequiresGeodeHome requiresGeodeHome = new RequiresGeodeHome();
- @Rule
- public GfshRule gfshRule = new GfshRule();
-
- private File serverFolder;
- private int jmxPort;
-
- @Before
- public void setServerFolder() {
- serverFolder = gfshRule.getTemporaryFolder().getRoot();
- }
-
- @Before
- public void setJmxPort() {
- jmxPort = getRandomAvailableTCPPort();
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_byDefault() {
- String startServerCommand = String.join(" ",
- "start server",
- "--name=server",
- "--dir=" + serverFolder.getAbsolutePath(),
- "--disable-default-server",
- "--J=-Dgemfire.enable-cluster-configuration=false",
- "--J=-Dgemfire.http-service-port=0",
- "--J=-Dgemfire.jmx-manager=true",
- "--J=-Dgemfire.jmx-manager-port=" + jmxPort,
- "--J=-Dgemfire.jmx-manager-start=true");
-
- gfshRule.execute(startServerCommand);
-
- Path serverLogFile = serverFolder.toPath().resolve("server.log");
- await().untilAsserted(() -> {
- LogFileAssert.assertThat(serverLogFile.toFile()).exists()
- .doesNotContain("Global serial filter is now configured.")
- .doesNotContain("jdk.serialFilter");
- });
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenJdkSerialFilterIsNotBlank() {
- String startServerCommand = String.join(" ",
- "start server",
- "--name=server",
- "--dir=" + serverFolder.getAbsolutePath(),
- "--disable-default-server",
- "--J=-Dgemfire.enable-cluster-configuration=false",
- "--J=-Dgemfire.http-service-port=0",
- "--J=-Dgemfire.jmx-manager=true",
- "--J=-Dgemfire.jmx-manager-port=" + jmxPort,
- "--J=-Dgemfire.jmx-manager-start=true",
- "--J=-Djdk.serialFilter=*");
-
- gfshRule.execute(startServerCommand);
-
- Path serverLogFile = serverFolder.toPath().resolve("server.log");
- await().untilAsserted(() -> {
- LogFileAssert.assertThat(serverLogFile.toFile()).exists()
- .doesNotContain("Global serial filter is now configured.")
- .contains("jdk.serialFilter");
- });
- }
-
- /**
- * ServerLauncher is not currently wired up with EnabledGlobalSerialFilterConfigurationFactory
- * like LocatorLauncher is.
- */
- @Test
- public void startConfiguresGlobalSerialFilter_whenEnableGlobalSerialFilterIsTrue() {
- String startServerCommand = String.join(" ",
- "start server",
- "--name=server",
- "--dir=" + serverFolder.getAbsolutePath(),
- "--disable-default-server",
- "--J=-Dgemfire.enable-cluster-configuration=false",
- "--J=-Dgemfire.http-service-port=0",
- "--J=-Dgemfire.jmx-manager=true",
- "--J=-Dgemfire.jmx-manager-port=" + jmxPort,
- "--J=-Dgemfire.jmx-manager-start=true",
- "--J=-Dgeode.enableGlobalSerialFilter=true");
-
- gfshRule.execute(startServerCommand);
-
- Path serverLogFile = serverFolder.toPath().resolve("server.log");
- await().untilAsserted(() -> {
- LogFileAssert.assertThat(serverLogFile.toFile()).exists()
- .contains("Global serial filter is now configured.")
- .doesNotContain("jdk.serialFilter");
- });
- }
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenEnableGlobalSerialFilterIsTrue_andJdkSerialFilterIsNotBlank() {
- String startServerCommand = String.join(" ",
- "start server",
- "--name=server",
- "--dir=" + serverFolder.getAbsolutePath(),
- "--disable-default-server",
- "--J=-Dgemfire.enable-cluster-configuration=false",
- "--J=-Dgemfire.http-service-port=0",
- "--J=-Dgemfire.jmx-manager=true",
- "--J=-Dgemfire.jmx-manager-port=" + jmxPort,
- "--J=-Dgemfire.jmx-manager-start=true",
- "--J=-Dgeode.enableGlobalSerialFilter=true",
- "--J=-Djdk.serialFilter=*");
-
- gfshRule.execute(startServerCommand);
-
- Path serverLogFile = serverFolder.toPath().resolve("server.log");
- await().untilAsserted(() -> {
- LogFileAssert.assertThat(serverLogFile.toFile()).exists()
- .doesNotContain("Global serial filter is now configured.")
- .contains("jdk.serialFilter");
- });
- }
-}
diff --git a/geode-common/build.gradle b/geode-common/build.gradle
index 5f8f3ecf0c..ae1df9898b 100755
--- a/geode-common/build.gradle
+++ b/geode-common/build.gradle
@@ -23,13 +23,7 @@ apply from: "${project.projectDir}/../gradle/warnings.gradle"
dependencies {
implementation(platform(project(':boms:geode-all-bom')))
implementation('com.fasterxml.jackson.core:jackson-databind')
-
- // test
- testImplementation('com.github.stefanbirkner:system-rules') {
- exclude module: 'junit-dep'
- }
testImplementation('junit:junit')
- testImplementation('org.apache.commons:commons-lang3')
testImplementation('org.assertj:assertj-core')
testImplementation('org.mockito:mockito-core')
}
diff --git a/geode-common/src/main/java/org/apache/geode/internal/lang/SystemProperty.java b/geode-common/src/main/java/org/apache/geode/internal/lang/SystemProperty.java
deleted file mode 100644
index 2c433ef321..0000000000
--- a/geode-common/src/main/java/org/apache/geode/internal/lang/SystemProperty.java
+++ /dev/null
@@ -1,118 +0,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.
- */
-package org.apache.geode.internal.lang;
-
-import java.util.Optional;
-
-public class SystemProperty {
-
- private static final String GEODE_PREFIX = "geode.";
- public static final String GEMFIRE_PREFIX = "gemfire.";
- public static final String DEFAULT_PREFIX = GEODE_PREFIX;
-
- /**
- * This method will try to look up "geode." and "gemfire." versions of the system property. It
- * will check and prefer "geode." setting first, then try to check "gemfire." setting.
- *
- * @param name system property name set in Geode
- * @return an Optional containing the Boolean value of the system property
- */
- public static Optional<Boolean> getProductBooleanProperty(String name) {
- String property = getProperty(name);
- return property != null ? Optional.of(Boolean.parseBoolean(property)) : Optional.empty();
- }
-
- /**
- * This method will try to look up "geode." and "gemfire." versions of the system property. It
- * will check and prefer "geode." setting first, then try to check "gemfire." setting.
- *
- * @param name system property name set in Geode
- * @return an Optional containing the Integer value of the system property
- */
- public static Optional<Integer> getProductIntegerProperty(String name) {
- Integer propertyValue = Integer.getInteger(DEFAULT_PREFIX + name);
- if (propertyValue == null) {
- propertyValue = Integer.getInteger(GEMFIRE_PREFIX + name);
- }
-
- if (propertyValue != null) {
- return Optional.of(propertyValue);
- }
- return Optional.empty();
- }
-
- /**
- * This method will try to look up "geode." and "gemfire." versions of the system property. It
- * will check and prefer "geode." setting first, then try to check "gemfire." setting.
- *
- * @param name system property name set in Geode
- * @return the integer value of the system property if exits or the default value
- */
- public static Integer getProductIntegerProperty(String name, int defaultValue) {
- return getProductIntegerProperty(name).orElse(defaultValue);
- }
-
- /**
- * This method will try to look up "geode." and "gemfire." versions of the system property. It
- * will check and prefer "geode." setting first, then try to check "gemfire." setting.
- *
- * @param name system property name set in Geode
- * @return an Optional containing the Long value of the system property
- */
- public static Optional<Long> getProductLongProperty(String name) {
- Long propertyValue = Long.getLong(DEFAULT_PREFIX + name);
- if (propertyValue == null) {
- propertyValue = Long.getLong(GEMFIRE_PREFIX + name);
- }
-
- if (propertyValue != null) {
- return Optional.of(propertyValue);
- }
- return Optional.empty();
- }
-
- public static Long getProductLongProperty(String name, long defaultValue) {
- return getProductLongProperty(name).orElse(defaultValue);
- }
-
- /**
- * This method will try to look up "geode." and "gemfire." versions of the system property. It
- * will check and prefer "geode." setting first, then try to check "gemfire." setting.
- *
- * @param name system property name set in Geode
- * @return an Optional containing the String value of the system property
- */
- public static Optional<String> getProductStringProperty(String name) {
- String property = getProperty(name);
- return property != null ? Optional.of(property) : Optional.empty();
- }
-
- public static String getProperty(String name) {
- String property = getGeodeProperty(name);
- return property != null ? property : getGemfireProperty(name);
- }
-
- private static String getGeodeProperty(String name) {
- return System.getProperty(DEFAULT_PREFIX + name);
- }
-
- private static String getGemfireProperty(String name) {
- return System.getProperty(GEMFIRE_PREFIX + name);
- }
-
- private SystemProperty() {
- // do not instantiate
- }
-}
diff --git a/geode-common/src/test/java/org/apache/geode/internal/lang/SystemPropertyTest.java b/geode-common/src/test/java/org/apache/geode/internal/lang/SystemPropertyTest.java
deleted file mode 100644
index eb319ab9c5..0000000000
--- a/geode-common/src/test/java/org/apache/geode/internal/lang/SystemPropertyTest.java
+++ /dev/null
@@ -1,107 +0,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.
- */
-package org.apache.geode.internal.lang;
-
-import static org.apache.geode.internal.lang.SystemProperty.getProductBooleanProperty;
-import static org.apache.geode.internal.lang.SystemProperty.getProductIntegerProperty;
-import static org.apache.geode.internal.lang.SystemProperty.getProductLongProperty;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-
-public class SystemPropertyTest {
-
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Test
- public void getIntegerPropertyPrefersGeodePrefix() {
- String testProperty = "testIntegerProperty";
- String gemfirePrefixProperty = "gemfire." + testProperty;
- String geodePrefixProperty = "geode." + testProperty;
- System.setProperty(geodePrefixProperty, "1");
- System.setProperty(gemfirePrefixProperty, "0");
-
- assertThat(getProductIntegerProperty(testProperty).get()).isEqualTo(1);
- }
-
- @Test
- public void getIntegerPropertyReturnsGemfirePrefixIfGeodeMissing() {
- String testProperty = "testIntegerProperty";
- String gemfirePrefixProperty = "gemfire." + testProperty;
- System.setProperty(gemfirePrefixProperty, "1");
-
- assertThat(getProductIntegerProperty(testProperty).get()).isEqualTo(1);
- }
-
- @Test
- public void getIntegerPropertyWithDefaultValue() {
- String testProperty = "testIntegerProperty";
-
- assertThat(getProductIntegerProperty(testProperty, 1000)).isEqualTo(1000);
- }
-
- @Test
- public void getLongPropertyWithoutDefaultReturnsGemfirePrefixIfGeodeMissing() {
- String testProperty = "testLongProperty";
- String gemfirePrefixProperty = "gemfire." + testProperty;
- System.setProperty(gemfirePrefixProperty, "1");
-
- assertThat(getProductLongProperty(testProperty).get()).isEqualTo(1);
- }
-
- @Test
- public void getLongPropertyWithDefaultValue() {
- String testProperty = "testIntegerProperty";
-
- assertThat(getProductLongProperty(testProperty, 1000)).isEqualTo(1000);
- }
-
- @Test
- public void getIntegerPropertyReturnsEmptyOptionalIfPropertiesMissing() {
- String testProperty = "notSetProperty";
-
- assertThat(getProductIntegerProperty(testProperty).isPresent()).isFalse();
- }
-
- @Test
- public void getBooleanPropertyReturnsEmptyOptionalIfProperiesMissing() {
- String testProperty = "notSetProperty";
-
- assertThat(getProductBooleanProperty(testProperty).isPresent()).isFalse();
- }
-
- @Test
- public void getBooleanPropertyPrefersGeodePrefix() {
- String testProperty = "testBooleanProperty";
- String gemfirePrefixProperty = "gemfire." + testProperty;
- String geodePrefixProperty = "geode." + testProperty;
- System.setProperty(geodePrefixProperty, "true");
- System.setProperty(gemfirePrefixProperty, "false");
-
- assertThat(getProductBooleanProperty(testProperty).get()).isTrue();
- }
-
- @Test
- public void getBooleanPropertyReturnsGemfirePrefixIfGeodeMissing() {
- String testProperty = "testBooleanProperty";
- String gemfirePrefixProperty = "gemfire." + testProperty;
- System.setProperty(gemfirePrefixProperty, "true");
-
- assertThat(getProductBooleanProperty(testProperty).get()).isTrue();
- }
-}
diff --git a/geode-connectors/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeConnectorsSerializablesIntegrationTest.java b/geode-connectors/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeConnectorsSerializablesIntegrationTest.java
index db50c2f1b5..a5fa5a10b7 100644
--- a/geode-connectors/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeConnectorsSerializablesIntegrationTest.java
+++ b/geode-connectors/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeConnectorsSerializablesIntegrationTest.java
@@ -23,7 +23,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
public class AnalyzeConnectorsSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+ extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-connectors/src/integrationTest/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesServiceIntegrationTest.java b/geode-connectors/src/integrationTest/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesServiceIntegrationTest.java
index 9a1be57fc2..7a6d11a670 100644
--- a/geode-connectors/src/integrationTest/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-connectors/src/integrationTest/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.connectors.jdbc.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesService.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesService.java
index 007978bf21..76b53902dc 100644
--- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesService.java
+++ b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/ConnectorsSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.connectors.jdbc.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class ConnectorsSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-connectors/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-connectors/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-connectors/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-connectors/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 0ed1e47434..143ac46dff 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -312,13 +312,13 @@ dependencies {
//RMIIO is used for uploading jar files and copying them between locator an servers
implementation('com.healthmarketscience.rmiio:rmiio')
- //Geode-common has annotations and other pieces used geode-core
- api(project(':geode-common'))
- implementation(project(':geode-logging'))
- implementation(project(':geode-membership'))
- implementation(project(':geode-unsafe'))
- api(project(':geode-serialization'))
- implementation(project(':geode-tcp-server'))
+ //Geode-common has annotations and other pieces used geode-core
+ api(project(':geode-common'))
+ implementation(project(':geode-logging'))
+ implementation(project(':geode-membership'))
+ implementation(project(':geode-unsafe'))
+ implementation(project(':geode-serialization'))
+ implementation(project(':geode-tcp-server'))
//geode-management currently has pieces of the public API
//copied into it, so it is an API dependency
@@ -331,7 +331,6 @@ dependencies {
exclude module: 'geode-core'
}
testImplementation(project(':geode-concurrency-test'))
- testImplementation(project(':geode-serialization'))
testImplementation('org.apache.bcel:bcel')
testImplementation('org.assertj:assertj-core')
testImplementation('org.mockito:mockito-core')
@@ -363,7 +362,6 @@ dependencies {
exclude module: 'geode-core'
}
integrationTestImplementation(project(':geode-concurrency-test'))
- integrationTestImplementation(project(':geode-serialization'))
integrationTestImplementation('org.apache.bcel:bcel')
integrationTestImplementation('org.apache.logging.log4j:log4j-core')
integrationTestImplementation('org.powermock:powermock-core')
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/cache/ValidateSerializableObjectsDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/cache/ValidateSerializableObjectsDistributedTest.java
deleted file mode 100644
index 6a90616c2f..0000000000
--- a/geode-core/src/distributedTest/java/org/apache/geode/cache/ValidateSerializableObjectsDistributedTest.java
+++ /dev/null
@@ -1,320 +0,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.
- */
-package org.apache.geode.cache;
-
-import static java.util.Arrays.asList;
-import static org.apache.geode.cache.RegionShortcut.REPLICATE;
-import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.VALIDATE_SERIALIZABLE_OBJECTS;
-import static org.apache.geode.test.dunit.DistributedTestUtils.getLocatorPort;
-import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
-import static org.apache.geode.test.dunit.VM.getVM;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.catchThrowable;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InvalidClassException;
-import java.io.NotSerializableException;
-import java.io.Serializable;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.geode.InternalGemFireException;
-import org.apache.geode.SerializationException;
-import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.distributed.ServerLauncher;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.rules.DistributedReference;
-import org.apache.geode.test.dunit.rules.DistributedRule;
-import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
-
-@SuppressWarnings("serial")
-public class ValidateSerializableObjectsDistributedTest implements Serializable {
-
- private VM server1;
- private VM server2;
-
- private File server1Dir;
- private File server2Dir;
- private int locatorPort;
-
- @Rule
- public DistributedRule distributedRule = new DistributedRule();
- @Rule
- public DistributedReference<ServerLauncher> server = new DistributedReference<>();
- @Rule
- public SerializableTemporaryFolder temporaryFolder = new SerializableTemporaryFolder();
-
- @Before
- public void setUp() throws IOException {
- server1 = getVM(0);
- server2 = getVM(1);
-
- server1Dir = temporaryFolder.newFolder("server1");
- server2Dir = temporaryFolder.newFolder("server2");
-
- locatorPort = getLocatorPort();
-
- server1.invoke(() -> {
- server.set(startServer("server1", server1Dir));
- });
- server2.invoke(() -> {
- server.set(startServer("server2", server2Dir));
- });
-
- asList(server1, server2).forEach(vm -> vm.invoke(() -> {
- server.get().getCache()
- .createRegionFactory(REPLICATE)
- .addCacheListener(new CacheListenerAdapter<Object, Object>() {
- @Override
- public void afterCreate(EntryEvent<Object, Object> event) {
- // cache listener afterCreate causes all creates to deserialize the value which causes
- // the tests to pass if serialization filter is configured
- assertThat(event.getNewValue()).isNotNull();
- }
- })
- .create("region");
- }));
- }
-
- @Test
- public void stringIsAllowed() {
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = "key";
- Object value = "value";
-
- // puts entry locally and propagates to server2
- region.put(key, value);
-
- // entry exists in server1
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isSameAs(value);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = "key";
- Object value = "value";
-
- // entry exists in server2
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isEqualTo(value);
- });
- }
-
- @Test
- public void primitiveIsAllowed() {
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = 1;
- Object value = 1;
-
- // puts entry locally and propagates to server2
- region.put(key, value);
-
- // entry exists in server1
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isSameAs(value);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = 1;
- Object value = 1;
-
- // entry exists in server2
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isEqualTo(value);
- });
- }
-
- @Test
- public void nonSerializableThrowsNotSerializableException() {
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new Object();
- Object value = new Object();
-
- // put stores entry locally and then tries to propagate to server2
- Throwable thrown = catchThrowable(() -> {
- region.put(key, value);
- });
-
- // key and value fail to serialize non-serializable objects in server1
- assertThat(thrown).hasCauseExactlyInstanceOf(NotSerializableException.class);
-
- // entry exists in server1 despite serialization failure
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isSameAs(value);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new Object();
-
- // entry does NOT exist in server2 at all
- assertThat(region.containsKey(key)).isFalse();
- assertThat(region.get(key)).isNull();
- });
- }
-
- @Test
- public void nonAllowedValueFailsToDeserializeInOtherServer() {
- addIgnoredException(InvalidClassException.class);
- addIgnoredException(SerializationException.class);
-
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = "key";
- Object value = new SerializableClass();
-
- // put stores entry locally and sends serialized key/value to server2
- region.put(key, value);
-
- // entry exists in server1
- assertThat(region.get(key)).isInstanceOf(SerializableClass.class);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = "key";
-
- // key exists in server2
- assertThat(region.containsKey(key)).isTrue();
-
- // get tries to fetch value from server1 if it's missing in server2
- Throwable thrown = catchThrowable(() -> {
- region.get(key);
- });
-
- // value fails to deserialize in server2
- assertThat(thrown)
- .isInstanceOf(SerializationException.class)
- .hasCauseInstanceOf(InvalidClassException.class);
- });
- }
-
- @Test
- public void nonAllowedKeyFailsToDeserializeInOtherServer() {
- addIgnoredException(InvalidClassException.class);
- addIgnoredException(IOException.class);
-
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new SerializableClass();
- Object value = "value";
-
- // put stores entry locally and ails to serialize for propagation to server2
- Throwable thrown = catchThrowable(() -> {
- region.put(key, value);
- });
-
- // put fails to create entry locally because key is not serializable
- assertThat(thrown)
- .isInstanceOf(InternalGemFireException.class)
- .hasCauseInstanceOf(IOException.class)
- .hasRootCauseInstanceOf(InvalidClassException.class);
-
- // entry exists in server1
- assertThat(region.containsKey(key)).isTrue();
- assertThat(region.get(key)).isEqualTo(value);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new Object();
-
- // entry does NOT exist in server2
- assertThat(region.containsKey(key)).isFalse();
- assertThat(region.get(key)).isNull();
- });
- }
-
- @Test
- public void nonAllowedKeyAndValueThrowsInsteadOfPutting() {
- addIgnoredException(InvalidClassException.class);
- addIgnoredException(IOException.class);
-
- server1.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new SerializableClass();
- Object value = new SerializableClass();
-
- // put stores entry locally tries sending to server/key to server2
- Throwable thrown = catchThrowable(() -> {
- region.put(key, value);
- });
-
- // value fails to propagate to server2
- assertThat(thrown)
- .isInstanceOf(InternalGemFireException.class)
- .hasCauseInstanceOf(IOException.class)
- .hasRootCauseInstanceOf(InvalidClassException.class);
- });
-
- server2.invoke(() -> {
- Region<Object, Object> region = server.get().getCache().getRegion("region");
-
- Object key = new SerializableClass();
-
- // entry does NOT exist in server2
- assertThat(region.containsKey(key)).isFalse();
- assertThat(region.get(key)).isNull();
- });
- }
-
- private ServerLauncher startServer(String serverName, File serverDir) {
- ServerLauncher serverLauncher = new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setDeletePidFileOnStop(true)
- .setMemberName(serverName)
- .setWorkingDirectory(serverDir.getAbsolutePath())
- .setServerPort(0)
- .set(ENABLE_CLUSTER_CONFIGURATION, "false")
- .set(LOCATORS, "localHost[" + locatorPort + "]")
- .set(VALIDATE_SERIALIZABLE_OBJECTS, "true")
- .build();
-
- serverLauncher.start();
-
- return serverLauncher;
- }
-
- /**
- * Simple Java serializable class that is not accept listed using serializable-object-filter.
- * Deserialization of instances of this type will be rejected when validate-serializable-objects
- * is enabled.
- */
- public static class SerializableClass implements Serializable {
- }
-}
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorLauncherTest.java
similarity index 97%
rename from geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
rename to geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 5bcb6d4bea..d7ba3c599f 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -30,7 +30,7 @@ import org.apache.geode.distributed.internal.InternalLocator;
public class LocatorLauncherTest {
@Test
- public void canBeMocked() {
+ public void canBeMocked() throws Exception {
LocatorLauncher mockLocatorLauncher = mock(LocatorLauncher.class);
InternalLocator mockInternalLocator = mock(InternalLocator.class);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/BrokenSerializationConsistencyRegressionTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/BrokenSerializationConsistencyRegressionTest.java
index 48c3ee8539..be39bbd894 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/BrokenSerializationConsistencyRegressionTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/BrokenSerializationConsistencyRegressionTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.internal.cache;
import static org.apache.geode.cache.RegionShortcut.REPLICATE;
import static org.apache.geode.internal.lang.SystemPropertyHelper.EARLY_ENTRY_EVENT_SERIALIZATION;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.test.dunit.VM.getVM;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@@ -34,7 +35,6 @@ import org.apache.geode.DataSerializable;
import org.apache.geode.ToDataException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionFactory;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.pdx.PdxReader;
import org.apache.geode.pdx.PdxSerializable;
import org.apache.geode.pdx.PdxWriter;
@@ -67,11 +67,11 @@ public class BrokenSerializationConsistencyRegressionTest implements Serializabl
public void setUpAll() {
vm0 = getVM(0);
- System.setProperty(SystemProperty.DEFAULT_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
+ System.setProperty(GEODE_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
createReplicateRegions();
vm0.invoke(() -> {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
+ System.setProperty(GEODE_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
createReplicateRegions();
});
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientDeserializationCopyOnReadRegressionTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientDeserializationCopyOnReadRegressionTest.java
index a43c696461..5b1d5eff56 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientDeserializationCopyOnReadRegressionTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientDeserializationCopyOnReadRegressionTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.internal.cache;
import static org.apache.geode.distributed.ConfigurationProperties.DELTA_PROPAGATION;
import static org.apache.geode.internal.lang.SystemPropertyHelper.EARLY_ENTRY_EVENT_SERIALIZATION;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
@@ -51,7 +52,6 @@ import org.apache.geode.internal.cache.ha.HARegionQueue;
import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.Invoke;
import org.apache.geode.test.dunit.NetworkUtils;
import org.apache.geode.test.dunit.VM;
@@ -113,10 +113,9 @@ public class ClientDeserializationCopyOnReadRegressionTest extends ClientServerT
@Test
public void testCopyOnReadWithBridgeServer() {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
+ System.setProperty(GEODE_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
Invoke.invokeInEveryVM(
- () -> System.setProperty(SystemProperty.DEFAULT_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION,
- "true"));
+ () -> System.setProperty(GEODE_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true"));
createBridgeServer(server, rName, ports[0]);
// Put an instance of SerializationCounter to assert copy-on-read behavior
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DeltaPropagationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DeltaPropagationDUnitTest.java
index 41000e2c26..c78c576ada 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DeltaPropagationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DeltaPropagationDUnitTest.java
@@ -30,7 +30,7 @@ import static org.apache.geode.internal.AvailablePort.SOCKET;
import static org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
import static org.apache.geode.internal.cache.CacheServerImpl.generateNameForClientMsgsRegion;
import static org.apache.geode.internal.cache.tier.sockets.CacheClientProxyFactory.INTERNAL_FACTORY_PROPERTY;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout;
import static org.apache.geode.test.dunit.VM.getController;
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java
index 3fc5505650..43019bf919 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java
@@ -22,7 +22,7 @@ import static org.apache.geode.cache.RegionShortcut.PARTITION;
import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX;
import static org.apache.geode.management.ManagementService.getExistingManagementService;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout;
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationComplexDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationComplexDistributedTest.java
index b0853e5ab3..97734372af 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationComplexDistributedTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/control/RebalanceOperationComplexDistributedTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache.control;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.geode.distributed.ConfigurationProperties.REDUNDANCY_ZONE;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
@@ -44,7 +45,6 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.control.ResourceManager;
import org.apache.geode.internal.cache.PartitionedRegion;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.dunit.VM;
@@ -217,7 +217,7 @@ public class RebalanceOperationComplexDistributedTest implements Serializable {
if (!temporaryDirectory.exists()) {
Files.createDirectory(temporaryDirectory.toPath());
}
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, path);
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, path);
});
clusterStartupRule.startServerVM(index, s -> s.withProperty("cache-xml-file",
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
index a6055732f1..176827850e 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
@@ -20,7 +20,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.DELTA_PROPAGA
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.apache.geode.internal.cache.CacheServerImpl.generateNameForClientMsgsRegion;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.dunit.NetworkUtils.getServerHostName;
import static org.assertj.core.api.Assertions.assertThat;
@@ -209,7 +209,8 @@ public class HARQueueNewImplDUnitTest extends JUnit4DistributedTestCase {
public static void createClientCache(String host, Integer port1, Integer port2, String rLevel,
Boolean addListener) throws Exception {
- System.setProperty(GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "true");
+ System.setProperty(GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints",
+ "true");
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueExpiryRegressionTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueExpiryRegressionTest.java
index 917b5e3d22..f524c38955 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueExpiryRegressionTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueExpiryRegressionTest.java
@@ -18,6 +18,7 @@ import static org.apache.geode.cache30.ClientServerTestCase.configureConnectionP
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.apache.geode.internal.cache.tier.sockets.ConflationDUnitTestHelper.setIsSlowStart;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.internal.lang.SystemPropertyHelper.HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.dunit.Host.getHost;
@@ -43,7 +44,6 @@ import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.Scope;
import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.cache.CacheTestCase;
import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
@@ -129,8 +129,7 @@ public class HARegionQueueExpiryRegressionTest extends CacheTestCase {
}
private int createServerCache() throws IOException {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY,
- String.valueOf(1));
+ System.setProperty(GEODE_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY, String.valueOf(1));
System.setProperty("slowStartTimeForTesting", String.valueOf(DISPATCHER_SLOWSTART_TIME));
AttributesFactory factory = new AttributesFactory();
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueThreadIdExpiryRegressionTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueThreadIdExpiryRegressionTest.java
index 90d7f9911a..47b9d4d73a 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueThreadIdExpiryRegressionTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueThreadIdExpiryRegressionTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.internal.cache.ha;
import static org.apache.geode.cache.RegionShortcut.REPLICATE;
import static org.apache.geode.cache.client.ClientRegionShortcut.CACHING_PROXY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.internal.lang.SystemPropertyHelper.HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY;
import static org.apache.geode.internal.lang.SystemPropertyHelper.THREAD_ID_EXPIRY_TIME_PROPERTY;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
@@ -38,7 +39,6 @@ import org.apache.geode.cache.client.ClientRegionFactory;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.rules.CacheRule;
import org.apache.geode.test.dunit.rules.ClientCacheRule;
@@ -110,10 +110,8 @@ public class HARegionQueueThreadIdExpiryRegressionTest implements Serializable {
}
private int createCacheServer() throws IOException {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY,
- EXPIRY_TIME_SECONDS);
- System.setProperty(SystemProperty.DEFAULT_PREFIX + THREAD_ID_EXPIRY_TIME_PROPERTY,
- EXPIRY_TIME_SECONDS);
+ System.setProperty(GEODE_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY, EXPIRY_TIME_SECONDS);
+ System.setProperty(GEODE_PREFIX + THREAD_ID_EXPIRY_TIME_PROPERTY, EXPIRY_TIME_SECONDS);
cacheRule.createCache();
cacheRule.getCache().setMessageSyncInterval(MESSAGE_SYNC_INTERVAL_SECONDS);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
index 4b73a46cd8..63e0f0e4c9 100755
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.internal.cache.tier.sockets;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
import static org.apache.geode.test.dunit.Disconnect.disconnectAllFromDS;
import static org.apache.geode.test.dunit.VM.getController;
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCoreSerializablesIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCoreSerializablesIntegrationTest.java
index d93d8d1dee..6832442b5b 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCoreSerializablesIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCoreSerializablesIntegrationTest.java
@@ -22,8 +22,7 @@ import org.apache.geode.internal.CoreSanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
-public class AnalyzeCoreSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeCoreSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java
index 92212a83b3..fafb051d24 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java
@@ -15,56 +15,85 @@
package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_HTTP_PORT;
import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATOR_WAIT_TIME;
import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPort;
-import static org.apache.geode.internal.security.SecurableCommunicationChannel.LOCATOR;
+import static org.apache.geode.internal.AvailablePort.SOCKET;
+import static org.apache.geode.internal.AvailablePort.getRandomAvailablePort;
+import static org.apache.geode.util.internal.GeodeGlossary.GEMFIRE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Properties;
+import java.util.function.IntSupplier;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
import org.junit.experimental.categories.Category;
import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+import org.junit.runners.Parameterized.UseParametersRunnerFactory;
import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.ServerLocation;
import org.apache.geode.distributed.internal.tcpserver.HostAndPort;
import org.apache.geode.distributed.internal.tcpserver.TcpClient;
import org.apache.geode.distributed.internal.tcpserver.TcpSocketFactory;
+import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.net.SocketCreatorFactory;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.logging.internal.OSProcess;
-import org.apache.geode.management.ManagementService;
import org.apache.geode.management.internal.JmxManagerAdvisor.JmxManagerProfile;
-import org.apache.geode.management.internal.SystemManagementService;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusRequest;
import org.apache.geode.test.junit.categories.MembershipTest;
+import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
-@Category(MembershipTest.class)
+@Category({MembershipTest.class})
+@RunWith(Parameterized.class)
+@UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
public class LocatorIntegrationTest {
private Locator locator;
- private File logFile;
+ private File tmpFile;
private int port;
+ @Parameters
+ public static Collection<Object> data() {
+ return Arrays.asList(new Object[] {
+ (IntSupplier) () -> 0,
+ (IntSupplier) AvailablePortHelper::getRandomAvailableTCPPort});
+ }
+
+ @Parameter
+ public IntSupplier portSupplier;
+
+ @Rule
+ public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Before
public void setUp() throws IOException {
- logFile = temporaryFolder.newFile("locator.log");
+ tmpFile = File.createTempFile("locator", ".log");
+ port = portSupplier.getAsInt();
+ deleteLocatorViewFile(port);
}
@After
@@ -72,22 +101,21 @@ public class LocatorIntegrationTest {
if (locator != null) {
locator.stop();
}
- deleteLocatorViewFile(port);
+ assertThat(Locator.hasLocator()).isFalse();
}
/**
* Fix: locator creates "locator0view.dat" file when started with port 0
*/
@Test
- public void doesNotCreateZeroPortViewFileForEphemeralPort() throws Exception {
+ public void testThatLocatorDoesNotCreateFileWithZeroPort() throws Exception {
deleteLocatorViewFile(0);
Properties configProperties = new Properties();
+ configProperties.setProperty(MCAST_PORT, "0");
configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(JMX_MANAGER, "false");
+ configProperties.setProperty(LOCATOR_WAIT_TIME, "1"); // seconds
configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
locator = Locator.startLocatorAndDS(port, null, configProperties);
@@ -96,121 +124,75 @@ public class LocatorIntegrationTest {
assertThat(viewFile).doesNotExist();
}
- @Test
- public void locatorStartsOnSpecifiedPort() throws IOException {
- Properties configProperties = new Properties();
- configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(JMX_MANAGER, "false");
- configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
-
- port = getRandomAvailableTCPPort();
- locator = Locator.startLocatorAndDS(port, null, configProperties);
-
- port = locator.getPort();
- assertThat(port).isEqualTo(port);
- }
-
- @Test
- public void locatorStartsOnEphemeralPort() throws IOException {
- Properties configProperties = new Properties();
- configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(JMX_MANAGER, "false");
- configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
-
- locator = Locator.startLocatorAndDS(0, null, configProperties);
-
- port = locator.getPort();
- assertThat(port).isNotZero();
- }
-
/**
* Fix: if jmx-manager-start is true in a locator then gfsh connect will fail
*/
@Test
- public void gfshConnectsIfJmxManagerStartIsTrue() throws Exception {
- int jmxPort = getRandomAvailableTCPPort();
+ public void testGfshConnectShouldSucceedIfJmxManagerStartIsTrueInLocator() throws Exception {
+ int jmxPort = getRandomAvailablePort(SOCKET);
Properties configProperties = new Properties();
- configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
+ configProperties.setProperty(MCAST_PORT, "0");
+ configProperties.setProperty(JMX_MANAGER_PORT, "" + jmxPort);
configProperties.setProperty(JMX_MANAGER_START, "true");
+ configProperties.setProperty(JMX_MANAGER_HTTP_PORT, "0");
+ configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
+
+ // not needed
+ System.setProperty(GEMFIRE_PREFIX + "disableManagement", "false");
locator = Locator.startLocatorAndDS(port, null, configProperties);
- InternalLocator internalLocator = (InternalLocator) locator;
- InternalCache cache = internalLocator.getCache();
- List<JmxManagerProfile> alreadyManaging = cache.getJmxManagerAdvisor().adviseAlreadyManaging();
+ List<JmxManagerProfile> alreadyManaging =
+ GemFireCacheImpl.getInstance().getJmxManagerAdvisor().adviseAlreadyManaging();
assertThat(alreadyManaging).hasSize(1);
- assertThat(alreadyManaging.get(0).getDistributedMember()).isEqualTo(cache.getMyId());
+ assertThat(alreadyManaging.get(0).getDistributedMember())
+ .isEqualTo(GemFireCacheImpl.getInstance().getMyId());
}
@Test
- public void hasHandlerForSharedConfigurationStatusRequest() throws Exception {
+ public void testHandlersAreWaitedOn() throws Exception {
Properties configProperties = new Properties();
+ configProperties.setProperty(MCAST_PORT, "0");
configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(JMX_MANAGER, "false");
+ configProperties.setProperty(LOCATOR_WAIT_TIME, "1"); // seconds
configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
locator = Locator.startLocatorAndDS(port, null, configProperties);
InternalLocator internalLocator = (InternalLocator) locator;
// the locator should always install a SharedConfigurationStatusRequest handler
- boolean hasHandler = internalLocator.hasHandlerForClass(SharedConfigurationStatusRequest.class);
- assertThat(hasHandler).isTrue();
- }
-
- @Test
- public void infoRequestIncludesActualPortWhenSpecifiedPortIsZero() throws Exception {
- locator = Locator.startLocator(0, logFile);
- port = locator.getPort();
- TcpClient client = new TcpClient(
- SocketCreatorFactory.getSocketCreatorForComponent(LOCATOR),
- InternalDataSerializer.getDSFIDSerializer().getObjectSerializer(),
- InternalDataSerializer.getDSFIDSerializer().getObjectDeserializer(),
- TcpSocketFactory.DEFAULT);
-
- String[] info = client.getInfo(new HostAndPort("localhost", port));
-
- assertThat(info).isNotNull();
- assertThat(info.length).isGreaterThanOrEqualTo(1);
+ assertThat(internalLocator.hasHandlerForClass(SharedConfigurationStatusRequest.class)).isTrue();
}
@Test
- public void infoRequestIncludesActualPortWhenSpecifiedIsNonZero() throws Exception {
- locator = Locator.startLocator(getRandomAvailableTCPPort(), logFile);
- port = locator.getPort();
- TcpClient client = new TcpClient(
- SocketCreatorFactory.getSocketCreatorForComponent(LOCATOR),
+ public void testBasicInfo() throws Exception {
+ locator = Locator.startLocator(port, tmpFile);
+ int boundPort = port == 0 ? locator.getPort() : port;
+ TcpClient client = new TcpClient(SocketCreatorFactory
+ .getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR),
InternalDataSerializer.getDSFIDSerializer().getObjectSerializer(),
InternalDataSerializer.getDSFIDSerializer().getObjectDeserializer(),
TcpSocketFactory.DEFAULT);
-
- String[] info = client.getInfo(new HostAndPort("localhost", port));
+ String[] info = client.getInfo(new HostAndPort("localhost", boundPort));
assertThat(info).isNotNull();
assertThat(info.length).isGreaterThanOrEqualTo(1);
}
@Test
- public void threadsAreCleanedUpWhenStartFails() throws Exception {
+ public void testNoThreadLeftBehind() throws Exception {
Properties configProperties = new Properties();
- configProperties.setProperty(LOG_FILE, "");
configProperties.setProperty(MCAST_PORT, "0");
+ configProperties.setProperty(JMX_MANAGER_START, "false");
+ configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
int threadCount = Thread.activeCount();
Throwable thrown = catchThrowable(
- () -> locator = Locator.startLocatorAndDS(-2, null, configProperties));
+ () -> locator = Locator.startLocatorAndDS(-2, new File(""), configProperties));
assertThat(thrown).isInstanceOf(IllegalArgumentException.class);
@@ -225,31 +207,22 @@ public class LocatorIntegrationTest {
assertThat(threadCount)
.as("Expected " + threadCount + " threads or fewer but found " + Thread.activeCount()
+ ". Check log file for a thread dump.")
- .withThreadDumpOnError()
.isGreaterThanOrEqualTo(Thread.activeCount());
}
/**
- * Validates that Locator.startLocatorAndDS does not start a JMX Manager by default. Only the
- * LocatorLauncher starts one by default.
+ * Make sure two ServerLocation objects on different hosts but with the same port are not equal
+ *
+ * <p>
+ * Fix: LoadBalancing directs all traffic to a single cache server if all servers are started on
+ * the same port
*/
@Test
- public void doesNotStartJmxManagerByDefault() throws Exception {
- Properties configProperties = new Properties();
- configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
- configProperties.setProperty(HTTP_SERVICE_PORT, "0");
- configProperties.setProperty(LOG_FILE, "");
- configProperties.setProperty(MCAST_PORT, "0");
-
- locator = Locator.startLocatorAndDS(port, null, configProperties);
-
- InternalLocator internalLocator = (InternalLocator) locator;
- InternalCache cache = internalLocator.getCache();
- SystemManagementService managementService =
- (SystemManagementService) ManagementService.getManagementService(cache);
+ public void testServerLocationOnDifferentHostsShouldNotTestEqual() {
+ ServerLocation serverLocation1 = new ServerLocation("host1", 777);
+ ServerLocation serverLocation2 = new ServerLocation("host2", 777);
- boolean isManager = managementService.isManager();
- assertThat(isManager).isFalse();
+ assertThat(serverLocation1).isNotEqualTo(serverLocation2);
}
private void deleteLocatorViewFile(int portNumber) {
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherJmxManagerLocalRegressionTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherJmxManagerLocalRegressionTest.java
index 430d8b1608..d304b91a42 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherJmxManagerLocalRegressionTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherJmxManagerLocalRegressionTest.java
@@ -35,7 +35,7 @@ import org.apache.geode.internal.process.ProcessType;
* Regression tests for stopping a JMX Manager process launched with {@link LocatorLauncher}.
*
* <p>
- * Confirms fix for <strong>Locator not stopping correctly if jmx-manager-port=0</strong>
+ * Confirms fix for <bold>Locator not stopping correctly if jmx-manager-port=0</bold>
*
* <p>
* Refactored from LocatorLauncherAssemblyIntegrationTest which used to be in geode-assembly.
@@ -104,26 +104,6 @@ public class LocatorLauncherJmxManagerLocalRegressionTest
assertThatThreadsStopped();
}
- @Test
- public void startsLocatorWithJmxManager() {
- startLocator(newBuilder()
- .setDeletePidFileOnStop(true)
- .setMemberName(getUniqueName())
- .setPort(defaultLocatorPort)
- .setRedirectOutput(false)
- .setWorkingDirectory(getWorkingDirectoryPath())
- .set(ENABLE_CLUSTER_CONFIGURATION, "false")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_START, "true")
- .set(JMX_MANAGER_PORT, String.valueOf(jmxManagerPort))
- .set(LOG_LEVEL, "config"));
-
- stopLocator();
-
- assertDeletionOf(getPidFile());
- assertThatThreadsStopped();
- }
-
private void assertThatThreadsStopped() {
await()
.atMost(AWAIT_MILLIS, MILLISECONDS)
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/CoreSanctionedSerializablesServiceIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/CoreSanctionedSerializablesServiceIntegrationTest.java
index 36e0623f4f..feeb08d411 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/CoreSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/CoreSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
index accf6cc103..8c19f7418a 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ha/HARegionQueueJUnitTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.internal.cache.ha;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.internal.lang.SystemPropertyHelper.HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY;
import static org.apache.geode.internal.statistics.StatisticsClockFactory.disabledClock;
import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
@@ -79,7 +80,6 @@ import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import org.apache.geode.internal.cache.tier.sockets.HAEventWrapper;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.ThreadUtils;
import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
@@ -1350,7 +1350,7 @@ public class HARegionQueueJUnitTest {
*/
@Test
public void testExpiryUsingSystemProperty() throws Exception {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY, "1");
+ System.setProperty(GEODE_PREFIX + HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY, "1");
HARegionQueueAttributes haa = new HARegionQueueAttributes();
HARegionQueue regionQueue = createHARegionQueue(testName.getMethodName(), haa);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsIntegrationTest.java
index 4061769831..c5201d8efa 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsIntegrationTest.java
@@ -18,6 +18,7 @@ package org.apache.geode.internal.cache.persistence;
import static org.apache.geode.internal.cache.persistence.DefaultDiskDirs.getDefaultDiskDirs;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Rule;
@@ -26,7 +27,6 @@ import org.junit.contrib.java.lang.system.RestoreSystemProperties;
import org.junit.experimental.categories.Category;
import org.junit.rules.TemporaryFolder;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.junit.categories.PersistenceTest;
@Category({PersistenceTest.class})
@@ -40,7 +40,7 @@ public class DefaultDiskDirsIntegrationTest {
@Test
public void getDefaultDiskDirsReturnsOverriddenValue() {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
temporaryFolder.getRoot().getAbsolutePath());
assertThat(getDefaultDiskDirs()[0]).exists().isEqualTo(temporaryFolder.getRoot());
}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterBlankIntegrationTest.java
deleted file mode 100644
index 0b352c4656..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterBlankIntegrationTest.java
+++ /dev/null
@@ -1,55 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsSameAs;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherGlobalSerialFilterBlankIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenFilterIsBlank()
- throws InvocationTargetException, IllegalAccessException {
- Object existingGlobalSerialFilter = OBJECT_INPUT_FILTER_API.createFilter(" ");
- OBJECT_INPUT_FILTER_API.setSerialFilter(existingGlobalSerialFilter);
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsSameAs(existingGlobalSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterExistsIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterExistsIntegrationTest.java
deleted file mode 100644
index c948f595fe..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterExistsIntegrationTest.java
+++ /dev/null
@@ -1,55 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsSameAs;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherGlobalSerialFilterExistsIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenFilterExists()
- throws InvocationTargetException, IllegalAccessException {
- Object existingGlobalSerialFilter = OBJECT_INPUT_FILTER_API.createFilter("!*");
- OBJECT_INPUT_FILTER_API.setSerialFilter(existingGlobalSerialFilter);
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsSameAs(existingGlobalSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterIntegrationTest.java
deleted file mode 100644
index 8be64f3204..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterIntegrationTest.java
+++ /dev/null
@@ -1,52 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsNull;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherGlobalSerialFilterIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenFilterDoesNotExist()
- throws InvocationTargetException, IllegalAccessException {
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java
deleted file mode 100644
index ea021f41cc..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java
+++ /dev/null
@@ -1,54 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsNull;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherGlobalSerialFilterPropertyBlankIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenPropertyIsBlank()
- throws InvocationTargetException, IllegalAccessException {
- System.setProperty(JDK_PROPERTY, " ");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java
deleted file mode 100644
index 52b46f69ed..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java
+++ /dev/null
@@ -1,54 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsNull;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherGlobalSerialFilterPropertyEmptyIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenPropertyIsEmpty()
- throws InvocationTargetException, IllegalAccessException {
- System.setProperty(JDK_PROPERTY, "");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterIntegrationTest.java
deleted file mode 100644
index 66f7137a38..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterIntegrationTest.java
+++ /dev/null
@@ -1,84 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherJmxSerialFilterIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyBlankIntegrationTest.java
deleted file mode 100644
index bb6b01b58c..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyBlankIntegrationTest.java
+++ /dev/null
@@ -1,88 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherJmxSerialFilterPropertyBlankIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_whenPropertyIsBlank_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- System.setProperty(JMX_PROPERTY, " ");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyIsBlank_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- System.setProperty(JMX_PROPERTY, " ");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(" ");
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java
deleted file mode 100644
index d924f6c1d6..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java
+++ /dev/null
@@ -1,88 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherJmxSerialFilterPropertyEmptyIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_whenPropertyIsEmpty_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- System.setProperty(JMX_PROPERTY, "");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyIsEmpty_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- System.setProperty(JMX_PROPERTY, "");
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo("");
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyExistsIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyExistsIntegrationTest.java
deleted file mode 100644
index 3de7ac24d8..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherJmxSerialFilterPropertyExistsIntegrationTest.java
+++ /dev/null
@@ -1,90 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.LocatorLauncher;
-
-public class LocatorLauncherJmxSerialFilterPropertyExistsIntegrationTest
- extends LocatorLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyExists_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- String existingJmxSerialFilter = "!*";
- System.setProperty(JMX_PROPERTY, existingJmxSerialFilter);
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(existingJmxSerialFilter);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyExists_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- String existingJmxSerialFilter = "!*";
- System.setProperty(JMX_PROPERTY, existingJmxSerialFilter);
-
- locator.set(new LocatorLauncher.Builder()
- .setMemberName(NAME)
- .setPort(locatorPort)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(existingJmxSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherWithJmxManager.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherWithJmxManager.java
deleted file mode 100644
index b18865c25a..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/LocatorLauncherWithJmxManager.java
+++ /dev/null
@@ -1,82 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-
-import java.nio.file.Path;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.distributed.LocatorLauncher;
-import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.test.junit.rules.CloseableReference;
-
-public abstract class LocatorLauncherWithJmxManager {
-
- static final String NAME = "locator";
- static final String JDK_PROPERTY = "jdk.serialFilter";
- static final String JMX_PROPERTY = "jmx.remote.rmi.server.serial.filter.pattern";
-
- static final ObjectInputFilterApi OBJECT_INPUT_FILTER_API =
- new ReflectiveObjectInputFilterApiFactory().createObjectInputFilterApi();
-
- Path workingDirectory;
- int locatorPort;
- int jmxPort;
- Path logFile;
- String openMBeanFilterPattern;
-
- @Rule
- public CloseableReference<LocatorLauncher> locator = new CloseableReference<>();
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
- public void setUpFiles() {
- workingDirectory = temporaryFolder.getRoot().toPath().toAbsolutePath();
- logFile = workingDirectory.resolve(NAME + ".log").toAbsolutePath();
- }
-
- @Before
- public void setUpPorts() {
- int[] ports = getRandomAvailableTCPPorts(2);
- jmxPort = ports[0];
- locatorPort = ports[1];
- }
-
- @Before
- public void setUpFilterPattern() {
- openMBeanFilterPattern = new OpenMBeanFilterPattern().pattern();
- }
-
- SystemManagementService getSystemManagementService() {
- InternalLocator locator = (InternalLocator) this.locator.get().getLocator();
- InternalCache cache = locator.getCache();
- return (SystemManagementService) ManagementService.getManagementService(cache);
- }
-
- boolean isJmxManagerStarted() {
- return getSystemManagementService().isManager();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/SerialFilterAssertions.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/SerialFilterAssertions.java
deleted file mode 100644
index 8432e7d7a1..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/SerialFilterAssertions.java
+++ /dev/null
@@ -1,58 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.lang.reflect.InvocationTargetException;
-
-@SuppressWarnings({"unused", "WeakerAccess"})
-public class SerialFilterAssertions {
-
- private static final ObjectInputFilterApi API = new ReflectiveObjectInputFilterApiFactory()
- .createObjectInputFilterApi();
-
- private SerialFilterAssertions() {
- // do not instantiate
- }
-
- public static void assertThatSerialFilterIsNull()
- throws InvocationTargetException, IllegalAccessException {
- assertThat(API.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isNull();
- }
-
- public static void assertThatSerialFilterIsNotNull()
- throws InvocationTargetException, IllegalAccessException {
- assertThat(API.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isNotNull();
- }
-
- public static void assertThatSerialFilterIsSameAs(Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException {
- assertThat(API.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isSameAs(objectInputFilter);
- }
-
- public static void assertThatSerialFilterIsNotSameAs(Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException {
- assertThat(API.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isNotSameAs(objectInputFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterBlankIntegrationTest.java
deleted file mode 100644
index 5cbb8c27c2..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterBlankIntegrationTest.java
+++ /dev/null
@@ -1,55 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsSameAs;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherGlobalSerialFilterBlankIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenFilterIsBlank()
- throws InvocationTargetException, IllegalAccessException {
- Object existingGlobalSerialFilter = OBJECT_INPUT_FILTER_API.createFilter(" ");
- OBJECT_INPUT_FILTER_API.setSerialFilter(existingGlobalSerialFilter);
-
- server.set(new ServerLauncher.Builder()
- .setMemberName(NAME)
- .setDisableDefaultServer(true)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsSameAs(existingGlobalSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterExistsIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterExistsIntegrationTest.java
deleted file mode 100644
index b5560c624a..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterExistsIntegrationTest.java
+++ /dev/null
@@ -1,55 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.internal.serialization.filter.SerialFilterAssertions.assertThatSerialFilterIsSameAs;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherGlobalSerialFilterExistsIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenFilterExists()
- throws InvocationTargetException, IllegalAccessException {
- Object existingGlobalSerialFilter = OBJECT_INPUT_FILTER_API.createFilter("!*");
- OBJECT_INPUT_FILTER_API.setSerialFilter(existingGlobalSerialFilter);
-
- server.set(new ServerLauncher.Builder()
- .setMemberName(NAME)
- .setDisableDefaultServer(true)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThatSerialFilterIsSameAs(existingGlobalSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterIntegrationTest.java
deleted file mode 100644
index 7c90152d58..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterIntegrationTest.java
+++ /dev/null
@@ -1,51 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherGlobalSerialFilterIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter() {
- server.set(new ServerLauncher.Builder()
- .setMemberName(NAME)
- .setDisableDefaultServer(true)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(System.getProperty(JDK_PROPERTY))
- .as(JDK_PROPERTY)
- .isNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java
deleted file mode 100644
index 6fb95dfa95..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyBlankIntegrationTest.java
+++ /dev/null
@@ -1,53 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherGlobalSerialFilterPropertyBlankIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenPropertyIsBlank() {
- System.setProperty(JDK_PROPERTY, " ");
-
- server.set(new ServerLauncher.Builder()
- .setMemberName(NAME)
- .setDisableDefaultServer(true)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(System.getProperty(JDK_PROPERTY))
- .as(JDK_PROPERTY)
- .isEqualTo(" ");
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java
deleted file mode 100644
index e34d4001bf..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherGlobalSerialFilterPropertyEmptyIntegrationTest.java
+++ /dev/null
@@ -1,53 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherGlobalSerialFilterPropertyEmptyIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureGlobalSerialFilter_whenPropertyIsEmpty() {
- System.setProperty(JDK_PROPERTY, "");
-
- server.set(new ServerLauncher.Builder()
- .setMemberName(NAME)
- .setDisableDefaultServer(true)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(System.getProperty(JDK_PROPERTY))
- .as(JDK_PROPERTY)
- .isEmpty();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterIntegrationTest.java
deleted file mode 100644
index cf4c851a93..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterIntegrationTest.java
+++ /dev/null
@@ -1,87 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherJmxSerialFilterIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- /**
- * The system property for the JmxSerialFilter was not added until Java 9.
- */
- @Test
- public void startDoesNotConfigureJmxSerialFilter_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isNull();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyBlankIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyBlankIntegrationTest.java
deleted file mode 100644
index 26aa5ed49e..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyBlankIntegrationTest.java
+++ /dev/null
@@ -1,88 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherJmxSerialFilterPropertyBlankIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_whenPropertyIsBlank_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- System.setProperty(JMX_PROPERTY, " ");
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyIsBlank_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- System.setProperty(JMX_PROPERTY, " ");
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(" ");
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java
deleted file mode 100644
index 68232a2417..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyEmptyIntegrationTest.java
+++ /dev/null
@@ -1,88 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherJmxSerialFilterPropertyEmptyIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startConfiguresJmxSerialFilter_whenPropertyIsEmpty_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- System.setProperty(JMX_PROPERTY, "");
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(openMBeanFilterPattern);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyIsEmpty_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- System.setProperty(JMX_PROPERTY, "");
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo("");
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyExistsIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyExistsIntegrationTest.java
deleted file mode 100644
index 05e33ac930..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherJmxSerialFilterPropertyExistsIntegrationTest.java
+++ /dev/null
@@ -1,90 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assumptions.assumeThat;
-
-import org.junit.Test;
-
-import org.apache.geode.distributed.ServerLauncher;
-
-public class ServerLauncherJmxSerialFilterPropertyExistsIntegrationTest
- extends ServerLauncherWithJmxManager {
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyExists_onJava9orGreater() {
- assumeThat(isJavaVersionAtLeast(JAVA_9)).isTrue();
-
- String existingJmxSerialFilter = "!*";
- System.setProperty(JMX_PROPERTY, existingJmxSerialFilter);
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(existingJmxSerialFilter);
- }
-
- @Test
- public void startDoesNotConfigureJmxSerialFilter_whenPropertyExists_onJava8() {
- assumeThat(isJavaVersionAtMost(JAVA_1_8)).isTrue();
-
- String existingJmxSerialFilter = "!*";
- System.setProperty(JMX_PROPERTY, existingJmxSerialFilter);
-
- server.set(new ServerLauncher.Builder()
- .setDisableDefaultServer(true)
- .setMemberName(NAME)
- .setWorkingDirectory(valueOf(workingDirectory))
- .set(HTTP_SERVICE_PORT, "0")
- .set(JMX_MANAGER, "true")
- .set(JMX_MANAGER_PORT, valueOf(jmxPort))
- .set(JMX_MANAGER_START, "true")
- .set(LOG_FILE, valueOf(logFile))
- .build())
- .get()
- .start();
-
- assertThat(isJmxManagerStarted())
- .isTrue();
- assertThat(System.getProperty(JMX_PROPERTY))
- .as(JMX_PROPERTY)
- .isEqualTo(existingJmxSerialFilter);
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherWithJmxManager.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherWithJmxManager.java
deleted file mode 100644
index a47c83a501..0000000000
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ServerLauncherWithJmxManager.java
+++ /dev/null
@@ -1,77 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPort;
-
-import java.nio.file.Path;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.distributed.ServerLauncher;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.test.junit.rules.CloseableReference;
-
-public abstract class ServerLauncherWithJmxManager {
-
- static final String NAME = "server";
- static final String JDK_PROPERTY = "jdk.serialFilter";
- static final String JMX_PROPERTY = "jmx.remote.rmi.server.serial.filter.pattern";
-
- static final ObjectInputFilterApi OBJECT_INPUT_FILTER_API =
- new ReflectiveObjectInputFilterApiFactory().createObjectInputFilterApi();
-
- Path workingDirectory;
- int jmxPort;
- Path logFile;
- String openMBeanFilterPattern;
-
- @Rule
- public CloseableReference<ServerLauncher> server = new CloseableReference<>();
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Before
- public void setUpFiles() {
- workingDirectory = temporaryFolder.getRoot().toPath().toAbsolutePath();
- logFile = workingDirectory.resolve(NAME + ".log").toAbsolutePath();
- }
-
- @Before
- public void setUpPorts() {
- jmxPort = getRandomAvailableTCPPort();
- }
-
- @Before
- public void setUpFilterPattern() {
- openMBeanFilterPattern = new OpenMBeanFilterPattern().pattern();
- }
-
- SystemManagementService getSystemManagementService() {
- Cache cache = server.get().getCache();
- return (SystemManagementService) ManagementService.getManagementService(cache);
- }
-
- boolean isJmxManagerStarted() {
- return getSystemManagementService().isManager();
- }
-}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/LocatorManagerConfiguresJmxSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/LocatorManagerConfiguresJmxSerialFilterIntegrationTest.java
new file mode 100644
index 0000000000..47f196ff1c
--- /dev/null
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/LocatorManagerConfiguresJmxSerialFilterIntegrationTest.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
+import static org.apache.geode.management.internal.JmxRmiOpenTypesSerialFilter.PROPERTY_NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assumptions.assumeThat;
+
+import java.io.File;
+
+import org.apache.commons.lang3.JavaVersion;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.distributed.LocatorLauncher;
+import org.apache.geode.test.junit.rules.CloseableReference;
+
+public class LocatorManagerConfiguresJmxSerialFilterIntegrationTest {
+
+ private static final String NAME = "locator";
+
+ private File workingDirectory;
+ private int locatorPort;
+ private int jmxPort;
+ private String expectedSerialFilter;
+
+ @Rule
+ public CloseableReference<LocatorLauncher> locator = new CloseableReference<>();
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Before
+ public void setUp() throws Exception {
+ workingDirectory = temporaryFolder.newFolder(NAME);
+ int[] ports = getRandomAvailableTCPPorts(2);
+ locatorPort = ports[0];
+ jmxPort = ports[1];
+ expectedSerialFilter = new JmxRmiOpenTypesSerialFilter().createSerialFilterPattern();
+ }
+
+ @After
+ public void tearDown() {
+ System.clearProperty(PROPERTY_NAME);
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_configuresSerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(expectedSerialFilter);
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_changesEmptySerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ System.setProperty(PROPERTY_NAME, "");
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(expectedSerialFilter);
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_skipsNonEmptySerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ String existingSerialFilter = "!*";
+ System.setProperty(PROPERTY_NAME, existingSerialFilter);
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(existingSerialFilter);
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_skipsSerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isNull();
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_skipsEmptySerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ System.setProperty(PROPERTY_NAME, "");
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo("");
+ }
+
+ @Test
+ public void startingLocatorWithJmxManager_skipsNonEmptySerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ String existingSerialFilter = "!*";
+ System.setProperty(PROPERTY_NAME, existingSerialFilter);
+
+ locator.set(new LocatorLauncher.Builder()
+ .setMemberName(NAME)
+ .setPort(locatorPort)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(existingSerialFilter);
+ }
+}
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ManagementAgentIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ManagementAgentIntegrationTest.java
index 257454d98f..15815a55e1 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ManagementAgentIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ManagementAgentIntegrationTest.java
@@ -35,10 +35,10 @@ import org.junit.rules.TemporaryFolder;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.internal.serialization.filter.FilterConfiguration;
public class ManagementAgentIntegrationTest {
+ // private ManagementAgent managementAgent = spy(ManagementAgent.class);
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -46,14 +46,14 @@ public class ManagementAgentIntegrationTest {
public void testSetMBeanServer() throws IOException {
DistributionConfig distributionConfig = mock(DistributionConfig.class);
InternalCache internalCache = mock(InternalCache.class);
- FilterConfiguration filterConfiguration = mock(FilterConfiguration.class);
+ JmxRmiSerialFilter serialFilter = mock(JmxRmiSerialFilter.class);
SecurityService securityService = mock(SecurityService.class);
when(internalCache.getSecurityService()).thenReturn(securityService);
when(securityService.isIntegratedSecurity()).thenReturn(false);
File tempFile = temporaryFolder.newFile("testFile");
when(distributionConfig.getJmxManagerAccessFile()).thenReturn(tempFile.getCanonicalPath());
ManagementAgent managementAgent =
- new ManagementAgent(distributionConfig, internalCache, filterConfiguration);
+ new ManagementAgent(distributionConfig, internalCache, serialFilter);
MBeanServer mBeanServer = mock(MBeanServer.class);
JMXConnectorServer jmxConnectorServerWithMBeanServer = new JMXConnectorServer(mBeanServer) {
@Override
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ServerManagerConfiguresJmxSerialFilterIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ServerManagerConfiguresJmxSerialFilterIntegrationTest.java
new file mode 100644
index 0000000000..f77438edae
--- /dev/null
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/ServerManagerConfiguresJmxSerialFilterIntegrationTest.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPort;
+import static org.apache.geode.management.internal.JmxRmiOpenTypesSerialFilter.PROPERTY_NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assumptions.assumeThat;
+
+import java.io.File;
+
+import org.apache.commons.lang3.JavaVersion;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.distributed.ServerLauncher;
+import org.apache.geode.test.junit.rules.CloseableReference;
+
+public class ServerManagerConfiguresJmxSerialFilterIntegrationTest {
+
+ private static final String NAME = "server";
+
+ private File workingDirectory;
+ private int jmxPort;
+ private String expectedSerialFilter;
+
+ @Rule
+ public CloseableReference<ServerLauncher> server = new CloseableReference<>();
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Before
+ public void setUp() throws Exception {
+ workingDirectory = temporaryFolder.newFolder(NAME);
+ jmxPort = getRandomAvailableTCPPort();
+ expectedSerialFilter = new JmxRmiOpenTypesSerialFilter().createSerialFilterPattern();
+ }
+
+ @After
+ public void tearDown() {
+ System.clearProperty(PROPERTY_NAME);
+ }
+
+ @Test
+ public void startingServerWithJmxManager_configuresSerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(expectedSerialFilter);
+ }
+
+ @Test
+ public void startingServerWithJmxManager_changesEmptySerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ System.setProperty(PROPERTY_NAME, "");
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(expectedSerialFilter);
+ }
+
+ @Test
+ public void startingServerWithJmxManager_skipsNonEmptySerialFilter_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ String existingSerialFilter = "!*";
+ System.setProperty(PROPERTY_NAME, existingSerialFilter);
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(existingSerialFilter);
+ }
+
+ @Test
+ public void startingServerWithJmxManager_skipsSerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isNull();
+ }
+
+ @Test
+ public void startingServerWithJmxManager_skipsEmptySerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ System.setProperty(PROPERTY_NAME, "");
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo("");
+ }
+
+ @Test
+ public void startingServerWithJmxManager_skipsNonEmptySerialFilter_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ String existingSerialFilter = "!*";
+ System.setProperty(PROPERTY_NAME, existingSerialFilter);
+
+ server.set(new ServerLauncher.Builder()
+ .setMemberName(NAME)
+ .setDisableDefaultServer(true)
+ .setWorkingDirectory(workingDirectory.getAbsolutePath())
+ .set(HTTP_SERVICE_PORT, "0")
+ .set(JMX_MANAGER, "true")
+ .set(JMX_MANAGER_PORT, String.valueOf(jmxPort))
+ .set(JMX_MANAGER_START, "true")
+ .set(LOG_FILE, new File(workingDirectory, NAME + ".log").getAbsolutePath())
+ .build())
+ .get()
+ .start();
+
+ String serialFilter = System.getProperty(PROPERTY_NAME);
+ assertThat(serialFilter).isEqualTo(existingSerialFilter);
+ }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
index 8bac461883..c91e73a7d7 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
@@ -18,9 +18,9 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.join;
import static org.apache.commons.lang3.StringUtils.lowerCase;
import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.internal.lang.ClassUtils.forName;
import static org.apache.geode.internal.lang.StringUtils.defaultString;
import static org.apache.geode.internal.lang.SystemUtils.CURRENT_DIRECTORY;
-import static org.apache.geode.internal.lang.utils.ClassUtils.forName;
import java.io.File;
import java.io.FileReader;
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index e64d6b1bce..0cd015e27e 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -64,7 +64,6 @@ import org.apache.geode.distributed.internal.tcpserver.HostAndPort;
import org.apache.geode.distributed.internal.tcpserver.TcpClient;
import org.apache.geode.distributed.internal.tcpserver.TcpSocketCreator;
import org.apache.geode.distributed.internal.tcpserver.TcpSocketFactory;
-import org.apache.geode.internal.DistributedSerializableObjectConfig;
import org.apache.geode.internal.DistributionLocator;
import org.apache.geode.internal.GemFireVersion;
import org.apache.geode.internal.InternalDataSerializer;
@@ -88,8 +87,6 @@ import org.apache.geode.internal.process.ProcessType;
import org.apache.geode.internal.process.ProcessUtils;
import org.apache.geode.internal.process.UnableToControlProcessException;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.geode.internal.serialization.filter.SystemPropertyGlobalSerialFilterConfigurationFactory;
-import org.apache.geode.internal.serialization.filter.UnableToSetSerialFilterException;
import org.apache.geode.lang.AttachAPINotFoundException;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.management.internal.util.HostUtils;
@@ -705,8 +702,6 @@ public class LocatorLauncher extends AbstractLauncher<String> {
if (isStartable()) {
INSTANCE.compareAndSet(null, this);
- boolean serializationFilterConfigured = configureGlobalSerialFilterIfEnabled();
-
try {
this.process =
new FileControllableProcess(this.controlHandler, new File(getWorkingDirectory()),
@@ -721,11 +716,6 @@ public class LocatorLauncher extends AbstractLauncher<String> {
this.locator = InternalLocator.startLocator(getPort(), getLogFile(), null, null,
getBindAddress(), true, getDistributedSystemProperties(), getHostnameForClients(),
Paths.get(workingDirectory));
-
- if (serializationFilterConfigured) {
- log.info("Global serial filter is now configured.");
- }
-
} finally {
ProcessLauncherContext.remove();
}
@@ -770,16 +760,6 @@ public class LocatorLauncher extends AbstractLauncher<String> {
}
}
- private boolean configureGlobalSerialFilterIfEnabled() {
- try {
- return new SystemPropertyGlobalSerialFilterConfigurationFactory()
- .create(new DistributedSerializableObjectConfig(getDistributedSystemProperties()))
- .configure();
- } catch (UnableToSetSerialFilterException e) {
- throw new RuntimeException(e);
- }
- }
-
@Override
protected Properties getDistributedSystemProperties() {
return super.getDistributedSystemProperties(getProperties());
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index 7458206175..f10b05372c 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -71,7 +71,6 @@ import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.internal.DefaultServerLauncherCacheProvider;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.DistributedSerializableObjectConfig;
import org.apache.geode.internal.GemFireVersion;
import org.apache.geode.internal.cache.AbstractCacheServer;
import org.apache.geode.internal.cache.CacheConfig;
@@ -95,8 +94,6 @@ import org.apache.geode.internal.process.ProcessControllerParameters;
import org.apache.geode.internal.process.ProcessLauncherContext;
import org.apache.geode.internal.process.ProcessType;
import org.apache.geode.internal.process.UnableToControlProcessException;
-import org.apache.geode.internal.serialization.filter.SystemPropertyGlobalSerialFilterConfigurationFactory;
-import org.apache.geode.internal.serialization.filter.UnableToSetSerialFilterException;
import org.apache.geode.lang.AttachAPINotFoundException;
import org.apache.geode.logging.internal.executors.LoggingThread;
import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -790,8 +787,6 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (isStartable()) {
INSTANCE.compareAndSet(null, this);
- boolean serializationFilterConfigured = configureGlobalSerialFilterIfEnabled();
-
try {
process = getControllableProcess();
@@ -811,10 +806,6 @@ public class ServerLauncher extends AbstractLauncher<String> {
final Properties gemfireProperties = getDistributedSystemProperties(getProperties());
cache = createCache(gemfireProperties);
- if (serializationFilterConfigured) {
- log.info("Global serial filter is now configured.");
- }
-
// Set the resource manager options
if (criticalHeapPercentage != null) {
cache.getResourceManager().setCriticalHeapPercentage(getCriticalHeapPercentage());
@@ -889,16 +880,6 @@ public class ServerLauncher extends AbstractLauncher<String> {
getServiceName(), getWorkingDirectory(), getId()));
}
- private boolean configureGlobalSerialFilterIfEnabled() {
- try {
- return new SystemPropertyGlobalSerialFilterConfigurationFactory()
- .create(new DistributedSerializableObjectConfig(getDistributedSystemProperties()))
- .configure();
- } catch (UnableToSetSerialFilterException e) {
- throw new RuntimeException(e);
- }
- }
-
Cache createCache(Properties gemfireProperties) {
Iterable<ServerLauncherCacheProvider> loader = getServerLauncherCacheProviders();
for (ServerLauncherCacheProvider provider : loader) {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
index b17110ab48..bcb73edb81 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionConfig.java
@@ -208,7 +208,6 @@ import org.apache.geode.internal.Config;
import org.apache.geode.internal.ConfigSource;
import org.apache.geode.internal.logging.LogWriterImpl;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
import org.apache.geode.internal.statistics.StatisticsConfig;
import org.apache.geode.internal.tcp.Connection;
import org.apache.geode.logging.internal.spi.LogConfig;
@@ -225,8 +224,7 @@ import org.apache.geode.util.internal.GeodeGlossary;
* @see Config
* @since GemFire 2.1
*/
-public interface DistributionConfig
- extends Config, LogConfig, StatisticsConfig, SerializableObjectConfig {
+public interface DistributionConfig extends Config, LogConfig, StatisticsConfig {
/**
* The static String definition of the prefix used to defined ssl-* properties
diff --git a/geode-core/src/main/java/org/apache/geode/internal/CoreSanctionedSerializablesService.java b/geode-core/src/main/java/org/apache/geode/internal/CoreSanctionedSerializablesService.java
index fa5f1e115b..790520eb34 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/CoreSanctionedSerializablesService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/CoreSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class CoreSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DistributedSerializableObjectConfig.java b/geode-core/src/main/java/org/apache/geode/internal/DistributedSerializableObjectConfig.java
deleted file mode 100644
index 1a9aec0803..0000000000
--- a/geode-core/src/main/java/org/apache/geode/internal/DistributedSerializableObjectConfig.java
+++ /dev/null
@@ -1,51 +0,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.
- */
-package org.apache.geode.internal;
-
-import static java.util.Objects.requireNonNull;
-import static org.apache.geode.distributed.ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER;
-import static org.apache.geode.distributed.ConfigurationProperties.VALIDATE_SERIALIZABLE_OBJECTS;
-
-import java.util.Properties;
-
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
-
-/**
- * Simple implementation of {@code SerializableObjectConfig} for use when an instance of
- * {@code DistributionConfig} is not available.
- */
-public class DistributedSerializableObjectConfig implements SerializableObjectConfig {
-
- private final Properties config;
-
- public DistributedSerializableObjectConfig(Properties config) {
- this.config = requireNonNull(config);
- }
-
- @Override
- public boolean getValidateSerializableObjects() {
- return "true".equalsIgnoreCase(config.getProperty(VALIDATE_SERIALIZABLE_OBJECTS));
- }
-
- @Override
- public void setValidateSerializableObjects(boolean value) {
- config.setProperty(VALIDATE_SERIALIZABLE_OBJECTS, Boolean.valueOf(value).toString());
- }
-
- @Override
- public String getSerializableObjectFilter() {
- return config.getProperty(SERIALIZABLE_OBJECT_FILTER);
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/NullStreamSerialFilter.java b/geode-core/src/main/java/org/apache/geode/internal/EmptyInputStreamFilter.java
similarity index 77%
rename from geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/NullStreamSerialFilter.java
rename to geode-core/src/main/java/org/apache/geode/internal/EmptyInputStreamFilter.java
index 226159b8ca..82369a0ccb 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/NullStreamSerialFilter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/EmptyInputStreamFilter.java
@@ -12,17 +12,13 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.serialization.filter;
+package org.apache.geode.internal;
import java.io.ObjectInputStream;
-/**
- * Implementation of {@code StreamSerialFilter} that does nothing.
- */
-public class NullStreamSerialFilter implements StreamSerialFilter {
-
+public class EmptyInputStreamFilter implements InputStreamFilter {
@Override
- public void setFilterOn(ObjectInputStream objectInputStream) {
+ public void setFilterOn(ObjectInputStream ois) {
// Do nothing, this is the case where we don't filter.
}
}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/StreamSerialFilterFactory.java b/geode-core/src/main/java/org/apache/geode/internal/InputStreamFilter.java
similarity index 75%
rename from geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/StreamSerialFilterFactory.java
rename to geode-core/src/main/java/org/apache/geode/internal/InputStreamFilter.java
index c5a3113462..43b43e6071 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/StreamSerialFilterFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InputStreamFilter.java
@@ -12,13 +12,13 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.serialization.filter;
+package org.apache.geode.internal;
-import java.util.Set;
+import java.io.ObjectInputStream;
-@FunctionalInterface
-public interface StreamSerialFilterFactory {
+public interface InputStreamFilter {
+
+ /** establish a serialization filter on the given stream */
+ void setFilterOn(ObjectInputStream ois);
- StreamSerialFilter create(SerializableObjectConfig serializableObjectConfig,
- Set<String> sanctionedClasses);
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index 56b4d83d9d..22cb7480ac 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -14,8 +14,7 @@
*/
package org.apache.geode.internal;
-import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedClassNames;
-import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedSerializablesServices;
+import static org.apache.geode.internal.serialization.SanctionedSerializables.loadSanctionedSerializablesServices;
import java.io.DataInput;
import java.io.DataOutput;
@@ -74,6 +73,7 @@ import org.apache.geode.CancelException;
import org.apache.geode.CanonicalInstantiator;
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
+import org.apache.geode.GemFireConfigException;
import org.apache.geode.GemFireIOException;
import org.apache.geode.GemFireRethrowable;
import org.apache.geode.Instantiator;
@@ -88,6 +88,7 @@ import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.distributed.internal.ClusterDistributionManager;
import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.LonerDistributionManager;
import org.apache.geode.distributed.internal.SerialDistributionMessage;
@@ -102,6 +103,7 @@ import org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.OldClientSupportService;
import org.apache.geode.internal.cache.tier.sockets.Part;
+import org.apache.geode.internal.lang.ClassUtils;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.serialization.BasicSerializable;
import org.apache.geode.internal.serialization.DSCODE;
@@ -112,18 +114,12 @@ import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.DscodeHelper;
import org.apache.geode.internal.serialization.ObjectDeserializer;
import org.apache.geode.internal.serialization.ObjectSerializer;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.internal.serialization.SerializationContext;
import org.apache.geode.internal.serialization.SerializationVersions;
import org.apache.geode.internal.serialization.StaticSerialization;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.VersionedDataStream;
-import org.apache.geode.internal.serialization.filter.NullStreamSerialFilter;
-import org.apache.geode.internal.serialization.filter.ReflectiveFacadeStreamSerialFilterFactory;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
-import org.apache.geode.internal.serialization.filter.StreamSerialFilter;
-import org.apache.geode.internal.serialization.filter.StreamSerialFilterFactory;
-import org.apache.geode.internal.serialization.filter.UnableToSetSerialFilterException;
import org.apache.geode.internal.util.concurrent.CopyOnWriteHashMap;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.pdx.NonPortableClassException;
@@ -287,12 +283,12 @@ public abstract class InternalDataSerializer extends DataSerializer {
"org.apache.geode.cache.query.internal.cq.ServerCQImpl";
@Immutable
- private static final StreamSerialFilter defaultSerializationFilter = new NullStreamSerialFilter();
+ private static final InputStreamFilter defaultSerializationFilter = new EmptyInputStreamFilter();
/**
* A deserialization filter for ObjectInputStreams
*/
@MakeNotStatic
- private static StreamSerialFilter serializationFilter = defaultSerializationFilter;
+ private static InputStreamFilter serializationFilter = defaultSerializationFilter;
/**
* support for old GemFire clients and WAN sites - needed to enable moving from GemFire to Geode
*/
@@ -401,31 +397,38 @@ public abstract class InternalDataSerializer extends DataSerializer {
* Initializes the optional serialization "accept list" if the user has requested it in the
* DistributionConfig
*
- * @param config the DistributedSystem configuration
+ * @param distributionConfig the DistributedSystem configuration
*/
- public static void initializeSerializationFilter(SerializableObjectConfig config) {
- initializeSerializationFilter(config, loadSanctionedSerializablesServices());
+ public static void initializeSerializationFilter(DistributionConfig distributionConfig) {
+ initializeSerializationFilter(distributionConfig, loadSanctionedSerializablesServices());
}
/**
* Initializes the optional serialization "accept list" if the user has requested it in the
* DistributionConfig
*
- * @param config the DistributedSystem configuration
+ * @param distributionConfig the DistributedSystem configuration
* @param services SanctionedSerializablesService that might have classes to acceptlist
*/
@VisibleForTesting
- public static void initializeSerializationFilter(SerializableObjectConfig config,
+ public static void initializeSerializationFilter(DistributionConfig distributionConfig,
Collection<SanctionedSerializablesService> services) {
logger.info("initializing InternalDataSerializer with {} services", services.size());
-
- StreamSerialFilterFactory objectInputFilterFactory =
- new ReflectiveFacadeStreamSerialFilterFactory();
-
- serializationFilter =
- objectInputFilterFactory.create(config, loadSanctionedClassNames(services));
+ if (distributionConfig.getValidateSerializableObjects()) {
+ if (!ClassUtils.isClassAvailable("sun.misc.ObjectInputFilter")
+ && !ClassUtils.isClassAvailable("java.io.ObjectInputFilter")) {
+ throw new GemFireConfigException(
+ "A serialization filter has been specified but this version of Java does not support serialization filters - ObjectInputFilter is not available");
+ }
+ serializationFilter =
+ new ObjectInputStreamFilterWrapper(SANCTIONED_SERIALIZABLES_DEPENDENCIES_PATTERN
+ + distributionConfig.getSerializableObjectFilter() + ";!*", services);
+ } else {
+ clearSerializationFilter();
+ }
}
+ @VisibleForTesting
static void clearSerializationFilter() {
serializationFilter = defaultSerializationFilter;
}
@@ -2682,14 +2685,7 @@ public abstract class InternalDataSerializer extends DataSerializer {
}
ObjectInput ois = new DSObjectInputStream(stream);
-
- try {
- serializationFilter.setFilterOn((ObjectInputStream) ois);
- } catch (UnableToSetSerialFilterException e) {
- // maintain existing behavior for validate-serializable-objects
- throw new UnsupportedOperationException(e);
- }
-
+ serializationFilter.setFilterOn((ObjectInputStream) ois);
if (stream instanceof VersionedDataStream) {
Version v = ((VersionedDataStream) stream).getVersion();
if (Version.CURRENT != v && v != null) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/ObjectInputStreamFilterWrapper.java b/geode-core/src/main/java/org/apache/geode/internal/ObjectInputStreamFilterWrapper.java
new file mode 100644
index 0000000000..184eb9ff81
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/ObjectInputStreamFilterWrapper.java
@@ -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.
+ */
+package org.apache.geode.internal;
+
+import java.io.IOException;
+import java.io.InvalidClassException;
+import java.io.ObjectInputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
+import org.apache.geode.logging.internal.log4j.api.LogService;
+
+
+/**
+ * ObjectInputStreamFilterWrapper isolates InternalDataSerializer from the JDK's
+ * ObjectInputFilter class, which is absent in builds of java8 prior to 121 and
+ * is sun.misc.ObjectInputFilter in later builds but is java.io.ObjectInputFilter
+ * in java9.
+ * <p>
+ * This class uses reflection and dynamic proxies to find the class and create a
+ * serialization filter. Once java8 is retired and no longer supported by Geode the
+ * use of reflection should be removed ObjectInputFilter can be directly used by
+ * InternalDataSerializer.
+ */
+public class ObjectInputStreamFilterWrapper implements InputStreamFilter {
+ private static final Logger logger = LogService.getLogger();
+
+ private boolean usingJava8;
+ private Object serializationFilter;
+
+ private Class configClass; // ObjectInputFilter$Config
+ private Method setObjectInputFilterMethod; // method on ObjectInputFilter$Config or
+ // ObjectInputStream
+ private Method createFilterMethod; // method on ObjectInputFilter$Config
+
+ private Class filterClass; // ObjectInputFilter
+ private Object ALLOWED; // field on ObjectInputFilter
+ private Object REJECTED; // field on ObjectInputFilter
+ private Method checkInputMethod; // method on ObjectInputFilter
+
+ private Class filterInfoClass; // ObjectInputFilter$FilterInfo
+ private Method serialClassMethod; // method on ObjectInputFilter$FilterInfo
+
+ public ObjectInputStreamFilterWrapper(String serializationFilterSpec,
+ Collection<SanctionedSerializablesService> services) {
+
+ Set<String> sanctionedClasses = new HashSet<>(500);
+ for (SanctionedSerializablesService service : services) {
+ try {
+ Collection<String> classNames = service.getSerializationAcceptlist();
+ logger.info("loaded {} sanctioned serializables from {}", classNames.size(),
+ service.getClass().getSimpleName());
+ sanctionedClasses.addAll(classNames);
+ } catch (IOException e) {
+ throw new InternalGemFireException("error initializing serialization filter for " + service,
+ e);
+ }
+ }
+
+ logger.info("setting a serialization filter containing {}", serializationFilterSpec);
+
+ // try java8 - this will not throw an exception if ObjectInputFilter can't be found
+ if (createJava8Filter(serializationFilterSpec, sanctionedClasses)) {
+ return;
+ }
+
+ // try java9 - this throws an exception if it fails to create the filter
+ createJava9Filter(serializationFilterSpec, sanctionedClasses);
+ }
+
+ @Override
+ public void setFilterOn(ObjectInputStream objectInputStream) {
+ try {
+ if (usingJava8) {
+ setObjectInputFilterMethod.invoke(configClass, objectInputStream, serializationFilter);
+ } else {
+ setObjectInputFilterMethod.invoke(objectInputStream, serializationFilter);
+ }
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new InternalGemFireError("Unable to filter serialization", e);
+ }
+ }
+
+ /**
+ * java8 has sun.misc.ObjectInputFilter and uses ObjectInputFilter$Config.setObjectInputFilter()
+ */
+ private boolean createJava8Filter(String serializationFilterSpec,
+ Collection<String> sanctionedClasses) {
+ ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
+ try {
+
+ filterInfoClass = classPathLoader.forName("sun.misc.ObjectInputFilter$FilterInfo");
+ serialClassMethod = filterInfoClass.getDeclaredMethod("serialClass");
+
+ filterClass = classPathLoader.forName("sun.misc.ObjectInputFilter");
+ checkInputMethod = filterClass.getDeclaredMethod("checkInput", filterInfoClass);
+
+ Class statusClass = classPathLoader.forName("sun.misc.ObjectInputFilter$Status");
+ ALLOWED = statusClass.getEnumConstants()[1];
+ REJECTED = statusClass.getEnumConstants()[2];
+ if (!ALLOWED.toString().equals("ALLOWED") || !REJECTED.toString().equals("REJECTED")) {
+ throw new GemFireConfigException(
+ "ObjectInputFilter$Status enumeration in this JDK is not as expected");
+ }
+
+ configClass = classPathLoader.forName("sun.misc.ObjectInputFilter$Config");
+ setObjectInputFilterMethod = configClass.getDeclaredMethod("setObjectInputFilter",
+ ObjectInputStream.class, filterClass);
+ createFilterMethod = configClass.getDeclaredMethod("createFilter", String.class);
+
+ serializationFilter = createSerializationFilter(serializationFilterSpec, sanctionedClasses);
+ usingJava8 = true;
+
+ } catch (ClassNotFoundException | InvocationTargetException | IllegalAccessException
+ | NoSuchMethodException e) {
+ if (filterInfoClass != null) {
+ throw new GemFireConfigException(
+ "A serialization filter has been specified but Geode was unable to configure a filter",
+ e);
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /** java9 has java.io.ObjectInputFilter and uses ObjectInputStream.setObjectInputFilter() */
+ private void createJava9Filter(String serializationFilterSpec,
+ Collection<String> sanctionedClasses) {
+ try {
+ ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
+
+ filterInfoClass = classPathLoader.forName("java.io.ObjectInputFilter$FilterInfo");
+ serialClassMethod = filterInfoClass.getDeclaredMethod("serialClass");
+
+
+ filterClass = classPathLoader.forName("java.io.ObjectInputFilter");
+ checkInputMethod = filterClass.getDeclaredMethod("checkInput", filterInfoClass);
+
+ Class statusClass = classPathLoader.forName("java.io.ObjectInputFilter$Status");
+ ALLOWED = statusClass.getEnumConstants()[1];
+ REJECTED = statusClass.getEnumConstants()[2];
+ if (!ALLOWED.toString().equals("ALLOWED") || !REJECTED.toString().equals("REJECTED")) {
+ throw new GemFireConfigException(
+ "ObjectInputFilter$Status enumeration in this JDK is not as expected");
+ }
+
+ configClass = classPathLoader.forName("java.io.ObjectInputFilter$Config");
+ setObjectInputFilterMethod =
+ ObjectInputStream.class.getDeclaredMethod("setObjectInputFilter", filterClass);
+ createFilterMethod = configClass.getDeclaredMethod("createFilter", String.class);
+
+ serializationFilter = createSerializationFilter(serializationFilterSpec, sanctionedClasses);
+
+ } catch (ClassNotFoundException | InvocationTargetException | IllegalAccessException
+ | NoSuchMethodException e) {
+ throw new GemFireConfigException(
+ "A serialization filter has been specified but Geode was unable to configure a filter",
+ e);
+ }
+ }
+
+
+ private Object createSerializationFilter(String serializationFilterSpec,
+ Collection<String> sanctionedClasses)
+ throws InvocationTargetException, IllegalAccessException {
+
+ /*
+ * create a user filter with the serialization acceptlist/denylist. This will be wrapped
+ * by a filter that accept-lists sanctioned classes
+ */
+ Object userFilter = createFilterMethod.invoke(null, serializationFilterSpec);
+
+ InvocationHandler handler = (proxy, method, args) -> {
+ switch (method.getName()) {
+ case "checkInput":
+ Object filterInfo = args[0];
+ Class<?> serialClass = (Class<?>) serialClassMethod.invoke(filterInfo);
+ if (serialClass == null) { // no class to check, so nothing to accept-list
+ return checkInputMethod.invoke(userFilter, filterInfo);
+ }
+ String className = serialClass.getName();
+ if (serialClass.isArray()) {
+ className = serialClass.getComponentType().getName();
+ }
+ if (sanctionedClasses.contains(className)) {
+ return ALLOWED;
+ }
+ Object status = checkInputMethod.invoke(userFilter, filterInfo);
+ if (status == REJECTED) {
+ logger.fatal("Serialization filter is rejecting class {}", className,
+ new InvalidClassException(className));
+ }
+ return status;
+ case "toString":
+ return userFilter.toString();
+ default:
+ throw new UnsupportedOperationException(
+ "ObjectInputFilter." + method.getName() + " is not implemented");
+ }
+ };
+
+ ClassPathLoader classPathLoader = ClassPathLoader.getLatest();
+ return Proxy.newProxyInstance(classPathLoader.asClassLoader(), new Class[] {filterClass},
+ handler);
+
+ }
+
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventSerialization.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventSerialization.java
index 4c48be094d..a49f9cb8c4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventSerialization.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventSerialization.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.internal.cache;
-import static org.apache.geode.internal.lang.SystemProperty.getProductBooleanProperty;
import static org.apache.geode.internal.lang.SystemPropertyHelper.EARLY_ENTRY_EVENT_SERIALIZATION;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.getProductBooleanProperty;
import java.io.IOException;
import java.io.UncheckedIOException;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/EvictionListBuilder.java b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/EvictionListBuilder.java
index 408aba4fa7..a2f0563902 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/EvictionListBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/EvictionListBuilder.java
@@ -16,7 +16,6 @@ package org.apache.geode.internal.cache.eviction;
import java.util.Optional;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.internal.lang.SystemPropertyHelper;
public class EvictionListBuilder {
@@ -28,7 +27,7 @@ public class EvictionListBuilder {
public EvictionListBuilder(EvictionController evictionController) {
this.controller = evictionController;
Optional<Boolean> asyncScan =
- SystemProperty.getProductBooleanProperty(SystemPropertyHelper.EVICTION_SCAN_ASYNC);
+ SystemPropertyHelper.getProductBooleanProperty(SystemPropertyHelper.EVICTION_SCAN_ASYNC);
evictionScanAsync = asyncScan.orElse(true);
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithAsyncSorting.java b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithAsyncSorting.java
index 8dadc6f45f..b2f935b9ab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithAsyncSorting.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithAsyncSorting.java
@@ -27,7 +27,6 @@ import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.RegionEntry;
import org.apache.geode.internal.cache.RegionEntryContext;
import org.apache.geode.internal.cache.versions.RegionVersionVector;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.internal.lang.SystemPropertyHelper;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.logging.internal.executors.LoggingExecutors;
@@ -48,7 +47,7 @@ public class LRUListWithAsyncSorting extends AbstractEvictionList {
private static final Logger logger = LogService.getLogger();
@Immutable
- private static final Optional<Integer> EVICTION_SCAN_MAX_THREADS = SystemProperty
+ private static final Optional<Integer> EVICTION_SCAN_MAX_THREADS = SystemPropertyHelper
.getProductIntegerProperty(SystemPropertyHelper.EVICTION_SCAN_MAX_THREADS);
@MakeNotStatic
@@ -88,7 +87,7 @@ public class LRUListWithAsyncSorting extends AbstractEvictionList {
}
private double calculateScanThreshold() {
- Optional<Integer> configuredThresholdPercent = SystemProperty
+ Optional<Integer> configuredThresholdPercent = SystemPropertyHelper
.getProductIntegerProperty(SystemPropertyHelper.EVICTION_SCAN_THRESHOLD_PERCENT);
int thresholdPercent =
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithSyncSorting.java b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithSyncSorting.java
index 3002822ea2..0ff2777ea3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithSyncSorting.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/LRUListWithSyncSorting.java
@@ -19,7 +19,6 @@ import java.util.Optional;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.internal.lang.SystemPropertyHelper;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -37,7 +36,7 @@ public class LRUListWithSyncSorting extends AbstractEvictionList {
private int readMaxEntriesProperty() {
int result = -1;
- Optional<Integer> optionalMaxEntries = SystemProperty
+ Optional<Integer> optionalMaxEntries = SystemPropertyHelper
.getProductIntegerProperty(SystemPropertyHelper.EVICTION_SEARCH_MAX_ENTRIES);
if (optionalMaxEntries.isPresent()) {
result = optionalMaxEntries.get();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
index 947a04a811..17a9566842 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
@@ -14,9 +14,9 @@
*/
package org.apache.geode.internal.cache.ha;
-import static org.apache.geode.internal.lang.SystemProperty.getProductIntegerProperty;
import static org.apache.geode.internal.lang.SystemPropertyHelper.HA_REGION_QUEUE_EXPIRY_TIME_PROPERTY;
import static org.apache.geode.internal.lang.SystemPropertyHelper.THREAD_ID_EXPIRY_TIME_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.getProductIntegerProperty;
import java.io.DataInput;
import java.io.DataOutput;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirs.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirs.java
index 789cdb1546..e7325f9fc7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirs.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirs.java
@@ -16,8 +16,8 @@
*/
package org.apache.geode.internal.cache.persistence;
-import static org.apache.geode.internal.lang.SystemProperty.getProductStringProperty;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.getProductStringProperty;
import java.io.File;
import java.util.Optional;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/config/JAXBService.java b/geode-core/src/main/java/org/apache/geode/internal/config/JAXBService.java
index f99fdae03d..562399d57f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/config/JAXBService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/config/JAXBService.java
@@ -16,9 +16,6 @@
*/
package org.apache.geode.internal.config;
-import static org.apache.geode.internal.lang.SystemProperty.getProperty;
-import static org.apache.geode.internal.lang.SystemPropertyHelper.PACKAGES_TO_SCAN;
-
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URL;
@@ -45,6 +42,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
import org.apache.geode.cache.configuration.XSDRootElement;
import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.lang.SystemPropertyHelper;
import org.apache.geode.management.internal.util.ClasspathScanLoadHelper;
public class JAXBService {
@@ -96,7 +94,7 @@ public class JAXBService {
static Set<String> getPackagesToScan() {
Set<String> packages = new HashSet<>();
- String sysProperty = getProperty(PACKAGES_TO_SCAN);
+ String sysProperty = SystemPropertyHelper.getProperty(SystemPropertyHelper.PACKAGES_TO_SCAN);
if (sysProperty != null) {
packages = Arrays.stream(sysProperty.split(",")).collect(Collectors.toSet());
} else {
diff --git a/geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java
similarity index 99%
rename from geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java
rename to geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java
index 82198ddf45..82bae799ee 100644
--- a/geode-common/src/main/java/org/apache/geode/internal/lang/ClassUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/ClassUtils.java
@@ -13,7 +13,7 @@
* the License.
*/
-package org.apache.geode.internal.lang.utils;
+package org.apache.geode.internal.lang;
import org.apache.geode.annotations.Immutable;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
index 01bdb67d3b..4b4685ab1d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
@@ -14,9 +14,8 @@
*/
package org.apache.geode.internal.lang;
-import static org.apache.geode.internal.lang.SystemProperty.getProductBooleanProperty;
+import java.util.Optional;
-import org.apache.geode.internal.cache.eviction.LRUListWithAsyncSorting;
/**
* The SystemPropertyHelper class is an helper class for accessing system properties used in geode.
@@ -26,9 +25,12 @@ import org.apache.geode.internal.cache.eviction.LRUListWithAsyncSorting;
*/
public class SystemPropertyHelper {
+ public static final String GEODE_PREFIX = "geode.";
+ public static final String GEMFIRE_PREFIX = "gemfire.";
+
/**
* When set to "true" enables asynchronous eviction algorithm (defaults to true). For more details
- * see {@link LRUListWithAsyncSorting}.
+ * see {@link org.apache.geode.internal.cache.eviction.LRUListWithAsyncSorting}.
*
* @since Geode 1.4.0
*/
@@ -37,7 +39,7 @@ public class SystemPropertyHelper {
/**
* This property allows the maximum number of threads used for asynchronous eviction scanning to
* be configured. It defaults to "Math.max((Runtime.getRuntime().availableProcessors() / 4), 1)".
- * For more details see {@link LRUListWithAsyncSorting}.
+ * For more details see {@link org.apache.geode.internal.cache.eviction.LRUListWithAsyncSorting}.
*
* @since Geode 1.4.0
*/
@@ -48,7 +50,7 @@ public class SystemPropertyHelper {
* started. If the number of entries that have been recently used since the previous scan divided
* by total number of entries exceeds the threshold then a scan is started. The default threshold
* is 25. If the threshold is less than 0 or greater than 100 then the default threshold is used.
- * For more details see {@link LRUListWithAsyncSorting}.
+ * For more details see {@link org.apache.geode.internal.cache.eviction.LRUListWithAsyncSorting}.
*
* @since Geode 1.4.0
*/
@@ -69,23 +71,9 @@ public class SystemPropertyHelper {
public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
- /**
- * This property allows users to enable retrying when client application encounters
- * PdxSerializationException. The default setting is false, and PdxSerializationException will not
- * be retried. It will cause client application to throw ServerOperationException. When the
- * property is set to true, the client application will automatically retry the operation to
- * another server if encountered PdxSerializationException.
- *
- * @since Geode 1.15.0
- */
- public static final String ENABLE_QUERY_RETRY_ON_PDX_SERIALIZATION_EXCEPTION =
- "enableQueryRetryOnPdxSerializationException";
-
/**
* a comma separated string to list out the packages to scan. If not specified, the entire
* classpath is scanned.
- *
- * <p>
* This is used by the FastPathScanner to scan for:
* 1. XSDRootElement annotation
*
@@ -94,34 +82,69 @@ public class SystemPropertyHelper {
public static final String PACKAGES_TO_SCAN = "packagesToScan";
/**
- * This property turns on/off parallel disk store recovery during cluster restart.
- * By default, the value is True, which allows parallel disk store recovery by multiple threads.
+ * This method will try to look up "geode." and "gemfire." versions of the system property. It
+ * will check and prefer "geode." setting first, then try to check "gemfire." setting.
+ *
+ * @param name system property name set in Geode
+ * @return an Optional containing the Boolean value of the system property
*/
- public static final String PARALLEL_DISK_STORE_RECOVERY = "parallelDiskStoreRecovery";
+ public static Optional<Boolean> getProductBooleanProperty(String name) {
+ String property = getProperty(name);
+ return property != null ? Optional.of(Boolean.parseBoolean(property)) : Optional.empty();
+ }
/**
- * Milliseconds to wait before retrying to get events for a transaction from the
- * gateway sender queue when group-transaction-events is true.
+ * This method will try to look up "geode." and "gemfire." versions of the system property. It
+ * will check and prefer "geode." setting first, then try to check "gemfire." setting.
+ *
+ * @param name system property name set in Geode
+ * @return an Optional containing the Integer value of the system property
*/
- public static final String GET_TRANSACTION_EVENTS_FROM_QUEUE_WAIT_TIME_MS =
- "get-transaction-events-from-queue-wait-time-ms";
+ public static Optional<Integer> getProductIntegerProperty(String name) {
+ Integer propertyValue = Integer.getInteger(GEODE_PREFIX + name);
+ if (propertyValue == null) {
+ propertyValue = Integer.getInteger(GEMFIRE_PREFIX + name);
+ }
+
+ if (propertyValue != null) {
+ return Optional.of(propertyValue);
+ } else {
+ return Optional.empty();
+ }
+ }
/**
- * Milliseconds to wait for the client to re-authenticate back before unregister this client
- * proxy. If client re-authenticate back successfully within this period, messages will continue
- * to be delivered to the client
+ * This method will try to look up "geode." and "gemfire." versions of the system property. It
+ * will check and prefer "geode." setting first, then try to check "gemfire." setting.
+ *
+ * @param name system property name set in Geode
+ * @return an Optional containing the String value of the system property
*/
- public static final String RE_AUTHENTICATE_WAIT_TIME = "reauthenticate.wait.time";
+ public static Optional<String> getProductStringProperty(String name) {
+ String property = getProperty(name);
+ return property != null ? Optional.of(property) : Optional.empty();
+ }
+
+ public static String getProperty(String name) {
+ String property = getGeodeProperty(name);
+ return property != null ? property : getGemfireProperty(name);
+ }
+
+ private static String getGeodeProperty(String name) {
+ return System.getProperty(GEODE_PREFIX + name);
+ }
+
+ private static String getGemfireProperty(String name) {
+ return System.getProperty(GEMFIRE_PREFIX + name);
+ }
/**
* As of Geode 1.4.0, a region set operation will be in a transaction even if it is the first
* operation in the transaction.
*
- * <p>
* In previous releases, a region set operation is not in a transaction if it is the first
* operation of the transaction.
*
- * <p>
* Setting this system property to true will restore the previous behavior.
*
* @since Geode 1.4.0
@@ -134,7 +157,6 @@ public class SystemPropertyHelper {
* As of Geode 1.4.0, idle expiration on a replicate or partitioned region will now do a
* distributed check for a more recent last access time on one of the other copies of the region.
*
- * <p>
* This system property can be set to true to turn off this new check and restore the previous
* behavior of only using the local last access time as the basis for expiration.
*
@@ -143,5 +165,4 @@ public class SystemPropertyHelper {
public static boolean restoreIdleExpirationBehavior() {
return getProductBooleanProperty("restoreIdleExpirationBehavior").orElse(false);
}
-
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java b/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
index 81d2efa52e..70ceea6dfb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
@@ -16,7 +16,7 @@ package org.apache.geode.internal.logging;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
diff --git a/geode-core/src/main/java/org/apache/geode/logging/internal/Configuration.java b/geode-core/src/main/java/org/apache/geode/logging/internal/Configuration.java
index 1074067df7..2f6d2df23e 100644
--- a/geode-core/src/main/java/org/apache/geode/logging/internal/Configuration.java
+++ b/geode-core/src/main/java/org/apache/geode/logging/internal/Configuration.java
@@ -14,11 +14,11 @@
*/
package org.apache.geode.logging.internal;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.logging.internal.spi.LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG;
import static org.apache.geode.logging.internal.spi.LogLevelUpdateScope.GEODE_LOGGERS;
import org.apache.geode.annotations.VisibleForTesting;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogConfigListener;
import org.apache.geode.logging.internal.spi.LogConfigSupplier;
@@ -52,13 +52,13 @@ public class Configuration implements LogConfigListener {
* System property that may be used to override which {@code LogLevelUpdateOccurs} to use.
*/
public static final String LOG_LEVEL_UPDATE_OCCURS_PROPERTY =
- SystemProperty.DEFAULT_PREFIX + "LOG_LEVEL_UPDATE_OCCURS";
+ GEODE_PREFIX + "LOG_LEVEL_UPDATE_OCCURS";
/**
* System property that may be used to override which {@code LogLevelUpdateScope} to use.
*/
static final String LOG_LEVEL_UPDATE_SCOPE_PROPERTY =
- SystemProperty.DEFAULT_PREFIX + "LOG_LEVEL_UPDATE_SCOPE";
+ GEODE_PREFIX + "LOG_LEVEL_UPDATE_SCOPE";
private final LogLevelUpdateOccurs logLevelUpdateOccurs;
private final LogLevelUpdateScope logLevelUpdateScope;
diff --git a/geode-core/src/main/java/org/apache/geode/logging/internal/LoggingProviderLoader.java b/geode-core/src/main/java/org/apache/geode/logging/internal/LoggingProviderLoader.java
index 8505a37b6c..ebf6228fb0 100644
--- a/geode-core/src/main/java/org/apache/geode/logging/internal/LoggingProviderLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/logging/internal/LoggingProviderLoader.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.logging.internal;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
+
import java.util.Collection;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -23,7 +25,6 @@ import org.apache.logging.log4j.Logger;
import org.apache.geode.annotations.VisibleForTesting;
import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.internal.util.CollectingServiceLoader;
import org.apache.geode.internal.util.ListCollectingServiceLoader;
import org.apache.geode.logging.internal.spi.LoggingProvider;
@@ -46,7 +47,7 @@ public class LoggingProviderLoader {
*/
@VisibleForTesting
public static final String LOGGING_PROVIDER_NAME_PROPERTY =
- SystemProperty.DEFAULT_PREFIX + "LOGGING_PROVIDER_NAME";
+ GEODE_PREFIX + "LOGGING_PROVIDER_NAME";
public LoggingProvider load() {
// 1: use LOGGING_PROVIDER_NAME_PROPERTY if set
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilter.java b/geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilter.java
new file mode 100644
index 0000000000..803bc03a50
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilter.java
@@ -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.
+ */
+package org.apache.geode.management.internal;
+
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.rmi.MarshalledObject;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+import javax.management.ObjectName;
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+import org.apache.commons.lang3.JavaVersion;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.annotations.VisibleForTesting;
+import org.apache.geode.logging.internal.log4j.api.LogService;
+
+/**
+ * Configure the “jmx.remote.rmi.server.serial.filter.pattern” system property if Java version is
+ * greater than Java 8. The serial pattern will be configured to accept only standard JMX
+ * open-types. If the system property already has a non-null value, then leave it as is.
+ */
+public class JmxRmiOpenTypesSerialFilter implements JmxRmiSerialFilter {
+
+ private static final Logger logger = LogService.getLogger();
+
+ @VisibleForTesting
+ public static final String PROPERTY_NAME = "jmx.remote.rmi.server.serial.filter.pattern";
+
+ private final Consumer<String> infoLogger;
+ private final Supplier<Boolean> supportsSerialFilter;
+
+ JmxRmiOpenTypesSerialFilter() {
+ this(logger::info, () -> isJavaVersionAtLeast(JavaVersion.JAVA_9));
+ }
+
+ @VisibleForTesting
+ JmxRmiOpenTypesSerialFilter(Consumer<String> infoLogger, Supplier<Boolean> supportsSerialFilter) {
+ this.infoLogger = infoLogger;
+ this.supportsSerialFilter = supportsSerialFilter;
+ }
+
+ @Override
+ public void configureSerialFilter() {
+ if (supportsDedicatedSerialFilter()) {
+ setPropertyValueUnlessExists(createSerialFilterPattern());
+ }
+ }
+
+ @VisibleForTesting
+ boolean supportsDedicatedSerialFilter() {
+ return supportsSerialFilter.get();
+ }
+
+ /**
+ * Sets the value of the system property {@code jmx.remote.rmi.server.serial.filter.pattern}
+ * unless it exists with a value that is not null or empty ("").
+ */
+ @VisibleForTesting
+ void setPropertyValueUnlessExists(String value) {
+ String existingValue = System.getProperty(PROPERTY_NAME);
+ if (StringUtils.isNotEmpty(existingValue)) {
+ infoLogger.accept("System property " + PROPERTY_NAME + " is already configured.");
+ return;
+ }
+
+ System.setProperty(PROPERTY_NAME, value);
+ infoLogger.accept("System property " + PROPERTY_NAME + " is now configured with '"
+ + value + "'.");
+ }
+
+ /**
+ * Returns a serial filter pattern that accepts all open MBean data types and rejects everything
+ * not included in the pattern.
+ */
+ @VisibleForTesting
+ String createSerialFilterPattern() {
+ // note: java.util.* may also be needed
+ return new StringBuilder()
+ // accept all open MBean data types
+ .append(Boolean.class.getName())
+ .append(';')
+ .append(Byte.class.getName())
+ .append(';')
+ .append(Character.class.getName())
+ .append(';')
+ .append(Short.class.getName())
+ .append(';')
+ .append(Integer.class.getName())
+ .append(';')
+ .append(Long.class.getName())
+ .append(';')
+ .append(Float.class.getName())
+ .append(';')
+ .append(Double.class.getName())
+ .append(';')
+ .append(String.class.getName())
+ .append(';')
+ .append(BigInteger.class.getName())
+ .append(';')
+ .append(BigDecimal.class.getName())
+ .append(';')
+ .append(ObjectName.class.getName())
+ .append(';')
+ .append(OpenType.class.getName())
+ .append(';')
+ .append(CompositeData.class.getName())
+ .append(';')
+ .append(TabularData.class.getName())
+ .append(';')
+ .append(SimpleType.class.getName())
+ .append(';')
+ .append(CompositeType.class.getName())
+ .append(';')
+ .append(TabularType.class.getName())
+ .append(';')
+ .append(ArrayType.class.getName())
+ .append(';')
+ .append(MarshalledObject.class.getName())
+ .append(';')
+ // reject all other classes
+ .append("!*")
+ .toString();
+ }
+}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApiFactory.java b/geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiSerialFilter.java
similarity index 78%
rename from geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApiFactory.java
rename to geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiSerialFilter.java
index 11957dd4b6..4a187e0a9b 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApiFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JmxRmiSerialFilter.java
@@ -12,13 +12,10 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.serialization.filter;
+package org.apache.geode.management.internal;
-/**
- * Creates an instance of {@code ObjectInputFilterApi}.
- */
@FunctionalInterface
-public interface ObjectInputFilterApiFactory {
+public interface JmxRmiSerialFilter {
- ObjectInputFilterApi createObjectInputFilterApi();
+ void configureSerialFilter();
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 85571c2c86..5648cebaa3 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -65,8 +65,6 @@ import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.internal.security.shiro.JMXShiroAuthenticator;
-import org.apache.geode.internal.serialization.filter.FilterConfiguration;
-import org.apache.geode.internal.serialization.filter.UnableToSetSerialFilterException;
import org.apache.geode.internal.tcp.TCPConduit;
import org.apache.geode.logging.internal.log4j.api.LogService;
import org.apache.geode.management.ManagementException;
@@ -111,7 +109,7 @@ public class ManagementAgent {
private int port;
private RemoteStreamExporter remoteStreamExporter = null;
- private final FilterConfiguration filterConfiguration;
+ private final JmxRmiSerialFilter serialFilter;
/**
* This system property is set to true when the embedded HTTP server is started so that the
@@ -124,23 +122,20 @@ public class ManagementAgent {
private static final String PULSE_USESSL_LOCATOR = "pulse.useSSL.locator";
public ManagementAgent(DistributionConfig config, InternalCache cache,
- FilterConfiguration filterConfiguration) {
+ JmxRmiSerialFilter serialFilter) {
this.config = config;
this.cache = cache;
this.securityService = cache.getSecurityService();
- this.filterConfiguration = filterConfiguration;
+ this.serialFilter = serialFilter;
}
public synchronized boolean isRunning() {
return this.running;
}
+
public synchronized void startAgent() {
- try {
- filterConfiguration.configure();
- } catch (UnableToSetSerialFilterException e) {
- throw new RuntimeException(e);
- }
+ serialFilter.configureSerialFilter();
loadWebApplications();
if (!this.running && this.config.getJmxManagerPort() != 0) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgentFactory.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgentFactory.java
index 31c36528f6..bff205e4fe 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgentFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgentFactory.java
@@ -16,11 +16,10 @@ package org.apache.geode.management.internal;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.serialization.filter.FilterConfiguration;
@FunctionalInterface
interface ManagementAgentFactory {
ManagementAgent create(DistributionConfig config, InternalCache cache,
- FilterConfiguration filterConfiguration);
+ JmxRmiSerialFilter serialFilter);
}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
index 2479b8f248..a5bf2f43f6 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/SystemManagementService.java
@@ -45,8 +45,6 @@ import org.apache.geode.distributed.internal.ResourceEvent;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.InternalCacheForClientAccess;
-import org.apache.geode.internal.serialization.filter.FilterConfiguration;
-import org.apache.geode.internal.serialization.filter.SystemPropertyJmxSerialFilterConfigurationFactory;
import org.apache.geode.internal.statistics.StatisticsClock;
import org.apache.geode.logging.internal.executors.LoggingExecutors;
import org.apache.geode.logging.internal.log4j.api.LogService;
@@ -180,12 +178,9 @@ public class SystemManagementService extends BaseManagementService {
repo = new ManagementResourceRepo();
notificationHub = notificationHubFactory.apply(repo);
-
if (system.getConfig().getJmxManager()) {
- FilterConfiguration filterConfiguration =
- new SystemPropertyJmxSerialFilterConfigurationFactory().create();
-
- agent = managementAgentFactory.create(system.getConfig(), cache, filterConfiguration);
+ agent = managementAgentFactory.create(system.getConfig(), cache,
+ new JmxRmiOpenTypesSerialFilter());
} else {
agent = null;
}
diff --git a/geode-core/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-core/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-core/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-core/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionConfigJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionConfigJUnitTest.java
index e6d4db9279..64d0022b9a 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionConfigJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionConfigJUnitTest.java
@@ -62,7 +62,6 @@ import org.junit.experimental.categories.Category;
import org.apache.geode.UnmodifiableException;
import org.apache.geode.internal.ConfigSource;
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
import org.apache.geode.security.TestPostProcessor;
import org.apache.geode.security.TestSecurityManager;
import org.apache.geode.test.junit.categories.MembershipTest;
@@ -469,11 +468,4 @@ public class DistributionConfigJUnitTest {
DistributionConfig config = new DistributionConfigImpl(props);
assertThat(config.getSecurityAuthTokenEnabledComponents()).containsExactly("MANAGEMENT");
}
-
- @Test
- public void isASerializableObjectConfig() {
- DistributionConfig config = new DistributionConfigImpl(new Properties());
-
- assertThat(config).isInstanceOf(SerializableObjectConfig.class);
- }
}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DistributedSerializableObjectConfigTest.java b/geode-core/src/test/java/org/apache/geode/internal/DistributedSerializableObjectConfigTest.java
deleted file mode 100644
index d52890450c..0000000000
--- a/geode-core/src/test/java/org/apache/geode/internal/DistributedSerializableObjectConfigTest.java
+++ /dev/null
@@ -1,62 +0,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.
- */
-package org.apache.geode.internal;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER;
-import static org.apache.geode.distributed.ConfigurationProperties.VALIDATE_SERIALIZABLE_OBJECTS;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
-
-public class DistributedSerializableObjectConfigTest {
-
- @Test
- public void getValidateSerializableObjects_returnsTrue_whenPropertyIsTrue() {
- Properties properties = spy(new Properties());
- SerializableObjectConfig config = new DistributedSerializableObjectConfig(properties);
- when(properties.getProperty(VALIDATE_SERIALIZABLE_OBJECTS)).thenReturn("true");
-
- boolean result = config.getValidateSerializableObjects();
-
- assertThat(result).isTrue();
- }
-
- @Test
- public void setValidateSerializableObjects_setsPropertyValue() {
- Properties properties = spy(new Properties());
- SerializableObjectConfig config = new DistributedSerializableObjectConfig(properties);
-
- config.setValidateSerializableObjects(true);
-
- assertThat(properties.getProperty(VALIDATE_SERIALIZABLE_OBJECTS)).isEqualTo("true");
- }
-
- @Test
- public void getSerializableObjectFilter_returnsPropertyValue() {
- Properties properties = spy(new Properties());
- SerializableObjectConfig config = new DistributedSerializableObjectConfig(properties);
- when(properties.getProperty(SERIALIZABLE_OBJECT_FILTER)).thenReturn("!*");
-
- String result = config.getSerializableObjectFilter();
-
- assertThat(result).isEqualTo("!*");
- }
-}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java
index 2c03f6bd2b..b460888f67 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerSerializationAcceptlistTest.java
@@ -17,29 +17,27 @@ package org.apache.geode.internal;
import static java.util.Collections.emptySet;
import static org.apache.geode.distributed.internal.DistributionConfig.SERIALIZABLE_OBJECT_FILTER_NAME;
import static org.apache.geode.distributed.internal.DistributionConfig.VALIDATE_SERIALIZABLE_OBJECTS_NAME;
-import static org.apache.geode.internal.InternalDataSerializer.initializeSerializationFilter;
-import static org.apache.geode.internal.serialization.filter.ObjectInputFilterUtils.supportsObjectInputFilter;
+import static org.apache.geode.internal.lang.ClassUtils.isClassAvailable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
+import static org.junit.Assume.assumeTrue;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.InvalidClassException;
import java.io.Serializable;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionConfigImpl;
import org.apache.geode.internal.serialization.Version;
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
@@ -49,20 +47,20 @@ public class InternalDataSerializerSerializationAcceptlistTest {
private Object testSerializable;
private Properties properties;
- @BeforeClass
- public static void hasObjectInputFilter() {
- assertThat(supportsObjectInputFilter())
- .as("java.io.ObjectInputFilter or sun.misc.ObjectInputFilter is available")
- .isTrue();
- }
-
@Before
public void setUp() {
+ assumeTrue("ObjectInputFilter is present in this JVM (post- 8.111)",
+ hasObjectInputFilter());
outputStream = new HeapDataOutputStream(Version.CURRENT);
testSerializable = new TestSerializable();
properties = new Properties();
}
+ private boolean hasObjectInputFilter() {
+ return isClassAvailable("sun.misc.ObjectInputFilter")
+ || isClassAvailable("java.io.ObjectInputFilter");
+ }
+
@After
public void clearSerializationFilter() {
InternalDataSerializer.clearSerializationFilter();
@@ -70,37 +68,23 @@ public class InternalDataSerializerSerializationAcceptlistTest {
@Test
public void distributionConfigDefaults() {
- SerializableObjectConfig config = new DistributionConfigImpl(new Properties());
+ DistributionConfig distributionConfig = new DistributionConfigImpl(new Properties());
- assertThat(config.getValidateSerializableObjects()).isFalse();
- assertThat(config.getSerializableObjectFilter()).isEqualTo("!*");
+ assertThat(distributionConfig.getValidateSerializableObjects()).isFalse();
+ assertThat(distributionConfig.getSerializableObjectFilter()).isEqualTo("!*");
}
@Test
- public void canSerializeWhenFilterIsDisabled() throws ClassNotFoundException, IOException {
- initializeSerializationFilter(emptyConfig(), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
- Object deserializedObject;
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- deserializedObject = DataSerializer.readObject(dataInputStream);
- }
-
- assertThat(deserializedObject).isInstanceOf(testSerializable.getClass());
+ public void canSerializeWhenFilterIsDisabled() throws Exception {
+ trySerializingTestObject(new Properties());
}
@Test
- public void notAcceptlistedWithFilterCannotSerialize() throws IOException {
+ public void notAcceptlistedWithFilterCannotSerialize() {
properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingTestObject(properties);
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
@@ -110,100 +94,51 @@ public class InternalDataSerializerSerializationAcceptlistTest {
public void acceptlistedWithFilterCanSerialize() throws Exception {
properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, TestSerializable.class.getName());
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
- Object deserializedObject;
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- deserializedObject = DataSerializer.readObject(dataInputStream);
- }
- assertThat(deserializedObject).isInstanceOf(testSerializable.getClass());
+ trySerializingTestObject(properties);
}
@Test
- public void acceptlistedWithNonMatchingFilterCannotSerialize() throws IOException {
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, "RabidMonkeyTurnip");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
+ public void acceptlistedWithNonMatchingFilterCannotSerialize() {
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingWithFilter("RabidMonkeyTurnip");
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
}
@Test
- public void acceptlistedWithPartialMatchingFilterCannotSerialize() throws IOException {
- // Not fully qualified class name
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, "TestSerializable");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
+ public void acceptlistedWithPartialMatchingFilterCannotSerialize() {
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingWithFilter("TestSerializable"); // Not fully qualified class name
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
}
@Test
- public void acceptlistedWithEmptyFilterCannotSerialize() throws IOException {
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, "");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
+ public void acceptlistedWithEmptyFilterCannotSerialize() {
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingWithFilter("");
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
}
@Test
- public void acceptlistedWithIncorrectPathFilterCannotSerialize() throws IOException {
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME,
- "org.apache.commons.InternalDataSerializerSerializationAcceptlistTest$TestSerializable");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
+ public void acceptlistedWithIncorrectPathFilterCannotSerialize() {
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingWithFilter(
+ "org.apache.commons.InternalDataSerializerSerializationAcceptlistTest$TestSerializable");
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
}
@Test
- public void acceptlistedWithWildcardPathFilterCannotSerialize() throws IOException {
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, "org.apache.*");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
-
+ public void acceptlistedWithWildcardPathFilterCannotSerialize() {
Throwable thrown = catchThrowable(() -> {
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- DataSerializer.readObject(dataInputStream);
- }
+ trySerializingWithFilter("org.apache.*");
});
assertThat(thrown).isInstanceOf(InvalidClassException.class);
@@ -211,26 +146,26 @@ public class InternalDataSerializerSerializationAcceptlistTest {
@Test
public void acceptlistedWithWildcardSubpathFilterCanSerialize() throws Exception {
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
- properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, "org.apache.**");
- initializeSerializationFilter(config(properties), emptySet());
- DataSerializer.writeObject(testSerializable, outputStream);
+ trySerializingWithFilter("org.apache.**");
+ }
- Object deserializedObject;
- try (InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
- DataInputStream dataInputStream = new DataInputStream(in)) {
- deserializedObject = DataSerializer.readObject(dataInputStream);
- }
+ private void trySerializingWithFilter(String filter) throws Exception {
+ properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
+ properties.setProperty(SERIALIZABLE_OBJECT_FILTER_NAME, filter);
- assertThat(deserializedObject).isInstanceOf(testSerializable.getClass());
+ trySerializingTestObject(properties);
}
- private static SerializableObjectConfig emptyConfig() {
- return config(new Properties());
- }
+ private void trySerializingTestObject(Properties properties)
+ throws IOException, ClassNotFoundException {
+ DistributionConfig distributionConfig = new DistributionConfigImpl(properties);
+ InternalDataSerializer.initializeSerializationFilter(distributionConfig, emptySet());
+
+ DataSerializer.writeObject(testSerializable, outputStream);
- private static SerializableObjectConfig config(Properties properties) {
- return new DistributedSerializableObjectConfig(properties);
+ // if this throws, we're good!
+ DataSerializer
+ .readObject(new DataInputStream(new ByteArrayInputStream(outputStream.toByteArray())));
}
@SuppressWarnings("serial")
diff --git a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java
index 723bd1bc88..55bb9fe9d2 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/InternalDataSerializerShiroAcceptListTest.java
@@ -16,9 +16,9 @@ package org.apache.geode.internal;
import static java.util.Collections.emptySet;
import static org.apache.geode.distributed.internal.DistributionConfig.VALIDATE_SERIALIZABLE_OBJECTS_NAME;
+import static org.apache.geode.internal.lang.ClassUtils.isClassAvailable;
import static org.apache.geode.internal.serialization.Version.CURRENT;
-import static org.apache.geode.internal.serialization.filter.ObjectInputFilterUtils.supportsObjectInputFilter;
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assume.assumeTrue;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -44,7 +44,8 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.geode.DataSerializer;
-import org.apache.geode.internal.serialization.filter.SerializableObjectConfig;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
import org.apache.geode.test.junit.categories.SecurityTest;
import org.apache.geode.test.junit.categories.SerializationTest;
@@ -53,9 +54,9 @@ public class InternalDataSerializerShiroAcceptListTest {
@BeforeClass
public static void hasObjectInputFilter() {
- assertThat(supportsObjectInputFilter())
- .as("java.io.ObjectInputFilter or sun.misc.ObjectInputFilter is available")
- .isTrue();
+ assumeTrue("ObjectInputFilter is present in this JVM",
+ isClassAvailable("sun.misc.ObjectInputFilter") ||
+ isClassAvailable("java.io.ObjectInputFilter"));
}
@After
@@ -137,9 +138,17 @@ public class InternalDataSerializerShiroAcceptListTest {
propertiesWithoutFilter());
}
+ private static Properties propertiesWithoutFilter() {
+ Properties properties = new Properties();
+ properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
+
+ return properties;
+ }
+
private static void trySerializingObject(Object object, Properties properties)
throws IOException, ClassNotFoundException {
- InternalDataSerializer.initializeSerializationFilter(config(properties), emptySet());
+ DistributionConfig distributionConfig = new DistributionConfigImpl(properties);
+ InternalDataSerializer.initializeSerializationFilter(distributionConfig, emptySet());
HeapDataOutputStream outputStream = new HeapDataOutputStream(CURRENT);
DataSerializer.writeObject(object, outputStream);
@@ -149,15 +158,4 @@ public class InternalDataSerializerShiroAcceptListTest {
DataSerializer.readObject(dis);
}
}
-
- private static SerializableObjectConfig config(Properties properties) {
- return new DistributedSerializableObjectConfig(properties);
- }
-
- private static Properties propertiesWithoutFilter() {
- Properties properties = new Properties();
- properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS_NAME, "true");
-
- return properties;
- }
}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventSerializationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventSerializationTest.java
index 2700c02dc5..c6a441d633 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventSerializationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventSerializationTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.internal.cache;
import static org.apache.geode.internal.lang.SystemPropertyHelper.EARLY_ENTRY_EVENT_SERIALIZATION;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -35,7 +36,6 @@ import org.mockito.ArgumentCaptor;
import org.apache.geode.SerializationException;
import org.apache.geode.cache.Scope;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.pdx.internal.PdxInstanceImpl;
public class EntryEventSerializationTest {
@@ -50,7 +50,7 @@ public class EntryEventSerializationTest {
@Before
public void setUp() {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
+ System.setProperty(GEODE_PREFIX + EARLY_ENTRY_EVENT_SERIALIZATION, "true");
region = mock(InternalRegion.class);
event = mock(InternalEntryEvent.class);
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsTest.java
index 1a69c79aed..8a7713306f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/DefaultDiskDirsTest.java
@@ -18,6 +18,7 @@ package org.apache.geode.internal.cache.persistence;
import static org.apache.geode.internal.cache.persistence.DefaultDiskDirs.getDefaultDiskDirs;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
@@ -26,8 +27,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.apache.geode.internal.lang.SystemProperty;
-
public class DefaultDiskDirsTest {
@@ -41,8 +40,7 @@ public class DefaultDiskDirsTest {
@Test
public void getDefaultDiskDirsReturnsOverriddenValue() {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
- "/FullyQualifiedPath");
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, "/FullyQualifiedPath");
assertThat(getDefaultDiskDirs()).isEqualTo(new File[] {new File("/FullyQualifiedPath")});
}
}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistenceInitialImageAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistenceInitialImageAdvisorTest.java
index d811cdd2a4..66f1004cac 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistenceInitialImageAdvisorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistenceInitialImageAdvisorTest.java
@@ -20,6 +20,7 @@ import static java.util.Collections.emptySet;
import static java.util.stream.Collectors.toCollection;
import static java.util.stream.Collectors.toSet;
import static org.apache.geode.internal.cache.persistence.MembershipChangeListenerFactory.cancelCondition;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.internal.lang.SystemPropertyHelper.PERSISTENT_VIEW_RETRY_TIMEOUT_SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@@ -57,7 +58,6 @@ import org.apache.geode.distributed.internal.ReplyException;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.CacheDistributionAdvisor;
import org.apache.geode.internal.cache.CacheDistributionAdvisor.InitialImageAdvice;
-import org.apache.geode.internal.lang.SystemProperty;
public class PersistenceInitialImageAdvisorTest {
@@ -73,8 +73,7 @@ public class PersistenceInitialImageAdvisorTest {
@Before
public void setUp() {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + PERSISTENT_VIEW_RETRY_TIMEOUT_SECONDS,
- String.valueOf(15));
+ System.setProperty(GEODE_PREFIX + PERSISTENT_VIEW_RETRY_TIMEOUT_SECONDS, String.valueOf(15));
persistenceAdvisor = mock(InternalPersistenceAdvisor.class);
cacheDistributionAdvisor = mock(CacheDistributionAdvisor.class, RETURNS_DEEP_STUBS);
diff --git a/geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
similarity index 97%
rename from geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
index 49e371447e..ad118ef1b5 100644
--- a/geode-common/src/test/java/org/apache/geode/internal/lang/utils/ClassUtilsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
@@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.lang.utils;
+package org.apache.geode.internal.lang;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -22,20 +22,20 @@ import static org.junit.Assert.assertTrue;
import java.util.Calendar;
import java.util.Date;
-import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
+
/**
* The ClassUtilsJUnitTest class is a test suite with test cases to test the contract and
* functionality of the ClassUtils class.
* <p/>
*
- * @see ClassUtils
+ * @see org.apache.geode.internal.lang.ClassUtils
* @see org.junit.Assert
* @see org.junit.Test
* @since GemFire 7.0
*/
-public class ClassUtilsTest {
+public class ClassUtilsJUnitTest {
@Test
public void testForNameWithExistingClass() {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
index f1f61d9fb9..51930031e6 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
@@ -14,105 +14,94 @@
*/
package org.apache.geode.internal.lang;
-import static org.apache.geode.internal.lang.SystemProperty.DEFAULT_PREFIX;
-import static org.apache.geode.internal.lang.SystemProperty.GEMFIRE_PREFIX;
-import static org.apache.geode.internal.lang.SystemProperty.getProductBooleanProperty;
-import static org.apache.geode.internal.lang.SystemPropertyHelper.PARALLEL_DISK_STORE_RECOVERY;
-import static org.apache.geode.internal.lang.SystemPropertyHelper.restoreSetOperationTransactionBehavior;
import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-public class SystemPropertyHelperTest {
-
- private final String restoreSetOperationTransactionBehavior =
- "restoreSetOperationTransactionBehavior";
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+public class SystemPropertyHelperTest {
+ private String restoreSetOperationTransactionBehavior = "restoreSetOperationTransactionBehavior";
@Test
public void testRestoreSetOperationTransactionBehaviorDefaultToFalse() {
- assertThat(restoreSetOperationTransactionBehavior()).isFalse();
+ assertThat(SystemPropertyHelper.restoreSetOperationTransactionBehavior()).isFalse();
}
@Test
- public void testRestoreSetOperationTransactionBehaviorGemfireSystemProperty() {
+ public void testRestoreSetOperationTransactionBehaviorSystemProperty() {
String gemfirePrefixProperty = "gemfire." + restoreSetOperationTransactionBehavior;
System.setProperty(gemfirePrefixProperty, "true");
- assertThat(restoreSetOperationTransactionBehavior()).isTrue();
- }
+ assertThat(SystemPropertyHelper.restoreSetOperationTransactionBehavior()).isTrue();
+ System.clearProperty(gemfirePrefixProperty);
- @Test
- public void testRestoreSetOperationTransactionBehaviorGeodeSystemProperty() {
String geodePrefixProperty = "geode." + restoreSetOperationTransactionBehavior;
System.setProperty(geodePrefixProperty, "true");
- assertThat(restoreSetOperationTransactionBehavior()).isTrue();
+ assertThat(SystemPropertyHelper.restoreSetOperationTransactionBehavior()).isTrue();
+ System.clearProperty(geodePrefixProperty);
}
@Test
public void testRestoreSetOperationTransactionBehaviorGeodePreference() {
String gemfirePrefixProperty = "gemfire." + restoreSetOperationTransactionBehavior;
String geodePrefixProperty = "geode." + restoreSetOperationTransactionBehavior;
-
System.setProperty(geodePrefixProperty, "false");
System.setProperty(gemfirePrefixProperty, "true");
-
- assertThat(restoreSetOperationTransactionBehavior()).isFalse();
+ assertThat(SystemPropertyHelper.restoreSetOperationTransactionBehavior()).isFalse();
+ System.clearProperty(geodePrefixProperty);
+ System.clearProperty(gemfirePrefixProperty);
}
@Test
- public void getBooleanPropertyReturnsEnableRetryOnPdxSerializationException() {
- String testProperty = "enableQueryRetryOnPdxSerializationException";
+ public void getIntegerPropertyPrefersGeodePrefix() {
+ String testProperty = "testIntegerProperty";
String gemfirePrefixProperty = "gemfire." + testProperty;
-
- System.setProperty(gemfirePrefixProperty, "true");
- assertThat(getProductBooleanProperty(testProperty).get()).isTrue();
-
+ String geodePrefixProperty = "geode." + testProperty;
+ System.setProperty(geodePrefixProperty, "1");
+ System.setProperty(gemfirePrefixProperty, "0");
+ assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).get()).isEqualTo(1);
+ System.clearProperty(geodePrefixProperty);
System.clearProperty(gemfirePrefixProperty);
- assertThat(getProductBooleanProperty(testProperty).orElse(false)).isFalse();
}
@Test
- public void getBooleanPropertyParallelDiskStoreRecovery_default() {
- // default
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).isPresent()).isFalse();
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).orElse(true)).isTrue();
+ public void getIntegerPropertyReturnsGemfirePrefixIfGeodeMissing() {
+ String testProperty = "testIntegerProperty";
+ String gemfirePrefixProperty = "gemfire." + testProperty;
+ System.setProperty(gemfirePrefixProperty, "1");
+ assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).get()).isEqualTo(1);
+ System.clearProperty(gemfirePrefixProperty);
}
@Test
- public void getBooleanPropertyParallelDiskStoreRecovery_withoutPrefix() {
- // without geode or gemfire prefix
- System.setProperty(PARALLEL_DISK_STORE_RECOVERY, "true");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).isPresent()).isFalse();
+ public void getIntegerPropertyReturnsEmptyOptionalIfPropertiesMissing() {
+ String testProperty = "notSetProperty";
+ assertThat(SystemPropertyHelper.getProductIntegerProperty(testProperty).isPresent()).isFalse();
}
@Test
- public void getBooleanPropertyParallelDiskStoreRecovery_withGeodePrefix() {
- // with geode prefix
- System.setProperty(DEFAULT_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "true");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).get()).isTrue();
- System.setProperty(DEFAULT_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "false");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).get()).isFalse();
+ public void getBooleanPropertyReturnsEmptyOptionalIfProperiesMissing() {
+ String testProperty = "notSetProperty";
+ assertThat(SystemPropertyHelper.getProductBooleanProperty(testProperty).isPresent()).isFalse();
}
@Test
- public void getBooleanPropertyParallelDiskStoreRecovery_withGemFirePrefix() {
- // with gemfire prefix
- System.clearProperty(DEFAULT_PREFIX + PARALLEL_DISK_STORE_RECOVERY);
- System.setProperty(GEMFIRE_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "true");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).get()).isTrue();
- System.setProperty(GEMFIRE_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "false");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).get()).isFalse();
+ public void getBooleanPropertyPrefersGeodePrefix() {
+ String testProperty = "testBooleanProperty";
+ String gemfirePrefixProperty = "gemfire." + testProperty;
+ String geodePrefixProperty = "geode." + testProperty;
+ System.setProperty(geodePrefixProperty, "true");
+ System.setProperty(gemfirePrefixProperty, "false");
+ assertThat(SystemPropertyHelper.getProductBooleanProperty(testProperty).get()).isTrue();
+ System.clearProperty(geodePrefixProperty);
+ System.clearProperty(gemfirePrefixProperty);
}
@Test
- public void getBooleanPropertyParallelDiskStoreRecovery_withBothPrefixes() {
- // with geode and gemfire prefix
- System.setProperty(DEFAULT_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "true");
- System.setProperty(GEMFIRE_PREFIX + PARALLEL_DISK_STORE_RECOVERY, "false");
- assertThat(getProductBooleanProperty(PARALLEL_DISK_STORE_RECOVERY).get()).isTrue();
+ public void getBooleanPropertyReturnsGemfirePrefixIfGeodeMissing() {
+ String testProperty = "testBooleanProperty";
+ String gemfirePrefixProperty = "gemfire." + testProperty;
+ System.setProperty(gemfirePrefixProperty, "true");
+ assertThat(SystemPropertyHelper.getProductBooleanProperty(testProperty).get()).isTrue();
+ System.clearProperty(gemfirePrefixProperty);
}
}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilterTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilterTest.java
new file mode 100644
index 0000000000..c8f8ea9050
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/JmxRmiOpenTypesSerialFilterTest.java
@@ -0,0 +1,351 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
+import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
+import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assumptions.assumeThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.rmi.MarshalledObject;
+import java.util.function.Consumer;
+
+import javax.management.ObjectName;
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+import org.apache.commons.lang3.JavaVersion;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+
+public class JmxRmiOpenTypesSerialFilterTest {
+
+ private Consumer<String> infoLogger;
+
+ @Rule
+ public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+ @Before
+ public void setUp() {
+ infoLogger = uncheckedCast(mock(Consumer.class));
+ }
+
+ @Test
+ public void propertyValueIsNullByDefault() {
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+
+ assertThat(propertyValue).isNull();
+ }
+
+ @Test
+ public void supportsDedicatedSerialFilter_returnsTrue_atLeastJava9() {
+ assumeThat(isJavaVersionAtLeast(JavaVersion.JAVA_9)).isTrue();
+
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ boolean result = jmxRmiOpenTypesSerialFilter.supportsDedicatedSerialFilter();
+
+ assertThat(result).isTrue();
+ }
+
+ @Test
+ public void supportsDedicatedSerialFilter_returnsFalse_atMostJava8() {
+ assumeThat(isJavaVersionAtMost(JavaVersion.JAVA_1_8)).isTrue();
+
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ boolean result = jmxRmiOpenTypesSerialFilter.supportsDedicatedSerialFilter();
+
+ assertThat(result).isFalse();
+ }
+
+ @Test
+ public void setPropertyValue_setsValue_ifExistingValueIsNull() {
+ String value = "value-of-property";
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ jmxRmiOpenTypesSerialFilter.setPropertyValueUnlessExists(value);
+
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+ assertThat(propertyValue).isEqualTo(value);
+ }
+
+ @Test
+ public void setPropertyValue_setsValue_ifExistingValueIsEmpty() {
+ System.setProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME, "");
+ String value = "value-of-property";
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ jmxRmiOpenTypesSerialFilter.setPropertyValueUnlessExists(value);
+
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+ assertThat(propertyValue).isEqualTo(value);
+ }
+
+ @Test
+ public void setPropertyValue_logsMessage_ifExistingValueIsEmpty() {
+ System.setProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME, "");
+ String value = "value-of-property";
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter =
+ new JmxRmiOpenTypesSerialFilter(infoLogger, () -> true);
+
+ jmxRmiOpenTypesSerialFilter.setPropertyValueUnlessExists(value);
+
+ String expectedLogMessage = "System property " + JmxRmiOpenTypesSerialFilter.PROPERTY_NAME +
+ " is now configured with '" + value + "'.";
+ verify(infoLogger).accept(expectedLogMessage);
+ }
+
+ @Test
+ public void setPropertyValue_leavesExistingValue_ifExistingValueIsNotEmpty() {
+ String existingValue = "existing-value-of-property";
+ System.setProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME, existingValue);
+ String value = "value-of-property";
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ jmxRmiOpenTypesSerialFilter.setPropertyValueUnlessExists(value);
+
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+ assertThat(propertyValue).isEqualTo(existingValue);
+ }
+
+ @Test
+ public void setPropertyValue_logsMessage_ifExistingValueIsNotEmpty() {
+ String existingValue = "existing-value-of-property";
+ System.setProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME, existingValue);
+ String value = "value-of-property";
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter =
+ new JmxRmiOpenTypesSerialFilter(infoLogger, () -> true);
+
+ jmxRmiOpenTypesSerialFilter.setPropertyValueUnlessExists(value);
+
+ String expectedLogMessage = "System property " + JmxRmiOpenTypesSerialFilter.PROPERTY_NAME +
+ " is already configured.";
+ verify(infoLogger).accept(expectedLogMessage);
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesBoolean() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Boolean.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesByte() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Byte.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesCharacter() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Character.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesShort() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Short.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesInteger() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Integer.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesLong() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Long.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesFloat() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Float.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesDouble() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(Double.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesString() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(String.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesBigInteger() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(BigInteger.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesBigDecimal() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(BigDecimal.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesObjectName() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(ObjectName.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesCompositeData() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(CompositeData.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesTabularData() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(TabularData.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesSimpleType() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(SimpleType.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesCompositeType() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(CompositeType.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesTabularType() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(TabularType.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesArrayType() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(ArrayType.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_includesMarshalledObject() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).contains(MarshalledObject.class.getName());
+ }
+
+ @Test
+ public void createSerialFilterPattern_rejectsAllOtherTypes() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter = new JmxRmiOpenTypesSerialFilter();
+
+ String result = jmxRmiOpenTypesSerialFilter.createSerialFilterPattern();
+
+ assertThat(result).endsWith("!*");
+ }
+
+ @Test
+ public void configureSerialFilterIfEmpty_setsPropertyValue_atLeastJava9() {
+ JmxRmiOpenTypesSerialFilter jmxRmiOpenTypesSerialFilter =
+ new JmxRmiOpenTypesSerialFilter(infoLogger, () -> true);
+
+ jmxRmiOpenTypesSerialFilter.configureSerialFilter();
+
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+ assertThat(propertyValue).isNotEmpty();
+ }
+
+ @Test
+ public void configureSerialFilterIfEmpty_setsPropertyValue_atMostJava8() {
+ JmxRmiSerialFilter jmxRmiOpenTypesSerialFilter =
+ new JmxRmiOpenTypesSerialFilter(infoLogger, () -> false);
+
+ jmxRmiOpenTypesSerialFilter.configureSerialFilter();
+
+ String propertyValue = System.getProperty(JmxRmiOpenTypesSerialFilter.PROPERTY_NAME);
+ assertThat(propertyValue).isNull();
+ }
+}
diff --git a/geode-core/src/test/resources/expected-pom.xml b/geode-core/src/test/resources/expected-pom.xml
index 2670e8347e..47ae85aa53 100644
--- a/geode-core/src/test/resources/expected-pom.xml
+++ b/geode-core/src/test/resources/expected-pom.xml
@@ -76,11 +76,6 @@
<artifactId>geode-common</artifactId>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.apache.geode</groupId>
- <artifactId>geode-serialization</artifactId>
- <scope>compile</scope>
- </dependency>
<dependency>
<groupId>org.apache.geode</groupId>
<artifactId>geode-management</artifactId>
@@ -232,6 +227,11 @@
<artifactId>geode-unsafe</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.geode</groupId>
+ <artifactId>geode-serialization</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.geode</groupId>
<artifactId>geode-tcp-server</artifactId>
diff --git a/geode-cq/src/integrationTest/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesServiceIntegrationTest.java b/geode-cq/src/integrationTest/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesServiceIntegrationTest.java
index 1d1d09c8d1..b17a1cf8a2 100644
--- a/geode-cq/src/integrationTest/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-cq/src/integrationTest/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.cache.query.cq.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-cq/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesIntegrationTest.java b/geode-cq/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesIntegrationTest.java
index 3235c7b8cb..96c036a636 100755
--- a/geode-cq/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesIntegrationTest.java
+++ b/geode-cq/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeCQSerializablesIntegrationTest.java
@@ -23,8 +23,7 @@ import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category({ClientSubscriptionTest.class, SerializationTest.class})
-public class AnalyzeCQSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeCQSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesService.java b/geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesService.java
index b61cbc5597..59838f85d1 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesService.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/cq/internal/CQSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.cache.query.cq.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class CQSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-cq/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-cq/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-cq/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-cq/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedDiskDirRuleDistributedTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedDiskDirRuleDistributedTest.java
index e152817335..deb215179d 100644
--- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedDiskDirRuleDistributedTest.java
+++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedDiskDirRuleDistributedTest.java
@@ -15,6 +15,7 @@
package org.apache.geode.test.dunit.rules.tests;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.apache.geode.test.dunit.VM.getAllVMs;
import static org.apache.geode.test.dunit.VM.getController;
import static org.apache.geode.test.dunit.VM.getVM;
@@ -29,7 +30,6 @@ import java.util.List;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.rules.DistributedDiskDirRule;
import org.apache.geode.test.dunit.rules.DistributedRule;
@@ -50,8 +50,7 @@ public class DistributedDiskDirRuleDistributedTest implements Serializable {
public void setsDefaultDiskDirsPropertyInEveryVm() {
for (VM vm : toArray(getAllVMs(), getController())) {
vm.invoke(() -> {
- String propertyValue =
- System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
+ String propertyValue = System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
assertThat(propertyValue)
.isEqualTo(distributedDiskDirRule.getDiskDirFor(vm).getAbsolutePath());
@@ -65,8 +64,7 @@ public class DistributedDiskDirRuleDistributedTest implements Serializable {
for (VM vm : toArray(getAllVMs(), getController())) {
String propertyValue =
- vm.invoke(
- () -> System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
+ vm.invoke(() -> System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
assertThat(propertyValues).doesNotContain(propertyValue);
propertyValues.add(propertyValue);
}
@@ -79,8 +77,7 @@ public class DistributedDiskDirRuleDistributedTest implements Serializable {
VM newVM = getVM(getVMCount());
String propertyValue =
- newVM.invoke(
- () -> System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
+ newVM.invoke(() -> System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
assertThat(propertyValue).isNotNull();
}
@@ -88,14 +85,12 @@ public class DistributedDiskDirRuleDistributedTest implements Serializable {
@Test
public void defaultDiskDirsPropertyIsKeptInBouncedVm() {
String propertyValueBeforeBounce =
- getVM(0).invoke(
- () -> System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
+ getVM(0).invoke(() -> System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
getVM(0).bounce();
String propertyValueAfterBounce =
- getVM(0).invoke(
- () -> System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
+ getVM(0).invoke(() -> System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
assertThat(propertyValueAfterBounce).isEqualTo(propertyValueBeforeBounce);
}
}
diff --git a/geode-dunit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeDUnitSerializablesIntegrationTest.java b/geode-dunit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeDUnitSerializablesIntegrationTest.java
index 601b57ccb6..f188c068c1 100644
--- a/geode-dunit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeDUnitSerializablesIntegrationTest.java
+++ b/geode-dunit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeDUnitSerializablesIntegrationTest.java
@@ -27,9 +27,7 @@ import org.apache.geode.test.dunit.internal.Master;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
-public class AnalyzeDUnitSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
-
+public class AnalyzeDUnitSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
private static final Logger logger = LogService.getLogger();
private static final Set<Class<?>> IGNORE_CLASSES = new HashSet<>();
diff --git a/geode-dunit/src/integrationTest/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesServiceIntegrationTest.java b/geode-dunit/src/integrationTest/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesServiceIntegrationTest.java
index d73861e886..f70d3c3880 100644
--- a/geode-dunit/src/integrationTest/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-dunit/src/integrationTest/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.test.dunit.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-dunit/src/integrationTest/java/org/apache/geode/test/junit/rules/DiskDirRuleIntegrationTest.java b/geode-dunit/src/integrationTest/java/org/apache/geode/test/junit/rules/DiskDirRuleIntegrationTest.java
index 0c5492cd5a..83f2294da2 100644
--- a/geode-dunit/src/integrationTest/java/org/apache/geode/test/junit/rules/DiskDirRuleIntegrationTest.java
+++ b/geode-dunit/src/integrationTest/java/org/apache/geode/test/junit/rules/DiskDirRuleIntegrationTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.test.junit.rules;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
@@ -29,7 +30,6 @@ import org.junit.rules.TestName;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.internal.cache.DiskStoreImpl;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.SystemProperty;
/**
* Integration tests for {@link DiskDirRule}.
@@ -74,8 +74,7 @@ public class DiskDirRuleIntegrationTest {
@Test
public void setsDefaultDiskDirsSystemProperty() {
- String propertyValue =
- System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
+ String propertyValue = System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
assertThat(propertyValue).isEqualTo(diskDirRule.getDiskDir().getAbsolutePath());
}
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesService.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesService.java
index beb4daf343..6ae34d76d9 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesService.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/internal/DUnitSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.test.dunit.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class DUnitSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedDiskDirRule.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedDiskDirRule.java
index 0ebf10de63..672e9a9087 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedDiskDirRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedDiskDirRule.java
@@ -16,8 +16,9 @@
*/
package org.apache.geode.test.dunit.rules;
-import static org.apache.geode.internal.lang.SystemProperty.getProductStringProperty;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.getProductStringProperty;
import static org.apache.geode.test.dunit.VM.DEFAULT_VM_COUNT;
import static org.apache.geode.test.dunit.VM.getCurrentVMNum;
@@ -31,7 +32,6 @@ import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.junit.runner.Description;
-import org.apache.geode.internal.lang.SystemProperty;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.VMEventListener;
import org.apache.geode.test.dunit.internal.DUnitLauncher;
@@ -118,9 +118,7 @@ public class DistributedDiskDirRule extends DiskDirRule implements SerializableT
* Returns the current default disk dirs value for the specified VM.
*/
public File getDiskDirFor(VM vm) {
- return new File(
- vm.invoke(
- () -> System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY)));
+ return new File(vm.invoke(() -> System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY)));
}
@Override
@@ -178,8 +176,7 @@ public class DistributedDiskDirRule extends DiskDirRule implements SerializableT
Files.createDirectory(diskDir.toPath());
}
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
- diskDir.getAbsolutePath());
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, diskDir.getAbsolutePath());
}
private void doAfter() {
@@ -188,10 +185,9 @@ public class DistributedDiskDirRule extends DiskDirRule implements SerializableT
+ getCurrentVMNum() + ". Rule does not support VM.bounce().");
}
if (data.originalValue() == null) {
- System.clearProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
+ System.clearProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
} else {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
- data.originalValue());
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, data.originalValue());
}
}
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
index b221daca57..6a9f00e387 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/DiskDirRule.java
@@ -16,8 +16,9 @@
*/
package org.apache.geode.test.junit.rules;
-import static org.apache.geode.internal.lang.SystemProperty.getProductStringProperty;
import static org.apache.geode.internal.lang.SystemPropertyHelper.DEFAULT_DISK_DIRS_PROPERTY;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.GEODE_PREFIX;
+import static org.apache.geode.internal.lang.SystemPropertyHelper.getProductStringProperty;
import java.io.File;
import java.lang.reflect.Method;
@@ -27,8 +28,6 @@ import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.junit.runner.Description;
-import org.apache.geode.internal.lang.SystemProperty;
-
/**
* JUnit Rule that overrides the default DiskDirs directory. Internally, TemporaryFolder and
* TestName are used by this rule to define the directory locations and names.
@@ -74,7 +73,7 @@ public class DiskDirRule extends DescribedExternalResource {
* Returns the current default disk dirs value.
*/
public File getDiskDir() {
- return new File(System.getProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
+ return new File(System.getProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY));
}
@Override
@@ -86,16 +85,15 @@ public class DiskDirRule extends DescribedExternalResource {
File diskDir = temporaryFolder.newFolder(getDiskDirName(description.getClassName()));
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY,
- diskDir.getAbsolutePath());
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, diskDir.getAbsolutePath());
}
@Override
protected void after(Description description) {
if (originalValue == null) {
- System.clearProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
+ System.clearProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY);
} else {
- System.setProperty(SystemProperty.DEFAULT_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, originalValue);
+ System.setProperty(GEODE_PREFIX + DEFAULT_DISK_DIRS_PROPERTY, originalValue);
}
}
diff --git a/geode-dunit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-dunit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-dunit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-dunit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeGfshSerializablesIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeGfshSerializablesIntegrationTest.java
index bac8886b24..fb4e3986cc 100755
--- a/geode-gfsh/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeGfshSerializablesIntegrationTest.java
+++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeGfshSerializablesIntegrationTest.java
@@ -18,12 +18,11 @@ import java.util.Optional;
import org.junit.experimental.categories.Category;
-import org.apache.geode.gfsh.internal.management.GfshSanctionedSerializablesService;
+import org.apache.geode.management.internal.GfshSanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
-public class AnalyzeGfshSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeGfshSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-gfsh/src/integrationTest/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesServiceIntegrationTest.java b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/GfshSanctionedSerializablesServiceIntegrationTest.java
similarity index 93%
rename from geode-gfsh/src/integrationTest/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesServiceIntegrationTest.java
rename to geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/GfshSanctionedSerializablesServiceIntegrationTest.java
index 48a414c7d9..a2d7644353 100644
--- a/geode-gfsh/src/integrationTest/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/GfshSanctionedSerializablesServiceIntegrationTest.java
@@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.gfsh.internal.management;
+package org.apache.geode.management.internal;
import static org.assertj.core.api.Assertions.assertThat;
@@ -23,7 +23,7 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.management.cli.CommandProcessingException;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-gfsh/src/main/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesService.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/GfshSanctionedSerializablesService.java
similarity index 88%
rename from geode-gfsh/src/main/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesService.java
rename to geode-gfsh/src/main/java/org/apache/geode/management/internal/GfshSanctionedSerializablesService.java
index 867b897f94..66c9457d55 100644
--- a/geode-gfsh/src/main/java/org/apache/geode/gfsh/internal/management/GfshSanctionedSerializablesService.java
+++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/GfshSanctionedSerializablesService.java
@@ -12,11 +12,11 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.gfsh.internal.management;
+package org.apache.geode.management.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class GfshSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
index 2b5c72e70e..688d541e7f 100644
--- a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
+++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
@@ -23,7 +23,7 @@ import org.springframework.shell.core.annotation.CliOption;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.lang.utils.ClassUtils;
+import org.apache.geode.internal.lang.ClassUtils;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.ConverterHint;
import org.apache.geode.management.cli.GfshCommand;
diff --git a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
index 444cf0175e..7c47f230ca 100755
--- a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
+++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
@@ -46,7 +46,7 @@ import org.springframework.shell.event.ShellStatus.Status;
import org.apache.geode.annotations.internal.MakeNotStatic;
import org.apache.geode.annotations.internal.MutableForTesting;
import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.utils.ClassUtils;
+import org.apache.geode.internal.lang.ClassUtils;
import org.apache.geode.internal.logging.Banner;
import org.apache.geode.internal.process.signal.AbstractSignalNotificationHandler;
import org.apache.geode.internal.serialization.Version;
diff --git a/geode-redis/src/test/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 91%
rename from geode-redis/src/test/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
index c11ffee3f9..e51ef5e1a5 100644
--- a/geode-redis/src/test/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
+++ b/geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
@@ -12,4 +12,4 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#
-org.apache.geode.redis.internal.RedisSanctionedSerializablesService
+org.apache.geode.management.internal.GfshSanctionedSerializablesService
diff --git a/geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
deleted file mode 100644
index 51b414019a..0000000000
--- a/geode-gfsh/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
+++ /dev/null
@@ -1,15 +0,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.
-#
-org.apache.geode.gfsh.internal.management.GfshSanctionedSerializablesService
diff --git a/geode-gfsh/src/main/resources/org/apache/geode/gfsh/internal/management/sanctioned-geode-gfsh-serializables.txt b/geode-gfsh/src/main/resources/org/apache/geode/management/internal/sanctioned-geode-gfsh-serializables.txt
similarity index 100%
rename from geode-gfsh/src/main/resources/org/apache/geode/gfsh/internal/management/sanctioned-geode-gfsh-serializables.txt
rename to geode-gfsh/src/main/resources/org/apache/geode/management/internal/sanctioned-geode-gfsh-serializables.txt
diff --git a/geode-http-service/build.gradle b/geode-http-service/build.gradle
index 5af9232bdf..c9e0580e96 100755
--- a/geode-http-service/build.gradle
+++ b/geode-http-service/build.gradle
@@ -33,7 +33,6 @@ dependencies {
compileOnly(project(':geode-common')) {
exclude module: 'junit'
}
- compileOnly(project(':geode-serialization'))
testImplementation(project(':geode-core'))
testImplementation(project(':geode-common'))
diff --git a/geode-junit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeJUnitSerializablesIntegrationTest.java b/geode-junit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeJUnitSerializablesIntegrationTest.java
index cc225ff8ab..6e4aeabe88 100644
--- a/geode-junit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeJUnitSerializablesIntegrationTest.java
+++ b/geode-junit/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeJUnitSerializablesIntegrationTest.java
@@ -28,8 +28,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
import org.apache.geode.test.junit.internal.JUnitSanctionedSerializablesService;
@Category(SerializationTest.class)
-public class AnalyzeJUnitSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeJUnitSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
private static final Set<Class<?>> IGNORE_CLASSES = new HashSet<>(asList(
PortfolioNoDS.class, PortfolioPdx.class));
diff --git a/geode-junit/src/integrationTest/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesServiceIntegrationTest.java b/geode-junit/src/integrationTest/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesServiceIntegrationTest.java
index 2f48af85c8..f3172785f6 100644
--- a/geode-junit/src/integrationTest/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-junit/src/integrationTest/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,8 @@ package org.apache.geode.test.junit.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.CoreSanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
@@ -25,7 +26,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
public class JUnitSanctionedSerializablesServiceIntegrationTest
extends SanctionedSerializablesServiceIntegrationTestBase {
- private final SanctionedSerializablesService service = new JUnitSanctionedSerializablesService();
+ private final SanctionedSerializablesService service = new CoreSanctionedSerializablesService();
@Override
protected SanctionedSerializablesService getService() {
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesTestBase.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesJUnitTestBase.java
similarity index 88%
rename from geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesTestBase.java
rename to geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesJUnitTestBase.java
index 8c4d60d29c..5baa0d37e7 100644
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesTestBase.java
+++ b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesJUnitTestBase.java
@@ -16,7 +16,6 @@ package org.apache.geode.codeAnalysis;
import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.catchThrowable;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.Assert.assertTrue;
@@ -37,6 +36,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import org.junit.AfterClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -47,17 +47,18 @@ import org.apache.geode.codeAnalysis.decode.CompiledMethod;
import org.apache.geode.internal.serialization.BufferDataOutputStream;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.test.junit.categories.SerializationTest;
+import org.apache.geode.test.junit.rules.ClassAnalysisRule;
/**
* This abstract test class is the basis for all of our AnalyzeModuleNameSerializables tests.
* Subclasses must provide serialization/deserialization methods.
*
* <p>
- * Most tests should subclass {@link AnalyzeSerializablesWithClassAnalysisRuleTestBase} instead of
- * this class because it ties into geode-core serialization and saves a lot of work.
+ * Most tests should subclass {@link AnalyzeSerializablesJUnitTestBase} instead of this
+ * class because it ties into geode-core serialization and saves a lot of work.
*/
@Category({SerializationTest.class})
-public abstract class AnalyzeDataSerializablesTestBase {
+public abstract class AnalyzeDataSerializablesJUnitTestBase {
private static final Path MODULE_ROOT = Paths.get("..", "..", "..").toAbsolutePath().normalize();
private static final Path SOURCE_ROOT = MODULE_ROOT.resolve(Paths.get("src"));
@@ -99,6 +100,14 @@ public abstract class AnalyzeDataSerializablesTestBase {
@Rule
public TestName testName = new TestName();
+ @Rule
+ public ClassAnalysisRule classProvider = new ClassAnalysisRule(getModuleName());
+
+ @AfterClass
+ public static void afterClass() {
+ ClassAnalysisRule.clearCache();
+ }
+
/**
* implement this to return your module's name, such as "geode-core"
*/
@@ -138,10 +147,8 @@ public abstract class AnalyzeDataSerializablesTestBase {
}
}
- protected abstract Map<String, CompiledClass> loadClasses();
-
public void findClasses() throws Exception {
- classes = loadClasses();
+ classes = classProvider.getClasses();
List<String> excludedClasses = loadExcludedClasses(getResourceAsFile(EXCLUDED_CLASSES_TXT));
List<String> openBugs = loadOpenBugs(getResourceAsFile(OPEN_BUGS_TXT));
@@ -202,11 +209,9 @@ public abstract class AnalyzeDataSerializablesTestBase {
final Object excludedInstance;
try {
excludedInstance = excludedClass.newInstance();
- } catch (IllegalAccessException | InstantiationException | NullPointerException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
// okay - it's in the excludedClasses.txt file after all
- // IllegalAccessException: thrown when non-private constructor does not exist
- // InstantiationException: thrown when no-arg constructor does not exist
- // NullPointerException: thrown by constructors that fetch RMI dependencies
+ // IllegalAccessException means that the constructor is private.
continue;
}
serializeAndDeserializeObject(excludedInstance);
@@ -225,33 +230,17 @@ public abstract class AnalyzeDataSerializablesTestBase {
BufferDataOutputStream outputStream = new BufferDataOutputStream(Version.CURRENT);
try {
serializeObject(object, outputStream);
- } catch (IOException | NullPointerException e) {
+ } catch (IOException e) {
// some classes, such as BackupLock, are Serializable because the extend something
// like ReentrantLock but we never serialize them & it doesn't work to try to do so
System.out.println("Not Serializable: " + object.getClass().getName());
- return;
- } catch (Exception e) {
- /*
- * NOTE:
- * this block catches Exception instead of CacheClosedException so that modules without
- * dependency on geode-core can be tested with Analyze Serializables.
- *
- * ex: geode-membership does not depend on geode-core, so it cannot load CacheClosedException
- */
- if ("org.apache.geode.cache.CacheClosedException".equals(e.getClass().getName())) {
- System.out
- .println("I was unable to serialize " + object.getClass().getName() + " due to " + e);
- e.printStackTrace();
- return;
- }
- throw e;
}
-
- Throwable thrown = catchThrowable(() -> deserializeObject(outputStream));
-
- assertThat(thrown)
- .withFailMessage("I was able to deserialize " + object.getClass().getName())
- .isInstanceOf(InvalidClassException.class);
+ try {
+ deserializeObject(outputStream);
+ fail("I was able to deserialize " + object.getClass().getName());
+ } catch (InvalidClassException e) {
+ // expected
+ }
}
private String toBuildPathString(File file) {
@@ -349,7 +338,18 @@ public abstract class AnalyzeDataSerializablesTestBase {
}
File createEmptyFile(String fileName) throws IOException {
- File file = new File(fileName);
+ final String workingDir = System.getProperty("user.dir");
+ final String filePath;
+ if (isIntelliJDir(workingDir)) {
+ String buildDir = workingDir.replace(getModuleName(), "");
+ buildDir =
+ Paths.get(buildDir, "out", "production", "geode." + getModuleName() + ".integrationTest")
+ .toString();
+ filePath = buildDir + File.separator + fileName;
+ } else {
+ filePath = fileName;
+ }
+ File file = new File(filePath);
if (file.exists()) {
assertThat(file.delete()).isTrue();
}
@@ -358,6 +358,10 @@ public abstract class AnalyzeDataSerializablesTestBase {
return file;
}
+ private boolean isIntelliJDir(final String workingDir) {
+ return !workingDir.contains("build");
+ }
+
/**
* Use this method to get a resource stored in the test's resource directory
*/
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesWithClassAnalysisRuleTestBase.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesWithClassAnalysisRuleTestBase.java
deleted file mode 100644
index 3853d4ca0a..0000000000
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesWithClassAnalysisRuleTestBase.java
+++ /dev/null
@@ -1,40 +0,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.
- */
-package org.apache.geode.codeAnalysis;
-
-import java.util.Map;
-
-import org.junit.AfterClass;
-import org.junit.Rule;
-
-import org.apache.geode.codeAnalysis.decode.CompiledClass;
-import org.apache.geode.test.junit.rules.ClassAnalysisRule;
-
-public abstract class AnalyzeDataSerializablesWithClassAnalysisRuleTestBase
- extends AnalyzeDataSerializablesTestBase {
-
- @Rule
- public ClassAnalysisRule classProvider = new ClassAnalysisRule(getModuleName());
-
- @AfterClass
- public static void afterClass() {
- ClassAnalysisRule.clearCache();
- }
-
- @Override
- protected Map<String, CompiledClass> loadClasses() {
- return classProvider.getClasses();
- }
-}
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesTestBase.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTestBase.java
similarity index 92%
rename from geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesTestBase.java
rename to geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTestBase.java
index 16f02ea470..0776030621 100644
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesTestBase.java
+++ b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTestBase.java
@@ -16,7 +16,6 @@ package org.apache.geode.codeAnalysis;
import static org.apache.geode.distributed.ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER;
import static org.apache.geode.distributed.ConfigurationProperties.VALIDATE_SERIALIZABLE_OBJECTS;
-import static org.apache.geode.internal.InternalDataSerializer.initializeSerializationFilter;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -27,10 +26,10 @@ import java.io.Externalizable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InvalidClassException;
import java.io.Serializable;
import java.io.UncheckedIOException;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.nio.file.Path;
import java.rmi.RemoteException;
@@ -43,17 +42,16 @@ import java.util.Properties;
import java.util.Set;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.rules.ErrorCollector;
import org.apache.geode.CancelException;
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
import org.apache.geode.codeAnalysis.decode.CompiledClass;
import org.apache.geode.codeAnalysis.decode.CompiledField;
-import org.apache.geode.internal.DistributedSerializableObjectConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.serialization.BufferDataOutputStream;
import org.apache.geode.internal.serialization.DataSerializableFixedID;
import org.apache.geode.internal.serialization.Version;
@@ -66,8 +64,8 @@ import org.apache.geode.unsafe.internal.sun.reflect.ReflectionFactory;
* InternalDataSerializer. It also performs initialization of the Geode TypeRegistry
*/
@Category(SerializationTest.class)
-public abstract class AnalyzeSerializablesTestBase
- extends AnalyzeDataSerializablesTestBase {
+public abstract class AnalyzeSerializablesJUnitTestBase
+ extends AnalyzeDataSerializablesJUnitTestBase {
private static final String ACTUAL_SERIALIZABLES_DAT = "actualSerializables.dat";
@@ -76,9 +74,6 @@ public abstract class AnalyzeSerializablesTestBase
protected final List<ClassAndVariableDetails> expectedSerializables = new ArrayList<>();
- @Rule
- public ErrorCollector errorCollector = new ErrorCollector();
-
@Before
public void setUp() throws Exception {
TypeRegistry.init();
@@ -207,19 +202,12 @@ public abstract class AnalyzeSerializablesTestBase
isThrowable ? sanctionedClass.getDeclaredConstructor(String.class)
: sanctionedClass.getDeclaredConstructor((Class<?>[]) null);
constructor.setAccessible(true);
- if (isThrowable) {
- sanctionedInstance = constructor.newInstance("test throwable");
- } else {
- sanctionedInstance = constructor.newInstance();
- }
+ sanctionedInstance =
+ isThrowable ? constructor.newInstance("test throwable") : constructor.newInstance();
serializeAndDeserializeSanctionedObject(sanctionedInstance);
continue;
- } catch (NoSuchMethodException | InstantiationException | IllegalAccessException
- | NullPointerException | InvocationTargetException e) {
+ } catch (NoSuchMethodException | InstantiationException | IllegalAccessException e) {
// fall through
- } catch (Exception e) {
- errorCollector.addError(e);
- continue;
}
try {
Class<?> superClass = sanctionedClass;
@@ -333,7 +321,7 @@ public abstract class AnalyzeSerializablesTestBase
properties.setProperty(VALIDATE_SERIALIZABLE_OBJECTS, "true");
properties.setProperty(SERIALIZABLE_OBJECT_FILTER, "!*");
- initializeSerializationFilter(new DistributedSerializableObjectConfig(properties));
+ InternalDataSerializer.initializeSerializationFilter(new DistributionConfigImpl(properties));
}
@Override
@@ -351,23 +339,22 @@ public abstract class AnalyzeSerializablesTestBase
private void serializeAndDeserializeSanctionedObject(Object object) throws Exception {
BufferDataOutputStream outputStream = new BufferDataOutputStream(Version.CURRENT);
-
try {
serializeObject(object, outputStream);
} catch (RemoteException e) {
- // java.rmi.server.RemoteObject which is not supported by AnalyzeSerializables
- } catch (Exception e) {
- errorCollector.addError(
- new AssertionError("I was unable to serialize " + object.getClass().getName(), e));
+ fail(object.getClass().getName() +
+ " is a java.rmi.server.RemoteObject which is not supported by AnalyzeSerializables", e);
+ } catch (IOException e) {
+ // some classes, such as BackupLock, are Serializable because the extend something
+ // like ReentrantLock but we never serialize them & it doesn't work to try to do so
+ throw new AssertionError("Not Serializable: " + object.getClass().getName(), e);
}
-
try {
deserializeObject(outputStream);
} catch (CancelException e) {
// PDX classes fish for a PDXRegistry and find that there is no cache
- } catch (Exception e) {
- errorCollector.addError(
- new AssertionError("I was unable to deserialize " + object.getClass().getName(), e));
+ } catch (InvalidClassException e) {
+ fail("I was unable to deserialize " + object.getClass().getName(), e);
}
}
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesWithClassAnalysisRuleTestBase.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesWithClassAnalysisRuleTestBase.java
deleted file mode 100644
index 158bd6b729..0000000000
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesWithClassAnalysisRuleTestBase.java
+++ /dev/null
@@ -1,43 +0,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.
- */
-package org.apache.geode.codeAnalysis;
-
-import java.util.Map;
-
-import org.junit.AfterClass;
-import org.junit.Rule;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.codeAnalysis.decode.CompiledClass;
-import org.apache.geode.test.junit.categories.SerializationTest;
-import org.apache.geode.test.junit.rules.ClassAnalysisRule;
-
-@Category(SerializationTest.class)
-public abstract class AnalyzeSerializablesWithClassAnalysisRuleTestBase
- extends AnalyzeSerializablesTestBase {
-
- @Rule
- public ClassAnalysisRule classProvider = new ClassAnalysisRule(getModuleName());
-
- @AfterClass
- public static void afterClass() {
- ClassAnalysisRule.clearCache();
- }
-
- @Override
- protected Map<String, CompiledClass> loadClasses() {
- return classProvider.getClasses();
- }
-}
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java
index a82e80d151..c7e2d27cb7 100644
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java
+++ b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/CompiledClassUtils.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.codeAnalysis;
-import static org.apache.commons.lang3.StringUtils.isBlank;
-
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -303,11 +301,11 @@ public class CompiledClassUtils {
String line;
while ((line = in.readLine()) != null) {
line = line.trim();
- if (isBlank(line) || line.startsWith("#") || line.startsWith("//")) {
+ if (line.startsWith("#") || line.startsWith("//")) {
// comment line
- continue;
+ } else {
+ result.add(new ClassAndVariableDetails(line));
}
- result.add(new ClassAndVariableDetails(line));
}
return result;
}
diff --git a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/SanctionedSerializablesServiceIntegrationTestBase.java b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/SanctionedSerializablesServiceIntegrationTestBase.java
index d938769494..4a02107739 100644
--- a/geode-junit/src/main/java/org/apache/geode/codeAnalysis/SanctionedSerializablesServiceIntegrationTestBase.java
+++ b/geode-junit/src/main/java/org/apache/geode/codeAnalysis/SanctionedSerializablesServiceIntegrationTestBase.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.codeAnalysis;
-import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedSerializablesServices;
+import static org.apache.geode.internal.serialization.SanctionedSerializables.loadSanctionedSerializablesServices;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
@@ -23,7 +23,7 @@ import java.util.Collection;
import org.junit.Test;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public abstract class SanctionedSerializablesServiceIntegrationTestBase {
@@ -38,7 +38,7 @@ public abstract class SanctionedSerializablesServiceIntegrationTestBase {
}
@Test
- public void serviceIsLoaded() {
+ public final void serviceIsLoaded() {
Collection<SanctionedSerializablesService> services = loadSanctionedSerializablesServices();
SanctionedSerializablesService service = getService();
@@ -56,29 +56,23 @@ public abstract class SanctionedSerializablesServiceIntegrationTestBase {
}
@Test
- public void serviceResourceExists() {
+ public final void serviceResourceExists() {
SanctionedSerializablesService service = getService();
URL url = service.getSanctionedSerializablesURL();
- ServiceResourceExpectation expectation = getServiceResourceExpectation();
- String description = "Sanctioned serializables URL " + url + " " + expectation;
- switch (expectation) {
+ switch (getServiceResourceExpectation()) {
case NULL:
- assertThat(url)
- .as(description)
- .isNull();
+ assertThat(url).isNull();
break;
case EMPTY:
case NON_EMPTY:
- assertThat(url)
- .as(description)
- .isNotNull();
+ assertThat(url).isNotNull();
}
}
@Test
- public void serviceResourceIsLoaded() throws IOException {
+ public final void serviceResourceIsLoaded() throws IOException {
SanctionedSerializablesService service = getService();
Collection<String> serializables = service.getSerializationAcceptlist();
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/categories/SanctionedSerializablesTest.java b/geode-junit/src/main/java/org/apache/geode/test/junit/categories/SanctionedSerializablesTest.java
index ac0d7ac6c0..3401da107c 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/categories/SanctionedSerializablesTest.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/categories/SanctionedSerializablesTest.java
@@ -14,8 +14,5 @@
*/
package org.apache.geode.test.junit.categories;
-/**
- * A test category for SanctionedSerializables.
- */
-public interface SanctionedSerializablesTest extends SerializationTest {
+public interface SanctionedSerializablesTest {
}
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesService.java b/geode-junit/src/main/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesService.java
index 4de5d3ac88..0c3030ee58 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesService.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/internal/JUnitSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.test.junit.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class JUnitSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/ClassAnalysisRule.java b/geode-junit/src/main/java/org/apache/geode/test/junit/rules/ClassAnalysisRule.java
index 3ee70e72ea..599edf1a72 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/rules/ClassAnalysisRule.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/rules/ClassAnalysisRule.java
@@ -49,19 +49,13 @@ public class ClassAnalysisRule implements TestRule {
new AtomicReference<>(new HashMap<>());
private final String moduleName;
- private final String sourceSet;
private final Map<String, CompiledClass> classes = new HashMap<>();
/**
* @param moduleName The name of the gradle module in which your test resides
*/
public ClassAnalysisRule(String moduleName) {
- this(moduleName, "main");
- }
-
- public ClassAnalysisRule(String moduleName, String sourceSet) {
this.moduleName = moduleName;
- this.sourceSet = sourceSet;
}
public Map<String, CompiledClass> getClasses() {
@@ -101,18 +95,21 @@ public class ClassAnalysisRule implements TestRule {
.map(x -> new File(x))
.collect(Collectors.toList());
- // check for <module>/build/classes/java/**
String gradleBuildDirName =
- Paths.get(getModuleName(), "build", "classes", "java", sourceSet).toString();
-
- // check for <module>/build/classes/test/**
- String alternateBuildDirName =
- Paths.get(getModuleName(), "build", "classes", sourceSet).toString();
+ Paths.get(getModuleName(), "build", "classes", "java", "main").toString();
+ // System.out.println("gradleBuildDirName is " + gradleBuildDirName);
+ String ideaBuildDirName =
+ Paths.get(getModuleName(), "out", "production", "classes").toString();
+ // System.out.println("ideaBuildDirName is " + ideaBuildDirName);
+ String ideaFQCNBuildDirName =
+ Paths.get("out", "production", "geode." + getModuleName() + ".main").toString();
+ // System.out.println("idea build path with full package names is " + ideaFQCNBuildDirName);
String buildDir = null;
for (File entry : entries) {
if (entry.toString().endsWith(gradleBuildDirName)
- || entry.toString().endsWith(alternateBuildDirName)) {
+ || entry.toString().endsWith(ideaBuildDirName)
+ || entry.toString().endsWith(ideaFQCNBuildDirName)) {
buildDir = entry.toString();
break;
}
diff --git a/geode-junit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-junit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-junit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-junit/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-lucene/src/integrationTest/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesServiceIntegrationTest.java b/geode-lucene/src/integrationTest/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesServiceIntegrationTest.java
index f88e099c81..2c6ba29317 100644
--- a/geode-lucene/src/integrationTest/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-lucene/src/integrationTest/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.cache.lucene.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-lucene/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeLuceneSerializablesIntegrationTest.java b/geode-lucene/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeLuceneSerializablesIntegrationTest.java
index 3c77f28920..d170cd0e5b 100644
--- a/geode-lucene/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeLuceneSerializablesIntegrationTest.java
+++ b/geode-lucene/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeLuceneSerializablesIntegrationTest.java
@@ -23,8 +23,7 @@ import org.apache.geode.test.junit.categories.LuceneTest;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category({LuceneTest.class, SerializationTest.class})
-public class AnalyzeLuceneSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeLuceneSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesService.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesService.java
index 57db79473e..918c05d560 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesService.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.cache.lucene.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class LuceneSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-lucene/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-lucene/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-lucene/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-lucene/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-management/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeManagementSerializablesIntegrationTest.java b/geode-management/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeManagementSerializablesIntegrationTest.java
index 75f231f141..aab75d2311 100644
--- a/geode-management/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeManagementSerializablesIntegrationTest.java
+++ b/geode-management/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeManagementSerializablesIntegrationTest.java
@@ -23,7 +23,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
public class AnalyzeManagementSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+ extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-management/src/integrationTest/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesServiceIntegrationTest.java b/geode-management/src/integrationTest/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesServiceIntegrationTest.java
index 7a54d77a14..e2f1c10004 100644
--- a/geode-management/src/integrationTest/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-management/src/integrationTest/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.management.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-management/src/main/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesService.java b/geode-management/src/main/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesService.java
index 051cc1dfaa..6e232a5e76 100644
--- a/geode-management/src/main/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesService.java
+++ b/geode-management/src/main/java/org/apache/geode/management/internal/ManagementSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.management.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class ManagementSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-management/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-management/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-management/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-management/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMembershipSerializablesIntegrationTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMembershipSerializablesIntegrationTest.java
index 407ad6c526..e473148ff3 100644
--- a/geode-membership/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMembershipSerializablesIntegrationTest.java
+++ b/geode-membership/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMembershipSerializablesIntegrationTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
*/
@Category({MembershipTest.class, SerializationTest.class})
public class AnalyzeMembershipSerializablesIntegrationTest
- extends AnalyzeDataSerializablesWithClassAnalysisRuleTestBase {
+ extends AnalyzeDataSerializablesJUnitTestBase {
private final DSFIDSerializer dsfidSerializer = new DSFIDSerializerFactory().create();
diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
index d50d2e8d98..08211f8304 100644
--- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
+++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
@@ -58,6 +58,7 @@ public class MembershipDependenciesJUnitTest {
.or(resideInAPackage("org.apache.geode.internal.inet.."))
.or(resideInAPackage("org.apache.geode.internal.lang.."))
.or(resideInAPackage("org.apache.geode.codeAnalysis.."))
+
.or(not(resideInAPackage("org.apache.geode..")))
.or(type(AvailablePortHelper.class))
diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesServiceIntegrationTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesServiceIntegrationTest.java
index 1758efc413..cc1e6e9554 100644
--- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.distributed.internal.membership.gms;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesService.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesService.java
index 9311b0619b..b611b755f3 100644
--- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesService.java
+++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/MembershipSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.distributed.internal.membership.gms;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class MembershipSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-membership/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-membership/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-membership/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-membership/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-memcached/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMemcachedSerializablesIntegrationTest.java b/geode-memcached/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMemcachedSerializablesIntegrationTest.java
index c0850e0f26..8959d85b33 100644
--- a/geode-memcached/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMemcachedSerializablesIntegrationTest.java
+++ b/geode-memcached/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeMemcachedSerializablesIntegrationTest.java
@@ -23,7 +23,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
public class AnalyzeMemcachedSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+ extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-memcached/src/integrationTest/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesServiceIntegrationTest.java b/geode-memcached/src/integrationTest/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesServiceIntegrationTest.java
index 9badf90066..536b61b366 100644
--- a/geode-memcached/src/integrationTest/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-memcached/src/integrationTest/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.internal.memcached;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-memcached/src/main/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesService.java b/geode-memcached/src/main/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesService.java
index 014a2340a6..ab04e2d1f7 100644
--- a/geode-memcached/src/main/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesService.java
+++ b/geode-memcached/src/main/java/org/apache/geode/internal/memcached/MemcachedSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.internal.memcached;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class MemcachedSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-memcached/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-memcached/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-memcached/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-memcached/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-pulse/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzePulseSerializablesIntegrationTest.java b/geode-pulse/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzePulseSerializablesIntegrationTest.java
index 5efd0898e4..fbf8d52bf3 100644
--- a/geode-pulse/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzePulseSerializablesIntegrationTest.java
+++ b/geode-pulse/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzePulseSerializablesIntegrationTest.java
@@ -21,8 +21,7 @@ import org.junit.experimental.categories.Category;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
-public class AnalyzePulseSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzePulseSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-redis/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeRedisSerializablesIntegrationTest.java b/geode-redis/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeRedisSerializablesIntegrationTest.java
index 517b717e6c..828b4a0b73 100755
--- a/geode-redis/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeRedisSerializablesIntegrationTest.java
+++ b/geode-redis/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeRedisSerializablesIntegrationTest.java
@@ -22,8 +22,7 @@ import org.apache.geode.redis.internal.RedisSanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
-public class AnalyzeRedisSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+public class AnalyzeRedisSerializablesIntegrationTest extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisSanctionedSerializablesService.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisSanctionedSerializablesService.java
index 59842e16e7..d9853ef4df 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisSanctionedSerializablesService.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/RedisSanctionedSerializablesService.java
@@ -16,7 +16,7 @@ package org.apache.geode.redis.internal;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
public class RedisSanctionedSerializablesService implements SanctionedSerializablesService {
diff --git a/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService b/geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
similarity index 100%
rename from geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.filter.SanctionedSerializablesService
rename to geode-redis/src/main/resources/META-INF/services/org.apache.geode.internal.serialization.SanctionedSerializablesService
diff --git a/geode-redis/src/test/java/org/apache/geode/redis/internal/executor/RedisSanctionedSerializablesServiceIntegrationTest.java b/geode-redis/src/test/java/org/apache/geode/redis/internal/executor/RedisSanctionedSerializablesServiceIntegrationTest.java
index 82f8cf9a9a..420db71c8d 100644
--- a/geode-redis/src/test/java/org/apache/geode/redis/internal/executor/RedisSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-redis/src/test/java/org/apache/geode/redis/internal/executor/RedisSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,7 @@ package org.apache.geode.redis.internal;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
+import org.apache.geode.internal.serialization.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-serialization/build.gradle b/geode-serialization/build.gradle
index 581b424406..54620c79ca 100755
--- a/geode-serialization/build.gradle
+++ b/geode-serialization/build.gradle
@@ -25,14 +25,10 @@ dependencies {
//Geode-common has annotations and other pieces used by geode-serialization
implementation(project(':geode-common'))
- implementation(project(':geode-logging'))
//FastUtil contains optimized collections that are used in multiple places in core
implementation('it.unimi.dsi:fastutil')
- // serialization filtering uses Apache Commons
- implementation('org.apache.commons:commons-lang3')
-
//Log4j is used everywhere
implementation('org.apache.logging.log4j:log4j-api')
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeSerializationSerializablesIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeSerializationSerializablesIntegrationTest.java
index 175278ce2d..4aa74ffe3b 100644
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeSerializationSerializablesIntegrationTest.java
+++ b/geode-serialization/src/integrationTest/java/org/apache/geode/codeAnalysis/AnalyzeSerializationSerializablesIntegrationTest.java
@@ -23,7 +23,7 @@ import org.apache.geode.test.junit.categories.SerializationTest;
@Category(SerializationTest.class)
public class AnalyzeSerializationSerializablesIntegrationTest
- extends AnalyzeSerializablesWithClassAnalysisRuleTestBase {
+ extends AnalyzeSerializablesJUnitTestBase {
@Override
protected String getModuleName() {
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesServiceIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesServiceIntegrationTest.java
index 5c54d94d84..f733ee7fb9 100644
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesServiceIntegrationTest.java
+++ b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesServiceIntegrationTest.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.serialization;
import org.junit.experimental.categories.Category;
import org.apache.geode.codeAnalysis.SanctionedSerializablesServiceIntegrationTestBase;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
import org.apache.geode.test.junit.categories.SanctionedSerializablesTest;
import org.apache.geode.test.junit.categories.SerializationTest;
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenFilterIsAlreadySetIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenFilterIsAlreadySetIntegrationTest.java
deleted file mode 100644
index 89f3b913ec..0000000000
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenFilterIsAlreadySetIntegrationTest.java
+++ /dev/null
@@ -1,53 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.catchThrowable;
-import static org.mockito.Mockito.mock;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class GlobalSerialFilterConfigurationWhenFilterIsAlreadySetIntegrationTest {
-
- @Before
- public void filterIsAlreadySet() throws InvocationTargetException, IllegalAccessException {
- ObjectInputFilterApiFactory factory = new ReflectiveObjectInputFilterApiFactory();
- ObjectInputFilterApi api = factory.createObjectInputFilterApi();
- Object filter = api.createFilter("*");
- api.setSerialFilter(filter);
- }
-
- @Test
- public void throwsObjectInputFilterException_whenFilterIsAlreadySet() {
- FilterConfiguration configuration =
- new GlobalSerialFilterConfiguration(mock(SerializableObjectConfig.class));
-
- Throwable thrown = catchThrowable(() -> {
- configuration.configure();
- });
-
- assertThat(thrown)
- .isInstanceOf(UnableToSetSerialFilterException.class)
- .hasMessage(
- "Unable to configure a global serialization filter because filter has already been set non-null.")
- .hasCauseInstanceOf(InvocationTargetException.class)
- .hasRootCauseInstanceOf(IllegalStateException.class)
- .hasRootCauseMessage("Serial filter can only be set once");
- }
-}
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenObjectInputFilterNotFoundIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenObjectInputFilterNotFoundIntegrationTest.java
deleted file mode 100644
index 92d9937f04..0000000000
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationWhenObjectInputFilterNotFoundIntegrationTest.java
+++ /dev/null
@@ -1,108 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.catchThrowable;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-
-import org.apache.logging.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-
-public class GlobalSerialFilterConfigurationWhenObjectInputFilterNotFoundIntegrationTest {
-
- private final boolean supportsObjectInputFilter = false;
-
- private ReflectiveFacadeGlobalSerialFilterFactory globalSerialFilterFactory_throws;
- private SerializableObjectConfig config;
- private Logger logger;
-
- @Rule
- public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-
- @Before
- public void whenObjectInputFilter_classNotFound() {
- globalSerialFilterFactory_throws =
- new ReflectiveFacadeGlobalSerialFilterFactory(() -> {
- throw new UnsupportedOperationException(
- new ClassNotFoundException("sun.misc.ObjectInputFilter"));
- });
- }
-
- @Before
- public void setUpMocks() {
- config = mock(SerializableObjectConfig.class);
- logger = mock(Logger.class);
- }
-
- @Test
- public void doesNotThrow_whenEnableGlobalSerialFilterIsFalse_andObjectInputFilterClassNotFound() {
- System.clearProperty("geode.enableGlobalSerialFilter");
- GlobalSerialFilterConfigurationFactory factory =
- new SystemPropertyGlobalSerialFilterConfigurationFactory();
- FilterConfiguration configuration = factory.create(config);
-
- assertThatCode(configuration::configure)
- .doesNotThrowAnyException();
- }
-
- @Test
- public void logsNothing_whenEnableGlobalSerialFilterIsFalse_andObjectInputFilterClassNotFound()
- throws UnableToSetSerialFilterException {
- System.clearProperty("geode.enableGlobalSerialFilter");
- GlobalSerialFilterConfigurationFactory factory =
- new SystemPropertyGlobalSerialFilterConfigurationFactory(() -> supportsObjectInputFilter);
- FilterConfiguration configuration = factory.create(config);
-
- configuration.configure();
-
- verifyNoInteractions(logger);
- }
-
- @Test
- public void doesNotConfigureOrThrow_whenEnableGlobalSerialFilterIsTrue_andObjectInputFilterClassNotFound()
- throws UnableToSetSerialFilterException {
- System.setProperty("geode.enableGlobalSerialFilter", "true");
- GlobalSerialFilterConfigurationFactory factory =
- new SystemPropertyGlobalSerialFilterConfigurationFactory(() -> supportsObjectInputFilter);
- FilterConfiguration configuration = factory.create(config);
-
- boolean result = configuration.configure();
-
- assertThat(result).isFalse();
- }
-
- @Test
- public void logsWarning_whenEnableGlobalSerialFilterIsTrue_andObjectInputFilterClassNotFound() {
- System.setProperty("geode.enableGlobalSerialFilter", "true");
- FilterConfiguration configuration = new GlobalSerialFilterConfiguration(
- config, logger, globalSerialFilterFactory_throws);
-
- Throwable thrown = catchThrowable(() -> {
- configuration.configure();
- });
-
- assertThat(thrown)
- .isInstanceOf(UnsupportedOperationException.class)
- .hasMessage("java.lang.ClassNotFoundException: sun.misc.ObjectInputFilter")
- .hasRootCauseInstanceOf(ClassNotFoundException.class)
- .hasRootCauseMessage("sun.misc.ObjectInputFilter");
- }
-}
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterBlankIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterBlankIntegrationTest.java
deleted file mode 100644
index d5714f654a..0000000000
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterBlankIntegrationTest.java
+++ /dev/null
@@ -1,62 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.apache.geode.internal.serialization.filter.ApiPackage.JAVA_IO;
-import static org.apache.geode.internal.serialization.filter.ApiPackage.SUN_MISC;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * This test calls the real setSerialFilter which can only be set once within a JVM, so it's in an
- * integration test which forks a new JVM for the test class.
- */
-public class ReflectiveObjectInputFilterApiSetFilterBlankIntegrationTest {
-
- private ApiPackage apiPackage;
-
- @Before
- public void setUp() {
- if (isJavaVersionAtLeast(JAVA_1_8) && isJavaVersionAtMost(JAVA_1_8)) {
- apiPackage = SUN_MISC;
- }
-
- if (isJavaVersionAtLeast(JAVA_9)) {
- apiPackage = JAVA_IO;
- }
- }
-
- @Test
- public void setsFilterGivenBlankPattern()
- throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
- NoSuchMethodException {
- ObjectInputFilterApi api = new ReflectiveObjectInputFilterApi(apiPackage);
- Object filter = api.createFilter(" ");
-
- api.setSerialFilter(filter);
-
- assertThat(api.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isSameAs(filter);
- }
-}
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterIntegrationTest.java
deleted file mode 100644
index 619673b464..0000000000
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterIntegrationTest.java
+++ /dev/null
@@ -1,60 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * This test calls the real setSerialFilter which can only be set once within a JVM, so it's in an
- * integration test which forks a new JVM for the test class.
- */
-public class ReflectiveObjectInputFilterApiSetFilterIntegrationTest {
-
- private ApiPackage apiPackage;
-
- @Before
- public void setUp() {
- if (isJavaVersionAtLeast(JAVA_1_8) && isJavaVersionAtMost(JAVA_1_8)) {
- apiPackage = ApiPackage.SUN_MISC;
- }
-
- if (isJavaVersionAtLeast(JAVA_9)) {
- apiPackage = ApiPackage.JAVA_IO;
- }
- }
-
- @Test
- public void setsFilterGivenValidPattern()
- throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
- NoSuchMethodException {
- ObjectInputFilterApi api = new ReflectiveObjectInputFilterApi(apiPackage);
- Object filter = api.createFilter("!*");
-
- api.setSerialFilter(filter);
-
- assertThat(api.getSerialFilter())
- .as("ObjectInputFilter$Config.getSerialFilter()")
- .isSameAs(filter);
- }
-}
diff --git a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterNullIntegrationTest.java b/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterNullIntegrationTest.java
deleted file mode 100644
index 9b13b7351f..0000000000
--- a/geode-serialization/src/integrationTest/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiSetFilterNullIntegrationTest.java
+++ /dev/null
@@ -1,61 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtMost;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.catchThrowable;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * This test calls the real setSerialFilter which can only be set once within a JVM, so it's in an
- * integration test which forks a new JVM for the test class.
- */
-public class ReflectiveObjectInputFilterApiSetFilterNullIntegrationTest {
-
- private ApiPackage apiPackage;
-
- @Before
- public void setUp() {
- if (isJavaVersionAtLeast(JAVA_1_8) && isJavaVersionAtMost(JAVA_1_8)) {
- apiPackage = ApiPackage.SUN_MISC;
- }
-
- if (isJavaVersionAtLeast(JAVA_9)) {
- apiPackage = ApiPackage.JAVA_IO;
- }
- }
-
- @Test
- public void throwsNullPointerExceptionGivenNull()
- throws ClassNotFoundException, NoSuchMethodException {
- ObjectInputFilterApi api = new ReflectiveObjectInputFilterApi(apiPackage);
-
- Throwable thrown = catchThrowable(() -> {
- api.setSerialFilter(null);
- });
-
- assertThat(thrown)
- .isInstanceOf(InvocationTargetException.class)
- .hasCauseInstanceOf(NullPointerException.class);
- }
-}
diff --git a/geode-serialization/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-serialization/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializables.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializables.java
similarity index 60%
rename from geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializables.java
rename to geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializables.java
index 6c68010af7..7b9a77f960 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializables.java
+++ b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializables.java
@@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.serialization.filter;
+package org.apache.geode.internal.serialization;
import static java.util.Collections.emptyList;
@@ -20,32 +20,20 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.UncheckedIOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.ServiceLoader;
-import java.util.Set;
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.logging.internal.log4j.api.LogService;
-
-/**
- * Loads {@code SanctionedSerializablesService}s and sanctioned class data.
- */
public class SanctionedSerializables {
- private static final Logger logger = LogService.getLogger();
-
/**
* Loads all SanctionedSerializablesServices on the classpath.
*/
- public static Set<SanctionedSerializablesService> loadSanctionedSerializablesServices() {
+ public static Collection<SanctionedSerializablesService> loadSanctionedSerializablesServices() {
ServiceLoader<SanctionedSerializablesService> loader =
ServiceLoader.load(SanctionedSerializablesService.class);
- Set<SanctionedSerializablesService> services = new HashSet<>();
+ Collection<SanctionedSerializablesService> services = new ArrayList<>();
for (SanctionedSerializablesService service : loader) {
services.add(service);
}
@@ -56,7 +44,7 @@ public class SanctionedSerializables {
* Loads class names of sanctioned serializables from a resource. Caller will add these to the
* serialization filter acceptlist.
*/
- static Collection<String> loadClassNames(URL sanctionedSerializables) throws IOException {
+ public static Collection<String> loadClassNames(URL sanctionedSerializables) throws IOException {
if (sanctionedSerializables == null) {
return emptyList();
}
@@ -74,26 +62,4 @@ public class SanctionedSerializables {
}
return result;
}
-
- public static Set<String> loadSanctionedClassNames(
- Iterable<SanctionedSerializablesService> services) {
- Set<String> sanctionedClasses = new HashSet<>(650);
- for (SanctionedSerializablesService service : services) {
- try {
- Collection<String> classNames = service.getSerializationAcceptlist();
- logger.info("loaded {} sanctioned serializables from {}", classNames.size(),
- service.getClass().getSimpleName());
- sanctionedClasses.addAll(classNames);
- } catch (IOException e) {
- throw new UncheckedIOException(
- "Unable to initialize serialization filter for " + service,
- e);
- }
- }
- return sanctionedClasses;
- }
-
- private SanctionedSerializables() {
- // do not instantiate
- }
}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializablesService.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializablesService.java
similarity index 84%
rename from geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializablesService.java
rename to geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializablesService.java
index 9306934cf6..ad4072123b 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializablesService.java
+++ b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SanctionedSerializablesService.java
@@ -12,21 +12,15 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.serialization.filter;
+package org.apache.geode.internal.serialization;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
-/**
- * Service interface to define a module's sanctioned serializables.
- */
@FunctionalInterface
public interface SanctionedSerializablesService {
- /**
- * Returns a URL for loading a module's collection of sanctioned serializables.
- */
URL getSanctionedSerializablesURL();
default Class<?> getInterface() {
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesService.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesService.java
index 5957db6105..52827f2e08 100644
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesService.java
+++ b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/SerializationSanctionedSerializablesService.java
@@ -16,8 +16,6 @@ package org.apache.geode.internal.serialization;
import java.net.URL;
-import org.apache.geode.internal.serialization.filter.SanctionedSerializablesService;
-
public class SerializationSanctionedSerializablesService implements SanctionedSerializablesService {
@Override
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ApiPackage.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ApiPackage.java
deleted file mode 100644
index 549911ebe9..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ApiPackage.java
+++ /dev/null
@@ -1,41 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * The Java package containing {@code ObjectInputFilter}. On Java 8, it's {@code sun.misc}. On
- * Java 9 or greater, it's {@code java.io}.
- */
-enum ApiPackage {
-
- JAVA_IO("java.io."),
- SUN_MISC("sun.misc.");
-
- private final String prefix;
-
- ApiPackage(String prefix) {
- this.prefix = prefix;
- }
-
- String getPrefix() {
- return prefix;
- }
-
- String qualify(String className) {
- return prefix + requireNonNull(className, "className is required");
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterAlreadyConfiguredException.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterAlreadyConfiguredException.java
deleted file mode 100644
index e42990e059..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterAlreadyConfiguredException.java
+++ /dev/null
@@ -1,36 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Checked exception thrown when configuring a filter fails because a non-null filter already
- * exists. All uses of this exception are caught and rethrown before reaching the user.
- */
-public class FilterAlreadyConfiguredException extends UnableToSetSerialFilterException {
-
- public FilterAlreadyConfiguredException(String message) {
- super(message);
- }
-
- public FilterAlreadyConfiguredException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public FilterAlreadyConfiguredException(Throwable cause) {
- super(cause);
- }
-
- private static final long serialVersionUID = -6102549374563510704L;
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterConfiguration.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterConfiguration.java
deleted file mode 100644
index cf127901c0..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterConfiguration.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Defines operation to configure a serialization filter.
- */
-@FunctionalInterface
-public interface FilterConfiguration {
-
- /**
- * Returns true if serialization filter was successfully configured.
- */
- boolean configure() throws UnableToSetSerialFilterException;
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterPattern.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterPattern.java
deleted file mode 100644
index 79135b5528..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/FilterPattern.java
+++ /dev/null
@@ -1,28 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Defines operation to generate a serialization filter pattern. The syntax is defined in the
- * javadocs of the JREs {@code (sun.misc. or java.io.)ObjectInputFilter$Config#createFilter}
- */
-@FunctionalInterface
-public interface FilterPattern {
-
- /**
- * Returns the serialization filter pattern.
- */
- String pattern();
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilter.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilter.java
deleted file mode 100644
index 7858878520..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilter.java
+++ /dev/null
@@ -1,30 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Defines operation to set this serialization filter as the JVMs process-wide filter.
- */
-@FunctionalInterface
-interface GlobalSerialFilter {
-
- /**
- * Sets this serialization filter as the process-wide filter.
- *
- * @throws FilterAlreadyConfiguredException if a non-null serialization filter already exists
- * @throws UnableToSetSerialFilterException if there's any failure setting a serialization filter
- */
- void setFilter() throws UnableToSetSerialFilterException;
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfiguration.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfiguration.java
deleted file mode 100644
index 1bfd0280e9..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfiguration.java
+++ /dev/null
@@ -1,123 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedClassNames;
-import static org.apache.geode.internal.serialization.filter.SanctionedSerializables.loadSanctionedSerializablesServices;
-
-import java.util.Set;
-import java.util.function.Supplier;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.logging.internal.log4j.api.LogService;
-
-/**
- * Implementation of {@code FilterConfiguration} that delegates to an {@code ObjectInputFilterApi}.
- */
-class GlobalSerialFilterConfiguration implements FilterConfiguration {
-
- private static final Logger LOGGER = LogService.getLogger();
-
- private final SerializableObjectConfig serializableObjectConfig;
- private final FilterPatternFactory filterPatternFactory;
- private final Supplier<Set<String>> sanctionedClassesSupplier;
- private final Logger logger;
- private final GlobalSerialFilterFactory globalSerialFilterFactory;
-
- /**
- * Constructs instance with collaborators.
- */
- GlobalSerialFilterConfiguration(SerializableObjectConfig serializableObjectConfig) {
- this(serializableObjectConfig,
- (pattern, sanctionedClasses) -> new ReflectiveFacadeGlobalSerialFilterFactory()
- .create(pattern, sanctionedClasses));
- }
-
- GlobalSerialFilterConfiguration(
- SerializableObjectConfig serializableObjectConfig,
- GlobalSerialFilterFactory globalSerialFilterFactory) {
- this(serializableObjectConfig,
- LOGGER,
- globalSerialFilterFactory);
- }
-
- GlobalSerialFilterConfiguration(
- SerializableObjectConfig serializableObjectConfig,
- Logger logger,
- GlobalSerialFilterFactory globalSerialFilterFactory) {
- this(serializableObjectConfig,
- new DefaultFilterPatternFactory(),
- () -> loadSanctionedClassNames(loadSanctionedSerializablesServices()),
- logger,
- globalSerialFilterFactory);
- }
-
- private GlobalSerialFilterConfiguration(
- SerializableObjectConfig serializableObjectConfig,
- FilterPatternFactory filterPatternFactory,
- Supplier<Set<String>> sanctionedClassesSupplier,
- Logger logger,
- GlobalSerialFilterFactory globalSerialFilterFactory) {
- this.serializableObjectConfig = serializableObjectConfig;
- this.filterPatternFactory = filterPatternFactory;
- this.sanctionedClassesSupplier = sanctionedClassesSupplier;
- this.logger = logger;
- this.globalSerialFilterFactory = globalSerialFilterFactory;
- }
-
- @Override
- public boolean configure() throws UnableToSetSerialFilterException {
- // enable validate-serializable-objects
- serializableObjectConfig.setValidateSerializableObjects(true);
-
- // create a GlobalSerialFilter
- String pattern = filterPatternFactory
- .create(serializableObjectConfig.getSerializableObjectFilterIfEnabled());
- Set<String> sanctionedClasses = sanctionedClassesSupplier.get();
- GlobalSerialFilter globalSerialFilter =
- globalSerialFilterFactory.create(pattern, sanctionedClasses);
-
- // invoke setFilter on GlobalSerialFilter to set the process-wide filter
- globalSerialFilter.setFilter();
-
- // log statement that filter is now configured
- logger.info("Global serialization filter is now configured.");
- return true;
- }
-
- /**
- * Creates filter pattern string including the specified optional
- * {@code serializable-object-filter}.
- */
- @FunctionalInterface
- interface FilterPatternFactory {
-
- String create(String optionalSerializableObjectFilter);
- }
-
- /**
- * Default implementation of {@code FilterPatternFactory}.
- */
- public static class DefaultFilterPatternFactory implements FilterPatternFactory {
-
- @Override
- public String create(String optionalSerializableObjectFilter) {
- return new SanctionedSerializablesFilterPattern()
- .append(optionalSerializableObjectFilter)
- .pattern();
- }
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationFactory.java
deleted file mode 100644
index 6a85bfd959..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterConfigurationFactory.java
+++ /dev/null
@@ -1,29 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Defines the factory for creating a {@code FilterConfiguration} to configure a
- * {@code GlobalSerialFilter}.
- */
-@FunctionalInterface
-interface GlobalSerialFilterConfigurationFactory {
-
- /**
- * Creates a {@code FilterConfiguration} to configure a {@code GlobalSerialFilter} using the
- * specified {@code SerializableObjectConfig}.
- */
- FilterConfiguration create(SerializableObjectConfig serializableObjectConfig);
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterFactory.java
deleted file mode 100644
index 6745831f12..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/GlobalSerialFilterFactory.java
+++ /dev/null
@@ -1,30 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.util.Collection;
-
-/**
- * Defines the factory for creating a {@code GlobalSerialFilter}.
- */
-@FunctionalInterface
-interface GlobalSerialFilterFactory {
-
- /**
- * Creates a {@code GlobalSerialFilter} using the specified filter pattern and collection of
- * sanctioned classes. The pattern is generated by {@code FilterPattern}.
- */
- GlobalSerialFilter create(String pattern, Collection<String> sanctionedClasses);
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/Java9ReflectiveObjectInputFilterApi.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/Java9ReflectiveObjectInputFilterApi.java
deleted file mode 100644
index 53e3652cbc..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/Java9ReflectiveObjectInputFilterApi.java
+++ /dev/null
@@ -1,64 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Java 9 or greater needs to override some API paths in {@code ReflectiveObjectInputFilterApi}.
- */
-class Java9ReflectiveObjectInputFilterApi extends ReflectiveObjectInputFilterApi {
-
- private final Class<?> ObjectInputStream;
- private final Method ObjectInputStream_setObjectInputFilter;
- private final Method ObjectInputStream_getObjectInputFilter;
-
- /**
- * Constructs instance for the specified {@code ApiPackage}.
- */
- Java9ReflectiveObjectInputFilterApi(ApiPackage apiPackage)
- throws ClassNotFoundException, NoSuchMethodException {
- super(apiPackage);
- ObjectInputStream = ObjectInputStream();
- ObjectInputStream_setObjectInputFilter = ObjectInputStream_setObjectInputFilter();
- ObjectInputStream_getObjectInputFilter = ObjectInputStream_getObjectInputFilter();
- }
-
- private Class<?> ObjectInputStream() throws ClassNotFoundException {
- return Class.forName(apiPackage.qualify("ObjectInputStream"));
- }
-
- private Method ObjectInputStream_setObjectInputFilter() throws NoSuchMethodException {
- return ObjectInputStream.getDeclaredMethod("setObjectInputFilter", ObjectInputFilter);
- }
-
- private Method ObjectInputStream_getObjectInputFilter() throws NoSuchMethodException {
- return ObjectInputStream.getDeclaredMethod("getObjectInputFilter");
- }
-
- @Override
- public Object getObjectInputFilter(ObjectInputStream inputStream)
- throws InvocationTargetException, IllegalAccessException {
- return ObjectInputStream_getObjectInputFilter.invoke(inputStream);
- }
-
- @Override
- public void setObjectInputFilter(ObjectInputStream inputStream, Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException {
- ObjectInputStream_setObjectInputFilter.invoke(inputStream, objectInputFilter);
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfiguration.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfiguration.java
deleted file mode 100644
index 86c71910af..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfiguration.java
+++ /dev/null
@@ -1,73 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.commons.lang3.StringUtils.isBlank;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.annotations.VisibleForTesting;
-import org.apache.geode.logging.internal.log4j.api.LogService;
-
-/**
- * Implementation of {@code FilterConfiguration} for configuring the JVMs JMX serialization filter.
- *
- * <p>
- * Configure the “jmx.remote.rmi.server.serial.filter.pattern” system property if Java version is
- * Java 9 or greater. The serial pattern will be configured to accept only standard JMX open-types.
- * If the system property already has a non-null value, then leave it as is.
- *
- * <p>
- * Configure the {@code jdk.serialFilter} system property if Java version is Java 8. The serial
- * pattern will be configured to accept only geode sanctioned serializables and standard JMX
- * open-types. If the system property already has a non-null value, then leave it as is.
- */
-class JmxSerialFilterConfiguration implements FilterConfiguration {
-
- private static final Logger LOGGER = LogService.getLogger();
-
- private final String key;
- private final String value;
- private final Logger logger;
-
- /**
- * Constructs instance for the specified system property and filter pattern.
- */
- JmxSerialFilterConfiguration(String property, String pattern) {
- this(property, pattern, LOGGER);
- }
-
- @VisibleForTesting
- JmxSerialFilterConfiguration(
- String property,
- String pattern,
- Logger logger) {
- key = property;
- value = pattern;
- this.logger = logger;
- }
-
- @Override
- public boolean configure() {
- if (isBlank(System.getProperty(key))) {
- System.setProperty(key, value);
- logger.info("System property '" + key + "' is now configured with '" + value + "'.");
- return true;
- }
-
- logger.info("System property '" + key + "' is already configured.");
- return false;
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfigurationFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfigurationFactory.java
deleted file mode 100644
index 8062e0d4c0..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/JmxSerialFilterConfigurationFactory.java
+++ /dev/null
@@ -1,28 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-/**
- * Defines the factory for creating a {@code FilterConfiguration} to configure a
- * {@code JmxSerialFilter}.
- */
-@FunctionalInterface
-interface JmxSerialFilterConfigurationFactory {
-
- /**
- * Creates a {@code FilterConfiguration} to configure a {@code JmxSerialFilter}.
- */
- FilterConfiguration create();
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApi.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApi.java
deleted file mode 100644
index 976c748f2c..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterApi.java
+++ /dev/null
@@ -1,85 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-
-/**
- * Adapter interface that defines a layer of indirection for JDK's {@code ObjectInputFilter} class.
- *
- * <p>
- * {@code ObjectInputFilter} is absent in builds of Java 8 prior to 121. It is present in later
- * builds of Java 8 as {@code sun.misc.ObjectInputFilter} and underwent changes in Java 9 including
- * being moved to {@code java.io.ObjectInputFilter}.
- */
-interface ObjectInputFilterApi {
-
- /**
- * Get the filter for classes being deserialized on the ObjectInputStream.
- *
- * <p>
- * Invokes {@code getObjectInputFilter} on {@code ObjectInputFilter$Config}.
- */
- Object getObjectInputFilter(ObjectInputStream inputStream)
- throws InvocationTargetException, IllegalAccessException;
-
- /**
- * Set the process-wide filter if it has not already been configured or set.
- *
- * <p>
- * Invokes {@code setObjectInputFilter} on {@code ObjectInputFilter$Config}
- */
- void setObjectInputFilter(ObjectInputStream inputStream, Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException;
-
- /**
- * Returns the process-wide serialization filter or null if not configured.
- *
- * <p>
- * Invokes {@code getSerialFilter} on {@code ObjectInputFilter$Config}
- */
- Object getSerialFilter()
- throws InvocationTargetException, IllegalAccessException;
-
- /**
- * Set the process-wide filter if it has not already been configured or set.
- *
- * <p>
- * Invokes {@code setSerialFilter} on {@code ObjectInputFilter$Config}
- */
- void setSerialFilter(Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException;
-
- /**
- * Returns an ObjectInputFilter from a string of patterns. The syntax is defined in the javadocs
- * of the JREs {@code (sun.misc. or java.io.)ObjectInputFilter$Config}.
- *
- * <p>
- * Invokes {@code createFilter} on {@code ObjectInputFilter$Config}.
- */
- Object createFilter(String pattern)
- throws InvocationTargetException, IllegalAccessException;
-
- /**
- * Returns a Java Proxy with InvocationHandler to allow Geode to inject custom behavior before
- * invoking the methods on the JREs {@code (sun.misc. or java.io.)ObjectInputFilter$Config}.
- */
- Object createObjectInputFilterProxy(String pattern, Collection<String> sanctionedClasses)
- throws InvocationTargetException, IllegalAccessException;
-
- Class<?> getObjectInputFilterClass();
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterInvocationHandler.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterInvocationHandler.java
deleted file mode 100644
index 7c084b68f2..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterInvocationHandler.java
+++ /dev/null
@@ -1,109 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.util.Collections.unmodifiableCollection;
-import static java.util.Objects.requireNonNull;
-
-import java.io.InvalidClassException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.logging.internal.log4j.api.LogService;
-
-class ObjectInputFilterInvocationHandler implements InvocationHandler {
-
- private static final Logger logger = LogService.getLogger();
-
- private final Method ObjectInputFilter_checkInput;
- private final Method ObjectInputFilter_FilterInfo_serialClass;
- private final Object ObjectInputFilter_Status_ALLOWED;
- private final Object ObjectInputFilter_Status_REJECTED;
-
- private final Object objectInputFilter;
- private final Collection<String> sanctionedClasses;
-
- ObjectInputFilterInvocationHandler(
- Method ObjectInputFilter_checkInput,
- Method ObjectInputFilter_FilterInfo_serialClass,
- Object ObjectInputFilter_Status_ALLOWED,
- Object ObjectInputFilter_Status_REJECTED,
- Object objectInputFilter,
- Collection<String> sanctionedClasses) {
- this.ObjectInputFilter_checkInput = ObjectInputFilter_checkInput;
- this.ObjectInputFilter_FilterInfo_serialClass = ObjectInputFilter_FilterInfo_serialClass;
- this.ObjectInputFilter_Status_ALLOWED = ObjectInputFilter_Status_ALLOWED;
- this.ObjectInputFilter_Status_REJECTED = ObjectInputFilter_Status_REJECTED;
- this.objectInputFilter = objectInputFilter;
- this.sanctionedClasses = unmodifiableCollection(sanctionedClasses);
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws IllegalAccessException, IllegalArgumentException,
- java.lang.reflect.InvocationTargetException {
- if (!"checkInput".equals(method.getName())) {
- // delegate to the actual objectInputFilter instance for any method other than checkInput
- return method.invoke(objectInputFilter, args);
- }
-
- requireNonNull(args, "Single argument FilterInfo is null");
-
- if (args.length != 1) {
- throw new IllegalArgumentException("Single argument FilterInfo is required");
- }
-
- // fetch the class of the serialized instance
- Object objectInputFilter_filterInfo = args[0];
- Class<?> serialClass =
- (Class<?>) ObjectInputFilter_FilterInfo_serialClass.invoke(objectInputFilter_filterInfo);
- if (serialClass == null) { // no class to check, so nothing to accept-list
- return ObjectInputFilter_checkInput.invoke(objectInputFilter, objectInputFilter_filterInfo);
- }
-
- // check sanctionedClasses to determine if the name of the class is ALLOWED
- String serialClassName = serialClass.getName();
- if (serialClass.isArray()) {
- serialClassName = serialClass.getComponentType().getName();
- }
- if (sanctionedClasses.contains(serialClassName)) {
- return ObjectInputFilter_Status_ALLOWED;
- }
-
- // check the filter to determine if the class is ALLOWED
- Object objectInputFilter_Status =
- ObjectInputFilter_checkInput.invoke(objectInputFilter, objectInputFilter_filterInfo);
- if (objectInputFilter_Status == ObjectInputFilter_Status_REJECTED) {
- logger.fatal("Serialization filter is rejecting class {}", serialClassName,
- new InvalidClassException(serialClassName));
- }
- return objectInputFilter_Status;
- }
-
- @Override
- public String toString() {
- return new StringBuilder(getClass().getSimpleName())
- .append("@")
- .append(Integer.toHexString(hashCode()))
- .append('{')
- .append("objectInputFilter=").append(objectInputFilter)
- .append(", sanctionedClassesCount=").append(sanctionedClasses.size())
- .append('}')
- .toString();
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterUtils.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterUtils.java
deleted file mode 100644
index 6a44f49ff8..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ObjectInputFilterUtils.java
+++ /dev/null
@@ -1,61 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.util.function.Function;
-
-import org.apache.geode.annotations.VisibleForTesting;
-import org.apache.geode.internal.lang.utils.ClassUtils;
-
-/**
- * Utility methods for {@code ObjectInputFilter}.
- */
-public class ObjectInputFilterUtils {
-
- private static final String UNSUPPORTED_MESSAGE = "ObjectInputFilter is not available.";
-
- /**
- * Returns true if this JVM supports {@code ObjectInputFilter}.
- */
- public static boolean supportsObjectInputFilter() {
- return supportsObjectInputFilter(ClassUtils::isClassAvailable);
- }
-
- static void throwUnsupportedOperationException() {
- throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE, null);
- }
-
- static void throwUnsupportedOperationException(Throwable cause) {
- throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE, cause);
- }
-
- static void throwUnsupportedOperationException(String message) {
- throw new UnsupportedOperationException(message, null);
- }
-
- static void throwUnsupportedOperationException(String message, Throwable cause) {
- throw new UnsupportedOperationException(message, cause);
- }
-
- @VisibleForTesting
- static boolean supportsObjectInputFilter(Function<String, Boolean> isClassAvailable) {
- return isClassAvailable.apply("sun.misc.ObjectInputFilter") ||
- isClassAvailable.apply("java.io.ObjectInputFilter");
- }
-
- private ObjectInputFilterUtils() {
- // do not instantiate
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/OpenMBeanFilterPattern.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/OpenMBeanFilterPattern.java
deleted file mode 100644
index 14aa037128..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/OpenMBeanFilterPattern.java
+++ /dev/null
@@ -1,68 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.rmi.MarshalledObject;
-import java.util.StringJoiner;
-
-import javax.management.ObjectName;
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularType;
-
-/**
- * Defines a serial filter pattern that accepts all open MBean data types and rejects everything
- * not included in the pattern.
- */
-public class OpenMBeanFilterPattern implements FilterPattern {
-
- @Override
- public String pattern() {
- // note: java.util.* may also be needed
- return new StringJoiner(";")
-
- // accept all open MBean data types
- .add(Boolean.class.getName())
- .add(Byte.class.getName())
- .add(Character.class.getName())
- .add(Short.class.getName())
- .add(Integer.class.getName())
- .add(Long.class.getName())
- .add(Float.class.getName())
- .add(Double.class.getName())
- .add(String.class.getName())
- .add(BigInteger.class.getName())
- .add(BigDecimal.class.getName())
- .add(ObjectName.class.getName())
- .add(OpenType.class.getName())
- .add(CompositeData.class.getName())
- .add(TabularData.class.getName())
- .add(SimpleType.class.getName())
- .add(CompositeType.class.getName())
- .add(TabularType.class.getName())
- .add(ArrayType.class.getName())
- .add(MarshalledObject.class.getName())
-
- // reject all others
- .add("!*")
- .toString();
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilter.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilter.java
deleted file mode 100644
index 164bffc8db..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilter.java
+++ /dev/null
@@ -1,102 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.util.Collections.unmodifiableCollection;
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang3.exception.ExceptionUtils.getRootCause;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-
-/**
- * Implementation of {@code GlobalSerialFilter} that delegates to {@code ObjectInputFilterApi} to
- * maintain independence from the JRE version.
- */
-class ReflectiveFacadeGlobalSerialFilter implements GlobalSerialFilter {
-
- private final ObjectInputFilterApi api;
- private final String pattern;
- private final Collection<String> sanctionedClasses;
-
- /**
- * Constructs instance with the specified collaborators.
- */
- ReflectiveFacadeGlobalSerialFilter(ObjectInputFilterApi api, String pattern,
- Collection<String> sanctionedClasses) {
- this.api = requireNonNull(api, "ObjectInputFilterApi is required");
- this.pattern = pattern;
- this.sanctionedClasses = unmodifiableCollection(sanctionedClasses);
- }
-
- /**
- * Invokes interface-defined operation to set this as the process-wide filter.
- */
- @Override
- public void setFilter() throws UnableToSetSerialFilterException {
- try {
- // create the ObjectInputFilter to set as the global serial filter
- Object objectInputFilter = api.createObjectInputFilterProxy(pattern, sanctionedClasses);
-
- // set the global serial filter
- api.setSerialFilter(objectInputFilter);
-
- } catch (IllegalAccessException | InvocationTargetException e) {
- handleExceptionThrownByApi(e);
- }
- }
-
- @Override
- public String toString() {
- return new StringBuilder(getClass().getSimpleName())
- .append('{')
- .append("api=").append(api)
- .append(", pattern='").append(pattern).append('\'')
- .append('}')
- .toString();
- }
-
- private void handleExceptionThrownByApi(ReflectiveOperationException e)
- throws UnableToSetSerialFilterException {
- String className = getClassName(e);
- switch (className) {
- case "java.lang.IllegalAccessException":
- throw new UnableToSetSerialFilterException(
- "Unable to configure a global serialization filter using reflection.",
- e);
- case "java.lang.reflect.InvocationTargetException":
- if (getRootCause(e) instanceof IllegalStateException) {
- // ObjectInputFilter throws IllegalStateException
- // if the filter has already been set non-null
- throw new FilterAlreadyConfiguredException(
- "Unable to configure a global serialization filter because filter has already been set non-null.",
- e);
- }
- String causeClassName = e.getCause() == null ? getClassName(e) : getClassName(e.getCause());
- throw new UnableToSetSerialFilterException(
- "Unable to configure a global serialization filter because invocation target threw "
- + causeClassName + ".",
- e);
- default:
- throw new UnableToSetSerialFilterException(
- "Unable to configure a global serialization filter.",
- e);
- }
- }
-
- private static String getClassName(Throwable throwable) {
- return throwable.getClass().getName();
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilterFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilterFactory.java
deleted file mode 100644
index 3826e00816..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeGlobalSerialFilterFactory.java
+++ /dev/null
@@ -1,46 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.util.Collection;
-import java.util.function.Supplier;
-
-/**
- * Creates an instance of {@code GlobalSerialFilter} that delegates to {@code ObjectInputFilterApi}
- * to maintain independence from the JRE version.
- */
-class ReflectiveFacadeGlobalSerialFilterFactory implements GlobalSerialFilterFactory {
-
- private final Supplier<ObjectInputFilterApi> objectInputFilterApiSupplier;
-
- ReflectiveFacadeGlobalSerialFilterFactory() {
- this(() -> new ReflectiveObjectInputFilterApiFactory().createObjectInputFilterApi());
- }
-
- ReflectiveFacadeGlobalSerialFilterFactory(ObjectInputFilterApi objectInputFilterApi) {
- this(() -> objectInputFilterApi);
- }
-
- ReflectiveFacadeGlobalSerialFilterFactory(
- Supplier<ObjectInputFilterApi> objectInputFilterApiSupplier) {
- this.objectInputFilterApiSupplier = objectInputFilterApiSupplier;
- }
-
- @Override
- public GlobalSerialFilter create(String pattern, Collection<String> sanctionedClasses) {
- ObjectInputFilterApi api = objectInputFilterApiSupplier.get();
- return new ReflectiveFacadeGlobalSerialFilter(api, pattern, sanctionedClasses);
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilter.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilter.java
deleted file mode 100644
index 902cf60dee..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilter.java
+++ /dev/null
@@ -1,109 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static java.util.Collections.unmodifiableCollection;
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang3.exception.ExceptionUtils.getRootCause;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-
-/**
- * Implementation of {@code ObjectInputFilter} that delegates to {@code ObjectInputFilterApi} to
- * maintain independence from the JRE version.
- */
-class ReflectiveFacadeStreamSerialFilter implements StreamSerialFilter {
-
- private final ObjectInputFilterApi api;
- private final String pattern;
- private final Collection<String> sanctionedClasses;
-
- /**
- * Constructs instance with the specified collaborators.
- */
- ReflectiveFacadeStreamSerialFilter(ObjectInputFilterApi api, String pattern,
- Collection<String> sanctionedClasses) {
- this.api = requireNonNull(api, "ObjectInputFilterApi is required");
- this.pattern = pattern;
- this.sanctionedClasses = unmodifiableCollection(sanctionedClasses);
- }
-
- /**
- * Invokes interface-defined operation to set this serialization filter on the specified target
- * {@code ObjectInputStream}.
- */
- @Override
- public void setFilterOn(ObjectInputStream objectInputStream)
- throws UnableToSetSerialFilterException {
- try {
- // create the ObjectInputFilter to set as the global serial filter
- Object objectInputFilter = api.createObjectInputFilterProxy(pattern, sanctionedClasses);
-
- // set the global serial filter
- api.setObjectInputFilter(objectInputStream, objectInputFilter);
-
- } catch (IllegalAccessException | InvocationTargetException e) {
- handleExceptionThrownByApi(e);
- }
- }
-
- @Override
- public String toString() {
- return new StringBuilder(getClass().getSimpleName())
- .append('{')
- .append("api=").append(api)
- .append(", pattern='").append(pattern).append('\'')
- .append('}')
- .toString();
- }
-
- ObjectInputFilterApi getObjectInputFilterApi() {
- return api;
- }
-
- private void handleExceptionThrownByApi(ReflectiveOperationException e)
- throws UnableToSetSerialFilterException {
- String className = getClassName(e);
- switch (className) {
- case "java.lang.IllegalAccessException":
- throw new UnableToSetSerialFilterException(
- "Unable to configure an input stream serialization filter using reflection.",
- e);
- case "java.lang.reflect.InvocationTargetException":
- if (getRootCause(e) instanceof IllegalStateException) {
- // ObjectInputFilter throws IllegalStateException
- // if the filter has already been set non-null
- throw new FilterAlreadyConfiguredException(
- "Unable to configure an input stream serialization filter because a non-null filter has already been set.",
- e);
- }
- String causeClassName = e.getCause() == null ? getClassName(e) : getClassName(e.getCause());
- throw new UnableToSetSerialFilterException(
- "Unable to configure an input stream serialization filter because invocation target threw "
- + causeClassName + ".",
- e);
- default:
- throw new UnableToSetSerialFilterException(
- "Unable to configure an input stream serialization filter.",
- e);
- }
- }
-
- private static String getClassName(Throwable throwable) {
- return throwable.getClass().getName();
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilterFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilterFactory.java
deleted file mode 100644
index 3c479981d0..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveFacadeStreamSerialFilterFactory.java
+++ /dev/null
@@ -1,39 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.util.Set;
-
-/**
- * Creates an instance of {@code ObjectInputFilter} that delegates to {@code ObjectInputFilterApi}
- * to maintain independence from the JRE version.
- */
-public class ReflectiveFacadeStreamSerialFilterFactory implements StreamSerialFilterFactory {
-
- @Override
- public StreamSerialFilter create(SerializableObjectConfig config, Set<String> sanctionedClasses) {
- ObjectInputFilterApi api =
- new ReflectiveObjectInputFilterApiFactory().createObjectInputFilterApi();
-
- if (config.getValidateSerializableObjects()) {
- String pattern = new SanctionedSerializablesFilterPattern()
- .append(config.getSerializableObjectFilter())
- .pattern();
-
- return new ReflectiveFacadeStreamSerialFilter(api, pattern, sanctionedClasses);
- }
- return new NullStreamSerialFilter();
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApi.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApi.java
deleted file mode 100644
index 7b2e40a405..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApi.java
+++ /dev/null
@@ -1,238 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import java.io.ObjectInputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Collection;
-
-import org.apache.geode.annotations.VisibleForTesting;
-
-/**
- * Implementation of {@code ObjectInputFilterApi} that uses reflection and a dynamic proxy to wrap
- * the JREs ObjectInputFilter API in both Java 8 and Java 9 or greater.
- */
-public class ReflectiveObjectInputFilterApi implements ObjectInputFilterApi {
-
- protected final ApiPackage apiPackage;
-
- // api.package.ObjectInputFilter
- protected final Class<?> ObjectInputFilter;
- protected final Method ObjectInputFilter_checkInput;
- protected final Object ObjectInputFilter_Status_ALLOWED;
- protected final Object ObjectInputFilter_Status_REJECTED;
-
- // api.package.ObjectInputFilter$Config
- protected final Class<?> ObjectInputFilter_Config;
- protected final Method ObjectInputFilter_Config_createFilter;
- private final Method ObjectInputFilter_Config_getObjectInputFilter;
- private final Method ObjectInputFilter_Config_setObjectInputFilter;
- private final Method ObjectInputFilter_Config_getSerialFilter;
- private final Method ObjectInputFilter_Config_setSerialFilter;
-
- // api.package.ObjectInputFilter$FilterInfo
- private final Class<?> ObjectInputFilter_FilterInfo;
- protected final Method ObjectInputFilter_FilterInfo_serialClass;
-
- /**
- * Use reflection to look up the classes and methods for the API.
- */
- public ReflectiveObjectInputFilterApi(ApiPackage apiPackage)
- throws ClassNotFoundException, NoSuchMethodException {
- this.apiPackage = apiPackage;
-
- ObjectInputFilter = ObjectInputFilter();
- ObjectInputFilter_Config = ObjectInputFilter_Config();
- ObjectInputFilter_FilterInfo = ObjectInputFilter_FilterInfo();
- Class<?> ObjectInputFilter_Status = ObjectInputFilter_Status();
- ObjectInputFilter_Status_ALLOWED = ObjectInputFilter_Status.getEnumConstants()[1];
- ObjectInputFilter_Status_REJECTED = ObjectInputFilter_Status.getEnumConstants()[2];
-
- // Status enum includes UNDECIDED, ALLOWED, and REJECTED
- if (!ObjectInputFilter_Status_ALLOWED.toString().equals("ALLOWED")
- || !ObjectInputFilter_Status_REJECTED.toString().equals("REJECTED")) {
- throw new UnsupportedOperationException(
- "ObjectInputFilter$Status enumeration in this JDK is not as expected");
- }
-
- ObjectInputFilter_checkInput = ObjectInputFilter_checkInput();
-
- ObjectInputFilter_Config_createFilter = ObjectInputFilter_Config_createFilter();
- if (apiPackage == ApiPackage.SUN_MISC) {
- ObjectInputFilter_Config_getObjectInputFilter =
- ObjectInputFilter_Config_getObjectInputFilter();
- ObjectInputFilter_Config_setObjectInputFilter =
- ObjectInputFilter_Config_setObjectInputFilter();
- } else {
- ObjectInputFilter_Config_getObjectInputFilter = null;
- ObjectInputFilter_Config_setObjectInputFilter = null;
- }
- ObjectInputFilter_Config_getSerialFilter = ObjectInputFilter_Config_getSerialFilter();
- ObjectInputFilter_Config_setSerialFilter = ObjectInputFilter_Config_setSerialFilter();
-
- ObjectInputFilter_FilterInfo_serialClass = ObjectInputFilter_FilterInfo_serialClass();
- }
-
- @Override
- public Object getObjectInputFilter(ObjectInputStream inputStream)
- throws InvocationTargetException, IllegalAccessException {
- return ObjectInputFilter_Config_getObjectInputFilter.invoke(ObjectInputFilter_Config,
- inputStream);
- }
-
- @Override
- public void setObjectInputFilter(ObjectInputStream inputStream, Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException {
- ObjectInputFilter_Config_setObjectInputFilter.invoke(ObjectInputFilter_Config, inputStream,
- objectInputFilter);
- }
-
- @Override
- public Object getSerialFilter()
- throws InvocationTargetException, IllegalAccessException {
- return ObjectInputFilter_Config_getSerialFilter.invoke(ObjectInputFilter_Config);
- }
-
- @Override
- public void setSerialFilter(Object objectInputFilter)
- throws InvocationTargetException, IllegalAccessException {
- ObjectInputFilter_Config_setSerialFilter.invoke(ObjectInputFilter_Config, objectInputFilter);
- }
-
- @Override
- public Object createFilter(String pattern)
- throws InvocationTargetException, IllegalAccessException {
- return ObjectInputFilter_Config_createFilter.invoke(null, pattern);
- }
-
- @Override
- public Object createObjectInputFilterProxy(String pattern, Collection<String> sanctionedClasses)
- throws InvocationTargetException, IllegalAccessException {
- Object objectInputFilter =
- ObjectInputFilter_Config_createFilter.invoke(ObjectInputFilter_Config, pattern);
-
- /*
- * Members first connect to each other with sockets that are restricted to the Geode sanctioned
- * serializables which sets the Filter on that stream (an ObjectInputStream can only set a
- * Filter once in its lifetime). Geode then loads up its ConfigurationProperties and needs
- * to widen the Filter to include the User's sanctioned serializables if they provided any
- * (serializable-object-filter).
- *
- * Wrap the Filter in a dynamic Proxy to provide an InvocationHandler in order to decorate
- * before-calls to checkInput (checks the class against the filter). This allows us to
- * effectively override the call to widen the filter to include the User's addition to the set
- * of sanctioned serializables.
- */
- InvocationHandler invocationHandler = new ObjectInputFilterInvocationHandler(
- ObjectInputFilter_checkInput,
- ObjectInputFilter_FilterInfo_serialClass,
- ObjectInputFilter_Status_ALLOWED,
- ObjectInputFilter_Status_REJECTED,
- objectInputFilter,
- sanctionedClasses);
-
- // wrap the filter within a proxy to inject the above invocation handler
- return Proxy.newProxyInstance(
- ObjectInputFilter.getClassLoader(),
- new Class<?>[] {ObjectInputFilter},
- invocationHandler);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("ReflectiveObjectInputFilterApi{");
- sb.append("apiPackage='").append(apiPackage).append('\'');
- sb.append('}');
- return sb.toString();
- }
-
- @Override
- public Class<?> getObjectInputFilterClass() {
- return ObjectInputFilter;
- }
-
- @VisibleForTesting
- public ApiPackage getApiPackage() {
- return apiPackage;
- }
-
- /** {@code public interface ObjectInputFilter} */
- private Class<?> ObjectInputFilter() throws ClassNotFoundException {
- return Class.forName(apiPackage.qualify("ObjectInputFilter"));
- }
-
- /** {@code public Status checkInput(FilterInfo filterInfo)} */
- private Method ObjectInputFilter_checkInput()
- throws NoSuchMethodException {
- return ObjectInputFilter
- .getDeclaredMethod("checkInput", ObjectInputFilter_FilterInfo);
- }
-
- /** {@code public enum Status} */
- private Class<?> ObjectInputFilter_Status() throws ClassNotFoundException {
- return Class.forName(apiPackage.qualify("ObjectInputFilter$Status"));
- }
-
- /** {@code public final class Config} */
- private Class<?> ObjectInputFilter_Config() throws ClassNotFoundException {
- return Class.forName(apiPackage.qualify("ObjectInputFilter$Config"));
- }
-
- /** {@code public static ObjectInputFilter createFilter(String pattern)} */
- private Method ObjectInputFilter_Config_createFilter()
- throws NoSuchMethodException {
- return ObjectInputFilter_Config.getDeclaredMethod("createFilter", String.class);
- }
-
- /** {@code public static ObjectInputFilter getSerialFilter()} */
- private Method ObjectInputFilter_Config_getObjectInputFilter()
- throws NoSuchMethodException {
- return ObjectInputFilter_Config.getDeclaredMethod("getObjectInputFilter",
- ObjectInputStream.class);
- }
-
- /** {@code public static setSerialFilter(ObjectInputFilter filter)} */
- private Method ObjectInputFilter_Config_setObjectInputFilter()
- throws NoSuchMethodException {
- return ObjectInputFilter_Config.getDeclaredMethod("setObjectInputFilter",
- ObjectInputStream.class, ObjectInputFilter);
- }
-
- /** {@code public static ObjectInputFilter getSerialFilter()} */
- private Method ObjectInputFilter_Config_getSerialFilter()
- throws NoSuchMethodException {
- return ObjectInputFilter_Config.getDeclaredMethod("getSerialFilter");
- }
-
- /** {@code public static setSerialFilter(ObjectInputFilter filter)} */
- private Method ObjectInputFilter_Config_setSerialFilter()
- throws NoSuchMethodException {
- return ObjectInputFilter_Config.getDeclaredMethod("setSerialFilter", ObjectInputFilter);
- }
-
- /** {@code public interface FilterInfo} */
- private Class<?> ObjectInputFilter_FilterInfo() throws ClassNotFoundException {
- return Class.forName(apiPackage.qualify("ObjectInputFilter$FilterInfo"));
- }
-
- /** {@code public Class<?> serialClass()} */
- private Method ObjectInputFilter_FilterInfo_serialClass()
- throws NoSuchMethodException {
- return ObjectInputFilter_FilterInfo.getDeclaredMethod("serialClass");
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiFactory.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiFactory.java
deleted file mode 100644
index d50c15d460..0000000000
--- a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/ReflectiveObjectInputFilterApiFactory.java
+++ /dev/null
@@ -1,45 +0,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.
- */
-package org.apache.geode.internal.serialization.filter;
-
-import static org.apache.commons.lang3.JavaVersion.JAVA_1_8;
-import static org.apache.commons.lang3.JavaVersion.JAVA_9;
-import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast;
-import static org.apache.geode.internal.serialization.filter.ApiPackage.JAVA_IO;
-import static org.apache.geode.internal.serialization.filter.ApiPackage.SUN_MISC;
-import static org.apache.geode.internal.serialization.filter.ObjectInputFilterUtils.throwUnsupportedOperationException;
-
-/**
- * Implementation of {@code ObjectInputFilterApiFactory} that creates a reflection based
- * {@code ObjectInputFilterApi}.
- */
-public class ReflectiveObjectInputFilterApiFactory implements ObjectInputFilterApiFactory {
-
- @Override
- public ObjectInputFilterApi createObjectInputFilterApi() {
- try {
- if (isJavaVersionAtLeast(JAVA_9)) {
- return new Java9ReflectiveObjectInputFilterApi(JAVA_IO);
- }
- if (isJavaVersionAtLeast(JAVA_1_8)) {
- return new ReflectiveObjectInputFilterApi(SUN_MISC);
- }
- } catch (ClassNotFoundException | NoSuchMethodException e) {
- throwUnsupportedOperationException(e);
- }
- throwUnsupportedOperationException();
- return null; // unreachable
- }
-}
diff --git a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializablesFilterPattern.java b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/SanctionedSerializablesFilterPattern.java
deleted file mode 100644
index b40ef0e7eb..0000000000
... 2952 lines suppressed ...