コード例 #1
0
  public void testDeleteCheckedoutFileUptodateParent()
      throws IOException, SecurityException, NoSuchMethodException, IllegalAccessException,
          IllegalAccessException, IllegalArgumentException, IllegalArgumentException,
          InvocationTargetException {
    File parent = new File(testRoot, "parent");
    parent.mkdirs();

    // create uptodate file and folder
    File file = new File(parent, "file");
    file.createNewFile();
    add(parent, file);
    refreshImmediatelly(parent);
    refreshImmediatelly(file);
    ensureMutable(file);
    refreshImmediatelly(file);

    FileInformation info = cache.getInfo(file);
    assertEquals(FileInformation.STATUS_VERSIONED_CHECKEDOUT, info.getStatus());
    info = cache.getInfo(parent);
    assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, info.getStatus());

    // delete file
    assertTrue(delete(file));
    refreshImmediatelly(file);
    refreshImmediatelly(parent);

    // test
    assertFalse(file.exists()); // file is deleted
    info = cache.getInfo(file);
    assertEquals(
        FileInformation.STATUS_UNKNOWN, info.getStatus()); // chache keeps track of it as unknown

    info = cache.getInfo(parent);
    assertEquals(FileInformation.STATUS_VERSIONED_CHECKEDOUT, info.getStatus());
  }
コード例 #2
0
  public void testDeleteViewPrivate()
      throws IOException, SecurityException, NoSuchMethodException, IllegalAccessException,
          IllegalAccessException, IllegalArgumentException, IllegalArgumentException,
          InvocationTargetException {
    File file = new File(testRoot, "file");
    file.createNewFile();

    refreshImmediatelly(file);

    // create notmanaged file
    FileInformation info = cache.getInfo(file);
    assertEquals(FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY, info.getStatus());

    // test
    assertFalse(delete(file)); // interceptor refused to handle the file

    //        // however, let's call delete on the interceptor
    //        interceptorDelete(file);
    //        refreshImmediatelly(file);
    //
    //        // test
    //        assertFalse(file.exists());                                         // file is deleted
    //        info = cache.getInfo(file);
    //        assertEquals(FileInformation.STATUS_UNKNOWN, info.getStatus());     // chache keeps
    // track of it as unknown
  }
コード例 #3
0
  public void testMoveFromNotManagedFileToNotManaged()
      throws IOException, SecurityException, NoSuchMethodException, IllegalAccessException,
          IllegalAccessException, IllegalArgumentException, IllegalArgumentException,
          InvocationTargetException {
    File from = File.createTempFile("fromfile", null);
    from.createNewFile();
    File to = File.createTempFile("tofile", null);

    refreshImmediatelly(to);
    refreshImmediatelly(from);

    FileInformation info = cache.getInfo(from);
    assertEquals(FileInformation.STATUS_NOTVERSIONED_NOTMANAGED, info.getStatus());
    info = cache.getInfo(to);
    assertEquals(FileInformation.STATUS_NOTVERSIONED_NOTMANAGED, info.getStatus());

    assertFalse(move(from, to)); // interceptor refused to handle the file

    // however, let's call move on the interceptor
    interceptorMove(from, to);
    refreshImmediatelly(to);
    refreshImmediatelly(from);

    // test
    assertFalse(from.exists()); // from is gone
    assertTrue(to.exists()); // to was created
    info = cache.getInfo(from);
    assertEquals(
        FileInformation.STATUS_NOTVERSIONED_NOTMANAGED,
        info.getStatus()); // once notmanaged, stays notmanaged

    info = cache.getInfo(to);
    assertEquals(
        FileInformation.STATUS_NOTVERSIONED_NOTMANAGED,
        info.getStatus()); //  --------------- "" -------------
  }
コード例 #4
0
  public void testMoveFromViewPrivateFileToViewPrivateFolder()
      throws IOException, SecurityException, NoSuchMethodException, IllegalAccessException,
          IllegalAccessException, IllegalArgumentException, IllegalArgumentException,
          InvocationTargetException {
    File fromParent = new File(testRoot, "fromparent");
    fromParent.mkdirs();
    File toParent = new File(testRoot, "toparent");
    toParent.mkdirs();

    // create uptodate file and folder
    File from = new File(fromParent, "fromfile");
    from.createNewFile();
    File to = new File(toParent, "tofile");
    to.createNewFile();

    add(fromParent, toParent);
    refreshImmediatelly(fromParent);
    refreshImmediatelly(toParent);
    refreshImmediatelly(to);
    refreshImmediatelly(from);

    FileInformation info;
    info = cache.getInfo(fromParent);
    assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, info.getStatus());
    info = cache.getInfo(toParent);
    assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, info.getStatus());
    info = cache.getInfo(from);
    assertEquals(FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY, info.getStatus());
    info = cache.getInfo(to);
    assertEquals(FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY, info.getStatus());

    // test
    assertFalse(move(from, to)); // interceptor refused to handle the file

    // however, let's call move on the interceptor
    interceptorMove(from, to);
    refreshImmediatelly(to);
    refreshImmediatelly(from);

    // test
    assertFalse(from.exists()); // from is gone
    assertTrue(to.exists()); // to was created
    info = cache.getInfo(from);
    assertEquals(FileInformation.STATUS_UNKNOWN, info.getStatus()); // cache keeps track as unknown
    info = cache.getInfo(to);
    assertEquals(
        FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY,
        info.getStatus()); //  --------------- "" -------------
  }