|
1 | 1 |
|
2 | 2 | /*
|
3 |
| - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. |
| 3 | + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. |
4 | 4 | *
|
5 | 5 | * Licensed under the Universal Permissive License v 1.0 as shown at
|
6 | 6 | * https://oss.oracle.com/licenses/upl.
|
|
13 | 13 | import com.oracle.bedrock.runtime.coherence.options.CacheConfig;
|
14 | 14 | import com.oracle.bedrock.runtime.coherence.options.ClusterName;
|
15 | 15 | import com.oracle.bedrock.runtime.coherence.options.LocalHost;
|
| 16 | +import com.oracle.bedrock.runtime.coherence.options.LocalStorage; |
16 | 17 | import com.oracle.bedrock.runtime.coherence.options.Logging;
|
17 | 18 | import com.oracle.bedrock.runtime.coherence.options.RoleName;
|
18 | 19 | import com.oracle.bedrock.runtime.coherence.options.WellKnownAddress;
|
|
35 | 36 | import com.tangosol.net.topic.Publisher;
|
36 | 37 | import com.tangosol.net.topic.Subscriber;
|
37 | 38 | import org.junit.After;
|
| 39 | +import org.junit.Before; |
| 40 | +import org.junit.BeforeClass; |
38 | 41 | import org.junit.ClassRule;
|
39 | 42 | import org.junit.Ignore;
|
40 | 43 | import org.junit.Rule;
|
|
72 | 75 | @SuppressWarnings({"resource", "unchecked"})
|
73 | 76 | public abstract class AbstractTopicChannelCountTests
|
74 | 77 | {
|
| 78 | + @BeforeClass |
| 79 | + public static void setup() |
| 80 | + { |
| 81 | + System.setProperty(LocalStorage.PROPERTY, "false"); |
| 82 | + } |
| 83 | + |
| 84 | + @Before |
| 85 | + public void startCluster() throws Throwable |
| 86 | + { |
| 87 | + if (m_cluster != null) |
| 88 | + { |
| 89 | + m_cluster.getCluster().close(); |
| 90 | + } |
| 91 | + |
| 92 | + m_cluster = new CoherenceClusterResource() |
| 93 | + .with(ClusterName.of(m_testWatcher.getMethodName()), |
| 94 | + Logging.atMax(), |
| 95 | + LocalHost.only(), |
| 96 | + WellKnownAddress.loopback(), |
| 97 | + IPv4Preferred.yes()) |
| 98 | + .include(STORAGE_MEMBER_COUNT, |
| 99 | + CoherenceClusterMember.class, |
| 100 | + CacheConfig.of(CACHE_CONFIG_FILE), |
| 101 | + SystemProperty.of(PROP_CHANNELS, STORAGE_CHANNEL_COUNT), |
| 102 | + DisplayName.of("Storage"), |
| 103 | + RoleName.of("storage"), |
| 104 | + JmxFeature.enabled(), |
| 105 | + m_testLogs.builder()); |
| 106 | + |
| 107 | + m_cluster.before(); |
| 108 | + } |
| 109 | + |
75 | 110 | @After
|
76 | 111 | public void cleanup()
|
77 | 112 | {
|
78 | 113 | Cluster cluster = CacheFactory.getCluster();
|
79 | 114 | CacheFactory.shutdown();
|
80 | 115 | Eventually.assertDeferred(cluster::isRunning, is(false));
|
| 116 | + m_cluster.after(); |
81 | 117 | }
|
82 | 118 |
|
83 | 119 | @Test
|
@@ -852,20 +888,5 @@ public String toString()
|
852 | 888 | @Rule(order = 1)
|
853 | 889 | public TestName m_testWatcher = new TestName();
|
854 | 890 |
|
855 |
| - @Rule(order = 2) |
856 |
| - public CoherenceClusterResource m_cluster = |
857 |
| - new CoherenceClusterResource() |
858 |
| - .with(ClusterName.of(m_testWatcher.getMethodName()), |
859 |
| - Logging.atMax(), |
860 |
| - LocalHost.only(), |
861 |
| - WellKnownAddress.loopback(), |
862 |
| - IPv4Preferred.yes()) |
863 |
| - .include(STORAGE_MEMBER_COUNT, |
864 |
| - CoherenceClusterMember.class, |
865 |
| - CacheConfig.of(CACHE_CONFIG_FILE), |
866 |
| - SystemProperty.of(PROP_CHANNELS, STORAGE_CHANNEL_COUNT), |
867 |
| - DisplayName.of("Storage"), |
868 |
| - RoleName.of("storage"), |
869 |
| - JmxFeature.enabled(), |
870 |
| - m_testLogs.builder()); |
| 891 | + public CoherenceClusterResource m_cluster; |
871 | 892 | }
|
0 commit comments