Search in sources :

Example 1 with Address

use of com.hazelcast.cluster.Address 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;
}
Also used : Address(com.hazelcast.cluster.Address) ClientConfig(com.hazelcast.client.config.ClientConfig) ClientNetworkConfig(com.hazelcast.client.config.ClientNetworkConfig)

Example 2 with Address

use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.

the class ClientTestSupport method blockMessagesFromInstance.

/**
 * Blocks incoming messages to client from given instance
 */
protected void blockMessagesFromInstance(HazelcastInstance instance, HazelcastInstance client) {
    HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
    ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
    Address address = instance.getCluster().getLocalMember().getAddress();
    ((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).blockFrom(address);
}
Also used : Address(com.hazelcast.cluster.Address) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientConnectionManager(com.hazelcast.client.impl.connection.ClientConnectionManager)

Example 3 with Address

use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.

the class ClientTestSupport method unblockMessagesToInstance.

/**
 * Unblocks outgoing messages from client to given instance
 */
protected void unblockMessagesToInstance(HazelcastInstance instance, HazelcastInstance client) {
    HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
    ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
    Address address = instance.getCluster().getLocalMember().getAddress();
    ((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).unblockTo(address);
}
Also used : Address(com.hazelcast.cluster.Address) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientConnectionManager(com.hazelcast.client.impl.connection.ClientConnectionManager)

Example 4 with Address

use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.

the class ClientTestSupport method unblockMessagesFromInstance.

/**
 * Unblocks incoming messages to client from given instance
 */
protected void unblockMessagesFromInstance(HazelcastInstance instance, HazelcastInstance client) {
    HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
    ClientConnectionManager connectionManager = clientImpl.getConnectionManager();
    Address address = instance.getCluster().getLocalMember().getAddress();
    ((TestClientRegistry.MockTcpClientConnectionManager) connectionManager).unblockFrom(address);
}
Also used : Address(com.hazelcast.cluster.Address) HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientConnectionManager(com.hazelcast.client.impl.connection.ClientConnectionManager)

Example 5 with Address

use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.

the class SplitBrainProtectionTestUtil method getClientConfig.

public static ClientConfig getClientConfig(HazelcastInstance instance) {
    ClientConfig clientConfig = new ClientConfig();
    Address address = getNode(instance).address;
    clientConfig.getNetworkConfig().addAddress(address.getHost() + ":" + address.getPort());
    clientConfig.getNetworkConfig().setSmartRouting(false);
    clientConfig.setClusterName(instance.getConfig().getClusterName());
    return clientConfig;
}
Also used : Address(com.hazelcast.cluster.Address) ClientConfig(com.hazelcast.client.config.ClientConfig)

Aggregations

Address (com.hazelcast.cluster.Address)540 Test (org.junit.Test)211 QuickTest (com.hazelcast.test.annotation.QuickTest)191 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)178 HazelcastInstance (com.hazelcast.core.HazelcastInstance)92 InetAddress (java.net.InetAddress)75 ArrayList (java.util.ArrayList)66 Member (com.hazelcast.cluster.Member)63 Accessors.getAddress (com.hazelcast.test.Accessors.getAddress)54 MemberImpl (com.hazelcast.cluster.impl.MemberImpl)48 Config (com.hazelcast.config.Config)43 PartitionReplica (com.hazelcast.internal.partition.PartitionReplica)43 UUID (java.util.UUID)43 ILogger (com.hazelcast.logging.ILogger)37 HashMap (java.util.HashMap)36 Operation (com.hazelcast.spi.impl.operationservice.Operation)35 List (java.util.List)35 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)34 Map (java.util.Map)33 InetSocketAddress (java.net.InetSocketAddress)32