1 16 package org.apache.juddi.datastore.jdbc; 17 18 import java.sql.Connection ; 19 20 import org.apache.juddi.datatype.business.BusinessEntity; 21 import org.apache.juddi.util.Config; 22 import org.apache.juddi.util.jdbc.Transaction; 23 import org.apache.juddi.uuidgen.UUIDGen; 24 import org.apache.juddi.uuidgen.UUIDGenFactory; 25 26 29 class TestBusinessEntityTable 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 Transaction txn = new Transaction(); 53 UUIDGen uuidgen = UUIDGenFactory.getUUIDGen(); 54 55 try 56 { 57 String businessKey = uuidgen.uuidgen(); 58 BusinessEntity business = new BusinessEntity(); 59 business.setBusinessKey(businessKey); 60 business.setAuthorizedName("Steve Viens"); 61 business.setOperator("www.jUDDI.org"); 62 63 String publisherID = "sviens"; 64 65 txn.begin(connection); 67 68 BusinessEntityTable.insert(business,publisherID,connection); 70 71 business = BusinessEntityTable.select(businessKey,connection); 73 74 77 business = BusinessEntityTable.select(businessKey,connection); 79 80 txn.commit(); 82 } 83 catch(Exception ex) 84 { 85 try { txn.rollback(); } 86 catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); } 87 throw ex; 88 } 89 } 90 } 91 | Popular Tags |