1 19 20 package taskblocks.bugzilla; 21 22 import java.io.FileNotFoundException ; 23 import java.io.IOException ; 24 import java.net.MalformedURLException ; 25 import java.net.UnknownHostException ; 26 import java.util.HashMap ; 27 import java.util.Map ; 28 29 import javax.xml.parsers.ParserConfigurationException ; 30 31 import org.xml.sax.SAXException ; 32 33 34 import junit.framework.TestCase; 35 36 public class BugzillaSubmitterTest extends TestCase { 37 38 public void notestSubmit() { 39 Map <String , String > formData = new HashMap <String , String >(); 40 formData.put(BugzillaSubmitter.KEYWORDS, "Plan"); 41 formData.put(BugzillaSubmitter.PRODUCT, "TestProduct"); 42 formData.put(BugzillaSubmitter.VERSION, "unspecified"); 43 formData.put(BugzillaSubmitter.COMPONENT, "TestComponent"); 44 formData.put(BugzillaSubmitter.HARDWARE, "All"); 45 formData.put(BugzillaSubmitter.OS, "All"); 46 formData.put(BugzillaSubmitter.PRIORITY, "P2"); 47 formData.put(BugzillaSubmitter.SEVERITY, "enhancement"); 48 formData.put(BugzillaSubmitter.STATUS, "NEW"); 49 formData.put(BugzillaSubmitter.ASSIGNED_TO, "j.neubauer@cz.gmc.net"); 50 formData.put(BugzillaSubmitter.SUMMARY, "Test Bug"); 51 formData.put(BugzillaSubmitter.DESCRIPTION, "Description of Test Bug"); 52 formData.put(BugzillaSubmitter.ESTIMATED_TIME, "16"); 53 formData.put(BugzillaSubmitter.STATUS_WHITEBOARD, "230407-240407"); 54 formData.put(BugzillaSubmitter.BLOCKS, "1,2"); 55 56 try { 57 String bugId = new BugzillaSubmitter().submit( 58 "http://jakubpc/bugzilla-3.0", "j.neubauer@cz.gmc.net", "heslo", 59 formData); 60 System.out.println("Submitted bug #" + bugId); 61 } catch (UnknownHostException e) { 62 System.err.println("Unknown host: " + e.getMessage()); 63 System.exit(2); 64 } catch (FileNotFoundException e) { 65 System.err.println("Page not found: " + e.getMessage()); 66 System.exit(2); 67 } catch (IOException e) { 68 System.err.println(e.getClass().getSimpleName() + ": " + e.getMessage()); 69 System.exit(2); 70 } catch (Exception e) { 71 System.err.println(e.getMessage()); 72 System.exit(2); 73 } 74 } 75 76 public void testQuery() { 77 try { 78 String result = new BugzillaSubmitter().query("http://wi", "j.neubauer@gmc.net", "abba", new String [] {"31396", "31397"}); 79 80 System.out.println(result); 81 } catch (MalformedURLException e) { 82 System.err.println(e.getMessage()); 83 System.exit(2); 84 } catch (IOException e) { 85 System.err.println(e.getMessage()); 86 System.exit(2); 87 } catch (SAXException e) { 88 System.err.println(e.getMessage()); 89 System.exit(2); 90 } catch (ParserConfigurationException e) { 91 System.err.println(e.getMessage()); 92 System.exit(2); 93 } 94 } 95 96 97 } 98
| Popular Tags
|