Beispiel #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));
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// The problem would manifest even if the transaction was performed on the Master, it would then occur when the
        /// Slave pulls updates and tries to apply the transaction. The reason for the test to run transactions against the
        /// Slave is because it makes guarantees for when the master has to apply the transaction.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteRecords()
        public virtual void ShouldDeleteRecords()
        {
            // given
            ManagedCluster cluster = ClusterRule.startCluster();

            HighlyAvailableGraphDatabase master = cluster.Master;
            HighlyAvailableGraphDatabase slave  = cluster.AnySlave;

            Relationship rel;

            using (Transaction tx = slave.BeginTx())
            {
                rel = slave.CreateNode().createRelationshipTo(slave.CreateNode(), withName("FOO"));
                tx.Success();
            }

            using (Transaction transaction = master.BeginTx())
            {
                assertNotNull(master.GetRelationshipById(rel.Id));
            }

            // when
            using (Transaction tx = slave.BeginTx())
            {
                rel.Delete();
                tx.Success();
            }

            // then - there should have been no exceptions
            slave.Shutdown();
            master.Shutdown();
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _cluster = ClusterRule.startCluster();
            _master  = _cluster.Master;
            _slave1  = _cluster.AnySlave;
            _slave2  = _cluster.getAnySlave(_slave1);
            ClearDatabase();
        }
Beispiel #4
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();
            }
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void programmaticConfigShouldSurviveMasterSwitches()
        public virtual void ProgrammaticConfigShouldSurviveMasterSwitches()
        {
            string propertyToIndex = "programmatic-property";

            // Given
            ManagedCluster cluster             = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase slave = cluster.AnySlave;

            AutoIndexer <Node> originalAutoIndex = slave.Index().NodeAutoIndexer;

            originalAutoIndex.Enabled = true;
            originalAutoIndex.StartAutoIndexingProperty(propertyToIndex);

            // When
            cluster.Shutdown(cluster.Master);
            cluster.Await(masterAvailable());

            // Then
            AutoIndexer <Node> newAutoIndex = slave.Index().NodeAutoIndexer;

            assertThat(newAutoIndex.Enabled, @is(true));
            assertThat(newAutoIndex.AutoIndexedProperties, hasItem(propertyToIndex));
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _cluster = ClusterRule.withCluster(clusterWithAdditionalClients(2, 1)).withAvailabilityChecks(masterAvailable(), masterSeesMembers(3), allSeesAllAsJoined()).startCluster();
        }