use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientMapTest method setup.
@Before
public void setup() {
Config config = getConfig();
config.getMapConfig("flushMap").setMapStoreConfig(new MapStoreConfig().setWriteDelaySeconds(1000).setImplementation(flushMapStore));
config.getMapConfig("putTransientMap").setMapStoreConfig(new MapStoreConfig().setWriteDelaySeconds(1000).setImplementation(transientMapStore));
server = hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().addPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortable();
}
});
client = hazelcastFactory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class LocalMapStatsUnderOnGoingClientUpdateTest method setUp.
@Before
public void setUp() throws Exception {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setConnectionAttemptLimit(100);
client = factory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientMapRecordStateStressTest method all_records_are_readable_state_in_the_end.
@Test
public void all_records_are_readable_state_in_the_end() throws Exception {
HazelcastInstance member = factory.newHazelcastInstance();
factory.newHazelcastInstance();
factory.newHazelcastInstance();
ClientConfig clientConfig = new ClientConfig();
clientConfig.addNearCacheConfig(newNearCacheConfig());
HazelcastInstance client = factory.newHazelcastClient(clientConfig);
IMap memberMap = member.getMap(mapName);
// initial population of imap from member
for (int i = 0; i < KEY_SPACE; i++) {
memberMap.put(i, i);
}
List<Thread> threads = new ArrayList<Thread>();
// member
for (int i = 0; i < PUT_THREAD_COUNT; i++) {
Put put = new Put(memberMap);
threads.add(put);
}
// client
IMap clientMap = client.getMap(mapName);
for (int i = 0; i < GET_ALL_THREAD_COUNT; i++) {
GetAll getAll = new GetAll(clientMap);
threads.add(getAll);
}
for (int i = 0; i < GET_THREAD_COUNT; i++) {
Get get = new Get(clientMap);
threads.add(get);
}
for (int i = 0; i < REMOVE_THREAD_COUNT; i++) {
Remove remove = new Remove(clientMap);
threads.add(remove);
}
for (int i = 0; i < CLEAR_THREAD_COUNT; i++) {
Clear clear = new Clear(clientMap);
threads.add(clear);
}
// start threads
for (Thread thread : threads) {
thread.start();
}
// stress for a while
sleepSeconds(TEST_RUN_SECONDS);
// stop threads
stop.set(true);
for (Thread thread : threads) {
thread.join();
}
assertFinalRecordStateIsReadPermitted(clientMap, getSerializationService(member));
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientNearCacheBatchInvalidationTest method testBatchInvalidationRemovesEntries.
@Test
public void testBatchInvalidationRemovesEntries() {
Config config = getConfig();
configureBatching(config, true, 10, 1);
HazelcastInstance server = factory.newHazelcastInstance(config);
factory.newHazelcastInstance(config);
ClientConfig clientConfig = newClientConfig(mapName);
HazelcastInstance client = factory.newHazelcastClient(clientConfig);
makeSureConnectedToServers(client, 2);
IMap<Integer, Integer> serverMap = server.getMap(mapName);
IMap<Integer, Integer> clientMap = client.getMap(mapName);
int size = 1000;
// fill serverMap
for (int i = 0; i < size; i++) {
serverMap.put(i, i);
}
// fill Near Cache on client
for (int i = 0; i < size; i++) {
clientMap.get(i);
}
// generate invalidation data
for (int i = 0; i < size; i++) {
serverMap.put(i, i);
}
assertNearCacheSizeEventually(clientMap, 0);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientNearCacheBatchInvalidationTest method newClientConfig.
protected ClientConfig newClientConfig(String mapName) {
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setInMemoryFormat(getNearCacheInMemoryFormat());
nearCacheConfig.setName(mapName);
nearCacheConfig.setInvalidateOnChange(true);
ClientConfig clientConfig = new ClientConfig();
clientConfig.addNearCacheConfig(nearCacheConfig);
return clientConfig;
}
Aggregations