コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void slaveShouldMoveToPendingAndThenRecoverIfMasterDiesAndThenRecovers() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SlaveShouldMoveToPendingAndThenRecoverIfMasterDiesAndThenRecovers()
        {
            HighlyAvailableGraphDatabase master   = _cluster.Master;
            HighlyAvailableGraphDatabase theSlave = _cluster.AnySlave;

            string propertyName  = "prop";
            string propertyValue = "value1";
            long   slaveNodeId;

            ClusterManager.RepairKit repairKit = _cluster.fail(master);
            _cluster.await(memberSeesOtherMemberAsFailed(theSlave, master));

            assertEquals(HighAvailabilityMemberState.PENDING, theSlave.InstanceState);

            repairKit.Repair();

            _cluster.await(allSeesAllAsAvailable());

            using (Transaction tx = theSlave.BeginTx())
            {
                Node node = theSlave.CreateNode();
                slaveNodeId = node.Id;
                node.SetProperty(propertyName, propertyValue);
                tx.Success();
            }

            using (Transaction tx = master.BeginTx())
            {
                assertEquals(propertyValue, master.GetNodeById(slaveNodeId).getProperty(propertyName));
                tx.Success();
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void masterShouldRemainAvailableIfTheSlaveDiesAndRecovers() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MasterShouldRemainAvailableIfTheSlaveDiesAndRecovers()
        {
            HighlyAvailableGraphDatabase master   = _cluster.Master;
            HighlyAvailableGraphDatabase theSlave = _cluster.AnySlave;

            string propertyName   = "prop";
            string propertyValue1 = "value1";
            string propertyValue2 = "value2";
            long   masterNodeId;
            long   slaveNodeId;

            ClusterManager.RepairKit repairKit = _cluster.fail(theSlave);
            _cluster.await(memberSeesOtherMemberAsFailed(master, theSlave));

            using (Transaction tx = master.BeginTx())
            {
                Node node = master.CreateNode();
                node.SetProperty(propertyName, propertyValue1);
                masterNodeId = node.Id;
                tx.Success();
            }

            repairKit.Repair();

            _cluster.await(allSeesAllAsAvailable());

            using (Transaction tx = theSlave.BeginTx())
            {
                Node node = theSlave.CreateNode();
                node.SetProperty(propertyName, propertyValue2);
                assertEquals(propertyValue1, theSlave.GetNodeById(masterNodeId).getProperty(propertyName));
                slaveNodeId = node.Id;
                tx.Success();
            }

            using (Transaction tx = master.BeginTx())
            {
                assertEquals(propertyValue2, master.GetNodeById(slaveNodeId).getProperty(propertyName));
                tx.Success();
            }
        }