Search in sources :

Example 11 with ObservedClusterMembers

use of org.neo4j.kernel.ha.cluster.member.ObservedClusterMembers in project neo4j by neo4j.

the class ClusterMetricsTest method getClusterMembers.

private static Supplier<ClusterMembers> getClusterMembers(String memberRole, HighAvailabilityMemberState memberState) {
    HighAvailabilityMemberStateMachine stateMachine = mock(HighAvailabilityMemberStateMachine.class);
    when(stateMachine.getCurrentState()).thenReturn(memberState);
    ClusterMember clusterMember = spy(new ClusterMember(new InstanceId(1)));
    when(clusterMember.getHARole()).thenReturn(memberRole);
    ObservedClusterMembers observedClusterMembers = mock(ObservedClusterMembers.class);
    when(observedClusterMembers.getCurrentMember()).thenReturn(clusterMember);
    return () -> new ClusterMembers(observedClusterMembers, stateMachine);
}
Also used : ObservedClusterMembers(org.neo4j.kernel.ha.cluster.member.ObservedClusterMembers) HighAvailabilityMemberStateMachine(org.neo4j.kernel.ha.cluster.HighAvailabilityMemberStateMachine) ClusterMember(org.neo4j.kernel.ha.cluster.member.ClusterMember) InstanceId(org.neo4j.cluster.InstanceId) ClusterMembers(org.neo4j.kernel.ha.cluster.member.ClusterMembers) ObservedClusterMembers(org.neo4j.kernel.ha.cluster.member.ObservedClusterMembers)

Aggregations

ObservedClusterMembers (org.neo4j.kernel.ha.cluster.member.ObservedClusterMembers)11 InstanceId (org.neo4j.cluster.InstanceId)10 Test (org.junit.Test)8 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)8 ClusterMemberEvents (org.neo4j.cluster.member.ClusterMemberEvents)7 ClusterMemberListener (org.neo4j.cluster.member.ClusterMemberListener)7 AvailabilityRequirement (org.neo4j.kernel.AvailabilityGuard.AvailabilityRequirement)5 ClusterMember (org.neo4j.kernel.ha.cluster.member.ClusterMember)3 ClusterMembers (org.neo4j.kernel.ha.cluster.member.ClusterMembers)3 File (java.io.File)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Predicate (java.util.function.Predicate)1 ClusterClient (org.neo4j.cluster.client.ClusterClient)1 ClusterMemberAvailability (org.neo4j.cluster.member.ClusterMemberAvailability)1