use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientCacheStatsTest method testNearCacheStats_whenNearCacheEnabled.
private void testNearCacheStats_whenNearCacheEnabled() {
String cacheName = randomName();
CacheConfig cacheConfig = createCacheConfig();
cacheConfig.setName(cacheName);
ClientConfig clientConfig = ((HazelcastClientProxy) client).getClientConfig();
clientConfig.addNearCacheConfig(new NearCacheConfig().setName(cacheName));
ICache<Integer, String> cache = createCache(cacheName, cacheConfig);
CacheStatistics stats = cache.getLocalCacheStatistics();
assertNotNull(stats.getNearCacheStatistics());
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy 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()));
});
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy 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));
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class MCTrustedInterfacesTest method testGetSystemPropertiesMessageTask_passing.
@Test
public void testGetSystemPropertiesMessageTask_passing() throws Exception {
HazelcastInstance client = factory.newHazelcastClient(new ClientConfig(), "222.222.222.222");
HazelcastClientInstanceImpl clientImpl = ((HazelcastClientProxy) client).client;
ClientInvocation invocation = new ClientInvocation(clientImpl, MCGetSystemPropertiesCodec.encodeRequest(), null);
ClientDelegatingFuture<List<Map.Entry<String, String>>> future = new ClientDelegatingFuture<>(invocation.invoke(), clientImpl.getSerializationService(), MCGetSystemPropertiesCodec::decodeResponse);
assertFalse(future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS).isEmpty());
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientMapProxy) clientMap).getContext().getNearCacheManager(clientMap.getServiceName());
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
ClientContext clientContext = ((ClientProxy) clientMap).getContext();
RepairingTask repairingTask = clientContext.getRepairingTask(MapService.SERVICE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
Aggregations