Package com.tinkerpop.blueprints

Examples of com.tinkerpop.blueprints.Graph


        assertNull(marko.getAge());
    }

    @Test
    public void testSetPropertiesToNull() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);

        Person marko = framedGraph.getVertex(1, Person.class);
        assertEquals(marko.getAge(), new Integer(29));
        marko.setAge(null);
View Full Code Here


        assertNull(marko.getAge());
    }

    @Test
    public void testEnumProperty() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);

        Person marko = framedGraph.getVertex(1, Person.class);
        assertEquals(marko.getGender(), null);
        marko.setGender(Person.Gender.MALE);
View Full Code Here

        assertEquals(marko.getGender(), null);
    }

    @Test
    public void testToString() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);

        Person marko = framedGraph.getVertex(1, Person.class);
        assertEquals("v[1]", marko.toString());
View Full Code Here

    }
   
    @Test(expected=UnhandledMethodException.class)
    public void testUnhandledMethodNoAnnotation() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);

        Person marko = framedGraph.getVertex(1, Person.class);     
        marko.unhandledNoAnnotation();
    }
View Full Code Here

        marko.unhandledNoAnnotation();
    }
   
    @Test(expected=UnhandledMethodException.class)
    public void testUnhandledMethodWithAnnotation() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);

        Person marko = framedGraph.getVertex(1, Person.class);     
        marko.unhandledNoHandler();
    }
View Full Code Here

        @InVertex
        <T extends Base> T getInVertex();
  };

  public void testSerializeVertexType() {
    Graph graph = new TinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
        .withClass(C.class).build());
    FramedGraph<Graph> framedGraph = factory.create(graph);
    A a = framedGraph.addVertex(null, A.class);
    C c = framedGraph.addVertex(null, C.class);
View Full Code Here

    assertEquals("A", ((VertexFrame) a).asVertex().getProperty("type"));
    assertEquals("C", ((VertexFrame) c).asVertex().getProperty("type"));
  }

  public void testDeserializeVertexType() {
    Graph graph = new TinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
        .withClass(C.class).build());
    FramedGraph<Graph> framedGraph = factory.create(graph);
    Vertex cV = graph.addVertex(null);
    cV.setProperty("type", "C");
    cV.setProperty("label", "C Label");

    Base c = framedGraph.getVertex(cV.getId(), Base.class);
    assertTrue(c instanceof C);
View Full Code Here

    ((C) c).setLabel("new label");
    assertEquals("new label", cV.getProperty("label"));
  }

  public void testSerializeEdgeType() {
    Graph graph = new TinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
        .withClass(C.class).build());
    FramedGraph<Graph> framedGraph = factory.create(graph);
    Vertex v1 = graph.addVertex(null);
    Vertex v2 = graph.addVertex(null);
    A a = framedGraph.addEdge(null, v1, v2, "label", Direction.OUT, A.class);
    C c = framedGraph.addEdge(null, v1, v2, "label", Direction.OUT, C.class);
    assertEquals("A", ((EdgeFrame) a).asEdge().getProperty("type"));
    assertEquals("C", ((EdgeFrame) c).asEdge().getProperty("type"));
  }
View Full Code Here

    assertEquals("A", ((EdgeFrame) a).asEdge().getProperty("type"));
    assertEquals("C", ((EdgeFrame) c).asEdge().getProperty("type"));
  }

  public void testDeserializeEdgeType() {
    Graph graph = new TinkerGraph();
    FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
        .withClass(C.class).build());
    FramedGraph<Graph> framedGraph = factory.create(graph);
    Vertex v1 = graph.addVertex(null);
    Vertex v2 = graph.addVertex(null);
    Edge cE = graph.addEdge(null, v1, v2, "label");
    cE.setProperty("type", "C");
    Base c = framedGraph.getEdge(cE.getId(), Direction.OUT, Base.class);
    assertTrue(c instanceof C);
  }
View Full Code Here

    Base c = framedGraph.getEdge(cE.getId(), Direction.OUT, Base.class);
    assertTrue(c instanceof C);
  }

    public void testWildcard() {
        Graph graph = new TinkerGraph();
        FramedGraphFactory factory = new FramedGraphFactory(new TypedGraphModuleBuilder().withClass(A.class).withClass(B.class)
                .withClass(C.class).build());
        FramedGraph<Graph> framedGraph = factory.create(graph);
        Vertex v1 = graph.addVertex(null);

        Vertex v2 = graph.addVertex(null);
        v2.setProperty("type", "A");
        Edge cE = graph.addEdge(null, v1, v2, "label");
        cE.setProperty("type", "C");
        Base c = framedGraph.getEdge(cE.getId(), Direction.OUT, Base.class);
        assertTrue(c instanceof C);
        assertTrue(((C) c).getInVertex() instanceof A);
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.Graph

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.