Search in sources :

Example 1 with ElectionCredentialsProvider

use of org.neo4j.cluster.protocol.election.ElectionCredentialsProvider in project neo4j by neo4j.

the class MultiPaxosContextTest method shouldDeepClone.

@Test
public void shouldDeepClone() throws Exception {
    // Given
    ObjectStreamFactory objStream = new ObjectStreamFactory();
    AcceptorInstanceStore acceptorInstances = mock(AcceptorInstanceStore.class);
    Executor executor = mock(Executor.class);
    Timeouts timeouts = mock(Timeouts.class);
    ClusterConfiguration clusterConfig = new ClusterConfiguration("myCluster", NullLogProvider.getInstance());
    ElectionCredentialsProvider electionCredentials = mock(ElectionCredentialsProvider.class);
    Config config = mock(Config.class);
    when(config.get(ClusterSettings.max_acceptors)).thenReturn(10);
    MultiPaxosContext ctx = new MultiPaxosContext(new InstanceId(1), Collections.<ElectionRole>emptyList(), clusterConfig, executor, NullLogProvider.getInstance(), objStream, objStream, acceptorInstances, timeouts, electionCredentials, config);
    // When
    MultiPaxosContext snapshot = ctx.snapshot(NullLogProvider.getInstance(), timeouts, executor, acceptorInstances, objStream, objStream, electionCredentials);
    // Then
    assertEquals(ctx, snapshot);
}
Also used : Executor(java.util.concurrent.Executor) ElectionCredentialsProvider(org.neo4j.cluster.protocol.election.ElectionCredentialsProvider) InstanceId(org.neo4j.cluster.InstanceId) Timeouts(org.neo4j.cluster.timeout.Timeouts) Config(org.neo4j.kernel.configuration.Config) MultiPaxosContext(org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext) ClusterConfiguration(org.neo4j.cluster.protocol.cluster.ClusterConfiguration) ObjectStreamFactory(org.neo4j.cluster.protocol.atomicbroadcast.ObjectStreamFactory) Test(org.junit.Test)

Aggregations

Executor (java.util.concurrent.Executor)1 Test (org.junit.Test)1 InstanceId (org.neo4j.cluster.InstanceId)1 ObjectStreamFactory (org.neo4j.cluster.protocol.atomicbroadcast.ObjectStreamFactory)1 MultiPaxosContext (org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext)1 ClusterConfiguration (org.neo4j.cluster.protocol.cluster.ClusterConfiguration)1 ElectionCredentialsProvider (org.neo4j.cluster.protocol.election.ElectionCredentialsProvider)1 Timeouts (org.neo4j.cluster.timeout.Timeouts)1 Config (org.neo4j.kernel.configuration.Config)1