//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotBeAbleToWriteToReadReplica() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotBeAbleToWriteToReadReplica() { // 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(); ReadReplicaGraphDatabase readReplica = cluster.FindAnyReadReplica().database(); // when try { using (Transaction tx = readReplica.BeginTx()) { Node node = readReplica.CreateNode(); node.SetProperty("foobar", "baz_bat"); node.AddLabel(Label.label("Foo")); tx.Success(); fail("should have thrown"); } } catch (WriteOperationsNotAllowedException) { // then all good } }
internal ReadReplicaStatus(OutputFormat output, ReadReplicaGraphDatabase db) : base(output) { this._output = output; DependencyResolver dependencyResolver = Db.DependencyResolver; this._commandIndexTracker = dependencyResolver.ResolveDependency(typeof(CommandIndexTracker)); this._topologyService = dependencyResolver.ResolveDependency(typeof(TopologyService)); this._dbHealth = dependencyResolver.ResolveDependency(typeof(DatabaseHealth)); }
//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() { OutputFormat output = new OutputFormat(new JsonFormat(), new URI("http://base.local:1234/"), null); ReadReplicaGraphDatabase db = mock(typeof(ReadReplicaGraphDatabase)); _topologyService = new FakeTopologyService(RandomMembers(3), RandomMembers(2), _myself, RoleInfo.READ_REPLICA); _dependencyResolver.satisfyDependencies(_topologyService); when(Db.DependencyResolver).thenReturn(_dependencyResolver); _databaseHealth = _dependencyResolver.satisfyDependency(new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), _logProvider.getLog(typeof(DatabaseHealth)))); _commandIndexTracker = _dependencyResolver.satisfyDependency(new CommandIndexTracker()); _status = CausalClusteringStatusFactory.Build(output, db); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void readReplicaProceduresShouldBeAvailable() public virtual void ReadReplicaProceduresShouldBeAvailable() { // given string[] readReplicaProcs = new string[] { "dbms.cluster.role", "dbms.procedures", "dbms.listQueries" }; // when foreach (string procedure in readReplicaProcs) { Optional <ReadReplica> firstReadReplica = _cluster.readReplicas().First(); Debug.Assert(firstReadReplica.Present); ReadReplicaGraphDatabase database = firstReadReplica.get().database(); InternalTransaction tx = database.BeginTransaction(KernelTransaction.Type.@explicit, AUTH_DISABLED); Result readReplicaResult = database.Execute("CALL " + procedure + "()"); // then //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue("read replica with procedure " + procedure, readReplicaResult.HasNext()); readReplicaResult.Close(); tx.Close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = 240_000) public void shouldNotBePossibleToStartTransactionsWhenReadReplicaCopiesStore() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotBePossibleToStartTransactionsWhenReadReplicaCopiesStore() { //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(); ReadReplica readReplica = cluster.FindAnyReadReplica(); readReplica.TxPollingClient().stop(); WriteSomeDataAndForceLogRotations(cluster); Semaphore storeCopyBlockingSemaphore = AddStoreCopyBlockingMonitor(readReplica); try { readReplica.TxPollingClient().start(); WaitForStoreCopyToStartAndBlock(storeCopyBlockingSemaphore); ReadReplicaGraphDatabase replicaGraphDatabase = readReplica.Database(); try { replicaGraphDatabase.BeginTx(); fail("Exception expected"); } catch (Exception e) { assertThat(e, instanceOf(typeof(TransactionFailureException))); assertThat(e.Message, containsString("Database is stopped to copy store")); } } finally { // release all waiters of the semaphore storeCopyBlockingSemaphore.release(int.MaxValue); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void transactionsShouldNotAppearOnTheReadReplicaWhilePollingIsPaused() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TransactionsShouldNotAppearOnTheReadReplicaWhilePollingIsPaused() { // 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(); ReadReplicaGraphDatabase readReplicaGraphDatabase = cluster.FindAnyReadReplica().database(); CatchupPollingProcess pollingClient = readReplicaGraphDatabase.DependencyResolver.resolveDependency(typeof(CatchupPollingProcess)); pollingClient.Stop(); cluster.CoreTx((coreGraphDatabase, transaction) => { coreGraphDatabase.createNode(); transaction.success(); }); CoreGraphDatabase leaderDatabase = cluster.AwaitLeader().database(); long transactionVisibleOnLeader = TransactionIdTracker(leaderDatabase).newestEncounteredTxId(); // when the poller is paused, transaction doesn't make it to the read replica try { TransactionIdTracker(readReplicaGraphDatabase).awaitUpToDate(transactionVisibleOnLeader, ofSeconds(15)); fail("should have thrown exception"); } catch (TransactionFailureException) { // expected timeout } // when the poller is resumed, it does make it to the read replica pollingClient.Start(); TransactionIdTracker(readReplicaGraphDatabase).awaitUpToDate(transactionVisibleOnLeader, ofSeconds(15)); }