@Test public void listing3_10_node_labels() { usersAndMovies.addLabelToMovies(); try (Transaction tx = graphDb.beginTx()) { ResourceIterable<Node> movies = GlobalGraphOperations.at(graphDb).getAllNodesWithLabel(DynamicLabel.label("MOVIES")); assertEquals(3, IteratorUtil.count(movies)); tx.success(); } }
@Test public void listing3_11_node_labels_and_property() { try { usersAndMovies.addLabelToMovies(); } catch (Exception e) { // ignore if index already exist } try (Transaction tx = graphDb.beginTx()) { ResourceIterable<Node> movies = graphDb.findNodesByLabelAndProperty(DynamicLabel.label("MOVIES"), "name", "Fargo"); assertEquals(1, IteratorUtil.count(movies)); tx.success(); } }