}
testConcept = (Concept) bqm.getRegistryObject(conceptKey.getId(), LifeCycleManager.CONCEPT);
SpecificationLink sl = blm.createSpecificationLink();
sl.setSpecificationObject(testConcept);
ServiceBinding sb = blm.createServiceBinding();
sb.setDescription(blm.createInternationalString(sbDescription));
sb.setAccessURI(accessURI);
sb.addSpecificationLink(sl);
service.addServiceBinding(sb);
Collection sbs = new ArrayList();
sbs.add(sb);
br = blm.saveServiceBindings(sbs);
if (br.getExceptions() != null)
{
fail("Save ServiceBindings failed ");
}
Collection specifications = new ArrayList();
specifications.add(testConcept);
br = bqm.findServiceBindings(serviceKey, null, null, specifications);
sbs = br.getCollection();
iter = sbs.iterator();
while (iter.hasNext())
{
sb = (ServiceBinding) iter.next();
Service storedService = sb.getService();
if (!(storedService.getName().getValue().equals(serviceName)))
{
fail("Error: service name");
}
Organization storedOrg = storedService.getProvidingOrganization();
if (!(storedOrg.getName().getValue().equals(orgname)))
{
fail("Error: unexpected organization name \n");
}
if (!(sb.getDescription().getValue().equals(sbDescription)))
{
fail("Error: servicebinding description");
}
if (!(sb.getAccessURI().equals(accessURI)))
{
fail("Error: unexpected accessURI name");
}
}
//Lets update the ServiceBinding
sbs = new ArrayList();
sb.setAccessURI("http://newURI");
sbs.add(sb);
br = blm.saveServiceBindings(sbs);
br = bqm.findServiceBindings(serviceKey, null, null, specifications);
sbs = br.getCollection();
iter = sbs.iterator();
while (iter.hasNext())
{
sb = (ServiceBinding) iter.next();
Service storedService = sb.getService();
if (!(storedService.getName().getValue().equals(serviceName)))
{
fail("Error: service name");
}
Organization storedOrg = storedService.getProvidingOrganization();
if (!(storedOrg.getName().getValue().equals(orgname)))
{
fail("Error: unexpected organization name \n");
}
if (!(sb.getDescription().getValue().equals(sbDescription)))
{
fail("Error: servicebinding description");
}
if (!(sb.getAccessURI().equals("http://newURI")))
{
fail("Error: unexpected accessURI name");
}
}
} catch (Exception e)