public override AnyValue MapSequence(SequenceValue value) { IList <AnyValue> list = new List <AnyValue>(value.Length()); value.forEach(v => list.Add(v.map(this))); return(VirtualValues.fromList(list)); }
public static AnyValue Convert(IEnumerable <Notification> notifications) { IList <AnyValue> @out = new List <AnyValue>(); foreach (Notification notification in notifications) { InputPosition pos = notification.Position; // position is optional bool includePosition = !pos.Equals(InputPosition.empty); int size = includePosition ? 5 : 4; MapValueBuilder builder = new MapValueBuilder(size); builder.Add("code", stringValue(notification.Code)); builder.Add("title", stringValue(notification.Title)); builder.Add("description", stringValue(notification.Description)); builder.Add("severity", stringValue(notification.Severity.ToString())); if (includePosition) { // only add the position if it is not empty builder.Add("position", VirtualValues.map(new string[] { "offset", "line", "column" }, new AnyValue[] { intValue(pos.Offset), intValue(pos.Line), intValue(pos.Column) })); } @out.Add(builder.Build()); } return(VirtualValues.fromList(@out)); }
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)); }
public static ListValue Range(AnyValue startValue, AnyValue endValue, AnyValue stepValue) { long step = AsLong(stepValue); if (step == 0L) { throw new InvalidArgumentException("step argument to range() cannot be zero", null); } return(VirtualValues.range(AsLong(startValue), AsLong(endValue), step)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleNodes() public virtual void ShouldHandleNodes() { // Given NodeValue nodeValue = nodeValue(42L, stringArray("L"), EMPTY_MAP); // When nodeValue.WriteTo(_converter); // Then assertThat(_converter.value(), equalTo(VirtualValues.node(42L))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleRelationships() public virtual void ShouldHandleRelationships() { // Given RelationshipValue relValue = relationshipValue(1L, nodeValue(42L, stringArray("L"), EMPTY_MAP), nodeValue(42L, stringArray("L"), EMPTY_MAP), stringValue("R"), EMPTY_MAP); // When relValue.WriteTo(_converter); // Then assertThat(_converter.value(), equalTo(VirtualValues.relationship(1L))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.util.List<LockOperationRecord> traceQueryLocks(String query, LockOperationListener... listeners) throws org.neo4j.kernel.impl.query.QueryExecutionKernelException private IList <LockOperationRecord> TraceQueryLocks(string query, params LockOperationListener[] listeners) { GraphDatabaseQueryService graph = DatabaseRule.resolveDependency(typeof(GraphDatabaseQueryService)); QueryExecutionEngine executionEngine = DatabaseRule.resolveDependency(typeof(QueryExecutionEngine)); using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED)) { TransactionalContextWrapper context = new TransactionalContextWrapper(CreateTransactionContext(graph, tx, query), listeners); executionEngine.ExecuteQuery(query, VirtualValues.emptyMap(), context); return(new List <LockOperationRecord>(context.RecordingLocks.LockOperationRecords)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTreatCharArrayAsListOfStrings() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTreatCharArrayAsListOfStrings() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.pack(charArray(new char[] { 'W', 'H', 'Y' })); object unpacked = unpacked(output.Bytes()); // Then assertThat(unpacked, instanceOf(typeof(ListValue))); assertThat(unpacked, equalTo(VirtualValues.list(stringValue("W"), stringValue("H"), stringValue("Y")))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleMaps() internal virtual void ShouldHandleMaps() { // Given IDictionary <string, object> map = MapUtil.map("a", Arrays.asList("foo", 42)); // When AnyValue anyValue = ValueUtils.of(map); // Then assertThat(anyValue, instanceOf(typeof(MapValue))); MapValue mapValue = ( MapValue )anyValue; assertThat(mapValue.Get("a"), equalTo(VirtualValues.list(stringValue("foo"), intValue(42)))); assertThat(mapValue.Size(), equalTo(1)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void testUnpackableStructParametersWithKnownType(org.neo4j.bolt.messaging.Neo4jPack packerForSerialization, org.neo4j.values.AnyValue parameterValue, String expectedMessage) throws Exception private void TestUnpackableStructParametersWithKnownType(Neo4jPack packerForSerialization, AnyValue parameterValue, string expectedMessage) { string statement = "RETURN $x"; MapValue parameters = VirtualValues.map(new string[] { "x" }, new AnyValue[] { parameterValue }); BoltStateMachine stateMachine = mock(typeof(BoltStateMachine)); SynchronousBoltConnection connection = new SynchronousBoltConnection(stateMachine); _channel = new EmbeddedChannel(NewDecoder(connection)); _channel.writeInbound(Unpooled.wrappedBuffer(serialize(packerForSerialization, new RunMessage(statement, parameters)))); _channel.finishAndReleaseAll(); verify(stateMachine).handleExternalFailure(eq(Neo4jError.from(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.TypeError, expectedMessage)), any()); }
private static ListValue FastListConversion(AnyValue value) { if (value is ListValue) { return(( ListValue )value); } else if (value is ArrayValue) { return(VirtualValues.fromArray(( ArrayValue )value)); } else if (value is PathValue) { return((( PathValue )value).asList()); } throw CantCoerce(value, "List"); }
public override ListValue Split(string separator) { Debug.Assert(!string.ReferenceEquals(separator, null)); string asString = Value(); //Cypher has different semantics for the case where the separator //is exactly the value, in cypher we expect two empty arrays //where as java returns an empty array if (separator.Equals(asString)) { return(EmptySplit); } else if (separator.Length == 0) { return(VirtualValues.fromArray(Values.CharArray(asString.ToCharArray()))); } IList <AnyValue> split = SplitNonRegex(asString, separator); return(VirtualValues.fromList(split)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: org.neo4j.values.virtual.ListValue unpackList() throws java.io.IOException internal virtual ListValue UnpackList() { int size = ( int )UnpackListHeader(); if (size == 0) { return(VirtualValues.EMPTY_LIST); } else if (size == UNKNOWN_SIZE) { IList <AnyValue> list = new List <AnyValue>(); bool more = true; while (more) { PackType keyType = PeekNextType(); switch (keyType) { case PackType.END_OF_STREAM: Unpack(); more = false; break; default: list.Add(Unpack()); break; } } return(VirtualValues.list(list.ToArray())); } else { AnyValue[] values = new AnyValue[size]; for (int i = 0; i < size; i++) { values[i] = Unpack(); } return(VirtualValues.list(values)); } }
public override ListValue Apply(AnyValue value, Neo4jTypes.AnyType innerType, DbAccess access) { //Fast route if (innerType == NTAny) { return(FastListConversion(value)); } //slow route, recursively convert the list if (!(value is SequenceValue)) { throw CantCoerce(value, "List"); } SequenceValue listValue = ( SequenceValue )value; Coercer innerCoercer = _converters[innerType.GetType()]; AnyValue[] coercedValues = new AnyValue[listValue.Length()]; Neo4jTypes.AnyType nextInner = nextInner(innerType); if (listValue.IterationPreference() == RANDOM_ACCESS) { for (int i = 0; i < coercedValues.Length; i++) { AnyValue nextItem = listValue.Value(i); coercedValues[i] = nextItem == NO_VALUE ? NO_VALUE : innerCoercer(nextItem, nextInner, access); } } else { int i = 0; foreach (AnyValue anyValue in listValue) { AnyValue nextItem = listValue.Value(i); coercedValues[i++] = nextItem == NO_VALUE ? NO_VALUE : innerCoercer(anyValue, nextInner, access); } } return(VirtualValues.list(coercedValues)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSerializeRelationship() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSerializeRelationship() { RelationshipValue rel = relationshipValue(12L, nodeValue(1L, stringArray(), VirtualValues.EMPTY_MAP), nodeValue(2L, stringArray(), VirtualValues.EMPTY_MAP), stringValue("KNOWS"), VirtualValues.map(new string[] { "name", "age" }, new AnyValue[] { stringValue("Bob"), intValue(14) })); assertThat(Serialized(rel), equalTo("B1 71 91 B5 52 0C 01 02 85 4B 4E 4F 57 53 A2 84" + lineSeparator() + "6E 61 6D 65 83 42 6F 62 83 61 67 65 0E")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSerializeNode() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSerializeNode() { NodeValue nodeValue = nodeValue(12L, stringArray("User", "Banana"), VirtualValues.map(new string[] { "name", "age" }, new AnyValue[] { stringValue("Bob"), intValue(14) })); assertThat(Serialized(nodeValue), equalTo("B1 71 91 B3 4E 0C 92 84 55 73 65 72 86 42 61 6E" + lineSeparator() + "61 6E 61 A2 84 6E 61 6D 65 83 42 6F 62 83 61 67" + lineSeparator() + "65 0E")); }
/// <summary> /// Utility function for doing addition /// </summary> public static object Add(object lhs, object rhs) { if (lhs == null || rhs == null || lhs == Values.NO_VALUE || rhs == Values.NO_VALUE) { return(null); } //List addition bool lhsIsListValue = lhs is ListValue; if (lhsIsListValue && rhs is ListValue) { return(VirtualValues.concat(( ListValue )lhs, ( ListValue )rhs)); } else if (lhsIsListValue) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: if (rhs instanceof java.util.List<?>) if (rhs is IList <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: return org.neo4j.values.virtual.VirtualValues.concat((org.neo4j.values.virtual.ListValue) lhs, org.neo4j.kernel.impl.util.ValueUtils.asListValue((java.util.List<?>) rhs)); return(VirtualValues.concat(( ListValue )lhs, ValueUtils.asListValue((IList <object>)rhs))); } else if (rhs is AnyValue) { return((( ListValue )lhs).append(( AnyValue )rhs)); } else { return((( ListValue )lhs).append(ValueUtils.of(rhs))); } } else if (rhs is ListValue) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: if (lhs instanceof java.util.List<?>) if (lhs is IList <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: return org.neo4j.values.virtual.VirtualValues.concat(org.neo4j.kernel.impl.util.ValueUtils.asListValue((java.util.List<?>) lhs), (org.neo4j.values.virtual.ListValue) rhs); return(VirtualValues.concat(ValueUtils.asListValue((IList <object>)lhs), ( ListValue )rhs)); } else if (lhs is AnyValue) { return((( ListValue )rhs).prepend(( AnyValue )lhs)); } else { return((( ListValue )rhs).prepend(ValueUtils.of(lhs))); } } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: else if (lhs instanceof java.util.List<?> && rhs instanceof java.util.List<?>) else if (lhs is IList <object> && rhs is IList <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<?> lhsList = (java.util.List<?>) lhs; IList <object> lhsList = (IList <object>)lhs; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<?> rhsList = (java.util.List<?>) rhs; IList <object> rhsList = (IList <object>)rhs; IList <object> result = new List <object>(lhsList.Count + rhsList.Count); ((IList <object>)result).AddRange(lhsList); ((IList <object>)result).AddRange(rhsList); return(result); } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: else if (lhs instanceof java.util.List<?>) else if (lhs is IList <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<?> lhsList = (java.util.List<?>) lhs; IList <object> lhsList = (IList <object>)lhs; IList <object> result = new List <object>(lhsList.Count + 1); ((IList <object>)result).AddRange(lhsList); result.Add(rhs); return(result); } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: else if (rhs instanceof java.util.List<?>) else if (rhs is IList <object> ) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<?> rhsList = (java.util.List<?>) rhs; IList <object> rhsList = (IList <object>)rhs; IList <object> result = new List <object>(rhsList.Count + 1); result.Add(lhs); ((IList <object>)result).AddRange(rhsList); return(result); } // String addition if (lhs is TextValue) { lhs = (( TextValue )lhs).stringValue(); } if (rhs is TextValue) { rhs = (( TextValue )rhs).stringValue(); } if (lhs is string) { if (rhs is Value) { // Unfortunately string concatenation is not defined for temporal and spatial types, so we need to exclude them if (!(rhs is TemporalValue || rhs is DurationValue || rhs is PointValue)) { return(lhs.ToString() + ((Value)rhs).prettyPrint()); } } else { return(lhs.ToString() + rhs.ToString()); } } if (rhs is string) { if (lhs is Value) { // Unfortunately string concatenation is not defined for temporal and spatial types, so we need to exclude them if (!(lhs is TemporalValue || lhs is DurationValue || lhs is PointValue)) { return((( Value )lhs).prettyPrint() + rhs.ToString()); } } else { return(lhs.ToString() + rhs.ToString()); } } // array addition // Extract arrays from ArrayValues if (lhs is ArrayValue) { lhs = (( ArrayValue )lhs).asObject(); } if (rhs is ArrayValue) { rhs = (( ArrayValue )rhs).asObject(); } Type lhsClass = lhs.GetType(); Type rhsClass = rhs.GetType(); if (lhsClass.IsArray && rhsClass.IsArray) { return(AddArrays(lhs, rhs)); } else if (lhsClass.IsArray) { return(AddArrayWithObject(lhs, rhs)); } else if (rhsClass.IsArray) { return(AddObjectWithArray(lhs, rhs)); } // Handle NumberValues if (lhs is NumberValue && rhs is NumberValue) { return((( NumberValue )lhs).plus(( NumberValue )rhs)); } if (lhs is NumberValue) { lhs = (( NumberValue )lhs).asObject(); } if (rhs is NumberValue) { rhs = (( NumberValue )rhs).asObject(); } if (lhs is Number) { if (rhs is Number) { if (lhs is double? || rhs is double? || lhs is float? || rhs is float?) { return((( Number )lhs).doubleValue() + ((Number)rhs).doubleValue()); } if (lhs is long? || rhs is long? || lhs is int? || rhs is int? || lhs is short? || rhs is short? || lhs is sbyte? || rhs is sbyte?) { return(Math.addExact((( Number )lhs).longValue(), ((Number)rhs).longValue())); // Remap java.lang.ArithmeticException later instead of: //catch ( java.lang.ArithmeticException e ) //{ // throw new ArithmeticException( // String.format( "result of %d + %d cannot be represented as an integer", // ((Number) lhs).longValue(), ((Number) rhs).longValue() ), e ); //} } } // other numbers we cannot add } // Temporal values if (lhs is TemporalValue) { if (rhs is DurationValue) { return((( TemporalValue )lhs).plus(( DurationValue )rhs)); } } if (lhs is DurationValue) { if (rhs is TemporalValue) { return((( TemporalValue )rhs).plus(( DurationValue )lhs)); } if (rhs is DurationValue) { return((( DurationValue )lhs).add(( DurationValue )rhs)); } } AnyValue lhsValue = lhs is AnyValue ? ( AnyValue )lhs : Values.of(lhs); AnyValue rhsValue = rhs is AnyValue ? ( AnyValue )rhs : Values.of(rhs); throw new CypherTypeException(string.Format("Cannot add `{0}` and `{1}`", lhsValue.TypeName, rhsValue.TypeName), null); }
public override void WriteRelationship(long relId, long startNodeId, long endNodeId, TextValue type, MapValue properties) { WriteValue(VirtualValues.relationship(relId)); }
public override void WriteNode(long nodeId, TextArray ignore, MapValue properties) { WriteValue(VirtualValues.node(nodeId)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings({"unchecked", "WeakerAccess"}) public static org.neo4j.values.AnyValue materializeAnyResult(org.neo4j.kernel.impl.core.EmbeddedProxySPI proxySpi, Object anyValue) public static AnyValue MaterializeAnyResult(EmbeddedProxySPI proxySpi, object anyValue) { if (anyValue == null || anyValue == NO_VALUE) { return(NO_VALUE); } else if (anyValue is AnyValue) { return(MaterializeAnyValueResult(proxySpi, anyValue)); } else if (anyValue is System.Collections.IList) { return(VirtualValues.fromList((IList <AnyValue>)(((System.Collections.IList)anyValue).Select(v => MaterializeAnyResult(proxySpi, v)).ToList()))); } else if (anyValue is System.Collections.IDictionary) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<String,?> incoming = (java.util.Map<String,?>) anyValue; IDictionary <string, ?> incoming = (IDictionary <string, ?>)anyValue; MapValueBuilder builder = new MapValueBuilder(incoming.Count); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (java.util.Map.Entry<String,?> entry : incoming.entrySet()) foreach (KeyValuePair <string, ?> entry in incoming.SetOfKeyValuePairs()) { builder.Add(entry.Key, MaterializeAnyResult(proxySpi, entry.Value)); } return(builder.Build()); } else if (anyValue is PrimitiveNodeStream) { return(VirtualValues.fromList((( PrimitiveNodeStream )anyValue).LongStream().mapToObj(id => (AnyValue)ValueUtils.fromNodeProxy(proxySpi.NewNodeProxy(id))).collect(Collectors.toList()))); } else if (anyValue is PrimitiveRelationshipStream) { return(VirtualValues.fromList((( PrimitiveRelationshipStream )anyValue).LongStream().mapToObj(id => (AnyValue)ValueUtils.fromRelationshipProxy(proxySpi.NewRelationshipProxy(id))).collect(Collectors.toList()))); } else if (anyValue is LongStream) { long[] array = (( LongStream )anyValue).toArray(); return(Values.longArray(array)); } else if (anyValue is DoubleStream) { double[] array = (( DoubleStream )anyValue).toArray(); return(Values.doubleArray(array)); } else if (anyValue is IntStream) { // IntStream is only used for list of primitive booleans return(VirtualValues.fromList((( IntStream )anyValue).mapToObj(i => Values.booleanValue(i != 0)).collect(Collectors.toList()))); } else if (anyValue.GetType().IsArray) { Type componentType = anyValue.GetType().GetElementType(); int length = Array.getLength(anyValue); if (componentType.IsPrimitive) { object copy = Array.CreateInstance(componentType, length); //noinspection SuspiciousSystemArraycopy Array.Copy(anyValue, 0, copy, 0, length); return(ValueUtils.of(copy)); } else if (anyValue is string[]) { return(Values.stringArray(( string[] )anyValue)); } else { AnyValue[] copy = new AnyValue[length]; for (int i = 0; i < length; i++) { copy[i] = MaterializeAnyResult(proxySpi, Array.get(anyValue, i)); } return(VirtualValues.list(copy)); } } else { return(ValueUtils.of(anyValue)); } }
//TODO this is horrible spaghetti code, we should push most of this down to AnyValue public static AnyValue Add(AnyValue lhs, AnyValue rhs) { if (lhs is NumberValue && rhs is NumberValue) { return((( NumberValue )lhs).plus(( NumberValue )rhs)); } //List addition //arrays are same as lists when it comes to addition if (lhs is ArrayValue) { lhs = VirtualValues.fromArray(( ArrayValue )lhs); } if (rhs is ArrayValue) { rhs = VirtualValues.fromArray(( ArrayValue )rhs); } bool lhsIsListValue = lhs is ListValue; if (lhsIsListValue && rhs is ListValue) { return(VirtualValues.concat(( ListValue )lhs, ( ListValue )rhs)); } else if (lhsIsListValue) { return((( ListValue )lhs).append(rhs)); } else if (rhs is ListValue) { return((( ListValue )rhs).prepend(lhs)); } // String addition if (lhs is TextValue && rhs is TextValue) { return((( TextValue )lhs).plus(( TextValue )rhs)); } else if (lhs is TextValue) { if (rhs is Value) { // Unfortunately string concatenation is not defined for temporal and spatial types, so we need to // exclude them if (!(rhs is TemporalValue || rhs is DurationValue || rhs is PointValue)) { return(stringValue((( TextValue )lhs).stringValue() + ((Value)rhs).prettyPrint())); } else { return(stringValue((( TextValue )lhs).stringValue() + rhs.ToString())); } } } else if (rhs is TextValue) { if (lhs is Value) { // Unfortunately string concatenation is not defined for temporal and spatial types, so we need to // exclude them if (!(lhs is TemporalValue || lhs is DurationValue || lhs is PointValue)) { return(stringValue((( Value )lhs).prettyPrint() + ((TextValue)rhs).stringValue())); } else { return(stringValue(lhs.ToString() + ((TextValue)rhs).stringValue())); } } } // Temporal values if (lhs is TemporalValue) { if (rhs is DurationValue) { return((( TemporalValue )lhs).plus(( DurationValue )rhs)); } } if (lhs is DurationValue) { if (rhs is TemporalValue) { return((( TemporalValue )rhs).plus(( DurationValue )lhs)); } if (rhs is DurationValue) { return((( DurationValue )lhs).add(( DurationValue )rhs)); } } throw new CypherTypeException(string.Format("Cannot add `{0}` and `{1}`", lhs.TypeName, rhs.TypeName), null); }
private MapValue SingletonMap(string key, object value) { return(VirtualValues.map(new string[] { key }, new AnyValue[] { ValueUtils.of(value) })); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProduceSensibleMapRepresentationInWaitingOnQueryState() public virtual void ShouldProduceSensibleMapRepresentationInWaitingOnQueryState() { // given WaitingOnQuery status = new WaitingOnQuery(new ExecutingQuery(12, null, null, "", VirtualValues.emptyMap(), null, () => 0, PageCursorTracer.NULL, Thread.CurrentThread.Id, Thread.CurrentThread.Name, _clock, FakeCpuClock.NOT_AVAILABLE, HeapAllocation.NOT_AVAILABLE), _clock.nanos()); _clock.forward(1025, TimeUnit.MILLISECONDS); // when IDictionary <string, object> statusMap = status.ToMap(_clock.nanos()); // then assertEquals("waiting", status.Name()); IDictionary <string, object> expected = new Dictionary <string, object>(); expected["waitTimeMillis"] = 1025L; expected["queryId"] = "query-12"; assertEquals(expected, statusMap); }
public static ListValue Range(AnyValue startValue, AnyValue endValue) { return(VirtualValues.range(AsLong(startValue), AsLong(endValue), 1L)); }
public override void WriteNodeReference(long nodeId) { WriteValue(VirtualValues.node(nodeId)); }
public override void WriteRelationshipReference(long relId) { WriteValue(VirtualValues.relationship(relId)); }