Package com.tinkerpop.gremlin.driver.message

Examples of com.tinkerpop.gremlin.driver.message.ResponseMessage$Builder


        assertEquals((short) 100, result.get(Short.class).shortValue());
    }

    @Test
    public void shouldGetLong() {
        final ResponseMessage msg = ResponseMessage.build(id).result(100l).create();
        final Result result = new Result(msg);

        assertEquals((long) 100, result.getLong());
        assertEquals((long) 100, result.get(Long.class).longValue());
    }
View Full Code Here


        assertEquals((long) 100, result.get(Long.class).longValue());
    }

    @Test
    public void shouldGetFloat() {
        final ResponseMessage msg = ResponseMessage.build(id).result(100.001f).create();
        final Result result = new Result(msg);

        assertEquals(100.001f, result.getFloat(), 0.0001f);
        assertEquals(100.001f, result.get(Float.class).floatValue(), 0.0001f);
    }
View Full Code Here

        map.put("x", 1);
        map.put("y", "some");
        map.put("z", innerMap);

        final ResponseMessage response = convert(map);
        assertCommon(response);

        final Map<String, Object> deserializedMap = (Map<String, Object>) response.getResult().getData();
        assertEquals(3, deserializedMap.size());
        assertEquals(1, deserializedMap.get("x"));
        assertEquals("some", deserializedMap.get("y"));

        final Map<String, String> deserializedInnerMap = (Map<String, String>) deserializedMap.get("z");
View Full Code Here

        final Edge e = v1.addEdge("test", v2);
        e.property("abc", 123);

        final Iterable<Edge> iterable = g.E().toList();

        final ResponseMessage response = convert(iterable);
        assertCommon(response);

        final List<DetachedEdge> edgeList = (List<DetachedEdge>) response.getResult().getData();
        assertEquals(1, edgeList.size());

        final DetachedEdge deserializedEdge = edgeList.get(0);
        assertEquals(2l, deserializedEdge.id());
        assertEquals("test", deserializedEdge.label());
View Full Code Here

        assertEquals(100.001f, result.get(Float.class).floatValue(), 0.0001f);
    }

    @Test
    public void shouldGetDouble() {
        final ResponseMessage msg = ResponseMessage.build(id).result(100.001d).create();
        final Result result = new Result(msg);

        assertEquals(100.001d, result.getDouble(), 0.0001d);
        assertEquals(100.001d, result.get(Double.class), 0.0001d);
    }
View Full Code Here

        v.property("friends", friends);

        final List list = g.V().toList();

        final ResponseMessage response = convert(list);
        assertCommon(response);

        final List<DetachedVertex> vertexList = (List<DetachedVertex>) response.getResult().getData();
        assertEquals(1, vertexList.size());

        final DetachedVertex deserializedVertex = vertexList.get(0);
        assertEquals(0l, deserializedVertex.id());
        assertEquals(Vertex.DEFAULT_LABEL, deserializedVertex.label());
View Full Code Here

        assertEquals(100.001d, result.get(Double.class), 0.0001d);
    }

    @Test
    public void shouldGetBoolean() {
        final ResponseMessage msg = ResponseMessage.build(id).result(true).create();
        final Result result = new Result(msg);

        assertEquals(true, result.getBoolean());
        assertEquals(true, result.get(Boolean.class));
    }
View Full Code Here

    }

    @Test
    public void shouldGetVertex() {
        final Vertex v = g.v(1);
        final ResponseMessage msg = ResponseMessage.build(id).result(v).create();
        final Result result = new Result(msg);

        assertEquals(v, result.getVertex());
        assertEquals(v, result.get(Vertex.class));
        assertEquals(v, result.getElement());
View Full Code Here

    public void serializeToMapWithElementForKey() throws Exception {
        final TinkerGraph g = TinkerFactory.createClassic();
        final Map<Vertex, Integer> map = new HashMap<>();
        map.put(g.V().<Vertex>has("name", Compare.eq, "marko").next(), 1000);

        final ResponseMessage response = convert(map);
        assertCommon(response);

        final Map<Vertex, Integer> deserializedMap = (Map<Vertex, Integer>) response.getResult().getData();
        assertEquals(1, deserializedMap.size());

        final Vertex deserializedMarko = deserializedMap.keySet().iterator().next();
        assertEquals("marko", deserializedMarko.iterators().valueIterator("name").next().toString());
        assertEquals(1, deserializedMarko.id());
View Full Code Here

    }

    @Test
    public void shouldGetEdge() {
        final Edge e = g.e(11);
        final ResponseMessage msg = ResponseMessage.build(id).result(e).create();
        final Result result = new Result(msg);

        assertEquals(e, result.getEdge());
        assertEquals(e, result.get(Edge.class));
        assertEquals(e, result.getElement());
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.driver.message.ResponseMessage$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.