Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void accept(final org.neo4j.bolt.runtime.BoltResult_Visitor visitor) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public override void Accept(Org.Neo4j.Bolt.runtime.BoltResult_Visitor visitor)
        {
            long start = _clock.millis();

            @delegate.Accept(row =>
            {
                visitor.Visit(row);
                return(true);
            });
            AddRecordStreamingTime(visitor, _clock.millis() - start);
            QueryExecutionType qt = @delegate.ExecutionType();

            visitor.AddMetadata("type", Values.stringValue(QueryTypeCode(qt.QueryType())));

            if (@delegate.QueryStatistics().containsUpdates())
            {
                MapValue stats = QueryStats(@delegate.QueryStatistics());
                visitor.AddMetadata("stats", stats);
            }
            if (qt.RequestedExecutionPlanDescription())
            {
                ExecutionPlanDescription rootPlanTreeNode = @delegate.ExecutionPlanDescription();
                string metadataFieldName = rootPlanTreeNode.HasProfilerStatistics() ? "profile" : "plan";
                visitor.AddMetadata(metadataFieldName, ExecutionPlanConverter.Convert(rootPlanTreeNode));
            }

            IEnumerable <Notification> notifications = @delegate.Notifications;

            if (notifications.GetEnumerator().hasNext())
            {
                visitor.AddMetadata("notifications", NotificationConverter.Convert(notifications));
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void profileStatisticConversion()
        public virtual void ProfileStatisticConversion()
        {
            MapValue convertedMap = ExecutionPlanConverter.Convert(new TestExecutionPlanDescription(this, "description", ProfilerStatistics, Identifiers, Arguments));

            assertEquals(convertedMap.Get("operatorType"), stringValue("description"));
            assertEquals(convertedMap.Get("args"), ValueUtils.asMapValue(Arguments));
            assertEquals(convertedMap.Get("identifiers"), ValueUtils.asListValue(Identifiers));
            assertEquals(convertedMap.Get("children"), VirtualValues.EMPTY_LIST);
            assertEquals(convertedMap.Get("rows"), longValue(1L));
            assertEquals(convertedMap.Get("dbHits"), longValue(2L));
            assertEquals(convertedMap.Get("pageCacheHits"), longValue(3L));
            assertEquals(convertedMap.Get("pageCacheMisses"), longValue(2L));
            assertEquals((( DoubleValue )convertedMap.Get("pageCacheHitRatio")).doubleValue(), 3.0 / 5, 0.0001);
            assertEquals(convertedMap.Size(), 9);
        }