Search in sources :

Example 46 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class TransactionImpl_OnePhaseTest method setup.

@Before
public void setup() {
    HazelcastInstance hz = createHazelcastInstance();
    operationService = getOperationService(hz);
    logger = mock(ILogger.class);
    txManagerService = mock(TransactionManagerServiceImpl.class);
    txManagerService.commitCount = MwCounter.newMwCounter();
    txManagerService.startCount = MwCounter.newMwCounter();
    txManagerService.rollbackCount = MwCounter.newMwCounter();
    nodeEngine = mock(NodeEngine.class);
    when(nodeEngine.getOperationService()).thenReturn(operationService);
    when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl());
    when(nodeEngine.getLogger(TransactionImpl.class)).thenReturn(logger);
    options = new TransactionOptions().setTransactionType(ONE_PHASE);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MemberImpl(com.hazelcast.instance.MemberImpl) TransactionOptions(com.hazelcast.transaction.TransactionOptions) ILogger(com.hazelcast.logging.ILogger) Before(org.junit.Before)

Example 47 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class TransactionImpl_TwoPhaseTest method setup.

@Before
public void setup() {
    HazelcastInstance hz = createHazelcastInstance();
    operationService = getOperationService(hz);
    logger = mock(ILogger.class);
    txManagerService = mock(TransactionManagerServiceImpl.class);
    txManagerService.commitCount = MwCounter.newMwCounter();
    txManagerService.startCount = MwCounter.newMwCounter();
    txManagerService.rollbackCount = MwCounter.newMwCounter();
    nodeEngine = mock(NodeEngine.class);
    when(nodeEngine.getOperationService()).thenReturn(operationService);
    when(nodeEngine.getLogger(TransactionImpl.class)).thenReturn(logger);
    when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl());
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MemberImpl(com.hazelcast.instance.MemberImpl) ILogger(com.hazelcast.logging.ILogger) Before(org.junit.Before)

Example 48 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberGroupFactoryTest method createMembersWithNoMetadata.

private Collection<Member> createMembersWithNoMetadata() throws UnknownHostException {
    Collection<Member> members = new HashSet<Member>();
    InetAddress fakeAddress = InetAddress.getLocalHost();
    members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, false));
    members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5702), VERSION, false));
    members.add(new MemberImpl(new Address("192.168.3.101", fakeAddress, 5701), VERSION, false));
    return members;
}
Also used : Address(com.hazelcast.nio.Address) InetAddress(java.net.InetAddress) MemberImpl(com.hazelcast.instance.MemberImpl) Member(com.hazelcast.core.Member) InetAddress(java.net.InetAddress) HashSet(java.util.HashSet)

Example 49 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberGroupFactoryTest method createMembersWithRackAwareMetadata.

private Collection<Member> createMembersWithRackAwareMetadata() throws UnknownHostException {
    Collection<Member> members = new HashSet<Member>();
    InetAddress fakeAddress = InetAddress.getLocalHost();
    MemberImpl member1 = new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, true);
    member1.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_RACK, "rack-1");
    MemberImpl member2 = new MemberImpl(new Address("192.192.0.2", fakeAddress, 5701), VERSION, true);
    member2.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_RACK, "rack-2");
    MemberImpl member3 = new MemberImpl(new Address("192.192.0.3", fakeAddress, 5701), VERSION, true);
    member3.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_RACK, "rack-3");
    members.add(member1);
    members.add(member2);
    members.add(member3);
    return members;
}
Also used : Address(com.hazelcast.nio.Address) InetAddress(java.net.InetAddress) MemberImpl(com.hazelcast.instance.MemberImpl) Member(com.hazelcast.core.Member) InetAddress(java.net.InetAddress) HashSet(java.util.HashSet)

Example 50 with MemberImpl

use of com.hazelcast.instance.MemberImpl in project hazelcast by hazelcast.

the class MemberGroupFactoryTest method createMembersWithZoneAwareMetadata.

private Collection<Member> createMembersWithZoneAwareMetadata() throws UnknownHostException {
    Collection<Member> members = new HashSet<Member>();
    InetAddress fakeAddress = InetAddress.getLocalHost();
    MemberImpl member1 = new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, true);
    member1.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "us-east-1");
    MemberImpl member2 = new MemberImpl(new Address("192.192.0.2", fakeAddress, 5701), VERSION, true);
    member2.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "us-west-1");
    MemberImpl member3 = new MemberImpl(new Address("192.192.0.3", fakeAddress, 5701), VERSION, true);
    member3.setStringAttribute(PartitionGroupMetaData.PARTITION_GROUP_ZONE, "eu-central-1");
    members.add(member1);
    members.add(member2);
    members.add(member3);
    return members;
}
Also used : Address(com.hazelcast.nio.Address) InetAddress(java.net.InetAddress) MemberImpl(com.hazelcast.instance.MemberImpl) Member(com.hazelcast.core.Member) InetAddress(java.net.InetAddress) HashSet(java.util.HashSet)

Aggregations

MemberImpl (com.hazelcast.instance.MemberImpl)86 Address (com.hazelcast.nio.Address)37 Test (org.junit.Test)18 Member (com.hazelcast.core.Member)17 QuickTest (com.hazelcast.test.annotation.QuickTest)16 ParallelTest (com.hazelcast.test.annotation.ParallelTest)14 ArrayList (java.util.ArrayList)12 InetAddress (java.net.InetAddress)9 Future (java.util.concurrent.Future)9 HashSet (java.util.HashSet)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 MemberInfo (com.hazelcast.internal.cluster.MemberInfo)7 ClusterService (com.hazelcast.internal.cluster.ClusterService)5 MemberInfoUpdateOperation (com.hazelcast.internal.cluster.impl.operations.MemberInfoUpdateOperation)5 PartitionRuntimeState (com.hazelcast.internal.partition.PartitionRuntimeState)5 ILogger (com.hazelcast.logging.ILogger)5 OperationService (com.hazelcast.spi.OperationService)5 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)5 Before (org.junit.Before)5 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)4