}
public static void test(Connection connection)
throws Exception
{
Transaction txn = new Transaction();
UUIDGen uuidgen = UUIDGenFactory.getUUIDGen();
if (connection != null)
{
try
{
String businessKey = uuidgen.uuidgen();
BusinessEntity business = new BusinessEntity();
business.setBusinessKey(businessKey);
business.setAuthorizedName("sviens");
business.setOperator("WebServiceRegistry.com");
String serviceKey = uuidgen.uuidgen();
BusinessService service = new BusinessService();
service.setBusinessKey(businessKey);
service.setServiceKey(serviceKey);
String bindingKey = uuidgen.uuidgen();
BindingTemplate binding = new BindingTemplate();
binding.setServiceKey(serviceKey);
binding.setBindingKey(bindingKey);
binding.setAccessPoint(new AccessPoint("http","http://juddi.org/bindingtemplate.html"));
String authorizedUserID = "sviens";
// begin a new transaction
txn.begin(connection);
// insert a new BusinessEntity
BusinessEntityTable.insert(business,authorizedUserID,connection);
// insert a new BusinessService
BusinessServiceTable.insert(service,connection);
// insert a new BindingTemplate
BindingTemplateTable.insert(binding,connection);
// insert another BindingTemplate
binding.setBindingKey(uuidgen.uuidgen());
BindingTemplateTable.insert(binding,connection);
// insert one more BindingTemplate
binding.setBindingKey(uuidgen.uuidgen());
BindingTemplateTable.insert(binding,connection);
// select a particular BindingTemplate
binding = BindingTemplateTable.select(bindingKey,connection);
// delete that BindingTemplate
BindingTemplateTable.delete(bindingKey,connection);
// re-select that BindingTemplate
binding = BindingTemplateTable.select(bindingKey,connection);
// select a Collection of BindingTemplate objects (by ServiceKey)
BindingTemplateTable.selectByServiceKey(serviceKey,connection);
// delete a Collection of BindingTemplate objects (by ServiceKey)
BindingTemplateTable.deleteByServiceKey(serviceKey,connection);
// re-select a Collection of BindingTemplate objects (by ServiceKey)
BindingTemplateTable.selectByServiceKey(serviceKey,connection);
// commit the transaction
txn.commit();
}
catch(Exception ex)
{
try { txn.rollback(); }
catch(java.sql.SQLException sqlex) { sqlex.printStackTrace(); }
throw ex;
}
}
}