Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyProcedureCloseAllAcquiredKernelStatements(ProcedureData proc) throws java.util.concurrent.ExecutionException, InterruptedException
        private void VerifyProcedureCloseAllAcquiredKernelStatements(ProcedureData proc)
        {
            if (proc.Skip)
            {
                return;
            }
            string failureMessage = "Failed on procedure " + proc.Name;

            using (Transaction outer = Db.beginTx())
            {
                string procedureQuery = proc.BuildProcedureQuery();
                Exhaust(Db.execute(procedureQuery)).close();
                Exhaust(Db.execute("MATCH (mo:Label) WHERE mo.prop = 'n/a' RETURN mo")).close();
                ExecuteInOtherThread("CREATE(mo:Label) SET mo.prop = 'val' RETURN mo");
                Result result = Db.execute("MATCH (mo:Label) WHERE mo.prop = 'val' RETURN mo");
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(failureMessage, result.HasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                IDictionary <string, object> next = result.Next();
                assertNotNull(failureMessage, next["mo"]);
                Exhaust(result);
                result.Close();
                outer.Success();
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void withConstraint(org.neo4j.function.ThrowingFunction<java.util.concurrent.CyclicBarrier,org.neo4j.graphdb.Node,Exception> action) throws Exception
        private void WithConstraint(ThrowingFunction <CyclicBarrier, Node, Exception> action)
        {
            // given
            Db.execute("CREATE CONSTRAINT ON (foo:Foo) ASSERT foo.bar IS UNIQUE");
            CyclicBarrier barrier = new CyclicBarrier(2);
            Node          node    = MergeNode();

            // when
            IList <Node> result = await(Threads.multiple(barrier.Parties, action, barrier));

            // then
            assertEquals("size of result", 2, result.Count);
            assertEquals(node, result[0]);
            assertEquals(node, result[1]);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldContainTheQueryItself()
        public virtual void ShouldContainTheQueryItself()
        {
            // given
            string query = "CALL dbms.listQueries";

            // when
            Result result = _db.execute(query);

            // then
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            IDictionary <string, object> row = result.Next();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(result.HasNext());
            assertEquals(query, row["query"]);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void multiTokenFulltextIndexesMustShowUpInSchemaGetIndexes()
        public virtual void MultiTokenFulltextIndexesMustShowUpInSchemaGetIndexes()
        {
            using (Transaction tx = Db.beginTx())
            {
                Db.execute(format(NODE_CREATE, "nodeIndex", array("Label1", "Label2"), array("prop1", "prop2"))).close();
                Db.execute(format(RELATIONSHIP_CREATE, "relIndex", array("RelType1", "RelType2"), array("prop1", "prop2"))).close();
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                foreach (IndexDefinition index in Db.schema().Indexes)
                {
                    assertFalse(index.ConstraintIndex);
                    assertTrue(index.MultiTokenIndex);
                    assertTrue(index.CompositeIndex);
                    if (index.NodeIndex)
                    {
                        assertFalse(index.RelationshipIndex);
                        assertThat(index.Labels, containsInAnyOrder(Label.label("Label1"), Label.label("Label2")));
                        try
                        {
                            index.Label;
                            fail("index.getLabel() on multi-token IndexDefinition should have thrown.");
                        }
                        catch (System.InvalidOperationException)
                        {
                        }
                        try
                        {
                            index.RelationshipTypes;
                            fail("index.getRelationshipTypes() on node IndexDefinition should have thrown.");
                        }
                        catch (System.InvalidOperationException)
                        {
                        }
                    }
                    else
                    {
                        assertTrue(index.RelationshipIndex);
                        assertThat(index.RelationshipTypes, containsInAnyOrder(RelationshipType.withName("RelType1"), RelationshipType.withName("RelType2")));
                        try
                        {
                            index.RelationshipType;
                            fail("index.getRelationshipType() on multi-token IndexDefinition should have thrown.");
                        }
                        catch (System.InvalidOperationException)
                        {
                        }
                        try
                        {
                            index.Labels;
                            fail("index.getLabels() on node IndexDefinition should have thrown.");
                        }
                        catch (System.InvalidOperationException)
                        {
                        }
                    }
                }
                tx.Success();
            }
        }