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.IdentifierBag; 22 import org.apache.juddi.datatype.KeyedReference; 23 import org.apache.juddi.util.Config; 24 import org.apache.juddi.util.jdbc.Transaction; 25 26 29 class TestFindTModelByIdentifierQuery 30 { 31 public static void main(String [] args) 32 throws Exception 33 { 34 Config.setStringProperty("juddi.useConnectionPool","true"); 37 38 Connection conn = null; 39 try { 40 conn = Database.aquireConnection(); 41 test(conn); 42 } 43 finally { 44 if (conn != null) 45 conn.close(); 46 } 47 } 48 49 public static void test(Connection connection) 50 throws Exception 51 { 52 IdentifierBag identifierBag = new IdentifierBag(); 53 Vector keyedRefVector = new Vector (); 54 keyedRefVector.addElement(new KeyedReference("af176f34-00ca-4d93-97f8-2b62aa3a75e5","blah, blah, blah")); 55 keyedRefVector.addElement(new KeyedReference("54a827e0-1b51-4381-8775-ad02c377bb25","Haachachachacha")); 56 keyedRefVector.addElement(new KeyedReference("xxxxxxxxxxxxxxxx","xxxxxxxxxxx")); 57 identifierBag.setKeyedReferenceVector(keyedRefVector); 58 59 Vector keysIn = new Vector (); 60 keysIn.add("824c73af-22e0-4816-9689-2429101c7727"); 61 keysIn.add("c311085b-3277-470d-8ce9-07b81c484e4b"); 62 keysIn.add("6b368a5a-6a62-4f23-a002-f11e22780a91"); 63 keysIn.add("45994713-d3c3-40d6-87b5-6ce51f36001c"); 64 keysIn.add("901b15c5-799c-4387-8337-a1a35fceb791"); 65 keysIn.add("80fdae14-0e5d-4ea6-8eb8-50fde422056d"); 66 keysIn.add("e1996c33-c436-4004-9e3e-14de191bcc6b"); 67 keysIn.add("f715d9ff-d4eb-4073-92e8-2411cd5d0d68"); 68 69 Transaction txn = new Transaction(); 70 71 if (connection != null) 72 { 73 try 74 { 75 txn.begin(connection); 77 78 FindTModelByIdentifierQuery.select(identifierBag,keysIn,null,connection); 79 FindTModelByIdentifierQuery.select(identifierBag,null,null,connection); 80 81 txn.commit(); 83 } 84 catch(Exception ex) 85 { 86 try { txn.rollback(); } 87 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 88 throw ex; 89 } 90 } 91 } 92 } 93 | Popular Tags |