Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.causalclustering.discovery.Cluster<?> startCluster(String recordFormat) throws Exception
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
        private Cluster <object> StartCluster(string recordFormat)
        {
            ClusterRule clusterRule = this._clusterRule.withSharedCoreParam(GraphDatabaseSettings.record_format, recordFormat).withSharedReadReplicaParam(GraphDatabaseSettings.record_format, recordFormat);
//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();

            CreateSomeData(cluster);
            return(cluster);
        }
Beispiel #2
0
        protected internal BaseMultiClusterRoutingIT(string ignoredName, int numCores, int numReplicas, ISet <string> dbNames, DiscoveryServiceType discoveryType)
        {
            this._dbNames       = dbNames;
            this._discoveryType = discoveryType;

            this._clusterRule = (new ClusterRule()).withNumberOfCoreMembers(numCores).withNumberOfReadReplicas(numReplicas).withDatabaseNames(dbNames);
            this._numCores    = numCores;

            this._fileSystemRule = new DefaultFileSystemRule();
            this.RuleChain       = RuleChain.outerRule(_fileSystemRule).around(_clusterRule);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void secondaryTransactionProtocolIsSwitchedOffCorrespondingBackupSetting() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SecondaryTransactionProtocolIsSwitchedOffCorrespondingBackupSetting()
        {
            // given a cluster with backup switched off
            int[]  backupPorts = new int[] { PortAuthority.allocatePort(), PortAuthority.allocatePort(), PortAuthority.allocatePort() };
            string value       = "localhost:%d";

            _clusterRule = _clusterRule.withSharedCoreParam(OnlineBackupSettings.online_backup_enabled, "false").withInstanceCoreParam(online_backup_server, i => format(value, backupPorts[i]));
            StartCluster(RecordFormat);
            string customAddress = "localhost:" + backupPorts[0];

            // then a full backup is impossible from the backup port
            assertEquals(1, RunBackupOtherJvm(customAddress, DATABASE_NAME));
        }
Beispiel #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void restartingTheClusterShouldWork(org.neo4j.test.ha.ClusterRule clusterRule) throws Exception
        private static void RestartingTheClusterShouldWork(ClusterRule clusterRule)
        {
            ClusterManager.ManagedCluster cluster = clusterRule.StartCluster();
            try
            {
                cluster.Await(allSeesAllAsAvailable(), 180);
            }
            finally
            {
                clusterRule.ShutdownCluster();
            }

            AssertAllStoreConsistent(cluster);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCatchupThroughHierarchy() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCatchupThroughHierarchy()
        {
            ClusterRule = ClusterRule.withInstanceReadReplicaParam(CausalClusteringSettings.server_groups, id => _serverGroups[id]).withInstanceCoreParam(CausalClusteringSettings.server_groups, id => _serverGroups[id]);

            // given
//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();
            int numberOfNodesToCreate = 100;

            cluster.CoreTx((db, tx) =>
            {
                Db.schema().constraintFor(label("Foo")).assertPropertyIsUnique("foobar").create();
                tx.success();
            });

            // 0, 1, 2 are core instances
            createLabelledNodesWithProperty(cluster, numberOfNodesToCreate, label("Foo"), () => Pair.of("foobar", string.Format("baz_bat{0}", System.Guid.randomUUID())));

            // 3, 4 are other DCs
            ReadReplica east3 = cluster.AddReadReplicaWithId(3);

            east3.Start();
            ReadReplica west4 = cluster.AddReadReplicaWithId(4);

            west4.Start();

            checkDataHasReplicatedToReadReplicas(cluster, numberOfNodesToCreate);

            foreach (CoreClusterMember coreClusterMember in cluster.CoreMembers())
            {
                coreClusterMember.DisableCatchupServer();
            }

            // 5, 6 are other DCs
            ReadReplica east5 = cluster.AddReadReplicaWithId(5);

            east5.UpstreamDatabaseSelectionStrategy = "connect-randomly-within-server-group";
            east5.Start();
            ReadReplica west6 = cluster.AddReadReplicaWithId(6);

            west6.UpstreamDatabaseSelectionStrategy = "connect-randomly-within-server-group";
            west6.Start();

            checkDataHasReplicatedToReadReplicas(cluster, numberOfNodesToCreate);
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void backupCanBeOptionallySwitchedOnWithTheBackupConfig() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BackupCanBeOptionallySwitchedOnWithTheBackupConfig()
        {
            // given a cluster with backup switched on
            int[]  backupPorts = new int[] { PortAuthority.allocatePort(), PortAuthority.allocatePort(), PortAuthority.allocatePort() };
            string value       = "localhost:%d";

            _clusterRule = _clusterRule.withSharedCoreParam(OnlineBackupSettings.online_backup_enabled, "true").withInstanceCoreParam(online_backup_server, i => format(value, backupPorts[i]));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.causalclustering.discovery.Cluster<?> cluster = startCluster(recordFormat);
            Cluster <object> cluster       = StartCluster(RecordFormat);
            string           customAddress = "localhost:" + backupPorts[0];

            // when a full backup is performed
            assertEquals(0, RunBackupOtherJvm(customAddress, DATABASE_NAME));
            assertEquals(DbRepresentation.of(ClusterDatabase(cluster)), GetBackupDbRepresentation(DATABASE_NAME, _backupStoreDir));

            // and an incremental backup is performed
            CreateSomeData(cluster);
            assertEquals(0, RunBackupOtherJvm(customAddress, DATABASE_NAME));
            assertEquals(0, RunBackupToolFromOtherJvmToGetExitCode("--from=" + customAddress, "--cc-report-dir=" + _backupStoreDir, "--backup-dir=" + _backupStoreDir, "--name=defaultport", Arg(ARG_NAME_FALLBACK_FULL, false)));

            // then the data matches
            assertEquals(DbRepresentation.of(ClusterDatabase(cluster)), GetBackupDbRepresentation(DATABASE_NAME, _backupStoreDir));
        }