Search in sources :

Example 6 with ClientProxy

use of com.hazelcast.client.impl.spi.ClientProxy 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);
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ClientContext(com.hazelcast.client.impl.spi.ClientContext) Data(com.hazelcast.internal.serialization.Data) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) ClientProxy(com.hazelcast.client.impl.spi.ClientProxy) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy) ClientConfig(com.hazelcast.client.config.ClientConfig) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy)

Example 7 with ClientProxy

use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.

the class ProxyEqualityTest method testTwoClientProxiesFromDifferentInstancesAreNotEquals.

@Test
public void testTwoClientProxiesFromDifferentInstancesAreNotEquals() {
    ClientProxy ref1 = (ClientProxy) client1ClusterA.getSet(name);
    ClientProxy ref2 = (ClientProxy) client1ClusterB.getSet(name);
    assertNotEquals(ref1, ref2);
}
Also used : ClientProxy(com.hazelcast.client.impl.spi.ClientProxy) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with ClientProxy

use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.

the class ClientMapInvalidationMetaDataFetcherTest method getRepairingTask.

private RepairingTask getRepairingTask(String mapName, int partition, long givenSequence, UUID givenUuid) {
    Config config = getBaseConfig();
    HazelcastInstance member = factory.newHazelcastInstance(config);
    distortRandomPartitionSequence(mapName, partition, givenSequence, member);
    distortRandomPartitionUuid(partition, givenUuid, member);
    ClientConfig clientConfig = new ClientConfig().addNearCacheConfig(new NearCacheConfig(mapName));
    HazelcastInstance client = factory.newHazelcastClient(clientConfig);
    IMap<Integer, Integer> clientMap = client.getMap(mapName);
    ClientContext clientContext = ((ClientProxy) clientMap).getContext();
    return clientContext.getRepairingTask(SERVICE_NAME);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) ClientContext(com.hazelcast.client.impl.spi.ClientContext) ClientProxy(com.hazelcast.client.impl.spi.ClientProxy) NearCacheConfig(com.hazelcast.config.NearCacheConfig) ClientConfig(com.hazelcast.client.config.ClientConfig)

Aggregations

ClientProxy (com.hazelcast.client.impl.spi.ClientProxy)8 ClientConfig (com.hazelcast.client.config.ClientConfig)4 ClientContext (com.hazelcast.client.impl.spi.ClientContext)4 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 Test (org.junit.Test)4 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)3 CacheTestSupport.createClientCachingProvider (com.hazelcast.cache.CacheTestSupport.createClientCachingProvider)2 NearCacheConfig (com.hazelcast.config.NearCacheConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 NearCacheManager (com.hazelcast.internal.nearcache.NearCacheManager)2 RepairingTask (com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask)2 Data (com.hazelcast.internal.serialization.Data)2 CachingProvider (javax.cache.spi.CachingProvider)2 CacheTestSupport.createServerCachingProvider (com.hazelcast.cache.CacheTestSupport.createServerCachingProvider)1 HazelcastClientCacheManager (com.hazelcast.client.cache.impl.HazelcastClientCacheManager)1 Config (com.hazelcast.config.Config)1 IMapDataStructureAdapter (com.hazelcast.internal.adapter.IMapDataStructureAdapter)1 NearCacheTestContextBuilder (com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder)1 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)1