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.Name; 22 import org.apache.juddi.util.Config; 23 import org.apache.juddi.util.jdbc.Transaction; 24 25 28 class TestFindServiceByNameQuery 29 { 30 public static void main(String [] args) 31 throws Exception 32 { 33 Config.setStringProperty("juddi.useConnectionPool","true"); 36 37 Connection conn = null; 38 try { 39 conn = Database.aquireConnection(); 40 test(conn); 41 } 42 finally { 43 if (conn != null) 44 conn.close(); 45 } 46 } 47 48 public static void test(Connection connection) 49 throws Exception 50 { 51 String businessKey = "0e70128c-f7c6-4854-b292-d2f13b638acf"; 52 53 Vector names = new Vector (); 54 names.add(new Name("St")); 55 59 Vector keysIn = null; 60 keysIn = new Vector (); 61 keysIn.add("0e70128c-f7c6-4854-b292-d2f13b638acf"); 62 keysIn.add("b405450a-64f5-4f95-8131-450429d0ae8c"); 63 keysIn.add("3009f336-98c1-4193-a22f-fea73e79c909"); 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("3ef4772f-e04b-46ed-8065-c5a4e167b5ba"); 69 70 Transaction txn = new Transaction(); 71 72 if (connection != null) 73 { 74 try 75 { 76 txn.begin(connection); 78 79 FindServiceByNameQuery.select(businessKey,names,keysIn,null,connection); 80 FindServiceByNameQuery.select(businessKey,names,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 |