Example #1
0
  public void testModify() throws Exception {
    createSampleNode();

    VFile dept = entry.resolveFile("node://dept/dept.node");
    IOUtil.copyNClose(
        new StringReader("{greeting:'�ѱ�', age:20}"), dept.getOutputStream(), "UTF-8");

    ReadNode node = session.pathBy("/dept");
    assertEquals("�ѱ�", node.property("greeting").asString());
  }
Example #2
0
  public void testCreate() throws Exception {
    createSampleNode();
    String fileName = "node://dept/dev2";

    VFile dev2 = entry.resolveFile(fileName);
    assertEquals(FileType.FOLDER, dev2.getType());
    assertEquals(FileType.FOLDER, dev2.getName().getType());

    dev2.createFolder();
    assertEquals(true, dev2.exists());

    VFile def2File = entry.resolveFile("node://dept/dev2/dev2.node");
    assertEquals(true, def2File.exists());

    IOUtil.copyNClose(
        new StringReader("{name:'dev2 team', desc:'������', date:" + new Date().getTime() + "}"),
        def2File.getOutputStream(),
        "UTF-8");

    ReadNode found = session.pathBy("/dept/dev2");
    assertEquals("dev2 team", found.property("name").asString());
    assertEquals("������", found.property("desc").asString());
  }