コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPreventConcurrentCreationOfConflictingDataOnSeparateHosts() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPreventConcurrentCreationOfConflictingDataOnSeparateHosts()
        {
            // given
            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();

            HighlyAvailableGraphDatabase slave1 = cluster.AnySlave;
            HighlyAvailableGraphDatabase slave2 = cluster.GetAnySlave(slave1);

            // when
            Future <bool> created;

            using (Transaction tx = slave1.BeginTx())
            {
                slave1.CreateNode(_label).setProperty(PROPERTY_KEY, "value3");

                created = OtherThread.execute(CreateNode(slave2, _label.name(), PROPERTY_KEY, "value3"));

                assertThat(OtherThread, Waiting);

                tx.Success();
            }

            // then
            assertFalse("creating violating data should fail", created.get());
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowOtherHostToCompleteIfFirstHostRollsBackTransaction() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowOtherHostToCompleteIfFirstHostRollsBackTransaction()
        {
            // given
            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();

            HighlyAvailableGraphDatabase slave1 = cluster.AnySlave;
            HighlyAvailableGraphDatabase slave2 = cluster.GetAnySlave(slave1);

            // when
            Future <bool> created;

            using (Transaction tx = slave1.BeginTx())
            {
                slave1.CreateNode(_label).setProperty(PROPERTY_KEY, "value4");

                created = OtherThread.execute(CreateNode(slave2, _label.name(), PROPERTY_KEY, "value4"));

                assertThat(OtherThread, Waiting);

                tx.Failure();
            }

            // then
            assertTrue("creating data that conflicts only with rolled back data should pass", created.get());
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowCreationOfNonConflictingDataOnSeparateHosts() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowCreationOfNonConflictingDataOnSeparateHosts()
        {
            // given
            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();

            HighlyAvailableGraphDatabase slave1 = cluster.AnySlave;
            HighlyAvailableGraphDatabase slave2 = cluster.GetAnySlave(slave1);

            // when
            Future <bool> created;

            using (Transaction tx = slave1.BeginTx())
            {
                slave1.CreateNode(_label).setProperty(PROPERTY_KEY, "value1");

                created = OtherThread.execute(CreateNode(slave2, _label.name(), PROPERTY_KEY, "value2"));
                tx.Success();
            }

            // then
            assertTrue("creating non-conflicting data should pass", created.get());
        }