コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReplicateTransactionToCoreMembers() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReplicateTransactionToCoreMembers()
        {
            // given
            TestDirectory testDirectory     = ClusterRule.testDirectory();
            File          dbDir             = testDirectory.CleanDirectory("classic-db-" + RecordFormat);
            int           classicNodeCount  = 1024;
            File          classicNeo4jStore = CreateNeoStore(dbDir, classicNodeCount);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = this.clusterRule.withRecordFormat(recordFormat).createCluster();
            Cluster <object> cluster = this.ClusterRule.withRecordFormat(RecordFormat).createCluster();

            using (DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction())
            {
                foreach (CoreClusterMember core in cluster.CoreMembers())
                {
                    (new RestoreDatabaseCommand(fileSystem, classicNeo4jStore, core.Config(), core.SettingValue(GraphDatabaseSettings.active_database.name()), true)).execute();
                }
            }

            cluster.Start();

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

            cluster.AddReadReplicaWithIdAndRecordFormat(4, RecordFormat).start();

            // then
            foreach (CoreClusterMember server in cluster.CoreMembers())
            {
                CoreGraphDatabase db = server.database();

                using (Transaction tx = Db.beginTx())
                {
                    ThrowingSupplier <long, Exception> nodeCount = () => count(Db.AllNodes);

                    Config config = Db.DependencyResolver.resolveDependency(typeof(Config));

                    assertEventually("node to appear on core server " + config.Get(raft_advertised_address), nodeCount, greaterThan(( long )classicNodeCount), 15, SECONDS);

                    assertEquals(classicNodeCount + 1, count(Db.AllNodes));

                    tx.Success();
                }
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _backupsDir = ClusterRule.testDirectory().cleanDirectory("backups");
            _cluster    = ClusterRule.startCluster();
        }