use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method test_partitionLostListener_invoked_fromOtherNode.
@Test
public void test_partitionLostListener_invoked_fromOtherNode() {
final HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance();
final HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance();
final ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setSmartRouting(false);
final HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
warmUpPartitions(instance1, instance2, client);
final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
final Address clientOwnerAddress = clientInstanceImpl.getClientClusterService().getOwnerConnectionAddress();
final HazelcastInstance other = getAddress(instance1).equals(clientOwnerAddress) ? instance2 : instance1;
final EventCollectingPartitionLostListener listener = new EventCollectingPartitionLostListener();
client.getPartitionService().addPartitionLostListener(listener);
assertRegistrationsSizeEventually(instance1, 1);
assertRegistrationsSizeEventually(instance2, 1);
final InternalPartitionServiceImpl partitionService = getNode(other).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
partitionService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
assertPartitionLostEventEventually(listener, partitionId);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class OomeOnClientAuthenticationMain method main.
public static void main(String[] args) {
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
ClientConfig clientConfig = new ClientConfig();
clientConfig.getGroupConfig().setPassword("foo");
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
for (int k = 0; k < 1000000; k++) {
System.out.println("At:" + k);
try {
HazelcastClient.newHazelcastClient(clientConfig);
} catch (IllegalStateException e) {
}
}
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class DummyClientReplicatedMapTest method getClientConfig.
private ClientConfig getClientConfig(HazelcastInstance instance) {
Address address = instance.getCluster().getLocalMember().getAddress();
String addressString = address.getHost() + ":" + address.getPort();
ClientConfig dummyClientConfig = new ClientConfig();
ClientNetworkConfig networkConfig = new ClientNetworkConfig();
networkConfig.setSmartRouting(false);
networkConfig.addAddress(addressString);
dummyClientConfig.setNetworkConfig(networkConfig);
return dummyClientConfig;
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientReplicatedMapNearCacheBasicTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
Config config = getConfig();
config.getReplicatedMapConfig(DEFAULT_NEAR_CACHE_NAME).setInMemoryFormat(nearCacheConfig.getInMemoryFormat());
ClientConfig clientConfig = getClientConfig().addNearCacheConfig(nearCacheConfig);
HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
ReplicatedMap<K, V> memberMap = member.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
ReplicatedMap<K, V> clientMap = client.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = client.client.getNearCacheManager();
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
return new NearCacheTestContext<K, V, Data, String>(client.getSerializationService(), client, member, new ReplicatedMapDataStructureAdapter<K, V>(clientMap), new ReplicatedMapDataStructureAdapter<K, V>(memberMap), false, nearCache, nearCacheManager);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientClusterProxyTest method client.
private HazelcastInstance client() {
factory = new TestHazelcastFactory();
Config config = new Config();
String groupAName = "HZ:GROUP";
config.getGroupConfig().setName(groupAName);
factory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.setGroupConfig(new GroupConfig(config.getGroupConfig().getName()));
return factory.newHazelcastClient(clientConfig);
}
Aggregations