示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readReplicaTest() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReadReplicaTest()
        {
            // given
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = clusterRule.withNumberOfCoreMembers(2).withNumberOfReadReplicas(1).startCluster();
            Cluster <object> cluster = ClusterRule.withNumberOfCoreMembers(2).withNumberOfReadReplicas(1).startCluster();

            // when
            CoreClusterMember last = cluster.CoreTx((db, tx) =>
            {
                Node node = Db.createNode(label("boo"));
                node.setProperty("foobar", "baz_bat");
                tx.success();
            });

            cluster.AddCoreMemberWithId(2).start();
            dataMatchesEventually(last, cluster.CoreMembers());
            dataMatchesEventually(last, cluster.ReadReplicas());

            cluster.Shutdown();

            using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction())
            {
                foreach (CoreClusterMember core in cluster.CoreMembers())
                {
                    ConsistencyCheckService.Result result = (new ConsistencyCheckService()).runFullConsistencyCheck(DatabaseLayout.of(core.DatabaseDirectory()), Config.defaults(), ProgressMonitorFactory.NONE, NullLogProvider.Instance, fileSystem, false, new ConsistencyFlags(true, true, true, true, false));
                    assertTrue("Inconsistent: " + core, result.Successful);
                }

                foreach (ReadReplica readReplica in cluster.ReadReplicas())
                {
                    ConsistencyCheckService.Result result = (new ConsistencyCheckService()).runFullConsistencyCheck(DatabaseLayout.of(readReplica.DatabaseDirectory()), Config.defaults(), ProgressMonitorFactory.NONE, NullLogProvider.Instance, fileSystem, false, new ConsistencyFlags(true, true, true, true, false));
                    assertTrue("Inconsistent: " + readReplica, result.Successful);
                }
            }
        }