Ejemplo n.º 1
0
  public void testDeleteFile() throws Exception {
    String text = "Yeah! Some content!";
    ModifiableSource source = (ModifiableSource) resolver.resolveURI("jcr://yet/another/deep/file");

    assertFalse(source.exists());
    write(source, text);

    // Lookup a fresh source
    source = (ModifiableSource) resolver.resolveURI("jcr://yet/another/deep/file");
    assertTrue(source.exists());
    source.delete();
    assertFalse(source.exists());

    // Lookup again to check it was really deleted
    source = (ModifiableSource) resolver.resolveURI("jcr://yet/another/deep/file");
    assertFalse(source.exists());
  }
Ejemplo n.º 2
0
 private void write(ModifiableSource src, String text) throws Exception {
   byte[] data = text.getBytes("ISO-8859-1");
   OutputStream os = src.getOutputStream();
   os.write(data);
   os.close();
 }