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.datatype.TModelKey; 23 import org.apache.juddi.util.Config; 24 import org.apache.juddi.util.jdbc.Transaction; 25 26 39 class TestFindServiceByTModelKeyQuery 40 { 41 public static void main(String [] args) 42 throws Exception 43 { 44 Config.setStringProperty("juddi.useConnectionPool","true"); 47 48 Connection conn = null; 49 try { 50 conn = Database.aquireConnection(); 51 test(conn); 52 } 53 finally { 54 if (conn != null) 55 conn.close(); 56 } 57 } 58 59 public static void test(Connection connection) 60 throws Exception 61 { 62 String businessKey = "13411e97-24cf-43d1-bee0-455e7ec5e9fc"; 63 64 TModelBag tModelBag = new TModelBag(); 65 Vector tModelKeyVector = new Vector (); 66 tModelKeyVector.addElement(new TModelKey("")); 67 tModelKeyVector.addElement(new TModelKey("")); 68 tModelKeyVector.addElement(new TModelKey("2a33d7d7-2b73-4de9-99cd-d4c51c186bce")); 69 tModelKeyVector.addElement(new TModelKey("2a33d7d7-2b73-4de9-99cd-d4c51c186bce")); 70 tModelBag.setTModelKeyVector(tModelKeyVector); 71 72 Vector keysIn = new Vector (); 73 keysIn.add("13411e97-24cf-43d1-bee0-455e7ec5e9fc"); 74 keysIn.add("3f244f19-7ba7-4c3e-a93e-ae33e530794b"); 75 keysIn.add("3009f336-98c1-4193-a22f-fea73e79c909"); 76 keysIn.add("3ef4772f-e04b-46ed-8065-c5a4e167b5ba"); 77 78 Transaction txn = new Transaction(); 79 80 if (connection != null) 81 { 82 try 83 { 84 txn.begin(connection); 86 87 FindServiceByTModelKeyQuery.select(businessKey,tModelBag,keysIn,null,connection); 88 FindServiceByTModelKeyQuery.select(businessKey,tModelBag,null,null,connection); 89 90 txn.commit(); 92 } 93 catch(Exception ex) 94 { 95 try { txn.rollback(); } 96 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 97 throw ex; 98 } 99 } 100 } 101 } 102 | Popular Tags |