Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDisallowDroppingIndexThatDoesNotExist() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDisallowDroppingIndexThatDoesNotExist()
        {
            // given
            IndexReference index;

            {
                SchemaWrite statement = SchemaWriteInNewTransaction();
                index = statement.IndexCreate(_descriptor);
                Commit();
            }
            {
                SchemaWrite statement = SchemaWriteInNewTransaction();
                statement.IndexDrop(index);
                Commit();
            }

            // when
            try
            {
                SchemaWrite statement = SchemaWriteInNewTransaction();
                statement.IndexDrop(index);
                Commit();
            }
            // then
            catch (SchemaKernelException e)
            {
                assertEquals("Unable to drop index on :label[" + _labelId + "](property[" + _propertyKeyId + "]): " + "No such INDEX ON :label[" + _labelId + "]uniquetempvar.", e.Message);
            }
            Commit();
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToRemoveAConstraintIndexWithoutOwner() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToRemoveAConstraintIndexWithoutOwner()
        {
            // given
            NodePropertyAccessor   propertyAccessor = mock(typeof(NodePropertyAccessor));
            AssertableLogProvider  logProvider      = new AssertableLogProvider();
            ConstraintIndexCreator creator          = new ConstraintIndexCreator(() => Kernel, IndexingService, propertyAccessor, logProvider);

            string          defaultProvider = Config.defaults().get(default_schema_provider);
            IndexDescriptor constraintIndex = creator.CreateConstraintIndex(_descriptor, defaultProvider);
            // then
            Transaction transaction = NewTransaction();

            assertEquals(emptySet(), asSet(transaction.SchemaRead().constraintsGetForLabel(_labelId)));
            Commit();

            // when
            SchemaWrite schemaWrite = SchemaWriteInNewTransaction();

            schemaWrite.IndexDrop(constraintIndex);
            Commit();

            // then
            transaction = NewTransaction();
            assertEquals(emptySet(), asSet(transaction.SchemaRead().indexesGetForLabel(_labelId)));
            Commit();
        }