//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writePlanDescriptionObjectBody(org.neo4j.graphdb.ExecutionPlanDescription planDescription) throws java.io.IOException private void WritePlanDescriptionObjectBody(ExecutionPlanDescription planDescription) { @out.writeStringField("operatorType", planDescription.Name); WritePlanArgs(planDescription); WritePlanIdentifiers(planDescription); IList <ExecutionPlanDescription> children = planDescription.Children; @out.writeArrayFieldStart("children"); try { foreach (ExecutionPlanDescription child in children) { @out.writeStartObject(); try { WritePlanDescriptionObjectBody(child); } finally { @out.writeEndObject(); } } } finally { @out.writeEndArray(); } }
//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)); } }
private ExecutionPlanDescription GetMockDescription(string name) { ExecutionPlanDescription plan = mock(typeof(ExecutionPlanDescription)); when(plan.Name).thenReturn(name); when(plan.Arguments).thenReturn(MapUtil.map("argumentKey", "argumentValue")); return(plan); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writePlanIdentifiers(org.neo4j.graphdb.ExecutionPlanDescription planDescription) throws java.io.IOException private void WritePlanIdentifiers(ExecutionPlanDescription planDescription) { @out.writeArrayFieldStart("identifiers"); foreach (string id in planDescription.Identifiers) { @out.writeString(id); } @out.writeEndArray(); }
private static ListValue Children(ExecutionPlanDescription plan) { IList <AnyValue> children = new LinkedList <AnyValue>(); foreach (ExecutionPlanDescription child in plan.Children) { children.Add(Convert(child)); } return(VirtualValues.fromList(children)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writePlanArgs(org.neo4j.graphdb.ExecutionPlanDescription planDescription) throws java.io.IOException private void WritePlanArgs(ExecutionPlanDescription planDescription) { foreach (KeyValuePair <string, object> entry in planDescription.Arguments.SetOfKeyValuePairs()) { string fieldName = entry.Key; object fieldValue = entry.Value; @out.writeFieldName(fieldName); writeValue(@out, fieldValue); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test @SuppressWarnings("unchecked") public void shouldSerializeProfilingResult() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSerializeProfilingResult() { // Given string name = "Kalle"; ExecutionPlanDescription plan = GetMockDescription(name); ExecutionPlanDescription childPlan = GetMockDescription("child"); when(plan.Children).thenReturn(asList(childPlan)); when(plan.HasProfilerStatistics()).thenReturn(true); Org.Neo4j.Graphdb.ExecutionPlanDescription_ProfilerStatistics stats = mock(typeof(Org.Neo4j.Graphdb.ExecutionPlanDescription_ProfilerStatistics)); when(stats.DbHits).thenReturn(13L); when(stats.Rows).thenReturn(25L); when(plan.ProfilerStatistics).thenReturn(stats); Result result = mock(typeof(Result)); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: when(result.HasNext()).thenReturn(false); when(result.Columns()).thenReturn(new List <>()); when(result.ExecutionPlanDescription).thenReturn(plan); // When IDictionary <string, object> serialized = SerializeToStringThenParseAsToMap(new CypherResultRepresentation(result, false, true)); // Then IDictionary <string, object> serializedPlan = (IDictionary <string, object>)serialized["plan"]; assertThat(serializedPlan["name"], equalTo(name)); assertThat(serializedPlan["rows"], @is(25)); assertThat(serializedPlan["dbHits"], @is(13)); IList <IDictionary <string, object> > children = (IList <IDictionary <string, object> >)serializedPlan["children"]; assertThat(children.Count, @is(1)); IDictionary <string, object> args = (IDictionary <string, object>)serializedPlan["args"]; assertThat(args["argumentKey"], @is("argumentValue")); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writeRootPlanDescription(org.neo4j.graphdb.ExecutionPlanDescription planDescription) throws java.io.IOException private void WriteRootPlanDescription(ExecutionPlanDescription planDescription) { @out.writeObjectFieldStart("plan"); try { @out.writeObjectFieldStart("root"); try { WritePlanDescriptionObjectBody(planDescription); } finally { @out.writeEndObject(); } } finally { @out.writeEndObject(); } }
public static MapValue Convert(ExecutionPlanDescription plan) { bool hasProfilerStatistics = plan.HasProfilerStatistics(); int size = hasProfilerStatistics ? 9 : 4; MapValueBuilder @out = new MapValueBuilder(size); @out.Add("operatorType", stringValue(plan.Name)); @out.Add("args", ValueUtils.asMapValue(plan.Arguments)); @out.Add("identifiers", ValueUtils.asListValue(plan.Identifiers)); @out.Add("children", Children(plan)); if (hasProfilerStatistics) { Org.Neo4j.Graphdb.ExecutionPlanDescription_ProfilerStatistics profile = plan.ProfilerStatistics; @out.Add("dbHits", longValue(profile.DbHits)); @out.Add("pageCacheHits", longValue(profile.PageCacheHits)); @out.Add("pageCacheMisses", longValue(profile.PageCacheMisses)); @out.Add("pageCacheHitRatio", doubleValue(profile.PageCacheHitRatio)); @out.Add("rows", longValue(profile.Rows)); } return(@out.Build()); }
public CypherPlanRepresentationAnonymousInnerClass2(ExecutionPlanDescription plan) { this._plan = plan; }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: public static CypherPlanRepresentation newFromPlan(final org.neo4j.graphdb.ExecutionPlanDescription plan) public static CypherPlanRepresentation NewFromPlan(ExecutionPlanDescription plan) { return(new CypherPlanRepresentationAnonymousInnerClass2(plan)); }