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.TModelBag; 22 import org.apache.juddi.util.Config; 23 import org.apache.juddi.util.jdbc.Transaction; 24 25 28 class TestFindBindingByTModelKeyQuery 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 serviceKey = "13411e97-24cf-43d1-bee0-455e7ec5e9fc"; 52 53 TModelBag tModelBag = new TModelBag(); 54 Vector tModelKeyVector = new Vector (); 55 tModelKeyVector.addElement("2a33d7d7-2b73-4de9-99cd-d4c51c186bce"); 56 tModelKeyVector.addElement("2a33d7d7-2b73-4de9-99cd-d4c51c186bce"); 57 tModelBag.setTModelKeyVector(tModelKeyVector); 58 59 Vector keysIn = new Vector (); 60 keysIn.add("13411e97-24cf-43d1-bee0-455e7ec5e9fc"); 61 keysIn.add("3f244f19-7ba7-4c3e-a93e-ae33e530794b"); 62 keysIn.add("3009f336-98c1-4193-a22f-fea73e79c909"); 63 keysIn.add("3ef4772f-e04b-46ed-8065-c5a4e167b5ba"); 64 65 Transaction txn = new Transaction(); 66 67 if (connection != null) 68 { 69 try 70 { 71 txn.begin(connection); 73 74 FindBindingByTModelKeyQuery.select(serviceKey,tModelBag,keysIn,null,connection); 75 FindBindingByTModelKeyQuery.select(serviceKey,tModelBag,null,null,connection); 76 77 txn.commit(); 79 } 80 catch(Exception ex) 81 { 82 try { txn.rollback(); } 83 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 84 throw ex; 85 } 86 } 87 } 88 } 89 | Popular Tags |