コード例 #1
0
 /** Setup of repository configuration */
 public void setUp() throws Exception {
   RepositoryFactory repoFactory = new RepositoryFactory();
   repo =
       repoFactory.newRepository("new-vfs"); // INFO: Make sure that this repo is configured within
   // 'src/test/java/yarep.properties'
   // repo = repoFactory.newRepository("vfs-example", new
   // java.io.File("new-vfs-example/repository.xml"));
   log.info("Testing repository: " + repo.getName() + " (" + repo.getConfigFile() + ")");
 }
コード例 #2
0
  /** Test indexing and searching of properties */
  public void testIndexingSearchingOfProperties() throws Exception {
    String path = "/" + NODE_NAME;

    String name = "firstnames";
    String value = "bob alice";

    Node node = repo.getNode(path);
    node.setProperty(name, value);
    Node[] nodes = repo.getSearcher().searchProperty(name, "alice", "/");
    log.info("Number of nodes found: " + nodes.length);

    assertTrue(nodes != null && nodes.length == 1 && nodes[0].getPath().equals(path));
  }