Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotRemoveConstraintThatGetsReAdded() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotRemoveConstraintThatGetsReAdded()
        {
            // given
            Constraint constraint;

            {
                SchemaWrite statement = schemaWriteInNewTransaction();
                constraint = CreateConstraint(statement, Descriptor);
                commit();
            }
            using (Org.Neo4j.Graphdb.Transaction tx = Db.beginTx())
            {
                // Make sure all schema changes are stable, to avoid any synchronous schema state invalidation
                Db.schema().awaitIndexesOnline(10, TimeUnit.SECONDS);
            }
            SchemaStateCheck schemaState = (new SchemaStateCheck(this)).SetUp();
            {
                SchemaWrite statement = schemaWriteInNewTransaction();

                // when
                DropConstraint(statement, constraint);
                CreateConstraint(statement, Descriptor);
                commit();
            }
            {
                Transaction transaction = newTransaction();

                // then
                assertEquals(singletonList(constraint), asCollection(transaction.SchemaRead().constraintsGetAll()));
                schemaState.AssertNotCleared(transaction);
                commit();
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearSchemaStateWhenConstraintIsCreated() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldClearSchemaStateWhenConstraintIsCreated()
        {
            // given
            SchemaStateCheck schemaState = (new SchemaStateCheck(this)).SetUp();

            SchemaWrite statement = schemaWriteInNewTransaction();

            // when
            CreateConstraint(statement, Descriptor);
            commit();

            // then
            schemaState.AssertCleared(newTransaction());
            rollback();
        }