1 package com.openedit.archive.update; 2 3 import java.util.Iterator ; 4 import java.util.List ; 5 6 import com.openedit.archive.ArchiveTest; 7 8 public abstract class ArcUpdateTestCase extends ArchiveTest { 9 10 public ArcUpdateTestCase(String inArg0) { 11 super(inArg0); 12 } 13 14 final private String Q = "\""; 15 16 protected CommandLineWithOutput findKeywords(String filename) { 17 String cmd[] = new String [6]; 18 cmd[0] = "exiflist"; 19 cmd[1] = "/o"; 20 cmd[2] = "ln"; 21 cmd[3] = "/f"; 22 cmd[4] = "ip-keyword"; 23 cmd[5] = Q + filename + Q; 24 CommandLineWithOutput findKeywords = new CommandLineWithOutput(); 25 findKeywords.exec(cmd); 26 return findKeywords; 27 } 28 29 protected CommandLineWithOutput findComment(String filename) { 30 String cmd[] = new String [6]; 31 cmd[0] = "exiflist"; 32 cmd[1] = "/o"; 33 cmd[2] = "ln"; 34 cmd[3] = "/f"; 35 cmd[4] = "comment"; 36 cmd[5] = Q + filename + Q; 37 CommandLineWithOutput findKeywords = new CommandLineWithOutput(); 38 findKeywords.exec(cmd); 39 return findKeywords; 40 } 41 42 protected void removeKeywords(String filename) { 43 String cmd[] = new String [5]; 44 cmd[0] = "exifedit"; 45 cmd[1] = "/b"; 46 cmd[2] = "/r"; 47 cmd[3] = "ip-keyword"; 48 cmd[4] = Q + filename + Q; 49 CommandLine removeKeys = new CommandLine(); 50 removeKeys.exec(cmd); 51 assertListDoesNotContain("ip-keyword", findKeywords(filename) 52 .getOutput()); 53 } 54 55 protected void assertListContains(String toFind, List output) { 56 for (Iterator iter = output.iterator(); iter.hasNext();) { 57 String oneLine = (String ) iter.next(); 58 if (oneLine.indexOf(toFind) > 0) 59 return; 60 } 61 fail("[" + toFind + "] not found in given list of Strings"); 62 } 63 64 protected void assertListDoesNotContain(String toFind, List output) { 65 for (Iterator iter = output.iterator(); iter.hasNext();) { 66 String oneLine = (String ) iter.next(); 67 if (oneLine.indexOf(toFind) > 0) 68 fail("[" + toFind + "] found in given list of Strings"); 69 } 70 } 71 72 } 73 | Popular Tags |