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.util.Config; 22 import org.apache.juddi.util.jdbc.Transaction; 23 24 27 class TestFindServiceByBusinessKeyQuery 28 { 29 public static void main(String [] args) 30 throws Exception 31 { 32 Config.setStringProperty("juddi.useConnectionPool","true"); 35 36 Connection conn = null; 37 try { 38 conn = Database.aquireConnection(); 39 test(conn); 40 } 41 finally { 42 if (conn != null) 43 conn.close(); 44 } 45 } 46 47 public static void test(Connection connection) 48 throws Exception 49 { 50 String businessKey = "740d75b1-3cde-4547-85dd-9578cd3ea1cd"; 51 52 Vector keysIn = new Vector (); 53 keysIn.add("740d75b1-3cde-4547-85dd-9578cd3ea1cd"); 54 keysIn.add("c311085b-3277-470d-8ce9-07b81c484e4b"); 55 keysIn.add("6b368a5a-6a62-4f23-a002-f11e22780a91"); 56 keysIn.add("45994713-d3c3-40d6-87b5-6ce51f36001c"); 57 keysIn.add("901b15c5-799c-4387-8337-a1a35fceb791"); 58 keysIn.add("80fdae14-0e5d-4ea6-8eb8-50fde422056d"); 59 keysIn.add("e1996c33-c436-4004-9e3e-14de191bcc6b"); 60 keysIn.add("3ef4772f-e04b-46ed-8065-c5a4e167b5ba"); 61 62 Transaction txn = new Transaction(); 63 64 if (connection != null) 65 { 66 try 67 { 68 txn.begin(connection); 70 71 keysIn = FindServiceByBusinessKeyQuery.select(businessKey,keysIn,null,connection); 72 keysIn = FindServiceByBusinessKeyQuery.select(businessKey,null,null,connection); 73 74 txn.commit(); 76 } 77 catch(Exception ex) 78 { 79 try { txn.rollback(); } 80 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 81 throw ex; 82 } 83 } 84 } 85 } 86 | Popular Tags |