Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.codehaus.jackson.JsonNode serialize(java.io.ByteArrayOutputStream out, org.codehaus.jackson.JsonGenerator json, ResultDataContentWriter resultDataContentWriter) throws java.io.IOException, org.neo4j.server.rest.domain.JsonParseException
        private JsonNode Serialize(MemoryStream @out, JsonGenerator json, ResultDataContentWriter resultDataContentWriter)
        {
            json.writeStartObject();
            // RETURN {one:{two:[true, {three: 42}]}}
            resultDataContentWriter.Write(json, asList("the column"), new MapRow(map("the column", map("one", map("two", asList(true, map("three", 42)))))), null);
            json.writeEndObject();
            json.flush();
            json.close();

            string jsonAsString = @out.ToString();

            return(jsonNode(jsonAsString).get("rest"));
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteNestedMaps() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWriteNestedMaps()
        {
            MemoryStream  @out = new MemoryStream();
            JsonGenerator json = (new JsonFactory(new Neo4jJsonCodec())).createJsonGenerator(@out);

            JsonNode row = Serialize(@out, json, new RowWriter());

            MatcherAssert.assertThat(row.size(), equalTo(1));
            JsonNode firstCell = row.get(0);

            MatcherAssert.assertThat(firstCell.get("one").get("two").size(), @is(2));
            MatcherAssert.assertThat(firstCell.get("one").get("two").get(0).asBoolean(), @is(true));
            MatcherAssert.assertThat(firstCell.get("one").get("two").get(1).get("three").asInt(), @is(42));
        }