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 TestFindBindingByServiceKeyQuery 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 serviceKey = "5E2D4E60-9876-11D8-AE77-AC68422E7D92"; 51 52 Vector keysIn = new Vector (); 53 keysIn.add("5E305BA0-9876-11D8-AE77-D080179B6DB4"); 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 Vector keys = null; 72 73 keys = FindBindingByServiceKeyQuery.select(serviceKey,keysIn,null,connection); 74 System.out.println(keys.size()); 75 76 keys = FindBindingByServiceKeyQuery.select(serviceKey,null,null,connection); 77 System.out.println(keys.size()); 78 79 txn.commit(); 81 } 82 catch(Exception ex) 83 { 84 try { txn.rollback(); } 85 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 86 throw ex; 87 } 88 } 89 } 90 } 91 | Popular Tags |