use of com.hazelcast.cluster.Cluster in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getClusterCalledSuccessfullyOverOSGiInstance.
@Test
public void getClusterCalledSuccessfullyOverOSGiInstance() {
Cluster mockCluster = mock(Cluster.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
when(mockHazelcastInstance.getCluster()).thenReturn(mockCluster);
assertEquals(mockCluster, hazelcastOSGiInstance.getCluster());
verify(mockHazelcastInstance).getCluster();
}
use of com.hazelcast.cluster.Cluster in project hazelcast by hazelcast.
the class AbstractSplitBrainProtectionFunctionTest method prepareSplitBrainProtectionFunctionForIcmpFDTest.
protected void prepareSplitBrainProtectionFunctionForIcmpFDTest(SplitBrainProtectionFunction splitBrainProtectionFunction) {
Cluster mockCluster = mock(Cluster.class);
when(mockCluster.getLocalMember()).thenReturn(members[0]);
HazelcastInstance mockInstance = mock(HazelcastInstance.class);
when(mockInstance.getConfig()).thenReturn(getIcmpFDEnabledConfig());
when(mockInstance.getCluster()).thenReturn(mockCluster);
assert splitBrainProtectionFunction instanceof HazelcastInstanceAware;
((HazelcastInstanceAware) splitBrainProtectionFunction).setHazelcastInstance(mockInstance);
}
use of com.hazelcast.cluster.Cluster in project hazelcast-simulator by hazelcast.
the class HazelcastUtilsTest method testGetHazelcastAddress_withClientWorker_oldHazelcastVersion.
@Test
public void testGetHazelcastAddress_withClientWorker_oldHazelcastVersion() {
Cluster cluster = mock(Cluster.class);
when(cluster.getLocalMember()).thenThrow(new UnsupportedOperationException("Client has no local member!"));
hazelcastInstance = mock(HazelcastInstance.class);
when(hazelcastInstance.getLocalEndpoint()).thenThrow(new NoSuchMethodError("expected exception"));
when(hazelcastInstance.getCluster()).thenReturn(cluster);
String address = getHazelcastAddress("javaclient", "172.16.16.1", hazelcastInstance);
assertEquals("client:172.16.16.1", address);
}
Aggregations