use of com.oracle.bedrock.runtime.coherence.CoherenceCluster in project oracle-bedrock by coherence-community.
the class SingleMemberCoherenceClusterResourceTest method shouldFormCorrectSizeCluster.
/**
* Ensure that a single member cluster is formed by {@link CoherenceClusterResource}.
*/
@Test
public void shouldFormCorrectSizeCluster() {
CoherenceCluster cluster = coherenceResource.getCluster();
Set<String> setNames = new TreeSet<>();
for (CoherenceClusterMember member : cluster) {
setNames.add(member.getName());
}
assertThat(setNames, contains("storage-1"));
}
use of com.oracle.bedrock.runtime.coherence.CoherenceCluster in project oracle-bedrock by coherence-community.
the class CoherenceClusterResourceTest method shouldPerformRollingRestartWithStorageDisabledSession.
/**
* 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(new 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()));
}
use of com.oracle.bedrock.runtime.coherence.CoherenceCluster in project oracle-bedrock by coherence-community.
the class CoherenceClusterExtensionTest method shouldPerformRollingRestart.
/**
* Ensure that a {@link CoherenceClusterResource} can be used to perform a rolling restart.
*/
@Test
public void shouldPerformRollingRestart() throws Exception {
CoherenceCluster cluster = coherenceResource.getCluster();
int memberOneBefore = cluster.get("storage-1").getLocalMemberId();
int memberTwoBefore = cluster.get("storage-2").getLocalMemberId();
// only restart storage enabled members
cluster.filter(member -> member.getName().startsWith("storage")).relaunch();
CoherenceClusterMember memberOneAfter = cluster.get("storage-1");
CoherenceClusterMember memberTwoAfter = cluster.get("storage-2");
assertThat(memberOneAfter, is(notNullValue()));
assertThat(memberTwoAfter, is(notNullValue()));
assertThat(memberOneAfter.getLocalMemberId(), is(not(memberOneBefore)));
assertThat(memberTwoAfter.getLocalMemberId(), is(not(memberTwoBefore)));
}
use of com.oracle.bedrock.runtime.coherence.CoherenceCluster in project oracle-bedrock by coherence-community.
the class CoherenceClusterResourceTest method shouldPerformRollingRestart.
/**
* 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));
}
use of com.oracle.bedrock.runtime.coherence.CoherenceCluster in project oracle-bedrock by coherence-community.
the class CoherenceClusterResourceTest method shouldFormCluster.
/**
* 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<String> 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"));
}
Aggregations