1 16 17 package test.wsdl.extra; 18 19 import java.io.File ; 20 import java.io.IOException ; 21 import java.util.HashSet ; 22 import java.util.Set ; 23 import java.util.Vector ; 24 25 31 public class ExtraClassesTestCase extends junit.framework.TestCase { 32 public ExtraClassesTestCase(String name) { 33 super(name); 34 } 35 36 39 protected Set shouldExist() { 40 HashSet set = new HashSet (); 41 set.add("Extra.java"); set.add("MyService.java"); 43 set.add("MyServiceService.java"); 44 set.add("MyServiceServiceLocator.java"); 45 set.add("MyServiceSoapBindingStub.java"); 46 set.add("MyService.wsdl"); 47 set.add("ExtraClassesTestCase.java"); 48 return set; 49 } 51 54 protected Set mayExist() { 55 HashSet set = new HashSet (); 56 return set; 57 } 58 59 62 protected String rootDir() { 63 return "build" + File.separator + "work" + File.separator + 64 "test" + File.separator + "wsdl" + File.separator + 65 "extra"; 66 } 68 public void testFileGen() throws IOException { 69 String rootDir = rootDir(); 70 Set shouldExist = shouldExist(); 71 Set mayExist = mayExist(); 72 73 File outputDir = new File (rootDir); 75 76 String [] files = outputDir.list(); 77 78 Vector shouldNotExist = new Vector (); 79 80 for (int i = 0; i < files.length; ++i) { 81 if (shouldExist.contains(files[i])) { 82 shouldExist.remove(files[i]); 83 } 84 else if (mayExist.contains(files[i])) { 85 mayExist.remove(files[i]); 86 } 87 else { 88 shouldNotExist.add(files[i]); 89 } 90 } 91 92 if (shouldExist.size() > 0) { 93 fail("The following files should exist but do not: " + shouldExist); 94 } 95 96 if (shouldNotExist.size() > 0) { 97 fail("The following files should NOT exist, but do: " + shouldNotExist); 98 } 99 } 100 } | Popular Tags |