1 16 package org.apache.juddi.datastore.jdbc; 17 18 import java.sql.Connection ; 19 import java.util.Vector ; 20 21 import org.apache.juddi.datatype.DiscoveryURL; 22 import org.apache.juddi.datatype.DiscoveryURLs; 23 import org.apache.juddi.util.Config; 24 import org.apache.juddi.util.jdbc.Transaction; 25 26 29 class TestFindBusinessByDiscoveryURLQuery 30 { 31 public static void main(String [] args) 32 throws Exception 33 { 34 Config.setStringProperty("juddi.useConnectionPool","true"); 37 38 Connection conn = null; 39 try { 40 conn = Database.aquireConnection(); 41 test(conn); 42 } 43 finally { 44 if (conn != null) 45 conn.close(); 46 } 47 } 48 49 public static void test(Connection connection) 50 throws Exception 51 { 52 53 DiscoveryURLs discoveryURLs = new DiscoveryURLs(); 54 Vector urls = new Vector (); 55 urls.add(new DiscoveryURL("http://www.uddi.org/","wsdl")); 56 urls.add(new DiscoveryURL("http://www.sviens.com/","soap")); 57 urls.add(new DiscoveryURL("http://www.juddi.org/","wsdl")); 58 discoveryURLs.setDiscoveryURLVector(urls); 59 60 Vector keysIn = new Vector (); 61 keysIn.add("d77170a5-cf1e-45e8-bbf3-5b0756b29199"); 62 keysIn.add("c311085b-3277-470d-8ce9-07b81c484e4b"); 63 keysIn.add("e2805dbe-3957-4490-9230-5f06d85fd50d"); 64 keysIn.add("45994713-d3c3-40d6-87b5-6ce51f36001c"); 65 keysIn.add("901b15c5-799c-4387-8337-a1a35fceb791"); 66 keysIn.add("80fdae14-0e5d-4ea6-8eb8-50fde422056d"); 67 keysIn.add("e1996c33-c436-4004-9e3e-14de191bcc6b"); 68 keysIn.add("36f5d745-3be5-4e8f-8c1a-5f59a4c69070"); 69 70 Transaction txn = new Transaction(); 71 72 if (connection != null) 73 { 74 try 75 { 76 txn.begin(connection); 78 79 FindBusinessByDiscoveryURLQuery.select(discoveryURLs,keysIn,null,connection); 80 FindBusinessByDiscoveryURLQuery.select(discoveryURLs,null,null,connection); 81 82 txn.commit(); 84 } 85 catch(Exception ex) 86 { 87 try { txn.rollback(); } 88 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 89 throw ex; 90 } 91 } 92 } 93 } 94 | Popular Tags |