Examples of GraphDatabaseService


Examples of org.neo4j.graphdb.GraphDatabaseService

    }
  }

  @Nonnull
  protected String serialize( @Nonnull Serializer<T, Node, Node> serializer, @Nonnull T objectToSerialize ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    try ( Transaction tx = db.beginTx() ) {
      Node rootNode = db.createNode();
      serializer.serialize( objectToSerialize, rootNode );

      tx.success();
    }

    //Creates the cyper representation for this database
    StringWriter out = new StringWriter();
    try ( Transaction tx = db.beginTx() ) {
      final SubGraph graph = DatabaseSubGraph.from( db );
      new SubGraphExporter( graph ).export( new PrintWriter( out ) );
      tx.success();
    }
    return out.toString();
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  @Override
  public Statement apply( final Statement base, Description description ) {
    return tmp.apply( new Statement() {
      @Override
      public void evaluate() throws Throwable {
        GraphDatabaseService db = createDb();
        try {
          base.evaluate();
        } catch ( Throwable e ) {
          dump(db);
          throw e;
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  @Nonnull
  private final List<GraphDatabaseService> dbs = new ArrayList<>();

  @Nonnull
  public GraphDatabaseService createDb() throws IOException {
    GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase( tmp.newFolder().getAbsolutePath() );
    dbs.add( db );
    return db;
  }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  }


  public void test00DbAvailable() {

    GraphDatabaseService graphDb = app.getGraphDatabaseService();

    assertTrue(graphDb != null);

  }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  }


  public void test00DbAvailable() {

    GraphDatabaseService graphDb = app.getGraphDatabaseService();

    assertTrue(graphDb != null);
  }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  public void testBulkCreateLabelsCommand() {

    try {

      final GraphDatabaseService graphDb = app.getGraphDatabaseService();
      final Set<Label> expectedLabels    = new LinkedHashSet<>();

      expectedLabels.add(DynamicLabel.label("Principal"));
      expectedLabels.add(DynamicLabel.label("Group"));
      expectedLabels.add(DynamicLabel.label("AccessControllable"));
      expectedLabels.add(DynamicLabel.label("AbstractUser"));

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();

          // set ID and type so that the rebuild index command identifies it as a Structr node.
          test.setProperty("type", "Group");
          test.setProperty("id", UUID.randomUUID().toString().replace("-", ""));
        }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  public void testBulkRebuildIndexCommand() {

    try {

      final GraphDatabaseService graphDb = app.getGraphDatabaseService();

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();

          // set ID and type so that the rebuild index command identifies it as a Structr node.
          test.setProperty("type", "TestOne");
          test.setProperty("id", UUID.randomUUID().toString().replace("-", ""));
        }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

        tx.success();
      }

      assertNotNull(rel);

      GraphDatabaseService graphDb      = graphDbCommand.execute();
      ExecutionEngine engine            = (ExecutionEngine) new ExecutionEngine(graphDb);
     
      try (final Tx tx = app.tx()) {
       
        ExecutionResult result            = engine.execute("start n = node(*) match (n)<-[r:ONE_TO_ONE]-() return r");
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  //~--- methods --------------------------------------------------------

  public void test00DbAvailable() {

    GraphDatabaseService graphDb = graphDbCommand.execute();

    assertTrue(graphDb != null);
  }
View Full Code Here

Examples of org.neo4j.graphdb.GraphDatabaseService

  }

  @Override
  public void execute(final Map<String, Object> map) throws FrameworkException {

    final GraphDatabaseService graphDb   = (GraphDatabaseService)arguments.get("graphDb");
    final RelationshipFactory relFactory = new RelationshipFactory(securityContext);

    if (graphDb != null) {

      // collect relationships in transactional context
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.