Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPropagateRelationshipCountsInHA() throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPropagateRelationshipCountsInHA()
        {
            ManagedCluster cluster = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase master = cluster.Master;

            using (Transaction tx = master.BeginTx())
            {
                Node left  = master.CreateNode();
                Node right = master.CreateNode(Label.label("A"));
                left.CreateRelationshipTo(right, RelationshipType.withName("Type"));
                tx.Success();
            }

            cluster.Sync();

            foreach (HighlyAvailableGraphDatabase db in cluster.AllMembers)
            {
                using ([email protected] tx = Db.DependencyResolver.resolveDependency(typeof(Kernel)).beginTransaction(@explicit, AUTH_DISABLED))
                {
                    assertEquals(1, tx.dataRead().countsForRelationship(-1, -1, -1));
                    assertEquals(1, tx.dataRead().countsForRelationship(-1, -1, 0));
                    assertEquals(1, tx.dataRead().countsForRelationship(-1, 0, -1));
                    assertEquals(1, tx.dataRead().countsForRelationship(-1, 0, 0));
                }
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenClusterWithCreatedIndexWhenDeleteIndexOnMasterThenIndexIsDeletedOnSlave()
        public virtual void GivenClusterWithCreatedIndexWhenDeleteIndexOnMasterThenIndexIsDeletedOnSlave()
        {
            ManagedCluster cluster = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase master = cluster.Master;

            using (Transaction tx = master.BeginTx())
            {
                master.Index().forNodes("Test");
                tx.Success();
            }

            cluster.Sync();

            HighlyAvailableGraphDatabase aSlave = cluster.AnySlave;

            using (Transaction tx = aSlave.BeginTx())
            {
                assertThat(aSlave.Index().existsForNodes("Test"), equalTo(true));
                tx.Success();
            }

            // When
            using (Transaction tx = master.BeginTx())
            {
                master.Index().forNodes("Test").delete();
                tx.Success();
            }

            cluster.Sync();

            // Then
            HighlyAvailableGraphDatabase anotherSlave = cluster.AnySlave;

            using (Transaction tx = anotherSlave.BeginTx())
            {
                assertThat(anotherSlave.Index().existsForNodes("Test"), equalTo(false));
                tx.Success();
            }
        }