|
9 | 9 |
|
10 | 10 | import com.oracle.bedrock.OptionsByType; |
11 | 11 | import com.oracle.bedrock.runtime.LocalPlatform; |
12 | | -import com.oracle.bedrock.runtime.coherence.CoherenceCluster; |
13 | | -import com.oracle.bedrock.runtime.coherence.CoherenceClusterBuilder; |
14 | 12 | import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember; |
15 | 13 | import com.oracle.bedrock.runtime.coherence.callables.IsCoherenceRunning; |
16 | 14 | import com.oracle.bedrock.runtime.coherence.options.CacheConfig; |
|
27 | 25 | import com.oracle.bedrock.runtime.java.options.IPv4Preferred; |
28 | 26 | import com.oracle.bedrock.runtime.java.options.SystemProperty; |
29 | 27 | import com.oracle.bedrock.runtime.options.DisplayName; |
30 | | -import com.oracle.bedrock.runtime.options.StabilityPredicate; |
31 | 28 | import com.oracle.bedrock.testsupport.MavenProjectFileUtils; |
32 | 29 | import com.oracle.bedrock.testsupport.deferred.Eventually; |
33 | 30 | import com.oracle.bedrock.testsupport.junit.TestLogs; |
@@ -110,37 +107,60 @@ public static void setup() throws Exception |
110 | 107 | } |
111 | 108 | else |
112 | 109 | { |
113 | | - // Start the cluster with two storage/proxy members |
114 | | - CoherenceClusterBuilder builder = new CoherenceClusterBuilder() |
115 | | - .with(s_commonOptions.asArray()) |
116 | | - .include(2, CoherenceClusterMember.class, |
117 | | - ClassName.of(SecureCoherence.class), |
| 110 | + // Start the first storage/proxy member |
| 111 | + OptionsByType options1 = OptionsByType.of(s_commonOptions) |
| 112 | + .addAll(ClassName.of(SecureCoherence.class), |
118 | 113 | LocalStorage.enabled(), |
119 | | - MemberName.withDiscriminator("member"), |
| 114 | + MemberName.of("member-1"), |
120 | 115 | SystemProperty.of("coherence.security.keystore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()), |
121 | | - SystemProperty.of("coherence.security.login.password", s_keyAndCertSet.storePasswordString()), |
| 116 | + SystemProperty.of("coherence.security.keystore.password", s_keyAndCertSet.storePasswordString()), |
| 117 | + SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()), |
122 | 118 | SystemProperty.of("coherence.security.truststore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()), |
123 | 119 | SystemProperty.of("coherence.security.truststore.password", s_keyAndCertSet.storePasswordString()), |
124 | 120 | SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()), |
125 | | - DisplayName.of("storage"), |
126 | | - RoleName.of("storage"), |
127 | | - StabilityPredicate.none()); |
| 121 | + DisplayName.of("storage-1"), |
| 122 | + RoleName.of("storage")); |
128 | 123 |
|
129 | | - s_cluster = builder.build(); |
| 124 | + s_storage1 = LocalPlatform.get().launch(CoherenceClusterMember.class, options1.asArray()); |
130 | 125 |
|
131 | | - for (CoherenceClusterMember member : s_cluster) |
132 | | - { |
133 | | - Eventually.assertDeferred(() -> member.invoke(IsCoherenceRunning.instance()), is(true)); |
134 | | - } |
| 126 | + // Start the second storage/proxy member |
| 127 | + OptionsByType options2 = OptionsByType.of(s_commonOptions) |
| 128 | + .addAll(ClassName.of(SecureCoherence.class), |
| 129 | + LocalStorage.enabled(), |
| 130 | + MemberName.of("member-2"), |
| 131 | + SystemProperty.of("coherence.security.keystore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()), |
| 132 | + SystemProperty.of("coherence.security.keystore.password", s_keyAndCertSet.storePasswordString()), |
| 133 | + SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()), |
| 134 | + SystemProperty.of("coherence.security.truststore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()), |
| 135 | + SystemProperty.of("coherence.security.truststore.password", s_keyAndCertSet.storePasswordString()), |
| 136 | + SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()), |
| 137 | + DisplayName.of("storage-2"), |
| 138 | + RoleName.of("storage")); |
| 139 | + |
| 140 | + // ensure member 1 is running before starting member-2 |
| 141 | + Eventually.assertDeferred(s_storage1::isCoherenceRunning, is(true)); |
| 142 | + |
| 143 | + s_storage2 = LocalPlatform.get().launch(CoherenceClusterMember.class, options2.asArray()); |
| 144 | + |
| 145 | + // ensure both members start |
| 146 | + Eventually.assertDeferred(() -> s_storage1.invoke(IsCoherenceRunning.instance()), is(true)); |
| 147 | + Eventually.assertDeferred(() -> s_storage2.invoke(IsCoherenceRunning.instance()), is(true)); |
| 148 | + // they should have formed a cluster |
| 149 | + Eventually.assertDeferred(() -> s_storage1.getClusterSize(), is(2)); |
| 150 | + Eventually.assertDeferred(() -> s_storage2.getClusterSize(), is(2)); |
135 | 151 | } |
136 | 152 | } |
137 | 153 |
|
138 | 154 | @AfterClass |
139 | 155 | public static void tearDown() |
140 | 156 | { |
141 | | - if (s_cluster != null) |
| 157 | + if (s_storage1 != null) |
142 | 158 | { |
143 | | - s_cluster.close(); |
| 159 | + s_storage1.close(); |
| 160 | + } |
| 161 | + if (s_storage2 != null) |
| 162 | + { |
| 163 | + s_storage2.close(); |
144 | 164 | } |
145 | 165 | } |
146 | 166 |
|
@@ -293,7 +313,9 @@ protected String getPrincipalName(KeyTool.KeyAndCert keyAndCert) |
293 | 313 |
|
294 | 314 | protected static KeyTool.KeyAndCert s_keyAndCertMissing; |
295 | 315 |
|
296 | | - protected static CoherenceCluster s_cluster; |
| 316 | + protected static CoherenceClusterMember s_storage1; |
| 317 | + |
| 318 | + protected static CoherenceClusterMember s_storage2; |
297 | 319 |
|
298 | 320 | @ClassRule |
299 | 321 | public static TestLogs s_testLogs = new TestLogs(CertSecuritySingleStoreTests.class); |
|
0 commit comments