use of com.hazelcast.cp.CPSubsystem in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getLockCalledSuccessfullyOverOSGiInstance.
@Test
public void getLockCalledSuccessfullyOverOSGiInstance() {
FencedLock mockLock = mock(FencedLock.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
CPSubsystem cpSubsystem = mock(CPSubsystem.class);
when(mockHazelcastInstance.getCPSubsystem()).thenReturn(cpSubsystem);
when(cpSubsystem.getLock("my-lock")).thenReturn(mockLock);
assertEquals(mockLock, hazelcastOSGiInstance.getCPSubsystem().getLock("my-lock"));
verify(cpSubsystem).getLock("my-lock");
}
use of com.hazelcast.cp.CPSubsystem in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getAtomicLongCalledSuccessfullyOverOSGiInstance.
@Test
public void getAtomicLongCalledSuccessfullyOverOSGiInstance() {
IAtomicLong mockAtomicLong = mock(IAtomicLong.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
CPSubsystem cpSubsystem = mock(CPSubsystem.class);
when(mockHazelcastInstance.getCPSubsystem()).thenReturn(cpSubsystem);
when(mockHazelcastInstance.getCPSubsystem().getAtomicLong("my-atomiclong")).thenReturn(mockAtomicLong);
assertEquals(mockAtomicLong, hazelcastOSGiInstance.getCPSubsystem().getAtomicLong("my-atomiclong"));
verify(cpSubsystem).getAtomicLong("my-atomiclong");
}
use of com.hazelcast.cp.CPSubsystem in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getAtomicReferenceCalledSuccessfullyOverOSGiInstance.
@Test
public void getAtomicReferenceCalledSuccessfullyOverOSGiInstance() {
IAtomicReference<Object> mockAtomicReference = mock(IAtomicReference.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
CPSubsystem cpSubsystem = mock(CPSubsystem.class);
when(mockHazelcastInstance.getCPSubsystem()).thenReturn(cpSubsystem);
when(cpSubsystem.getAtomicReference("my-atomicreference")).thenReturn(mockAtomicReference);
assertEquals(mockAtomicReference, hazelcastOSGiInstance.getCPSubsystem().getAtomicReference("my-atomicreference"));
verify(cpSubsystem).getAtomicReference("my-atomicreference");
}
use of com.hazelcast.cp.CPSubsystem in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getSemaphoreCalledSuccessfullyOverOSGiInstance.
@Test
public void getSemaphoreCalledSuccessfullyOverOSGiInstance() {
ISemaphore mockSemaphore = mock(ISemaphore.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
CPSubsystem cpSubsystem = mock(CPSubsystem.class);
when(mockHazelcastInstance.getCPSubsystem()).thenReturn(cpSubsystem);
when(cpSubsystem.getSemaphore("my-semaphore")).thenReturn(mockSemaphore);
assertEquals(mockSemaphore, hazelcastOSGiInstance.getCPSubsystem().getSemaphore("my-semaphore"));
verify(cpSubsystem).getSemaphore("my-semaphore");
}
use of com.hazelcast.cp.CPSubsystem in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getCountDownLatchCalledSuccessfullyOverOSGiInstance.
@Test
public void getCountDownLatchCalledSuccessfullyOverOSGiInstance() {
ICountDownLatch mockCountDownLatch = mock(ICountDownLatch.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
CPSubsystem cpSubsystem = mock(CPSubsystem.class);
when(mockHazelcastInstance.getCPSubsystem()).thenReturn(cpSubsystem);
when(cpSubsystem.getCountDownLatch("my-countdownlatch")).thenReturn(mockCountDownLatch);
assertEquals(mockCountDownLatch, hazelcastOSGiInstance.getCPSubsystem().getCountDownLatch("my-countdownlatch"));
verify(cpSubsystem).getCountDownLatch("my-countdownlatch");
}
Aggregations