//Delete one binding
Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey(),classification);
if ((serviceBindings2 != null) && (serviceBindings2.iterator() != null)
&& (serviceBindings2.iterator().hasNext())) {
ServiceBinding serviceBinding2 = serviceBindings2.iterator().next();
Remover remover = new Remover(blm);
remover.removeServiceBinding(serviceBinding2);
}
} catch (JAXRException re) {
fail(re.getMessage());
}
//find all services for this organization
try
{
RegistryService rs = connection.getRegistryService();
bqm = rs.getBusinessQueryManager();
Finder finder = new Finder(bqm, uddiversion);
Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
Organization org = orgs.iterator().next();
//Listing out the services and their Bindings
System.out.println("-------------------------------------------------");
System.out.println("Organization name: " + org.getName().getValue());
System.out.println("Description: " + org.getDescription().getValue());
System.out.println("Key id: " + org.getKey().getId());
User primaryContact = org.getPrimaryContact();
System.out.println("Primary Contact: " + primaryContact.getPersonName().getFullName());
Collection services = org.getServices();
for (Iterator serviceIter = services.iterator();serviceIter.hasNext();) {
Service service = (Service) serviceIter.next();
System.out.println("- Service Name: " + service.getName().getValue());
System.out.println(" Service Key : " + service.getKey().getId());
Collection serviceBindings = service.getServiceBindings();
for (Iterator serviceBindingIter = serviceBindings.iterator();serviceBindingIter.hasNext();){
ServiceBinding serviceBinding = (ServiceBinding) serviceBindingIter.next();
System.out.println(" ServiceBinding Description: " + serviceBinding.getDescription().getValue());
String xml = serviceBinding.getAccessURI();
System.out.println(" ServiceBinding URI: " + xml);
assertEquals("<epr>epr uri</epr>",xml);
}
}
System.out.println("-------------------------------------------------");
} catch (Exception je) {
fail(je.getMessage());
}
//delete the service
try
{
RegistryService rs = connection.getRegistryService();
bqm = rs.getBusinessQueryManager();
blm = rs.getBusinessLifeCycleManager();
Finder finder = new Finder(bqm, uddiversion);
//Find the service
Service service = finder.findService("registry","Registry Test ServiceName", blm);
Remover remover = new Remover(blm);
remover.removeService(service);
} catch (JAXRException je) {
fail(je.getMessage());
}
//delete the organization
try
{
RegistryService rs = connection.getRegistryService();
bqm = rs.getBusinessQueryManager();
blm = rs.getBusinessLifeCycleManager();
Finder finder = new Finder(bqm, uddiversion);
Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
Organization org = orgs.iterator().next();
Remover remover = new Remover(blm);
remover.removeOrganization(org);
} catch (JAXRException je) {
fail(je.getMessage());
}
}