Search in sources :

Example 6 with NodeRepresentation

use of org.neo4j.server.rest.repr.NodeRepresentation in project neo4j by neo4j.

the class StreamingJsonFormatTest method canFormatNode.

@Test
void canFormatNode() {
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
    GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
    try (Transaction transaction = db.beginTx()) {
        final Node n = transaction.createNode();
        json.assemble(new NodeRepresentation(n));
    } finally {
        managementService.shutdown();
    }
    assertTrue(stream.toString().contains("\"self\" : \"http://localhost/node/0\","));
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) NodeRepresentation(org.neo4j.server.rest.repr.NodeRepresentation) Transaction(org.neo4j.graphdb.Transaction) Node(org.neo4j.graphdb.Node) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test)

Aggregations

NodeRepresentation (org.neo4j.server.rest.repr.NodeRepresentation)6 Node (org.neo4j.graphdb.Node)4 Transaction (org.neo4j.graphdb.Transaction)3 Map (java.util.Map)2 Path (org.neo4j.graphdb.Path)2 Relationship (org.neo4j.graphdb.Relationship)2 PathRepresentation (org.neo4j.server.rest.repr.PathRepresentation)2 RelationshipRepresentation (org.neo4j.server.rest.repr.RelationshipRepresentation)2 Test (org.junit.jupiter.api.Test)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Label (org.neo4j.graphdb.Label)1 ScoredNodeRepresentation (org.neo4j.server.rest.repr.ScoredNodeRepresentation)1 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)1