Package com.tinkerpop.blueprints.impls.tg

Examples of com.tinkerpop.blueprints.impls.tg.TinkerGraph


        }

        try {
            if (graphFile == null || graphFile.length() == 0) {
                // pure in memory if graph file is specified
                return mockTx ? new MockTinkerTransactionalGraph() : new TinkerGraph();
            } else {
                return mockTx ? new MockTinkerTransactionalGraph(graphFile, getFileType(fileType)) : new TinkerGraph(graphFile, getFileType(fileType));
            }
        } catch (Exception ex) {
            throw new GraphConfigurationException(ex);
        }
    }
View Full Code Here


        Assert.assertEquals("y2", mapY.get("col2"));
    }

    @Test
    public void convertElements() throws Exception {
        TinkerGraph g = TinkerGraphFactory.createTinkerGraph();

        final Object unpacked = serializeAndDeserialize(g.getVertices());

        Assert.assertTrue(unpacked instanceof Iterable);

        final Iterator unpackerItty = ((Iterable) unpacked).iterator();
View Full Code Here

        Assert.assertEquals("y2", mapY.get("col2"));
    }

    @Test
    public void convertElements() throws Exception {
        TinkerGraph g = TinkerGraphFactory.createTinkerGraph();

        BufferPacker packer = msgpack.createBufferPacker(1024);
        ResultsConverter.serializeObject(g.getVertices(), packer);
        byte[] results = packer.toByteArray();

        final Object unpacked = ResultsConverter.deserializeObject(msgpack.read(results));

        Assert.assertTrue(unpacked instanceof Iterable);
View Full Code Here

*/
public class DefaultRexsterApplicationTest {

    @Test
    public void getGraphDoesNotExistReturnsNull() {
        final TinkerGraph g = new TinkerGraph();
        final String graphName = "test";

        final RexsterApplication ra = new DefaultRexsterApplication(graphName, g);

        Assert.assertNull(ra.getGraph("not-real"));
View Full Code Here

        Assert.assertNull(ra.getGraph("not-real"));
    }

    @Test
    public void shouldConfiguredSingleGraph() {
        final TinkerGraph g = new TinkerGraph();
        final String graphName = "test";

        final RexsterApplication ra = new DefaultRexsterApplication(graphName, g);

        Assert.assertEquals(graphName, ra.getGraphNames().toArray()[0]);
View Full Code Here

    protected RexsterApplication raEmptyGraph;

    @Before
    public void init() {
        this.mockery = new JUnit4Mockery();
        this.createDefaultGraphs(TinkerGraphFactory.createTinkerGraph(), new TinkerGraph());
    }
View Full Code Here

    componentsRoot = graph.addVertex(null);
    componentsRoot.setProperty("root", "components");
  }

  public static ScanGraph create() {
    TinkerGraph graph = new TinkerGraph();
    graph.createKeyIndex("key", Vertex.class);
    return new ScanGraph(graph);
  }
View Full Code Here

import static org.mockito.Mockito.when;

public class ComponentVertexTest {
  @Test
  public void should_copy() {
    BeanGraph beanGraph = new BeanGraph(new TinkerGraph());
    ComponentVertex vertex = beanGraph.createVertex(ComponentVertex.class);
    Component file = MockSourceFile.createMain("myproject:org/Foo.java").setName("Foo.java").setQualifier(Qualifiers.FILE)
      .setPath("src/org/Foo.java");

    vertex.copyFrom(file);
View Full Code Here

    assertThat(vertex.path()).isEqualTo("src/org/Foo.java");
  }

  @Test
  public void should_copy_db_ids() {
    BeanGraph beanGraph = new BeanGraph(new TinkerGraph());
    ComponentVertex vertex = beanGraph.createVertex(ComponentVertex.class);
    ResourceComponent component = mock(ResourceComponent.class);
    when(component.resourceId()).thenReturn(123L);
    when(component.snapshotId()).thenReturn(456L);
View Full Code Here

  }

  private SnapshotGraph read(String data, String rootVertexId) {
    StringReader input = new StringReader(data);
    try {
      TinkerGraph graph = new TinkerGraph();
      new GraphsonReader().read(input, graph);
      return new SnapshotGraph(graph, rootVertexId);
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.impls.tg.TinkerGraph

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.