From 5975b9f33be15bca873f9b8024a6f113589a3d15 Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Mon, 20 May 2024 12:11:15 +0300 Subject: [PATCH 1/2] Remove Coherence versions that are no longer officially supported. Fix some dependency CVEs --- .github/workflows/dependencies.yaml | 6 + .../coherence-12.1.2-testing-support/pom.xml | 172 ------ .../junit/CoherenceClusterResourceTest.java | 222 -------- ...gleMemberCoherenceClusterResourceTest.java | 97 ---- .../src/test/resources/proxy-cache-config.xml | 44 -- .../12.1.2/coherence-12.1.2-tests/pom.xml | 74 --- .../AbstractCoherenceCacheServerTest.java | 405 -------------- .../AbstractCoherenceClusterBuilderTest.java | 515 ------------------ ...ontainerBasedCoherenceCacheServerTest.java | 57 -- ...ainerBasedCoherenceClusterBuilderTest.java | 57 -- .../runtime/coherence/CustomServer.java | 170 ------ .../runtime/coherence/GetProcessor.java | 54 -- .../LocalCoherenceCacheServerTest.java | 47 -- .../LocalCoherenceClusterBuilderTest.java | 137 ----- .../test-autostart-services-cache-config.xml | 265 --------- .../src/test/resources/test-cache-config.xml | 57 -- .../src/test/resources/test-client-config.xml | 62 --- .../resources/test-extend-proxy-config.xml | 73 --- .../resources/test-operational-override.xml | 40 -- .../12.1.2/coherence-12.1.2/pom.xml | 138 ----- .../callables/GetAutoStartServiceNames.java | 140 ----- bedrock-coherence/12.1.2/pom.xml | 45 -- .../coherence-12.1.3-testing-support/pom.xml | 155 ------ .../junit/CoherenceClusterResourceTest.java | 222 -------- ...gleMemberCoherenceClusterResourceTest.java | 97 ---- .../src/test/resources/proxy-cache-config.xml | 44 -- .../12.1.3/coherence-12.1.3-tests/pom.xml | 74 --- .../AbstractCoherenceCacheServerTest.java | 405 -------------- .../AbstractCoherenceClusterBuilderTest.java | 501 ----------------- ...ontainerBasedCoherenceCacheServerTest.java | 57 -- ...ainerBasedCoherenceClusterBuilderTest.java | 57 -- .../runtime/coherence/CustomServer.java | 170 ------ .../runtime/coherence/GetProcessor.java | 54 -- .../LocalCoherenceCacheServerTest.java | 47 -- .../LocalCoherenceClusterBuilderTest.java | 137 ----- .../test-autostart-services-cache-config.xml | 265 --------- .../src/test/resources/test-cache-config.xml | 57 -- .../src/test/resources/test-client-config.xml | 62 --- .../resources/test-extend-proxy-config.xml | 73 --- .../resources/test-operational-override.xml | 40 -- .../12.1.3/coherence-12.1.3/pom.xml | 139 ----- bedrock-coherence/12.1.3/pom.xml | 45 -- bedrock-coherence/12.2.1/pom.xml | 4 +- bedrock-coherence/14.1.1/pom.xml | 2 +- bedrock-coherence/pom.xml | 2 - bedrock-core/pom.xml | 10 - etc/dependency-check-suppression.xml | 65 ++- pom.xml | 20 +- 48 files changed, 63 insertions(+), 5618 deletions(-) delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/pom.xml delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/resources/proxy-cache-config.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/pom.xml delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-autostart-services-cache-config.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-cache-config.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-client-config.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-extend-proxy-config.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-operational-override.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2/pom.xml delete mode 100755 bedrock-coherence/12.1.2/coherence-12.1.2/src/main/java/com/oracle/bedrock/runtime/coherence/callables/GetAutoStartServiceNames.java delete mode 100755 bedrock-coherence/12.1.2/pom.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/pom.xml delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/resources/proxy-cache-config.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/pom.xml delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java delete mode 100644 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-autostart-services-cache-config.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-cache-config.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-client-config.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-extend-proxy-config.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-operational-override.xml delete mode 100755 bedrock-coherence/12.1.3/coherence-12.1.3/pom.xml delete mode 100755 bedrock-coherence/12.1.3/pom.xml diff --git a/.github/workflows/dependencies.yaml b/.github/workflows/dependencies.yaml index 6072eedf1..abdebba89 100644 --- a/.github/workflows/dependencies.yaml +++ b/.github/workflows/dependencies.yaml @@ -41,3 +41,9 @@ jobs: run: | export MAVEN_ARGS="-P coherence-ce" sh ./etc/dependency-check.sh + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: build-output + path: "target/*.*" diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/pom.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/pom.xml deleted file mode 100755 index 1c9706ce3..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/pom.xml +++ /dev/null @@ -1,172 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.2 - 7.0.4-SNAPSHOT - - - coherence-12.1.2-testing-support - - Bedrock for Testing Coherence 12.1.2 - - - A set of tools to aid testing of Oracle Coherence 12.1.2 based applications. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock.coherence - coherence-12.1.2 - ${project.version} - - - - com.oracle.bedrock.coherence - coherence-3.7.1-testing-support - ${project.version} - - - ${coherence.groupId} - coherence - - - com.oracle.bedrock.coherence - coherence-3.7.1 - - - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - - - - - junit - junit - ${junit.version} - provided - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - provided - - - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven.shade.plugin.version} - - - true - - - - - com.oracle.bedrock.coherence:coherence-3.7.1-testing-support - - - - - - - com.oracle.bedrock.coherence:coherence-3.7.1-testing-support - - META-INF/** - - - - - - - - com.oracle.bedrock.coherence - - - - - - - package - - shade - - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven.source.plugin.version} - - - attach-sources - package - - jar - - - true - - - - - - - maven-antrun-plugin - 1.8 - - - unpack-source - package - - - - - - - - run - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.plugin.version} - - false - ${project.build.directory}/generated-sources - - - - attach-javadocs - - jar - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java deleted file mode 100644 index 014aa3239..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * File: CoherenceClusterResourceTests.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.junit; - -import com.oracle.bedrock.testsupport.deferred.Eventually; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.coherence.CoherenceCluster; -import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.Multicast; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.util.Capture; -import com.tangosol.net.ConfigurableCacheFactory; -import com.tangosol.net.NamedCache; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; - -import java.util.Set; -import java.util.TreeSet; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.junit.Assert.assertThat; - -/** - * Functional Tests for the JUnit {@link CoherenceClusterResource}. - *

- * Copyright (c) 2017. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class CoherenceClusterResourceTest -{ - /** - * Establish a {@link CoherenceClusterResource} for our test. - */ - @Rule - public CoherenceClusterResource coherenceResource = - new CoherenceClusterResource() - .using(LocalPlatform.get()) - .with(LocalHost.only(), - Multicast.ttl(0), - ClusterPort.automatic(), - SystemProperty.of("tangosol.coherence.extend.address", LocalPlatform.get().getLoopbackAddress().getHostAddress()), - SystemProperty.of("tangosol.coherence.extend.port", Capture.of(LocalPlatform.get().getAvailablePorts()))) - .include(2, - DisplayName.of("storage"), - RoleName.of("storage"), - LocalStorage.enabled(), - SystemProperty.of("tangosol.coherence.extend.enabled", false), - SystemProperty.of("test.property", "storageMember")) - .include(1, - DisplayName.of("proxy"), - RoleName.of("proxy"), - LocalStorage.disabled(), - SystemProperty.of("tangosol.coherence.extend.enabled", true), - SystemProperty.of("test.property", "proxyServer")); - - - /** - * Ensure that the required cluster is formed by a {@link CoherenceClusterResource}. - */ - @Test - public void shouldFormCluster() - { - // ensure the size of the cluster is as expected - Assert.assertThat(coherenceResource.getCluster().getClusterSize(), is(3)); - - // collect the names of the members - CoherenceCluster cluster = coherenceResource.getCluster(); - Set setNames = new TreeSet<>(); - - for (CoherenceClusterMember member : cluster) - { - setNames.add(member.getName()); - } - - // ensure the names of the cluster members are as expected - assertThat(setNames, contains("proxy-1", "storage-1", "storage-2")); - - } - - - /** - * Ensure that a {@link StorageDisabledMember} session can be created against the {@link CoherenceClusterResource}. - */ - @Test - public void shouldCreateStorageDisabledMemberSession() - { - ConfigurableCacheFactory session = coherenceResource.createSession(SessionBuilders.storageDisabledMember()); - - NamedCache cache = session.ensureCache("dist-example", null); - - Eventually.assertThat(coherenceResource.getCluster().getClusterSize(), is(4)); - - cache.put("message", "hello world"); - - Eventually.assertThat(invoking(coherenceResource.getCluster().getCache("dist-example")).get("message"), - is((Object) "hello world")); - } - - - /** - * Ensure that a {@link ExtendClient} session can be created against the {@link CoherenceClusterResource}. - */ - @Test - public void shouldCreateExtendClientSession() - { - ConfigurableCacheFactory session = - coherenceResource.createSession(SessionBuilders.extendClient("proxy-cache-config.xml")); - - NamedCache cache = session.ensureCache("dist-example", null); - - Assert.assertThat(coherenceResource.getCluster().getClusterSize(), is(3)); - - cache.put("message", "hello world"); - - Eventually.assertThat(invoking(coherenceResource.getCluster().getCache("dist-example")).get("message"), - is((Object) "hello world")); - } - - /** - * Ensure the proxy member(s) have a property set. - */ - @Test - public void shouldHaveSetProxyServerProperty() - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("proxy")) - { - assertThat(member.getSystemProperty("test.property"), is("proxyServer")); - } - } - - - /** - * Ensure the storage-enabled member(s) have a property set. - */ - @Test - public void shouldHaveSetStorageMemberProperty() - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("storage")) - { - assertThat(member.getSystemProperty("test.property"), is("storageMember")); - } - } - - - /** - * Ensure that a {@link CoherenceClusterResource} can be used to perform a rolling restart. - */ - @Test - public void shouldPerformRollingRestart() throws Exception - { - CoherenceCluster cluster = coherenceResource.getCluster(); - - // only restart storage enabled members - cluster.filter(member -> member.getName().startsWith("storage")).relaunch(); - - CoherenceClusterMember member1 = cluster.get("storage-1"); - CoherenceClusterMember member2 = cluster.get("storage-2"); - - assertThat(member1, is(notNullValue())); - assertThat(member2, is(notNullValue())); - - assertThat(member1.getLocalMemberId(), is(4)); - assertThat(member2.getLocalMemberId(), is(5)); - } - - - /** - * Ensure that a {@link CoherenceClusterResource} can be used to perform a rolling restart - * when there's a storage disabled session. - */ - @Test - public void shouldPerformRollingRestartWithStorageDisabledSession() throws Exception - { - CoherenceCluster cluster = coherenceResource.getCluster(); - - ConfigurableCacheFactory cacheFactory = coherenceResource.createSession(SessionBuilders.storageDisabledMember()); - - // only restart storage enabled members - cluster.filter(member -> member.getName().startsWith("storage")).relaunch(); - - CoherenceClusterMember member1 = cluster.get("storage-1"); - CoherenceClusterMember member2 = cluster.get("storage-2"); - - assertThat(member1, is(notNullValue())); - assertThat(member2, is(notNullValue())); - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java deleted file mode 100644 index ee44e8209..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * File: SingleMemberCoherenceClusterResourceTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.junit; - -import com.oracle.bedrock.runtime.coherence.CoherenceCluster; -import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.Multicast; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.options.DisplayName; -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Set; -import java.util.TreeSet; - -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -/** - * Functional Tests for single-member {@link CoherenceClusterResource}s. - *

- * Copyright (c) 2017. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class SingleMemberCoherenceClusterResourceTest -{ - /** - * A {@link CoherenceClusterResource} defining a single cluster member - */ - @ClassRule - public static CoherenceClusterResource coherenceResource = - new CoherenceClusterResource() - .with(ClusterName.of("SingletonCluster"), LocalHost.only(), Multicast.ttl(0)) - .include(1, - RoleName.of("storage"), - DisplayName.of("storage"), - LocalStorage.enabled(), - SystemProperty.of("test.property", "storageMember")); - - - /** - * Ensure that a single member cluster is formed by {@link CoherenceClusterResource}. - */ - @Test - public void shouldFormCorrectSizeCluster() - { - CoherenceCluster cluster = coherenceResource.getCluster(); - Set setNames = new TreeSet<>(); - - for (CoherenceClusterMember member : cluster) - { - setNames.add(member.getName()); - } - - assertThat(setNames, contains("storage-1")); - } - - - @Test - public void shouldHaveSetStorageMemberProperty() throws Exception - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("storage")) - { - assertThat(member.getSystemProperty("test.property"), is("storageMember")); - } - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/resources/proxy-cache-config.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/resources/proxy-cache-config.xml deleted file mode 100644 index 0969776d5..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-testing-support/src/test/resources/proxy-cache-config.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - dist-* - remote-cache - - - - - - - - remote-cache - - - - -

localhost
- 9099 - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/pom.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/pom.xml deleted file mode 100755 index 547a7627f..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.2 - 7.0.4-SNAPSHOT - - - coherence-12.1.2-tests - - Bedrock for Coherence 12.1.2 (Tests) - - - Functional and Integration tests for the Bedrock Coherence 12.1.2 module. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock.coherence - coherence-12.1.2 - ${project.version} - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - - - - - junit - junit - ${junit.version} - test - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - test - - - - org.jacoco - org.jacoco.agent - ${jacoco.version} - runtime - test - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven.deploy.plugin.version} - - true - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java deleted file mode 100644 index 696602a1a..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * File: AbstractCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.testsupport.junit.AbstractTest; -import com.oracle.bedrock.testsupport.matchers.MapMatcher; -import com.oracle.bedrock.options.Diagnostics; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.callables.GetClusterName; -import com.oracle.bedrock.runtime.coherence.callables.GetClusterSize; -import com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId; -import com.oracle.bedrock.runtime.coherence.callables.GetServiceStatus; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.OperationalOverride; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.coherence.options.SiteName; -import com.oracle.bedrock.runtime.concurrent.RemoteEvent; -import com.oracle.bedrock.runtime.concurrent.RemoteEventListener; -import com.oracle.bedrock.runtime.concurrent.options.StreamName; -import com.oracle.bedrock.runtime.java.features.JmxFeature; -import com.oracle.bedrock.runtime.java.options.ClassName; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.Discriminator; -import com.oracle.bedrock.util.Capture; -import com.tangosol.net.NamedCache; -import com.tangosol.util.aggregator.LongSum; -import com.tangosol.util.extractor.IdentityExtractor; -import com.tangosol.util.filter.PresentFilter; -import org.junit.Test; - -import javax.management.ObjectName; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; - -/** - * Functional Tests for {@link CoherenceCacheServer}s. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public abstract class AbstractCoherenceCacheServerTest extends AbstractTest -{ - /** - * Obtains the {@link Platform} to use when realizing applications. - */ - public abstract Platform getPlatform(); - - - /** - * Ensure we can start and connect to the Coherence using the {@link JmxFeature}. - * - * @throws Exception - */ - @Test - public void shouldStartJMXConnection() throws Exception - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.from(availablePorts), - LocalHost.only(), - RoleName.of("test-role"), - SiteName.of("test-site"), - JmxFeature.enabled(), - JMXManagementMode.LOCAL_ONLY)) - - { - assertThat(invoking(server).getClusterSize(), is(1)); - assertThat(server.getRoleName(), is("test-role")); - assertThat(server.getSiteName(), is("test-site")); - - JmxFeature jmxFeature = server.get(JmxFeature.class); - - assertThat(jmxFeature, is(notNullValue())); - - // use JMX to determine the cluster size - int size = jmxFeature.getMBeanAttribute(new ObjectName("Coherence:type=Cluster"), - "ClusterSize", - Integer.class); - - assertThat(size, is(1)); - } - } - - - /** - * Ensure that we can start and stop a single Coherence Cluster Member. - */ - @Test - public void shouldStartSingletonCluster() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - LocalHost.only(), - Diagnostics.enabled(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - assertThat(server, new GetServiceStatus("DistributedCache"), is(ServiceStatus.ENDANGERED)); - } - } - - - /** - * Ensure that we can start and stop Coherence Members on the same port - * continuously (quickly) and there is only ever one member. - */ - @Test - public void shouldStartStopMultipleTimes() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - - Platform platform = getPlatform(); - - ClusterPort clusterPort = ClusterPort.from(new Capture<>(availablePorts)); - - for (int i = 1; i <= 10; i++) - { - System.out.println("Building Instance: " + i); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - clusterPort, - LocalHost.only(), - RoleName.of("test-role"), - SiteName.of("test-site"), - Diagnostics.enabled(), - Discriminator.of(i), - Console.system())) - { - assertThat(invoking(server).getClusterSize(), is(1)); - assertThat(server.getRoleName(), is("test-role")); - assertThat(server.getSiteName(), is("test-site")); - } - } - } - - - /** - * Ensure that we can start and stop a Coherence Cluster Member - * that uses a specific operational override. - */ - @Test - public void shouldUseCustomOperationalOverride() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - OperationalOverride.of("test-operational-override.xml"), - LocalHost.only(), - Diagnostics.enabled(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - assertThat(server, new GetClusterName(), is("MyCluster")); - } - } - - - /** - * Ensure that we can create and use a NamedCache via a CoherenceCacheServer. - */ - @Test - public void shouldAccessNamedCache() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - LocalHost.only(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - - NamedCache namedCache = server.getCache("dist-example"); - - // ----- use NamedCache.clear ----- - namedCache.clear(); - - assertThat(namedCache.size(), is(0)); - - // ----- use NamedCache.put and NamedCache.get ----- - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - - // ----- use NamedCache.invokeAll ----- - Map map = namedCache.invokeAll(PresentFilter.INSTANCE, new GetProcessor()); - - assertThat(map, notNullValue()); - assertThat(map.size(), is(1)); - assertThat((String) map.get("key"), is("hello")); - - // ----- use NamedCache.keySet ----- - Set keySet = namedCache.keySet(); - - assertThat(keySet, notNullValue()); - assertThat(keySet.size(), is(1)); - assertThat(keySet.contains("key"), is(true)); - - // ----- use NamedCache.entrySet ----- - Set entrySet = namedCache.entrySet(); - - assertThat(entrySet, notNullValue()); - assertThat(entrySet.size(), is(1)); - assertThat(entrySet.contains(new AbstractMap.SimpleEntry("key", "hello")), is(true)); - - // ----- use NamedCache.values ----- - Collection values = namedCache.values(); - - assertThat(values, notNullValue()); - assertThat(values.size(), is(1)); - assertThat(values.contains("hello"), is(true)); - - namedCache.clear(); - - assertThat(invoking(namedCache).size(), is(0)); - - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - - // ----- use NamedCache.remove ----- - namedCache.remove("key"); - - assertThat(namedCache.size(), is(0)); - - // ----- use NamedCache.putAll ----- - HashMap putAllMap = new HashMap<>(); - long sum = 0; - - for (int i = 1; i < 5; i++) - { - String key = Integer.toString(i); - - putAllMap.put(key, new Integer(i)); - - sum += i; - } - - namedCache.putAll(putAllMap); - - assertThat(namedCache.size(), is(putAllMap.size())); - - // ----- use NamedCache.getAll ----- - Map getAllResults = namedCache.getAll(putAllMap.keySet()); - - assertThat(getAllResults, MapMatcher.sameAs(putAllMap)); - - Map otherGetAllResults = namedCache.getAll(namedCache.keySet()); - - assertThat(otherGetAllResults, MapMatcher.sameAs(putAllMap)); - - // ----- use NamedCache.aggregate ----- - long longSum = (Long) namedCache.aggregate(PresentFilter.INSTANCE, new LongSum(IdentityExtractor.INSTANCE)); - - assertThat(longSum, is(sum)); - - long anotherLongSum = (Long) namedCache.aggregate(putAllMap.keySet(), - new LongSum(IdentityExtractor.INSTANCE)); - - assertThat(anotherLongSum, is(sum)); - } - } - - - @Test - public void shouldSendEventsFromCustomServer() throws Exception - { - Platform platform = getPlatform(); - EventListener listener = new EventListener(1); - String name = "Foo"; - RemoteEvent event = new CustomServer.Event(19); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClassName.of(CustomServer.class), - ClusterPort.automatic(), - LocalHost.only(), - Console.system())) - { - server.addListener(listener, StreamName.of(name)); - - CustomServer.fireEvent(server, name, event); - - assertThat(listener.await(1, TimeUnit.MINUTES), is(true)); - assertThat(listener.getEvents().get(0), is(event)); - - server.close(); - } - - } - - - /** - * An instance of a {@link RemoteEventListener} that captures events. - */ - public static class EventListener implements RemoteEventListener - { - /** - * The counter to count the number of events received. - */ - private final CountDownLatch latch; - - /** - * The list of events received. - */ - private final List events; - - - /** - * Create an {@link EventListener} to receieve the expected number of events. - * - * @param expected the expected number of events - */ - public EventListener(int expected) - { - latch = new CountDownLatch(expected); - events = new ArrayList<>(); - } - - - /** - * Causes the current thread to wait until the expected number of events - * have been received, unless the thread is {@linkplain Thread#interrupt interrupted}, - * or the specified waiting time elapses. - * - * @param timeout the maximum time to wait - * @param unit the time unit of the {@code timeout} argument - * - * @return {@code true} if the correct number of events is received and {@code false} - * if the waiting time elapsed before the events were received - * - * @throws InterruptedException if the current thread is interrupted - * while waiting - */ - private boolean await(long timeout, - TimeUnit unit) throws InterruptedException - { - return latch.await(timeout, unit); - } - - - public List getEvents() - { - return events; - } - - - @Override - public void onEvent(RemoteEvent event) - { - events.add(event); - latch.countDown(); - } - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java deleted file mode 100644 index 65f2d70a2..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,515 +0,0 @@ -/* - * File: AbstractCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.OptionsByType; -import com.oracle.bedrock.testsupport.junit.AbstractTest; -import com.oracle.bedrock.options.Decoration; -import com.oracle.bedrock.runtime.ApplicationListener; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.options.CacheConfig; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.WellKnownAddress; -import com.oracle.bedrock.runtime.java.JavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.runtime.options.StabilityPredicate; -import com.oracle.bedrock.util.Capture; -import com.oracle.bedrock.util.Trilean; -import com.tangosol.net.NamedCache; -import org.junit.Assert; -import org.junit.Test; - -import java.util.HashSet; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.greaterThan; - -/** - * Functional Tests for the {@link CoherenceClusterBuilder} class. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public abstract class AbstractCoherenceClusterBuilderTest extends AbstractTest -{ - /** - * Creates a new {@link JavaApplicationLauncher} to use for a tests in this class and/or sub-classes. - * - * @return the {@link JavaApplicationLauncher} - */ - public abstract Platform getPlatform(); - - - /** - * Ensure we can build and destroy a {@link CoherenceCluster} containing storage-enabled - * {@link CoherenceCacheServer}s. - */ - @Test - public void shouldBuildStorageEnabledCluster() - { - final int CLUSTER_SIZE = 3; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - clusterPort, - LocalHost.only(), - ClusterName.of("Storage-Only")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - } - } - - - /** - * Ensure we can build and close a {@link CoherenceCluster} - * of storage enabled members with a proxy server. - */ - @Test - public void shouldBuildStorageAndProxyCluster() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(2, - CoherenceClusterMember.class, - DisplayName.of("storage"), - clusterPort, - ClusterName.of("Storage-Proxy"), - CacheConfig.of("test-cache-config.xml"), - LocalHost.only(), - LocalStorage.enabled()); - - builder.include(1, - CoherenceClusterMember.class, - DisplayName.of("extend"), - clusterPort, - ClusterName.of("Storage-Proxy"), - CacheConfig.of("test-extend-proxy-config.xml"), - LocalHost.only(), - LocalStorage.disabled(), - SystemProperty.of("coherence.extend.port", availablePorts)); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - // ensure the cluster size is as expected - assertThat(invoking(cluster).getClusterSize(), is(3)); - - // ensure the member id's are different - HashSet memberIds = new HashSet<>(); - - for (CoherenceClusterMember member : cluster) - { - // ensure the member id is not -1 (it may not have a member id yet) - assertThat(invoking(member).getLocalMemberId(), is(greaterThan(0))); - - memberIds.add(member.getLocalMemberId()); - } - - Assert.assertEquals(3, memberIds.size()); - - CoherenceClusterMember extendMember = cluster.get("extend-1"); - - assertThat(invoking(extendMember).isServiceRunning("ExtendTcpProxyService"), is(true)); - - for (CoherenceClusterMember storageMember : cluster.getAll("storage")) - { - assertThat(invoking(storageMember).isServiceRunning("ExtendTcpProxyService"), is(false)); - } - } - } - - - /** - * Ensure that we can build a cluster using WKA. - */ - @Test - public void shouldBuilderWKABasedStorageCluster() - { - Capture wkaPort = new Capture<>(LocalPlatform.get().getAvailablePorts()); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(LocalPlatform.get().getAvailablePorts())); - String localHost = System.getProperty("tangosol.coherence.localhost", "127.0.0.1"); - - String clusterName = "WKA" + getClass().getSimpleName(); - - int desiredClusterSize = 4; - - CoherenceClusterBuilder clusterBuilder = new CoherenceClusterBuilder(); - - clusterBuilder.include(desiredClusterSize, - CoherenceClusterMember.class, - DisplayName.of("storage"), - LocalStorage.enabled(), - WellKnownAddress.of(localHost, wkaPort), - ClusterName.of(clusterName), - LocalHost.of(localHost, wkaPort), - clusterPort); - - try (CoherenceCluster cluster = clusterBuilder.build(Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(desiredClusterSize)); - } - } - - - /** - * Ensure we perform a rolling restart of a {@link CoherenceCluster} - */ - @Test - public void shouldPerformRollingRestartOfCluster() - { - final int CLUSTER_SIZE = 4; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Rolling" + getClass().getSimpleName(); - - Platform platform = getPlatform(); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - StabilityPredicate predicate = - StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe()); - - cluster.filter(member -> member.isServiceRunning("ProxyService")).relaunch(); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - } - } - - - /** - * Ensure that we can create and use a NamedCache via a CoherenceCacheServer. - */ - @Test - public void shouldAccessNamedCache() - { - Capture wkaPort = new Capture<>(LocalPlatform.get().getAvailablePorts()); - final int CLUSTER_SIZE = 3; - String localHost = System.getProperty("tangosol.coherence.localhost", "127.0.0.1"); - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - WellKnownAddress.of(localHost, wkaPort), - clusterPort, - LocalHost.of(localHost, wkaPort), - ClusterName.of("Access")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - NamedCache namedCache = cluster.getCache("dist-example"); - - assertThat(namedCache.size(), is(0)); - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - } - } - - - /** - * Ensure that a {@link NamedCache} produced by a {@link CoherenceCluster} {@link CoherenceClusterMember} - * is failed over to another {@link CoherenceClusterMember} when the original {@link CoherenceClusterMember} - * is closed. - */ - @Test - public void shouldFailOverNamedCache() - { - Capture wkaPort = new Capture<>(LocalPlatform.get().getAvailablePorts()); - final int CLUSTER_SIZE = 3; - String localHost = System.getProperty("tangosol.coherence.localhost", "127.0.0.1"); - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - WellKnownAddress.of(localHost, wkaPort), - clusterPort, - LocalHost.of(localHost, wkaPort), - ClusterName.of("FailOver"), - DisplayName.of("DCS")); - - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // acquire a NamedCache from a specific cluster member - CoherenceClusterMember member = cluster.get("DCS-1"); - - NamedCache cache = member.getCache("dist-example"); - - // use the cache to put some data - cache.put("message", "hello"); - - // close the cluster member - member.close(); - - // ensure that it's not in the cluster - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE - 1)); - - // attempt to use the cache - assertThat(invoking(cache).get("message"), is("hello")); - } - } - - - /** - * Ensure that the explicitly closing a CoherenceCacheServer removes it from - * the CoherenceCluster in which is it defined. - */ - @Test - public void shouldRemoveCoherenceClusterMemberFromCoherenceCluster() - { - Capture wkaPort = new Capture<>(LocalPlatform.get().getAvailablePorts()); - final int CLUSTER_SIZE = 3; - String localHost = System.getProperty("tangosol.coherence.localhost", "127.0.0.1"); - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - WellKnownAddress.of(localHost, wkaPort), - clusterPort, - LocalHost.of(localHost, wkaPort), - ClusterName.of("Access"), - DisplayName.of("DCS")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // acquire a cluster member - CoherenceClusterMember member = cluster.get("DCS-1"); - - // close it - member.close(); - - // ensure that it's not in the cluster - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE - 1)); - } - } - - - /** - * Ensure we can clone {@link CoherenceClusterMember}s in a {@link CoherenceCluster}. - */ - @Test - public void shouldCloneMembersOfACluster() - { - final int CLUSTER_SIZE = 2; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Cloning" + getClass().getSimpleName(); - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.limit(1).clone(1); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 1)); - - cluster.unordered().limit(2).clone(2); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 5)); - } - } - - - /** - * Ensure we can expand {@link CoherenceClusterMember}s in a {@link CoherenceCluster}. - */ - @Test - public void shouldExpandMembersOfACluster() - { - final int CLUSTER_SIZE = 1; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Cloning" + getClass().getSimpleName(); - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // ensure that the DistributedCache service for the first (and only) cluster member is storage disabled - assertThat(invoking(cluster.get("DCS-1")).isStorageEnabled("DistributedCache"), is(Trilean.TRUE)); - - // ensure that the InvocationService service for the first (and only) cluster member is unknown - assertThat(invoking(cluster.get("DCS-1")).isStorageEnabled("InvocationService"), is(Trilean.UNKNOWN)); - - cluster.expand(1, - LocalPlatform.get(), - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system(), - LocalStorage.disabled()); - - // ensure that the cluster is bigger by one - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 1)); - - // ensure that the DistributedCache service for the new member is storage disabled - assertThat(invoking(cluster.get("DCS-2")).isStorageEnabled("DistributedCache"), is(Trilean.FALSE)); - - // ensure that the InvocationService service for the new member is unknown - assertThat(invoking(cluster.get("DCS-2")).isStorageEnabled("InvocationService"), is(Trilean.UNKNOWN)); - } - } - - - /** - * Ensure we clean up an unsuccessfully created {@link CoherenceCluster}. - */ - @Test - public void shouldAvoidPartialClusterCreation() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - // these two should start - builder.include(2, CoherenceClusterMember.class, clusterPort, LocalHost.only(), ClusterName.of("Storage-Only")); - - // this one will start but fail as the listener raises an exception - builder.include(1, - CoherenceClusterMember.class, - clusterPort, - LocalHost.only(), - ClusterName.of("Storage-Only"), - Decoration.of(new ApplicationListener() - { - @Override - public void onClosing(CoherenceClusterMember application, - OptionsByType optionsByType) - { - // do nothing - } - - @Override - public void onClosed(CoherenceClusterMember application, - OptionsByType optionsByType) - { - // do nothing - } - - @Override - public void onLaunched(CoherenceClusterMember application) - { - throw new IllegalStateException("Let's not start this application"); - } - })); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - Assert.fail("The cluster should not have started"); - } - catch (RuntimeException e) - { - Assert.assertThat(e.getMessage(), - containsString("Failed to launch one of the desired CoherenceClusterMember(s)")); - } - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java deleted file mode 100644 index 905d28f95..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * File: ContainerBasedCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.ContainerBasedJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.JavaVirtualMachine; -import org.junit.Ignore; - -/** - * Functional Test for {@link CoherenceCacheServer}s using a {@link ContainerBasedJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class ContainerBasedCoherenceCacheServerTest extends AbstractCoherenceCacheServerTest -{ - @Override - public Platform getPlatform() - { - return JavaVirtualMachine.get(); - } - - - @Override - @Ignore - public void shouldStartStopMultipleTimes() - { - // we skip this test as performing fast starting/stopping in - // container is not supported for Coherence 3.7.1.x - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java deleted file mode 100644 index 12e7f9604..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * File: ContainerBasedCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.ContainerBasedJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.JavaVirtualMachine; -import org.junit.Ignore; - -/** - * Functional Tests for {@link CoherenceClusterBuilder}s using a {@link ContainerBasedJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class ContainerBasedCoherenceClusterBuilderTest extends AbstractCoherenceClusterBuilderTest -{ - @Override - public Platform getPlatform() - { - return JavaVirtualMachine.get(); - } - - - @Override - @Ignore - public void shouldPerformRollingRestartOfCluster() - { - // we skip this test as performing a rolling restart in single JVM - // container is not supported for Coherence - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java deleted file mode 100644 index 785eeb98c..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * File: CustomServer.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.concurrent.RemoteChannel; -import com.oracle.bedrock.runtime.concurrent.RemoteEvent; -import com.oracle.bedrock.runtime.concurrent.RemoteRunnable; -import com.oracle.bedrock.runtime.concurrent.options.StreamName; -import com.oracle.bedrock.runtime.java.JavaApplication; -import com.tangosol.net.DefaultCacheServer; - -/** - * A custom server class with a main method that - * calls {@link DefaultCacheServer#main(String[])}. - *

- * Copyright (c) 2016. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Jonathan Knight - */ -public class CustomServer -{ - public static void main(String[] args) - { - DefaultCacheServer.main(args); - } - - - /** - * Fire an event from the specified application. - * - * @param application the application to fire the event from - * @param event the event to fire - */ - public static void fireEvent(JavaApplication application, - String streamName, - RemoteEvent event) - { - application.submit(new FireEvent(streamName, event)); - } - - - /** - * A simple implementation of a {@link RemoteEvent}. - */ - public static class Event implements RemoteEvent - { - /** - * The identifier of this event. - */ - private int id; - - - /** - * Create an {@link Event} with the specified identifier. - * - * @param id the identifier of this event - */ - public Event(int id) - { - this.id = id; - } - - - /** - * Obtain the identifier of this event. - * - * @return the identifier of this event - */ - public int getId() - { - return id; - } - - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - - if (o == null || getClass() != o.getClass()) - { - return false; - } - - Event event = (Event) o; - - return id == event.id; - - } - - - @Override - public int hashCode() - { - return id; - } - - - @Override - public String toString() - { - return "Event(" + "id=" + id + ')'; - } - } - - - /** - * A {@link RemoteRunnable} that can be used to fire an - * event from an application. - */ - public static class FireEvent implements RemoteRunnable - { - /** - * The {@link RemoteChannel} for asynchronously sending events / responses back - * (in addition to return values). - */ - @RemoteChannel.Inject - private RemoteChannel remoteChannel; - private String streamName; - private RemoteEvent event; - - - /** - * Constructs a {@link FireEvent}. - * - * @param streamName - * @param event - */ - public FireEvent(String streamName, - RemoteEvent event) - { - this.streamName = streamName; - this.event = event; - } - - - @Override - public void run() - { - remoteChannel.raise(event, StreamName.of(streamName)); - } - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java deleted file mode 100644 index dbe815c65..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * File: GetProcessor.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.tangosol.util.InvocableMap; -import com.tangosol.util.processor.AbstractProcessor; - -/** - * An {@link InvocableMap.EntryProcessor} to return the value of an entry. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class GetProcessor extends AbstractProcessor -{ - /** - * Constructs a {@link GetProcessor}. - */ - public GetProcessor() - { - } - - - @Override - public Object process(InvocableMap.Entry entry) - { - return entry.isPresent() ? entry.getValue() : null; - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java deleted file mode 100644 index e0c5d47fa..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * File: LocalCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.LocalJavaApplicationLauncher; - -/** - * Functional Test for {@link CoherenceCacheServer}s using a {@link LocalJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class LocalCoherenceCacheServerTest extends AbstractCoherenceCacheServerTest -{ - @Override - public Platform getPlatform() - { - return LocalPlatform.get(); - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java deleted file mode 100644 index 3c9b39b0f..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * File: LocalCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.options.CacheConfig; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.concurrent.runnable.RuntimeExit; -import com.oracle.bedrock.runtime.java.ClassPath; -import com.oracle.bedrock.runtime.java.LocalJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.options.JavaAgent; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.util.Capture; -import org.jacoco.agent.rt.RT; -import org.junit.Assert; -import org.junit.Test; - -import java.io.File; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.is; - -/** - * Functional Tests for {@link CoherenceClusterBuilder} - * using a {@link LocalJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class LocalCoherenceClusterBuilderTest extends AbstractCoherenceClusterBuilderTest -{ - @Override - public Platform getPlatform() - { - return LocalPlatform.get(); - } - - - /** - * Ensure we can build and close a {@link CoherenceCluster} - * of storage enabled members with a proxy server when using code-coverage tools. - */ - @Test - public void shouldEstablishStorageAndProxyClusterWithCodeCoverage() throws Exception - { - // determine the classpath of the JaCoCo runtime agent jar (should be something like jacocoagent-x.y.z.jar) - ClassPath jacocoPath = ClassPath.ofClass(RT.class); - - // define a temp file name pattern for JaCoCo code coverage reports - String jacocoDestinationFileName = "jacoco-${bedrock.runtime.id}.exec"; - File destinationFile = new File(System.getProperty("java.io.tmpdir"), jacocoDestinationFileName); - - // define the JavaAgent for JaCoCo - JavaAgent javaAgent = JavaAgent.using(jacocoPath.toString(), - "destfile=" + destinationFile - + ",output=file,sessionid=${bedrock.runtime.id},dumponexit=true"); - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - Capture clusterPort = new Capture<>(availablePorts); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(2, - CoherenceClusterMember.class, - DisplayName.of("storage"), - ClusterPort.of(clusterPort), - LocalStorage.enabled(), - CacheConfig.of("test-cache-config.xml"), - LocalHost.only(), - ClusterName.of("Storage-Proxy"), - javaAgent, - RuntimeExit.withExitCode(0)); - - builder.include(1, - CoherenceClusterMember.class, - DisplayName.of("extend"), - ClusterPort.of(clusterPort), - LocalStorage.disabled(), - CacheConfig.of("test-extend-proxy-config.xml"), - LocalHost.only(), - ClusterName.of("Storage-Proxy"), - javaAgent, - RuntimeExit.withExitCode(0)); - - try (CoherenceCluster cluster = builder.build(Console.system())) - { - // ensure the cluster size is as expected - assertThat(invoking(cluster).getClusterSize(), is(3)); - - CoherenceClusterMember extendMember = cluster.get("extend-1"); - - assertThat(invoking(extendMember).isServiceRunning("ExtendTcpProxyService"), is(true)); - - for (CoherenceClusterMember storageMember : cluster.getAll("storage")) - { - assertThat(invoking(storageMember).isServiceRunning("ExtendTcpProxyService"), is(false)); - } - } - catch (Exception e) - { - e.printStackTrace(); - Assert.fail(); - } - } -} diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-autostart-services-cache-config.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-autostart-services-cache-config.xml deleted file mode 100755 index 857b91c1b..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-autostart-services-cache-config.xml +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - * - distributed-scheme-auto-start - - - - - - - distributed-scheme-auto-start - AutoStartDistributedService - - - - - - true - - - - distributed-scheme-lazy-start - LazyStartDistributedService - - - - - - false - - - - - replicated-scheme-auto-start - AutoStartReplicatedService - - - - - - true - - - - replicated-scheme-lazy-start - LazyStartReplicatedService - - - - - - false - - - - - optimistic-scheme-auto-start - AutoStartOptimisticService - - - - - - true - - - - optimistic-scheme-lazy-start - LazyStartOptimisticService - - - - - - false - - - - - local-scheme - LocalService - - HYBRID - 0 - 1h - - - - - near-scheme-auto-start - - - - HYBRID - 100 - 1m - - - - - - distributed-scheme-auto-start - - - - present - true - - - - near-scheme-lazy-start - - - - HYBRID - 100 - 1m - - - - - - distributed-scheme-lazy-start - - - - present - false - - - - - overflow-external-scheme-auto-start - - - - - - - - - - - - - - true - - - - overflow-external-scheme-lazy-start - - - - - - - - - - - - - - false - - - - - transactional-scheme-auto-start - AutoStartTransactionalService - - true - - - - transactional-scheme-lazy-start - LazyStartTransactionalService - - false - - - - - proxy-scheme-auto-start - AutoStartProxyService - - - - - -

- - true - - - - - - true - - - - proxy-scheme-lazy-start - LazyStartProxyService - - - - - -
- - true -
-
-
-
- - false -
- - - - invocation-scheme-auto-start - AutoStartInvocationService - - true - - - - invocation-scheme-lazy-start - LazyStartInvocationService - - false - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-cache-config.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-cache-config.xml deleted file mode 100755 index e31216ffd..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-cache-config.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - pof - - - - - * - distributed-scheme - - - - - - distributed-scheme - distributed-service - 10 - - - BINARY - - - true - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-client-config.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-client-config.xml deleted file mode 100755 index 6e9bcb656..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-client-config.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - pof - system - - - - - * - remote-scheme - - - - - - remote-scheme - - - - -
localhost
- 10000 -
-
-
-
-
- -
- -
\ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-extend-proxy-config.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-extend-proxy-config.xml deleted file mode 100755 index 992c795bf..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-extend-proxy-config.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - pof - system - - - - - * - distributed-scheme - - - - - - distributed-scheme - distributed-service - - - BINARY - - - true - - - - ExtendTcpProxyService - 5 - - - -
localhost
- 10000 -
-
-
- true -
- -
- -
\ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-operational-override.xml b/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-operational-override.xml deleted file mode 100755 index 8906ad6e0..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2-tests/src/test/resources/test-operational-override.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - MyCluster - - - - 1000 - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2/pom.xml b/bedrock-coherence/12.1.2/coherence-12.1.2/pom.xml deleted file mode 100755 index 64f055fdc..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.2 - 7.0.4-SNAPSHOT - - - coherence-12.1.2 - - Bedrock for Coherence 12.1.2 - - - A set of tools to manage and control Oracle Coherence 12.1.2 processes at runtime. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock - bedrock-runtime - ${project.version} - - - - com.oracle.bedrock - bedrock-runtime-remote - ${project.version} - - - - com.oracle.bedrock.coherence - coherence-3.7.1 - ${project.version} - - - ${coherence.groupId} - coherence - - - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - test - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - test - - - - junit - junit - ${junit.version} - test - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.plugin.version} - - false - true - - com.oracle.bedrock.coherence:coherence-3.7.1 - - - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven.shade.plugin.version} - - - true - - - - - com.oracle.bedrock.coherence:coherence-3.7.1 - - - - - - - com.oracle.bedrock.coherence:coherence-3.7.1 - - META-INF/** - - - - - - - package - - shade - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.2/coherence-12.1.2/src/main/java/com/oracle/bedrock/runtime/coherence/callables/GetAutoStartServiceNames.java b/bedrock-coherence/12.1.2/coherence-12.1.2/src/main/java/com/oracle/bedrock/runtime/coherence/callables/GetAutoStartServiceNames.java deleted file mode 100755 index 5ffedc20b..000000000 --- a/bedrock-coherence/12.1.2/coherence-12.1.2/src/main/java/com/oracle/bedrock/runtime/coherence/callables/GetAutoStartServiceNames.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * File: GetAutoStartServiceNames.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence.callables; - -import com.oracle.bedrock.runtime.concurrent.RemoteCallable; -import com.tangosol.coherence.config.CacheConfig; -import com.tangosol.coherence.config.scheme.AbstractCompositeScheme; -import com.tangosol.coherence.config.scheme.ServiceScheme; -import com.tangosol.net.CacheFactory; -import com.tangosol.net.ConfigurableCacheFactory; -import com.tangosol.net.DefaultConfigurableCacheFactory; -import com.tangosol.net.ExtensibleConfigurableCacheFactory; -import com.tangosol.run.xml.XmlElement; - -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -/** - * A {@link RemoteCallable} to determine the names of auto-start cluster-based services. - *

- * Copyright (c) 2015. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class GetAutoStartServiceNames implements RemoteCallable> -{ - @Override - public Set call() throws Exception - { - ConfigurableCacheFactory configurableCacheFactory = CacheFactory.getConfigurableCacheFactory(); - - if (configurableCacheFactory instanceof DefaultConfigurableCacheFactory) - { - DefaultConfigurableCacheFactory cacheFactory = (DefaultConfigurableCacheFactory) configurableCacheFactory; - - // obtain the XmlElements representing the service scheme configurations - XmlElement xmlCacheConfig = cacheFactory.getConfig(); - - Map serviceSchemes = cacheFactory.collectServiceSchemes(xmlCacheConfig); - - HashSet serviceNames = new HashSet<>(); - - for (String serviceName : serviceSchemes.keySet()) - { - XmlElement xmlServiceScheme = serviceSchemes.get(serviceName); - - boolean isAutoStart = xmlServiceScheme.getSafeElement("autostart").getBoolean(false); - - if (isAutoStart) - { - serviceNames.add(serviceName); - } - } - - return serviceNames; - } - else if (configurableCacheFactory instanceof ExtensibleConfigurableCacheFactory) - { - ExtensibleConfigurableCacheFactory cacheFactory = - (ExtensibleConfigurableCacheFactory) configurableCacheFactory; - - CacheConfig cacheConfig = cacheFactory.getCacheConfig(); - - if (cacheConfig == null) - { - throw new RuntimeException("Failed to determine the CacheConfig for the ExtensibleConfigurableCacheFactory"); - } - else - { - LinkedHashSet serviceNames = new LinkedHashSet<>(); - - for (ServiceScheme serviceScheme : cacheConfig.getServiceSchemeRegistry()) - { - if (serviceScheme.isAutoStart()) - { - if (serviceScheme instanceof AbstractCompositeScheme) - { - serviceScheme = ((AbstractCompositeScheme) serviceScheme).getBackScheme(); - - if (isAutoStartable(serviceScheme)) - { - serviceNames.add(serviceScheme.getScopedServiceName()); - } - } - else - { - serviceNames.add(serviceScheme.getScopedServiceName()); - } - } - } - - return serviceNames; - } - } - else - { - throw new RuntimeException("The ConfigurableCacheFactory is neither a DefaultConfigurableCacheFactory or a ExtensibleConfigurableCacheFactory"); - } - } - - - /** - * Determine if the specified {@link ServiceScheme} is auto-startable - * (typically if it requires a cluster to operate). - * - * @param scheme the {@link ServiceScheme} - * - * @return if the service scheme is auto-startable - */ - public boolean isAutoStartable(ServiceScheme scheme) - { - return scheme.getServiceBuilder().isRunningClusterNeeded(); - } -} diff --git a/bedrock-coherence/12.1.2/pom.xml b/bedrock-coherence/12.1.2/pom.xml deleted file mode 100755 index 21600351f..000000000 --- a/bedrock-coherence/12.1.2/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock - bedrock-coherence - 7.0.4-SNAPSHOT - - - com.oracle.bedrock.coherence - 12.1.2 - - pom - - Bedrock for Coherence 12.1.2 Project - - - - 12.1.2-0-5 - com.oracle.coherence - - - - coherence-12.1.2 - coherence-12.1.2-tests - coherence-12.1.2-testing-support - - - - - - coherence-ce - - false - - - 21.06.2 - com.oracle.coherence.ce - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/pom.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/pom.xml deleted file mode 100755 index db0cd1505..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.3 - 7.0.4-SNAPSHOT - - - coherence-12.1.3-testing-support - - Bedrock for Testing Coherence 12.1.3 - - - A set of tools to aid testing of Oracle Coherence 12.1.3 based applications. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock.coherence - coherence-12.1.3 - ${project.version} - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - - - - com.oracle.bedrock.coherence - coherence-12.1.2-testing-support - ${project.version} - - - ${coherence.groupId} - coherence - - - com.oracle.bedrock.coherence - coherence-12.1.2 - - - - - - - junit - junit - ${junit.version} - provided - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - provided - - - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven.shade.plugin.version} - - - true - - - - - com.oracle.bedrock.coherence:coherence-12.1.2-testing-support - - - - - - - com.oracle.bedrock.coherence:coherence-12.1.2-testing-support - - META-INF/** - - - - - - - - com.oracle.bedrock.coherence - - - - - - - package - - shade - - - - - - - - maven-antrun-plugin - 1.8 - - - unpack-source - package - - - - - - - - run - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.plugin.version} - - false - ${project.build.directory}/generated-sources - - - - attach-javadocs - - jar - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java deleted file mode 100644 index 014aa3239..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/CoherenceClusterResourceTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * File: CoherenceClusterResourceTests.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.junit; - -import com.oracle.bedrock.testsupport.deferred.Eventually; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.coherence.CoherenceCluster; -import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.Multicast; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.util.Capture; -import com.tangosol.net.ConfigurableCacheFactory; -import com.tangosol.net.NamedCache; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; - -import java.util.Set; -import java.util.TreeSet; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.junit.Assert.assertThat; - -/** - * Functional Tests for the JUnit {@link CoherenceClusterResource}. - *

- * Copyright (c) 2017. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class CoherenceClusterResourceTest -{ - /** - * Establish a {@link CoherenceClusterResource} for our test. - */ - @Rule - public CoherenceClusterResource coherenceResource = - new CoherenceClusterResource() - .using(LocalPlatform.get()) - .with(LocalHost.only(), - Multicast.ttl(0), - ClusterPort.automatic(), - SystemProperty.of("tangosol.coherence.extend.address", LocalPlatform.get().getLoopbackAddress().getHostAddress()), - SystemProperty.of("tangosol.coherence.extend.port", Capture.of(LocalPlatform.get().getAvailablePorts()))) - .include(2, - DisplayName.of("storage"), - RoleName.of("storage"), - LocalStorage.enabled(), - SystemProperty.of("tangosol.coherence.extend.enabled", false), - SystemProperty.of("test.property", "storageMember")) - .include(1, - DisplayName.of("proxy"), - RoleName.of("proxy"), - LocalStorage.disabled(), - SystemProperty.of("tangosol.coherence.extend.enabled", true), - SystemProperty.of("test.property", "proxyServer")); - - - /** - * Ensure that the required cluster is formed by a {@link CoherenceClusterResource}. - */ - @Test - public void shouldFormCluster() - { - // ensure the size of the cluster is as expected - Assert.assertThat(coherenceResource.getCluster().getClusterSize(), is(3)); - - // collect the names of the members - CoherenceCluster cluster = coherenceResource.getCluster(); - Set setNames = new TreeSet<>(); - - for (CoherenceClusterMember member : cluster) - { - setNames.add(member.getName()); - } - - // ensure the names of the cluster members are as expected - assertThat(setNames, contains("proxy-1", "storage-1", "storage-2")); - - } - - - /** - * Ensure that a {@link StorageDisabledMember} session can be created against the {@link CoherenceClusterResource}. - */ - @Test - public void shouldCreateStorageDisabledMemberSession() - { - ConfigurableCacheFactory session = coherenceResource.createSession(SessionBuilders.storageDisabledMember()); - - NamedCache cache = session.ensureCache("dist-example", null); - - Eventually.assertThat(coherenceResource.getCluster().getClusterSize(), is(4)); - - cache.put("message", "hello world"); - - Eventually.assertThat(invoking(coherenceResource.getCluster().getCache("dist-example")).get("message"), - is((Object) "hello world")); - } - - - /** - * Ensure that a {@link ExtendClient} session can be created against the {@link CoherenceClusterResource}. - */ - @Test - public void shouldCreateExtendClientSession() - { - ConfigurableCacheFactory session = - coherenceResource.createSession(SessionBuilders.extendClient("proxy-cache-config.xml")); - - NamedCache cache = session.ensureCache("dist-example", null); - - Assert.assertThat(coherenceResource.getCluster().getClusterSize(), is(3)); - - cache.put("message", "hello world"); - - Eventually.assertThat(invoking(coherenceResource.getCluster().getCache("dist-example")).get("message"), - is((Object) "hello world")); - } - - /** - * Ensure the proxy member(s) have a property set. - */ - @Test - public void shouldHaveSetProxyServerProperty() - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("proxy")) - { - assertThat(member.getSystemProperty("test.property"), is("proxyServer")); - } - } - - - /** - * Ensure the storage-enabled member(s) have a property set. - */ - @Test - public void shouldHaveSetStorageMemberProperty() - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("storage")) - { - assertThat(member.getSystemProperty("test.property"), is("storageMember")); - } - } - - - /** - * Ensure that a {@link CoherenceClusterResource} can be used to perform a rolling restart. - */ - @Test - public void shouldPerformRollingRestart() throws Exception - { - CoherenceCluster cluster = coherenceResource.getCluster(); - - // only restart storage enabled members - cluster.filter(member -> member.getName().startsWith("storage")).relaunch(); - - CoherenceClusterMember member1 = cluster.get("storage-1"); - CoherenceClusterMember member2 = cluster.get("storage-2"); - - assertThat(member1, is(notNullValue())); - assertThat(member2, is(notNullValue())); - - assertThat(member1.getLocalMemberId(), is(4)); - assertThat(member2.getLocalMemberId(), is(5)); - } - - - /** - * Ensure that a {@link CoherenceClusterResource} can be used to perform a rolling restart - * when there's a storage disabled session. - */ - @Test - public void shouldPerformRollingRestartWithStorageDisabledSession() throws Exception - { - CoherenceCluster cluster = coherenceResource.getCluster(); - - ConfigurableCacheFactory cacheFactory = coherenceResource.createSession(SessionBuilders.storageDisabledMember()); - - // only restart storage enabled members - cluster.filter(member -> member.getName().startsWith("storage")).relaunch(); - - CoherenceClusterMember member1 = cluster.get("storage-1"); - CoherenceClusterMember member2 = cluster.get("storage-2"); - - assertThat(member1, is(notNullValue())); - assertThat(member2, is(notNullValue())); - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java deleted file mode 100644 index ee44e8209..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/java/com/oracle/bedrock/junit/SingleMemberCoherenceClusterResourceTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * File: SingleMemberCoherenceClusterResourceTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.junit; - -import com.oracle.bedrock.runtime.coherence.CoherenceCluster; -import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.Multicast; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.options.DisplayName; -import org.junit.ClassRule; -import org.junit.Test; - -import java.util.Set; -import java.util.TreeSet; - -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -/** - * Functional Tests for single-member {@link CoherenceClusterResource}s. - *

- * Copyright (c) 2017. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class SingleMemberCoherenceClusterResourceTest -{ - /** - * A {@link CoherenceClusterResource} defining a single cluster member - */ - @ClassRule - public static CoherenceClusterResource coherenceResource = - new CoherenceClusterResource() - .with(ClusterName.of("SingletonCluster"), LocalHost.only(), Multicast.ttl(0)) - .include(1, - RoleName.of("storage"), - DisplayName.of("storage"), - LocalStorage.enabled(), - SystemProperty.of("test.property", "storageMember")); - - - /** - * Ensure that a single member cluster is formed by {@link CoherenceClusterResource}. - */ - @Test - public void shouldFormCorrectSizeCluster() - { - CoherenceCluster cluster = coherenceResource.getCluster(); - Set setNames = new TreeSet<>(); - - for (CoherenceClusterMember member : cluster) - { - setNames.add(member.getName()); - } - - assertThat(setNames, contains("storage-1")); - } - - - @Test - public void shouldHaveSetStorageMemberProperty() throws Exception - { - for (CoherenceClusterMember member : coherenceResource.getCluster().getAll("storage")) - { - assertThat(member.getSystemProperty("test.property"), is("storageMember")); - } - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/resources/proxy-cache-config.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/resources/proxy-cache-config.xml deleted file mode 100644 index 0969776d5..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-testing-support/src/test/resources/proxy-cache-config.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - dist-* - remote-cache - - - - - - - - remote-cache - - - - -

localhost
- 9099 - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/pom.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/pom.xml deleted file mode 100755 index be0f7cb77..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.3 - 7.0.4-SNAPSHOT - - - coherence-12.1.3-tests - - Bedrock for Coherence 12.1.3 (Tests) - - - Functional and Integration tests for the Bedrock Coherence 12.1.3 module. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock.coherence - coherence-12.1.3 - ${project.version} - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - - - - - junit - junit - ${junit.version} - test - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - test - - - - org.jacoco - org.jacoco.agent - ${jacoco.version} - runtime - test - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven.deploy.plugin.version} - - true - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java deleted file mode 100644 index 696602a1a..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceCacheServerTest.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * File: AbstractCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.testsupport.junit.AbstractTest; -import com.oracle.bedrock.testsupport.matchers.MapMatcher; -import com.oracle.bedrock.options.Diagnostics; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.callables.GetClusterName; -import com.oracle.bedrock.runtime.coherence.callables.GetClusterSize; -import com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId; -import com.oracle.bedrock.runtime.coherence.callables.GetServiceStatus; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.OperationalOverride; -import com.oracle.bedrock.runtime.coherence.options.RoleName; -import com.oracle.bedrock.runtime.coherence.options.SiteName; -import com.oracle.bedrock.runtime.concurrent.RemoteEvent; -import com.oracle.bedrock.runtime.concurrent.RemoteEventListener; -import com.oracle.bedrock.runtime.concurrent.options.StreamName; -import com.oracle.bedrock.runtime.java.features.JmxFeature; -import com.oracle.bedrock.runtime.java.options.ClassName; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.Discriminator; -import com.oracle.bedrock.util.Capture; -import com.tangosol.net.NamedCache; -import com.tangosol.util.aggregator.LongSum; -import com.tangosol.util.extractor.IdentityExtractor; -import com.tangosol.util.filter.PresentFilter; -import org.junit.Test; - -import javax.management.ObjectName; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; - -/** - * Functional Tests for {@link CoherenceCacheServer}s. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public abstract class AbstractCoherenceCacheServerTest extends AbstractTest -{ - /** - * Obtains the {@link Platform} to use when realizing applications. - */ - public abstract Platform getPlatform(); - - - /** - * Ensure we can start and connect to the Coherence using the {@link JmxFeature}. - * - * @throws Exception - */ - @Test - public void shouldStartJMXConnection() throws Exception - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.from(availablePorts), - LocalHost.only(), - RoleName.of("test-role"), - SiteName.of("test-site"), - JmxFeature.enabled(), - JMXManagementMode.LOCAL_ONLY)) - - { - assertThat(invoking(server).getClusterSize(), is(1)); - assertThat(server.getRoleName(), is("test-role")); - assertThat(server.getSiteName(), is("test-site")); - - JmxFeature jmxFeature = server.get(JmxFeature.class); - - assertThat(jmxFeature, is(notNullValue())); - - // use JMX to determine the cluster size - int size = jmxFeature.getMBeanAttribute(new ObjectName("Coherence:type=Cluster"), - "ClusterSize", - Integer.class); - - assertThat(size, is(1)); - } - } - - - /** - * Ensure that we can start and stop a single Coherence Cluster Member. - */ - @Test - public void shouldStartSingletonCluster() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - LocalHost.only(), - Diagnostics.enabled(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - assertThat(server, new GetServiceStatus("DistributedCache"), is(ServiceStatus.ENDANGERED)); - } - } - - - /** - * Ensure that we can start and stop Coherence Members on the same port - * continuously (quickly) and there is only ever one member. - */ - @Test - public void shouldStartStopMultipleTimes() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - - Platform platform = getPlatform(); - - ClusterPort clusterPort = ClusterPort.from(new Capture<>(availablePorts)); - - for (int i = 1; i <= 10; i++) - { - System.out.println("Building Instance: " + i); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - clusterPort, - LocalHost.only(), - RoleName.of("test-role"), - SiteName.of("test-site"), - Diagnostics.enabled(), - Discriminator.of(i), - Console.system())) - { - assertThat(invoking(server).getClusterSize(), is(1)); - assertThat(server.getRoleName(), is("test-role")); - assertThat(server.getSiteName(), is("test-site")); - } - } - } - - - /** - * Ensure that we can start and stop a Coherence Cluster Member - * that uses a specific operational override. - */ - @Test - public void shouldUseCustomOperationalOverride() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - OperationalOverride.of("test-operational-override.xml"), - LocalHost.only(), - Diagnostics.enabled(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - assertThat(server, new GetClusterName(), is("MyCluster")); - } - } - - - /** - * Ensure that we can create and use a NamedCache via a CoherenceCacheServer. - */ - @Test - public void shouldAccessNamedCache() - { - Platform platform = getPlatform(); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClusterPort.automatic(), - LocalHost.only(), - Console.system())) - { - assertThat(server, new GetLocalMemberId(), is(1)); - assertThat(server, new GetClusterSize(), is(1)); - - NamedCache namedCache = server.getCache("dist-example"); - - // ----- use NamedCache.clear ----- - namedCache.clear(); - - assertThat(namedCache.size(), is(0)); - - // ----- use NamedCache.put and NamedCache.get ----- - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - - // ----- use NamedCache.invokeAll ----- - Map map = namedCache.invokeAll(PresentFilter.INSTANCE, new GetProcessor()); - - assertThat(map, notNullValue()); - assertThat(map.size(), is(1)); - assertThat((String) map.get("key"), is("hello")); - - // ----- use NamedCache.keySet ----- - Set keySet = namedCache.keySet(); - - assertThat(keySet, notNullValue()); - assertThat(keySet.size(), is(1)); - assertThat(keySet.contains("key"), is(true)); - - // ----- use NamedCache.entrySet ----- - Set entrySet = namedCache.entrySet(); - - assertThat(entrySet, notNullValue()); - assertThat(entrySet.size(), is(1)); - assertThat(entrySet.contains(new AbstractMap.SimpleEntry("key", "hello")), is(true)); - - // ----- use NamedCache.values ----- - Collection values = namedCache.values(); - - assertThat(values, notNullValue()); - assertThat(values.size(), is(1)); - assertThat(values.contains("hello"), is(true)); - - namedCache.clear(); - - assertThat(invoking(namedCache).size(), is(0)); - - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - - // ----- use NamedCache.remove ----- - namedCache.remove("key"); - - assertThat(namedCache.size(), is(0)); - - // ----- use NamedCache.putAll ----- - HashMap putAllMap = new HashMap<>(); - long sum = 0; - - for (int i = 1; i < 5; i++) - { - String key = Integer.toString(i); - - putAllMap.put(key, new Integer(i)); - - sum += i; - } - - namedCache.putAll(putAllMap); - - assertThat(namedCache.size(), is(putAllMap.size())); - - // ----- use NamedCache.getAll ----- - Map getAllResults = namedCache.getAll(putAllMap.keySet()); - - assertThat(getAllResults, MapMatcher.sameAs(putAllMap)); - - Map otherGetAllResults = namedCache.getAll(namedCache.keySet()); - - assertThat(otherGetAllResults, MapMatcher.sameAs(putAllMap)); - - // ----- use NamedCache.aggregate ----- - long longSum = (Long) namedCache.aggregate(PresentFilter.INSTANCE, new LongSum(IdentityExtractor.INSTANCE)); - - assertThat(longSum, is(sum)); - - long anotherLongSum = (Long) namedCache.aggregate(putAllMap.keySet(), - new LongSum(IdentityExtractor.INSTANCE)); - - assertThat(anotherLongSum, is(sum)); - } - } - - - @Test - public void shouldSendEventsFromCustomServer() throws Exception - { - Platform platform = getPlatform(); - EventListener listener = new EventListener(1); - String name = "Foo"; - RemoteEvent event = new CustomServer.Event(19); - - try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, - ClassName.of(CustomServer.class), - ClusterPort.automatic(), - LocalHost.only(), - Console.system())) - { - server.addListener(listener, StreamName.of(name)); - - CustomServer.fireEvent(server, name, event); - - assertThat(listener.await(1, TimeUnit.MINUTES), is(true)); - assertThat(listener.getEvents().get(0), is(event)); - - server.close(); - } - - } - - - /** - * An instance of a {@link RemoteEventListener} that captures events. - */ - public static class EventListener implements RemoteEventListener - { - /** - * The counter to count the number of events received. - */ - private final CountDownLatch latch; - - /** - * The list of events received. - */ - private final List events; - - - /** - * Create an {@link EventListener} to receieve the expected number of events. - * - * @param expected the expected number of events - */ - public EventListener(int expected) - { - latch = new CountDownLatch(expected); - events = new ArrayList<>(); - } - - - /** - * Causes the current thread to wait until the expected number of events - * have been received, unless the thread is {@linkplain Thread#interrupt interrupted}, - * or the specified waiting time elapses. - * - * @param timeout the maximum time to wait - * @param unit the time unit of the {@code timeout} argument - * - * @return {@code true} if the correct number of events is received and {@code false} - * if the waiting time elapsed before the events were received - * - * @throws InterruptedException if the current thread is interrupted - * while waiting - */ - private boolean await(long timeout, - TimeUnit unit) throws InterruptedException - { - return latch.await(timeout, unit); - } - - - public List getEvents() - { - return events; - } - - - @Override - public void onEvent(RemoteEvent event) - { - events.add(event); - latch.countDown(); - } - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java deleted file mode 100644 index 2e55df17d..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/AbstractCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * File: AbstractCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.OptionsByType; -import com.oracle.bedrock.testsupport.junit.AbstractTest; -import com.oracle.bedrock.options.Decoration; -import com.oracle.bedrock.runtime.ApplicationListener; -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.options.CacheConfig; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.coherence.options.WellKnownAddress; -import com.oracle.bedrock.runtime.java.JavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.options.SystemProperty; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.runtime.options.StabilityPredicate; -import com.oracle.bedrock.util.Capture; -import com.oracle.bedrock.util.Trilean; -import com.tangosol.net.NamedCache; -import org.junit.Assert; -import org.junit.Test; - -import java.util.HashSet; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.greaterThan; - -/** - * Functional Tests for the {@link CoherenceClusterBuilder} class. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public abstract class AbstractCoherenceClusterBuilderTest extends AbstractTest -{ - /** - * Creates a new {@link JavaApplicationLauncher} to use for a tests in this class and/or sub-classes. - * - * @return the {@link JavaApplicationLauncher} - */ - public abstract Platform getPlatform(); - - - /** - * Ensure we can build and destroy a {@link CoherenceCluster} containing storage-enabled - * {@link CoherenceCacheServer}s. - */ - @Test - public void shouldBuildStorageEnabledCluster() - { - final int CLUSTER_SIZE = 3; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - clusterPort, - LocalHost.only(), - ClusterName.of("Storage-Only")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - } - } - - - /** - * Ensure we can build and close a {@link CoherenceCluster} - * of storage enabled members with a proxy server. - */ - @Test - public void shouldBuildStorageAndProxyCluster() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(2, - CoherenceClusterMember.class, - DisplayName.of("storage"), - clusterPort, - ClusterName.of("Storage-Proxy"), - CacheConfig.of("test-cache-config.xml"), - LocalHost.only(), - LocalStorage.enabled()); - - builder.include(1, - CoherenceClusterMember.class, - DisplayName.of("extend"), - clusterPort, - ClusterName.of("Storage-Proxy"), - CacheConfig.of("test-extend-proxy-config.xml"), - LocalHost.only(), - LocalStorage.disabled(), - SystemProperty.of("coherence.extend.port", availablePorts)); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - // ensure the cluster size is as expected - assertThat(invoking(cluster).getClusterSize(), is(3)); - - // ensure the member id's are different - HashSet memberIds = new HashSet<>(); - - for (CoherenceClusterMember member : cluster) - { - // ensure the member id is not -1 (it may not have a member id yet) - assertThat(invoking(member).getLocalMemberId(), is(greaterThan(0))); - - memberIds.add(member.getLocalMemberId()); - } - - Assert.assertEquals(3, memberIds.size()); - - CoherenceClusterMember extendMember = cluster.get("extend-1"); - - assertThat(invoking(extendMember).isServiceRunning("ExtendTcpProxyService"), is(true)); - - for (CoherenceClusterMember storageMember : cluster.getAll("storage")) - { - assertThat(invoking(storageMember).isServiceRunning("ExtendTcpProxyService"), is(false)); - } - } - } - - - /** - * Ensure that we can build a cluster using WKA. - */ - @Test - public void shouldBuilderWKABasedStorageCluster() - { - Capture wkaPort = new Capture<>(LocalPlatform.get().getAvailablePorts()); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(LocalPlatform.get().getAvailablePorts())); - String localHost = System.getProperty("tangosol.coherence.localhost", "127.0.0.1"); - - String clusterName = "WKA" + getClass().getSimpleName(); - - int desiredClusterSize = 4; - - CoherenceClusterBuilder clusterBuilder = new CoherenceClusterBuilder(); - - clusterBuilder.include(desiredClusterSize, - CoherenceClusterMember.class, - DisplayName.of("storage"), - LocalStorage.enabled(), - WellKnownAddress.of(localHost, wkaPort), - ClusterName.of(clusterName), - LocalHost.of(localHost, wkaPort), - clusterPort); - - try (CoherenceCluster cluster = clusterBuilder.build(Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(desiredClusterSize)); - } - } - - - /** - * Ensure we perform a rolling restart of a {@link CoherenceCluster} - */ - @Test - public void shouldPerformRollingRestartOfCluster() - { - final int CLUSTER_SIZE = 4; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Rolling" + getClass().getSimpleName(); - - Platform platform = getPlatform(); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - StabilityPredicate predicate = - StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe()); - - cluster.filter(member -> member.isServiceRunning("ProxyService")).relaunch(); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.unordered().limit(2).relaunch(predicate); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - } - } - - - /** - * Ensure that we can create and use a NamedCache via a CoherenceCacheServer. - */ - @Test - public void shouldAccessNamedCache() - { - final int CLUSTER_SIZE = 3; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, CoherenceClusterMember.class, clusterPort, ClusterName.of("Access")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - NamedCache namedCache = cluster.getCache("dist-example"); - - assertThat(namedCache.size(), is(0)); - namedCache.put("key", "hello"); - - assertThat(namedCache.size(), is(1)); - assertThat((String) namedCache.get("key"), is("hello")); - } - } - - - /** - * Ensure that a {@link NamedCache} produced by a {@link CoherenceCluster} {@link CoherenceClusterMember} - * is failed over to another {@link CoherenceClusterMember} when the original {@link CoherenceClusterMember} - * is closed. - */ - @Test - public void shouldFailOverNamedCache() - { - final int CLUSTER_SIZE = 3; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - clusterPort, - ClusterName.of("FailOver"), - DisplayName.of("DCS")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // acquire a NamedCache from a specific cluster member - CoherenceClusterMember member = cluster.get("DCS-1"); - - NamedCache cache = member.getCache("dist-example"); - - // use the cache to put some data - cache.put("message", "hello"); - - assertThat(cluster.get("DCS-2").getCache("dist-example").get("message"), is("hello")); - - // close the cluster member - member.close(); - - // ensure that it's not in the cluster - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE - 1)); - - // attempt to use the cache - assertThat(invoking(cache).get("message"), is("hello")); - } - } - - - /** - * Ensure that the explicitly closing a CoherenceCacheServer removes it from - * the CoherenceCluster in which is it defined. - */ - @Test - public void shouldRemoveCoherenceClusterMemberFromCoherenceCluster() - { - final int CLUSTER_SIZE = 3; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - clusterPort, - ClusterName.of("Access"), - DisplayName.of("DCS")); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // acquire a cluster member - CoherenceClusterMember member = cluster.get("DCS-1"); - - // close it - member.close(); - - // ensure that it's not in the cluster - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE - 1)); - } - } - - - /** - * Ensure we can clone {@link CoherenceClusterMember}s in a {@link CoherenceCluster}. - */ - @Test - public void shouldCloneMembersOfACluster() - { - final int CLUSTER_SIZE = 2; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Cloning" + getClass().getSimpleName(); - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - cluster.limit(1).clone(1); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 1)); - - cluster.unordered().limit(2).clone(2); - - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 5)); - } - } - - - /** - * Ensure we can expand {@link CoherenceClusterMember}s in a {@link CoherenceCluster}. - */ - @Test - public void shouldExpandMembersOfACluster() - { - final int CLUSTER_SIZE = 1; - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - String clusterName = "Cloning" + getClass().getSimpleName(); - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(CLUSTER_SIZE, - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system()); - - try (CoherenceCluster cluster = builder.build(getPlatform())) - { - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE)); - - // ensure that the DistributedCache service for the first (and only) cluster member is storage disabled - assertThat(invoking(cluster.get("DCS-1")).isStorageEnabled("DistributedCache"), is(Trilean.TRUE)); - - // ensure that the InvocationService service for the first (and only) cluster member is unknown - assertThat(invoking(cluster.get("DCS-1")).isStorageEnabled("InvocationService"), is(Trilean.UNKNOWN)); - - cluster.expand(1, - LocalPlatform.get(), - CoherenceClusterMember.class, - DisplayName.of("DCS"), - clusterPort, - ClusterName.of(clusterName), - LocalHost.only(), - Console.system(), - LocalStorage.disabled()); - - // ensure that the cluster is bigger by one - assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE + 1)); - - // ensure that the DistributedCache service for the new member is storage disabled - assertThat(invoking(cluster.get("DCS-2")).isStorageEnabled("DistributedCache"), is(Trilean.FALSE)); - - // ensure that the InvocationService service for the new member is unknown - assertThat(invoking(cluster.get("DCS-2")).isStorageEnabled("InvocationService"), is(Trilean.UNKNOWN)); - } - } - - - /** - * Ensure we clean up an unsuccessfully created {@link CoherenceCluster}. - */ - @Test - public void shouldAvoidPartialClusterCreation() - { - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts)); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - // these two should start - builder.include(2, CoherenceClusterMember.class, clusterPort, LocalHost.only(), ClusterName.of("Storage-Only")); - - // this one will start but fail as the listener raises an exception - builder.include(1, - CoherenceClusterMember.class, - clusterPort, - LocalHost.only(), - ClusterName.of("Storage-Only"), - Decoration.of(new ApplicationListener() - { - @Override - public void onClosing(CoherenceClusterMember application, - OptionsByType optionsByType) - { - // do nothing - } - - @Override - public void onClosed(CoherenceClusterMember application, - OptionsByType optionsByType) - { - // do nothing - } - - @Override - public void onLaunched(CoherenceClusterMember application) - { - throw new IllegalStateException("Let's not start this application"); - } - })); - - try (CoherenceCluster cluster = builder.build(getPlatform(), Console.system())) - { - Assert.fail("The cluster should not have started"); - } - catch (RuntimeException e) - { - Assert.assertThat(e.getMessage(), - containsString("Failed to launch one of the desired CoherenceClusterMember(s)")); - } - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java deleted file mode 100644 index 905d28f95..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceCacheServerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * File: ContainerBasedCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.ContainerBasedJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.JavaVirtualMachine; -import org.junit.Ignore; - -/** - * Functional Test for {@link CoherenceCacheServer}s using a {@link ContainerBasedJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class ContainerBasedCoherenceCacheServerTest extends AbstractCoherenceCacheServerTest -{ - @Override - public Platform getPlatform() - { - return JavaVirtualMachine.get(); - } - - - @Override - @Ignore - public void shouldStartStopMultipleTimes() - { - // we skip this test as performing fast starting/stopping in - // container is not supported for Coherence 3.7.1.x - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java deleted file mode 100644 index 12e7f9604..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/ContainerBasedCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * File: ContainerBasedCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.ContainerBasedJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.JavaVirtualMachine; -import org.junit.Ignore; - -/** - * Functional Tests for {@link CoherenceClusterBuilder}s using a {@link ContainerBasedJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class ContainerBasedCoherenceClusterBuilderTest extends AbstractCoherenceClusterBuilderTest -{ - @Override - public Platform getPlatform() - { - return JavaVirtualMachine.get(); - } - - - @Override - @Ignore - public void shouldPerformRollingRestartOfCluster() - { - // we skip this test as performing a rolling restart in single JVM - // container is not supported for Coherence - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java deleted file mode 100644 index 785eeb98c..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/CustomServer.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * File: CustomServer.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.concurrent.RemoteChannel; -import com.oracle.bedrock.runtime.concurrent.RemoteEvent; -import com.oracle.bedrock.runtime.concurrent.RemoteRunnable; -import com.oracle.bedrock.runtime.concurrent.options.StreamName; -import com.oracle.bedrock.runtime.java.JavaApplication; -import com.tangosol.net.DefaultCacheServer; - -/** - * A custom server class with a main method that - * calls {@link DefaultCacheServer#main(String[])}. - *

- * Copyright (c) 2016. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Jonathan Knight - */ -public class CustomServer -{ - public static void main(String[] args) - { - DefaultCacheServer.main(args); - } - - - /** - * Fire an event from the specified application. - * - * @param application the application to fire the event from - * @param event the event to fire - */ - public static void fireEvent(JavaApplication application, - String streamName, - RemoteEvent event) - { - application.submit(new FireEvent(streamName, event)); - } - - - /** - * A simple implementation of a {@link RemoteEvent}. - */ - public static class Event implements RemoteEvent - { - /** - * The identifier of this event. - */ - private int id; - - - /** - * Create an {@link Event} with the specified identifier. - * - * @param id the identifier of this event - */ - public Event(int id) - { - this.id = id; - } - - - /** - * Obtain the identifier of this event. - * - * @return the identifier of this event - */ - public int getId() - { - return id; - } - - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - - if (o == null || getClass() != o.getClass()) - { - return false; - } - - Event event = (Event) o; - - return id == event.id; - - } - - - @Override - public int hashCode() - { - return id; - } - - - @Override - public String toString() - { - return "Event(" + "id=" + id + ')'; - } - } - - - /** - * A {@link RemoteRunnable} that can be used to fire an - * event from an application. - */ - public static class FireEvent implements RemoteRunnable - { - /** - * The {@link RemoteChannel} for asynchronously sending events / responses back - * (in addition to return values). - */ - @RemoteChannel.Inject - private RemoteChannel remoteChannel; - private String streamName; - private RemoteEvent event; - - - /** - * Constructs a {@link FireEvent}. - * - * @param streamName - * @param event - */ - public FireEvent(String streamName, - RemoteEvent event) - { - this.streamName = streamName; - this.event = event; - } - - - @Override - public void run() - { - remoteChannel.raise(event, StreamName.of(streamName)); - } - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java deleted file mode 100644 index dbe815c65..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/GetProcessor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * File: GetProcessor.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.tangosol.util.InvocableMap; -import com.tangosol.util.processor.AbstractProcessor; - -/** - * An {@link InvocableMap.EntryProcessor} to return the value of an entry. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class GetProcessor extends AbstractProcessor -{ - /** - * Constructs a {@link GetProcessor}. - */ - public GetProcessor() - { - } - - - @Override - public Object process(InvocableMap.Entry entry) - { - return entry.isPresent() ? entry.getValue() : null; - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java deleted file mode 100644 index e0c5d47fa..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceCacheServerTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * File: LocalCoherenceCacheServerTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.java.LocalJavaApplicationLauncher; - -/** - * Functional Test for {@link CoherenceCacheServer}s using a {@link LocalJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class LocalCoherenceCacheServerTest extends AbstractCoherenceCacheServerTest -{ - @Override - public Platform getPlatform() - { - return LocalPlatform.get(); - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java deleted file mode 100644 index 3c9b39b0f..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/java/com/oracle/bedrock/runtime/coherence/LocalCoherenceClusterBuilderTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * File: LocalCoherenceClusterBuilderTest.java - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * The contents of this file are subject to the terms and conditions of - * the Common Development and Distribution License 1.0 (the "License"). - * - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the License by consulting the LICENSE.txt file - * distributed with this file, or by consulting https://oss.oracle.com/licenses/CDDL - * - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file LICENSE.txt. - * - * MODIFICATIONS: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - */ - -package com.oracle.bedrock.runtime.coherence; - -import com.oracle.bedrock.runtime.LocalPlatform; -import com.oracle.bedrock.runtime.Platform; -import com.oracle.bedrock.runtime.coherence.options.CacheConfig; -import com.oracle.bedrock.runtime.coherence.options.ClusterName; -import com.oracle.bedrock.runtime.coherence.options.ClusterPort; -import com.oracle.bedrock.runtime.coherence.options.LocalHost; -import com.oracle.bedrock.runtime.coherence.options.LocalStorage; -import com.oracle.bedrock.runtime.concurrent.runnable.RuntimeExit; -import com.oracle.bedrock.runtime.java.ClassPath; -import com.oracle.bedrock.runtime.java.LocalJavaApplicationLauncher; -import com.oracle.bedrock.runtime.java.options.JavaAgent; -import com.oracle.bedrock.runtime.network.AvailablePortIterator; -import com.oracle.bedrock.runtime.options.Console; -import com.oracle.bedrock.runtime.options.DisplayName; -import com.oracle.bedrock.util.Capture; -import org.jacoco.agent.rt.RT; -import org.junit.Assert; -import org.junit.Test; - -import java.io.File; - -import static com.oracle.bedrock.deferred.DeferredHelper.invoking; -import static com.oracle.bedrock.testsupport.deferred.Eventually.assertThat; -import static org.hamcrest.CoreMatchers.is; - -/** - * Functional Tests for {@link CoherenceClusterBuilder} - * using a {@link LocalJavaApplicationLauncher}. - *

- * Copyright (c) 2014. All Rights Reserved. Oracle Corporation.
- * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. - * - * @author Brian Oliver - */ -public class LocalCoherenceClusterBuilderTest extends AbstractCoherenceClusterBuilderTest -{ - @Override - public Platform getPlatform() - { - return LocalPlatform.get(); - } - - - /** - * Ensure we can build and close a {@link CoherenceCluster} - * of storage enabled members with a proxy server when using code-coverage tools. - */ - @Test - public void shouldEstablishStorageAndProxyClusterWithCodeCoverage() throws Exception - { - // determine the classpath of the JaCoCo runtime agent jar (should be something like jacocoagent-x.y.z.jar) - ClassPath jacocoPath = ClassPath.ofClass(RT.class); - - // define a temp file name pattern for JaCoCo code coverage reports - String jacocoDestinationFileName = "jacoco-${bedrock.runtime.id}.exec"; - File destinationFile = new File(System.getProperty("java.io.tmpdir"), jacocoDestinationFileName); - - // define the JavaAgent for JaCoCo - JavaAgent javaAgent = JavaAgent.using(jacocoPath.toString(), - "destfile=" + destinationFile - + ",output=file,sessionid=${bedrock.runtime.id},dumponexit=true"); - - AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts(); - Capture clusterPort = new Capture<>(availablePorts); - - CoherenceClusterBuilder builder = new CoherenceClusterBuilder(); - - builder.include(2, - CoherenceClusterMember.class, - DisplayName.of("storage"), - ClusterPort.of(clusterPort), - LocalStorage.enabled(), - CacheConfig.of("test-cache-config.xml"), - LocalHost.only(), - ClusterName.of("Storage-Proxy"), - javaAgent, - RuntimeExit.withExitCode(0)); - - builder.include(1, - CoherenceClusterMember.class, - DisplayName.of("extend"), - ClusterPort.of(clusterPort), - LocalStorage.disabled(), - CacheConfig.of("test-extend-proxy-config.xml"), - LocalHost.only(), - ClusterName.of("Storage-Proxy"), - javaAgent, - RuntimeExit.withExitCode(0)); - - try (CoherenceCluster cluster = builder.build(Console.system())) - { - // ensure the cluster size is as expected - assertThat(invoking(cluster).getClusterSize(), is(3)); - - CoherenceClusterMember extendMember = cluster.get("extend-1"); - - assertThat(invoking(extendMember).isServiceRunning("ExtendTcpProxyService"), is(true)); - - for (CoherenceClusterMember storageMember : cluster.getAll("storage")) - { - assertThat(invoking(storageMember).isServiceRunning("ExtendTcpProxyService"), is(false)); - } - } - catch (Exception e) - { - e.printStackTrace(); - Assert.fail(); - } - } -} diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-autostart-services-cache-config.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-autostart-services-cache-config.xml deleted file mode 100755 index 857b91c1b..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-autostart-services-cache-config.xml +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - * - distributed-scheme-auto-start - - - - - - - distributed-scheme-auto-start - AutoStartDistributedService - - - - - - true - - - - distributed-scheme-lazy-start - LazyStartDistributedService - - - - - - false - - - - - replicated-scheme-auto-start - AutoStartReplicatedService - - - - - - true - - - - replicated-scheme-lazy-start - LazyStartReplicatedService - - - - - - false - - - - - optimistic-scheme-auto-start - AutoStartOptimisticService - - - - - - true - - - - optimistic-scheme-lazy-start - LazyStartOptimisticService - - - - - - false - - - - - local-scheme - LocalService - - HYBRID - 0 - 1h - - - - - near-scheme-auto-start - - - - HYBRID - 100 - 1m - - - - - - distributed-scheme-auto-start - - - - present - true - - - - near-scheme-lazy-start - - - - HYBRID - 100 - 1m - - - - - - distributed-scheme-lazy-start - - - - present - false - - - - - overflow-external-scheme-auto-start - - - - - - - - - - - - - - true - - - - overflow-external-scheme-lazy-start - - - - - - - - - - - - - - false - - - - - transactional-scheme-auto-start - AutoStartTransactionalService - - true - - - - transactional-scheme-lazy-start - LazyStartTransactionalService - - false - - - - - proxy-scheme-auto-start - AutoStartProxyService - - - - - -

- - true - - - - - - true - - - - proxy-scheme-lazy-start - LazyStartProxyService - - - - - -
- - true -
-
-
-
- - false -
- - - - invocation-scheme-auto-start - AutoStartInvocationService - - true - - - - invocation-scheme-lazy-start - LazyStartInvocationService - - false - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-cache-config.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-cache-config.xml deleted file mode 100755 index e31216ffd..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-cache-config.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - pof - - - - - * - distributed-scheme - - - - - - distributed-scheme - distributed-service - 10 - - - BINARY - - - true - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-client-config.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-client-config.xml deleted file mode 100755 index 6e9bcb656..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-client-config.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - pof - system - - - - - * - remote-scheme - - - - - - remote-scheme - - - - -
localhost
- 10000 -
-
-
-
-
- -
- -
\ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-extend-proxy-config.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-extend-proxy-config.xml deleted file mode 100755 index 992c795bf..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-extend-proxy-config.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - pof - system - - - - - * - distributed-scheme - - - - - - distributed-scheme - distributed-service - - - BINARY - - - true - - - - ExtendTcpProxyService - 5 - - - -
localhost
- 10000 -
-
-
- true -
- -
- -
\ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-operational-override.xml b/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-operational-override.xml deleted file mode 100755 index 8906ad6e0..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3-tests/src/test/resources/test-operational-override.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - MyCluster - - - - 1000 - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/coherence-12.1.3/pom.xml b/bedrock-coherence/12.1.3/coherence-12.1.3/pom.xml deleted file mode 100755 index ead88fe5a..000000000 --- a/bedrock-coherence/12.1.3/coherence-12.1.3/pom.xml +++ /dev/null @@ -1,139 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock.coherence - 12.1.3 - 7.0.4-SNAPSHOT - - - coherence-12.1.3 - - Bedrock for Coherence 12.1.3 - - - A set of tools to manage and control Oracle Coherence 12.1.3 processes at runtime. - - - - - ${coherence.groupId} - coherence - ${coherence.version} - provided - - - - com.oracle.bedrock - bedrock-runtime - ${project.version} - - - - com.oracle.bedrock - bedrock-runtime-remote - ${project.version} - - - - com.oracle.bedrock.coherence - coherence-12.1.2 - ${project.version} - - - ${coherence.groupId} - coherence - - - - - - com.oracle.bedrock - bedrock-testing-support - ${project.version} - test - - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - test - - - - junit - junit - ${junit.version} - test - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven.javadoc.plugin.version} - - false - true - - com.oracle.bedrock.coherence:coherence-3.7.1 - com.oracle.bedrock.coherence:coherence-12.1.2 - - - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven.shade.plugin.version} - - - true - - - - - com.oracle.bedrock.coherence:coherence-12.1.2 - - - - - - - com.oracle.bedrock.coherence:coherence-12.1.2 - - META-INF/** - - - - - - - package - - shade - - - - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.1.3/pom.xml b/bedrock-coherence/12.1.3/pom.xml deleted file mode 100755 index eb587ee01..000000000 --- a/bedrock-coherence/12.1.3/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - - - com.oracle.bedrock - bedrock-coherence - 7.0.4-SNAPSHOT - - - com.oracle.bedrock.coherence - 12.1.3 - - pom - - Bedrock for Coherence 12.1.3 Project - - - - 12.1.3-0-5 - com.oracle.coherence - - - - coherence-12.1.3 - coherence-12.1.3-tests - coherence-12.1.3-testing-support - - - - - - coherence-ce - - false - - - 21.06.2 - com.oracle.coherence.ce - - - - \ No newline at end of file diff --git a/bedrock-coherence/12.2.1/pom.xml b/bedrock-coherence/12.2.1/pom.xml index e084ff77d..1ea74549f 100755 --- a/bedrock-coherence/12.2.1/pom.xml +++ b/bedrock-coherence/12.2.1/pom.xml @@ -12,11 +12,11 @@ pom - Bedrock for Coherence 12.2.1 Project + Bedrock for Coherence 12.2.1.4 Project - 12.2.1-0-4 + 12.2.1-4-21 com.oracle.coherence diff --git a/bedrock-coherence/14.1.1/pom.xml b/bedrock-coherence/14.1.1/pom.xml index abee9f07a..0ebe8aef4 100755 --- a/bedrock-coherence/14.1.1/pom.xml +++ b/bedrock-coherence/14.1.1/pom.xml @@ -16,7 +16,7 @@ - 14.1.1-0-13 + 14.1.1-0-17 diff --git a/bedrock-coherence/pom.xml b/bedrock-coherence/pom.xml index 93391b4d3..3a737fd6e 100644 --- a/bedrock-coherence/pom.xml +++ b/bedrock-coherence/pom.xml @@ -15,8 +15,6 @@ 3.7.1 - 12.1.2 - 12.1.3 12.2.1 14.1.1 21.06 diff --git a/bedrock-core/pom.xml b/bedrock-core/pom.xml index 89636a112..4b9bb200c 100644 --- a/bedrock-core/pom.xml +++ b/bedrock-core/pom.xml @@ -24,16 +24,6 @@ jakarta.el jakarta.el-api - - org.glassfish - jakarta.el - - - jakarta.el - jakarta.el-api - - - org.hamcrest diff --git a/etc/dependency-check-suppression.xml b/etc/dependency-check-suppression.xml index 71a3fe335..cdcb0c647 100644 --- a/etc/dependency-check-suppression.xml +++ b/etc/dependency-check-suppression.xml @@ -2,20 +2,55 @@ - - - ^pkg:maven/com\.oracle\.coherence\.ce/coherence@.*$ - cpe:/a:oracle:coherence - - - - ^pkg:maven/com\.oracle\.coherence\.ce/coherence@.*$ - cpe:/a:oracle:coherence - - + + + ^pkg:maven/com\.oracle\.coherence\.ce/coherence@.*$ + cpe:/a:coherence_project:coherence + + + + ^pkg:maven/com\.oracle\.coherence\.ce/coherence@.*$ + cpe:/a:oracle:coherence + + + + ^pkg:maven/com\.oracle\.coherence\.ce/coherence@.*$ + cpe:/a:oracle:coherence + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-cipher@.*$ + cpe:/a:codehaus-plexus_project:codehaus-plexus + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-interpolation@.*$ + cpe:/a:codehaus-plexus_project:codehaus-plexus + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-sec\-dispatcher@.*$ + cpe:/a:codehaus-plexus_project:codehaus-plexus + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-sec\-dispatcher@.*$ + cpe:/a:sec_project:sec + + diff --git a/pom.xml b/pom.xml index 68dbc14b4..eecd703c2 100644 --- a/pom.xml +++ b/pom.xml @@ -117,7 +117,7 @@ 8.2.1 - 1.9.18 + 1.9.20 5.0.0-M1 2.2 5.0.1 @@ -125,7 +125,7 @@ 0.1.55 4.13.2 5.8.1 - 3.9.1 + 3.9.6 4.4.0 2019.1.1889202 @@ -236,17 +236,6 @@ jakarta.el-api ${jakarta.el.version} - - org.glassfish - jakarta.el - ${glassfish.el.version} - - - jakarta.el - jakarta.el-api - - - com.jcraft @@ -497,7 +486,7 @@ ${dependency-check.skip} true true - false + 0 false @@ -509,8 +498,7 @@ - ${top.parent.basedir}/etc/dependency-check-suppression.xml - + etc/dependency-check-suppression.xml From 6e800f6af2f3f7764fb2acf11062042b8830b38a Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Mon, 20 May 2024 12:23:11 +0300 Subject: [PATCH 2/2] Fix some dependency CVEs --- bedrock-core/pom.xml | 10 ++++++++++ etc/dependency-check-suppression.xml | 8 ++++++++ pom.xml | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/bedrock-core/pom.xml b/bedrock-core/pom.xml index 4b9bb200c..89636a112 100644 --- a/bedrock-core/pom.xml +++ b/bedrock-core/pom.xml @@ -24,6 +24,16 @@ jakarta.el jakarta.el-api + + org.glassfish + jakarta.el + + + jakarta.el + jakarta.el-api + + + org.hamcrest diff --git a/etc/dependency-check-suppression.xml b/etc/dependency-check-suppression.xml index cdcb0c647..6c130c83a 100644 --- a/etc/dependency-check-suppression.xml +++ b/etc/dependency-check-suppression.xml @@ -24,6 +24,14 @@ cpe:/a:oracle:coherence + + + ^pkg:maven/org\.glassfish/jakarta\.el@.*$ + cpe:/a:eclipse:glassfish + + jakarta.el-api ${jakarta.el.version} + + org.glassfish + jakarta.el + ${glassfish.el.version} + + + jakarta.el + jakarta.el-api + + + com.jcraft