Search in sources :

Example 1 with ClientProxySessionManager

use of com.hazelcast.client.cp.internal.session.ClientProxySessionManager in project hazelcast by hazelcast.

the class FencedLockClientBasicTest method test_sessionIsClosedOnCPSubsystemReset.

@Test
public void test_sessionIsClosedOnCPSubsystemReset() throws Exception {
    lock.lock();
    instances[0].getCPSubsystem().getCPSubsystemManagementService().reset().toCompletableFuture().get();
    assertTrueEventually(() -> {
        HazelcastClientProxy clientProxy = (HazelcastClientProxy) client;
        ClientProxySessionManager proxySessionManager = clientProxy.client.getProxySessionManager();
        assertEquals(NO_SESSION_ID, proxySessionManager.getSession((RaftGroupId) lock.getGroupId()));
    });
}
Also used : ClientProxySessionManager(com.hazelcast.client.cp.internal.session.ClientProxySessionManager) RaftGroupId(com.hazelcast.cp.internal.RaftGroupId) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) FencedLockBasicTest(com.hazelcast.cp.internal.datastructures.lock.FencedLockBasicTest)

Example 2 with ClientProxySessionManager

use of com.hazelcast.client.cp.internal.session.ClientProxySessionManager in project hazelcast by hazelcast.

the class SessionAwareSemaphoreClientBasicTest method testDrain_ReleasesSessionProperly.

@Test
public void testDrain_ReleasesSessionProperly() throws InterruptedException {
    int permits = 20;
    assertTrue(semaphore.init(permits));
    final int drainPermits = semaphore.drainPermits();
    HazelcastClientProxy clientProxy = (HazelcastClientProxy) client;
    ClientProxySessionManager proxySessionManager = clientProxy.client.getProxySessionManager();
    SessionAwareSemaphoreProxy proxy = (SessionAwareSemaphoreProxy) semaphore;
    RaftGroupId groupId = (RaftGroupId) proxy.getGroupId();
    final long session = proxySessionManager.getSession(groupId);
    assertEquals(drainPermits, proxySessionManager.getSessionAcquireCount(groupId, session));
}
Also used : ClientProxySessionManager(com.hazelcast.client.cp.internal.session.ClientProxySessionManager) RaftGroupId(com.hazelcast.cp.internal.RaftGroupId) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) SessionAwareSemaphoreBasicTest(com.hazelcast.cp.internal.datastructures.semaphore.SessionAwareSemaphoreBasicTest) Test(org.junit.Test)

Aggregations

ClientProxySessionManager (com.hazelcast.client.cp.internal.session.ClientProxySessionManager)2 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)2 RaftGroupId (com.hazelcast.cp.internal.RaftGroupId)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 FencedLockBasicTest (com.hazelcast.cp.internal.datastructures.lock.FencedLockBasicTest)1 SessionAwareSemaphoreBasicTest (com.hazelcast.cp.internal.datastructures.semaphore.SessionAwareSemaphoreBasicTest)1