Skip to content

Commit

Permalink
Fixes compilation errors from last merge
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalstain committed Feb 15, 2016
1 parent aca7899 commit 140c532
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
18 changes: 11 additions & 7 deletions enterprise/ha/src/test/java/org/neo4j/kernel/ha/TestFailover.java
Expand Up @@ -41,7 +41,8 @@ public class TestFailover
{ {
@Rule @Rule
public LoggerRule logger = new LoggerRule(); public LoggerRule logger = new LoggerRule();
public TargetDirectory dir = TargetDirectory.forTest( getClass() ); @Rule
public TargetDirectory.TestDirectory dir = TargetDirectory.testDirForTest( getClass() );


// parameters // parameters
private int clusterSize; private int clusterSize;
Expand All @@ -65,10 +66,13 @@ public TestFailover( int clusterSize )
private void testFailOver( int clusterSize ) throws Throwable private void testFailOver( int clusterSize ) throws Throwable
{ {
// given // given
ClusterManager clusterManager = new ClusterManager( clusterOfSize( clusterSize ), dir.cleanDirectory( "failover" ), stringMap( ClusterManager clusterManager = new ClusterManager.Builder().withRootDirectory( dir.cleanDirectory( "failover" ) ).
ClusterSettings.default_timeout.name(), "1", withProvider( ClusterManager.clusterOfSize( clusterSize ) )
ClusterSettings.heartbeat_interval.name(), "1", .withSharedConfig( stringMap(
ClusterSettings.heartbeat_timeout.name(), "2" ) ); ClusterSettings.default_timeout.name(), "1",
ClusterSettings.heartbeat_interval.name(), "1",
ClusterSettings.heartbeat_timeout.name(), "2" ) )
.build();


clusterManager.start(); clusterManager.start();
ClusterManager.ManagedCluster cluster = clusterManager.getDefaultCluster(); ClusterManager.ManagedCluster cluster = clusterManager.getDefaultCluster();
Expand All @@ -79,13 +83,13 @@ private void testFailOver( int clusterSize ) throws Throwable
// When // When
long start = System.nanoTime(); long start = System.nanoTime();
ClusterManager.RepairKit repairKit = cluster.fail( oldMaster ); ClusterManager.RepairKit repairKit = cluster.fail( oldMaster );
logger.getLogger().warn( "Shut down master" ); logger.getLogger().warning( "Shut down master" );


// Then // Then
cluster.await( ClusterManager.masterAvailable( oldMaster ) ); cluster.await( ClusterManager.masterAvailable( oldMaster ) );
long end = System.nanoTime(); long end = System.nanoTime();


logger.getLogger().warn( "Failover took:" + (end - start) / 1000000 + "ms" ); logger.getLogger().warning( "Failover took:" + (end - start) / 1000000 + "ms" );


repairKit.repair(); repairKit.repair();
Thread.sleep( 3000 ); // give repaired instance chance to cleanly rejoin and exit faster Thread.sleep( 3000 ); // give repaired instance chance to cleanly rejoin and exit faster
Expand Down
Expand Up @@ -45,7 +45,8 @@ public class TestFailoverWithAdditionalSlaveFailures
{ {
@Rule @Rule
public LoggerRule logger = new LoggerRule(); public LoggerRule logger = new LoggerRule();
public TargetDirectory dir = TargetDirectory.forTest( getClass() ); @Rule
public TargetDirectory.TestDirectory dir = TargetDirectory.testDirForTest( getClass() );


// parameters // parameters
private int clusterSize; private int clusterSize;
Expand Down Expand Up @@ -83,11 +84,13 @@ public void testFailoverWithAdditionalSlave() throws Throwable


private void testFailoverWithAdditionalSlave( int clusterSize, int[] slaveIndexes ) throws Throwable private void testFailoverWithAdditionalSlave( int clusterSize, int[] slaveIndexes ) throws Throwable
{ {
ClusterManager manager = new ClusterManager( ClusterManager.clusterOfSize( clusterSize ), ClusterManager manager = new ClusterManager.Builder().withRootDirectory( dir.cleanDirectory( "testcluster" ) ).
TargetDirectory.forTest( getClass() ).cleanDirectory( "testCluster" ), stringMap( withProvider( ClusterManager.clusterOfSize( clusterSize ) )
ClusterSettings.default_timeout.name(), "1", .withSharedConfig( stringMap(
ClusterSettings.heartbeat_interval.name(), "1", ClusterSettings.default_timeout.name(), "1",
ClusterSettings.heartbeat_timeout.name(), "2" ) ); ClusterSettings.heartbeat_interval.name(), "1",
ClusterSettings.heartbeat_timeout.name(), "2" ) )
.build();


try try
{ {
Expand Down

0 comments on commit 140c532

Please sign in to comment.