コード例 #1
0
  @Test
  public void testCreateNodeAndAddToIndex() throws Exception {
    RestIndex<Node> index =
        restAPI.createIndex(Node.class, "index", LuceneIndexImplementation.FULLTEXT_CONFIG);
    final Transaction tx = restAPI.beginTx();

    Node n1 = restAPI.createNode(map());
    index.add(n1, "key", "value");

    tx.success();
    tx.finish();
    Node node = index.get("key", "value").getSingle();
    assertEquals("created node found in index", n1, node);
  }
コード例 #2
0
  @Test(expected = RestResultException.class)
  public void testFailingCreateNodeAndAddToIndex() throws Exception {
    RestIndex<Node> index =
        restAPI.createIndex(
            Node.class,
            "index",
            MapUtil.stringMap(IndexManager.PROVIDER, "lucene", "type", "fulltext_ _"));
    final Transaction tx = restAPI.beginTx();

    Node n1 = restAPI.createNode(map());
    index.add(n1, "key", "value");

    tx.success();
    tx.finish();
    Node node = index.get("key", "value").getSingle();
    assertEquals("created node found in index", n1, node);
  }