}
}
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("mleblanc");
business.setOperator("XMLServiceRegistry.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://www.juddi.org/tmodelinstanceinfo.html",
"http"));
Vector infoList = new Vector();
infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
infoList.add(new TModelInstanceInfo(uuidgen.uuidgen()));
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 a Collection of TModelInstanceInfo objects
TModelInstanceInfoTable.insert(bindingKey, infoList, connection);
// select a Collection of TModelInstanceInfo objects (by BindingKey)
infoList = TModelInstanceInfoTable.select(bindingKey, connection);
// delete a Collection of TModelInstanceInfo objects (by BindingKey)
TModelInstanceInfoTable.delete(bindingKey, connection);
// re-select a Collection of TModelInstanceInfo objects (by BindingKey)
infoList = TModelInstanceInfoTable.select(bindingKey, connection);
// commit the transaction
txn.commit();
}
catch (Exception ex)
{
try
{
txn.rollback();
}
catch (java.sql.SQLException sqlex)
{
sqlex.printStackTrace();
}