示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void newSlaveJoiningClusterShouldNotAcceptOperationsUntilConstraintIsOnline() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void NewSlaveJoiningClusterShouldNotAcceptOperationsUntilConstraintIsOnline()
            {
                // Given
                ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();
                string type = type(4);
                string key  = key(4);

                HighlyAvailableGraphDatabase master = cluster.Master;

                HighlyAvailableGraphDatabase slave = cluster.AnySlave;
                File slaveStoreDirectory           = cluster.GetDatabaseDir(slave);

                // Crash the slave
                ClusterManager.RepairKit shutdownSlave = cluster.Shutdown(slave);
                deleteRecursively(slaveStoreDirectory);

                using (Transaction tx = master.BeginTx())
                {
                    CreateConstraint(master, type, key);
                    tx.Success();
                }

                // When
                slave = shutdownSlave.Repair();

                // Then
                using (Transaction ignored = slave.BeginTx())
                {
                    ConstraintDefinition definition = GetConstraint(slave, type, key);
                    assertThat(definition, instanceOf(ConstraintDefinitionClass()));
                    assertThat(single(definition.PropertyKeys), equalTo(key));
                    ValidateLabelOrRelationshipType(definition, type);
                }
            }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleSlaveWritingFirstAfterStoryCopy() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleSlaveWritingFirstAfterStoryCopy()
        {
            // Given
            ISet <long> expected = new HashSet <object>();

            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase  master  = cluster.Master;
            HighlyAvailableGraphDatabase  slave   = cluster.AnySlave;

            // When
            expected.Add(CreateOneNode(master));
            cluster.Sync();

            // ... crash the slave
            File slaveStoreDirectory = cluster.GetDatabaseDir(slave);

            ClusterManager.RepairKit shutdownSlave = cluster.Shutdown(slave);
            deleteRecursively(slaveStoreDirectory);

            // ... and slave copy store from master
            slave = shutdownSlave.Repair();
            // ... and first write after crash occurs on salve
            expected.Add(CreateOneNode(slave));
            cluster.Sync();

            // Then
            assertEquals(expected, CollectIds(master));
            assertEquals(expected, CollectIds(slave));
        }