Ejemplo n.º 1
0
 private void cleanUp() {
   if (!testRoot.exists()) {
     return;
   }
   String mockup = System.getProperty(MOCKUP_KEY);
   File[] files = testRoot.listFiles();
   for (File f : files) {
     if (mockup != null && !mockup.trim().equals("")) {
       Utils.deleteRecursively(f);
     } else {
       File parent = f.getParentFile();
       ensureMutable(parent);
       FileEntry entry = ClearcaseUtils.readEntry(Clearcase.getInstance().getClient(), f);
       if (entry != null && !entry.isViewPrivate()) {
         uncheckout(f);
         Clearcase.getInstance().getClient().exec(new RmElemCommand(f), false);
         FileUtil.refreshFor(parent);
         Clearcase.getInstance()
             .getClient()
             .exec(new CheckinCommand(new File[] {parent}, null, true, false), false);
       } else {
         Utils.deleteRecursively(f);
       }
     }
   }
 }
Ejemplo n.º 2
0
 private void init() {
   FileEntry entry = ClearcaseUtils.readEntry(Clearcase.getInstance().getClient(), testRoot);
   if (entry == null || entry.isViewPrivate()) {
     testRoot.mkdirs();
     add(testRoot);
   }
 }
Ejemplo n.º 3
0
 private static void ensureMutable(File file) {
   if (file.isDirectory()) {
     FileEntry entry = ClearcaseUtils.readEntry(Clearcase.getInstance().getClient(), file);
     if (entry == null || entry.isCheckedout() || entry.isViewPrivate()) {
       return;
     }
   } else {
     if (file.canWrite()) return;
   }
   CheckoutCommand command =
       new CheckoutCommand(new File[] {file}, null, CheckoutCommand.Reserved.Reserved, true);
   Clearcase.getInstance().getClient().exec(command, true);
 }