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

            for (int i = 0; i < 10; i++)
            {
                cluster.CoreTx((db, tx) =>
                {
                    Db.createNode();
                    tx.success();
                });
            }

            ICollection <CoreClusterMember> coreClusterMembers = cluster.CoreMembers();

            foreach (CoreClusterMember coreClusterMember in coreClusterMembers)
            {
                DependencyResolver dependencyResolver = coreClusterMember.Database().DependencyResolver;
                LogFiles           logFiles           = dependencyResolver.ResolveDependency(typeof(LogFiles));
                assertEquals(logFiles.LogFilesDirectory().Name, "core-tx-logs-" + coreClusterMember.ServerId());
                assertTrue(logFiles.HasAnyEntries(0));
                File[] coreLogDirectories = coreClusterMember.DatabaseDirectory().listFiles(file => file.Name.StartsWith("core"));
                assertThat(coreLogDirectories, Matchers.arrayWithSize(1));

                LogFileInStoreDirectoryDoesNotExist(coreClusterMember.DatabaseDirectory(), dependencyResolver);
            }

            ICollection <ReadReplica> readReplicas = cluster.ReadReplicas();

            foreach (ReadReplica readReplica in readReplicas)
            {
                readReplica.TxPollingClient().upToDateFuture().get();
                DependencyResolver dependencyResolver = readReplica.Database().DependencyResolver;
                LogFiles           logFiles           = dependencyResolver.ResolveDependency(typeof(LogFiles));
                assertEquals(logFiles.LogFilesDirectory().Name, "replica-tx-logs-" + readReplica.ServerId());
                assertTrue(logFiles.HasAnyEntries(0));
                File[] replicaLogDirectories = readReplica.DatabaseDirectory().listFiles(file => file.Name.StartsWith("replica"));
                assertThat(replicaLogDirectories, Matchers.arrayWithSize(1));

                LogFileInStoreDirectoryDoesNotExist(readReplica.DatabaseDirectory(), dependencyResolver);
            }
        }