Skip to content

Commit

Permalink
Move readOnlySlaveHaIT to already existing test
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Jul 10, 2017
1 parent 69f8d42 commit f1ffbf2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 136 deletions.

This file was deleted.

Expand Up @@ -27,17 +27,15 @@
import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction; import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.TransactionFailureException;
import org.neo4j.graphdb.security.WriteOperationsNotAllowedException; import org.neo4j.graphdb.security.WriteOperationsNotAllowedException;
import org.neo4j.kernel.api.exceptions.ReadOnlyDbException;
import org.neo4j.kernel.configuration.Settings; import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.ha.HighlyAvailableGraphDatabase; import org.neo4j.kernel.ha.HighlyAvailableGraphDatabase;
import org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster; import org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster;


import static junit.framework.TestCase.fail; import static junit.framework.TestCase.fail;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.neo4j.graphdb.factory.GraphDatabaseSettings.read_only; import static org.neo4j.graphdb.factory.GraphDatabaseSettings.read_only;
import static org.neo4j.helpers.collection.Iterators.count;
import static org.neo4j.kernel.ha.HaSettings.tx_push_factor; import static org.neo4j.kernel.ha.HaSettings.tx_push_factor;


/** /**
Expand Down Expand Up @@ -164,4 +162,29 @@ public void givenClusterWithReadOnlySlaveWhenAddNewRelTypeOnSlaveThenThrowExcept
// Ok! // Ok!
} }
} }

@Test
public void givenClusterWithReadOnlySlaveWhenCreatingNodeOnMasterThenSlaveShouldBeAbleToPullUpdates() throws Exception
{
ManagedCluster cluster = clusterRule.startCluster();
HighlyAvailableGraphDatabase master = cluster.getMaster();
Label label = Label.label( "label" );

try ( Transaction tx = master.beginTx() )
{
master.createNode( label );
tx.success();
}

Iterable<HighlyAvailableGraphDatabase> allMembers = cluster.getAllMembers();
for ( HighlyAvailableGraphDatabase member : allMembers )
{
try ( Transaction tx = member.beginTx() )
{
long count = count( member.findNodes( label ) );
tx.success();
assertEquals( 1, count );
}
}
}
} }

0 comments on commit f1ffbf2

Please sign in to comment.