logger.info("attempting to save business " + businessKey + " from " + businessXML);
try {
SaveBusiness sb = new SaveBusiness();
sb.setAuthInfo(authInfo);
BusinessEntity beIn = (BusinessEntity) EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
if (beIn == null) {
throw new Exception("Unload to load source xml document from " + businessXML);
}
sb.getBusinessEntity().add(beIn);
BusinessDetail saveBusiness = publication.saveBusiness(sb);
logger.info("Business saved with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());
if (serialize) {
JAXB.marshal(saveBusiness, System.out);
}
// Now get the entity and check the values
GetBusinessDetail gb = new GetBusinessDetail();
gb.getBusinessKey().add(businessKey);
BusinessDetail bd = inquiry.getBusinessDetail(gb);
List<BusinessEntity> beOutList = bd.getBusinessEntity();
BusinessEntity beOut = beOutList.get(0);
if (serialize) {
JAXB.marshal(beOut, new File("target/aftersave.xml"));
}
assertEquals(beIn.getBusinessKey(), beOut.getBusinessKey());
TckValidator.checkNames(beIn.getName(), beOut.getName());
TckValidator.checkDescriptions(beIn.getDescription(), beOut.getDescription());
TckValidator.checkDiscoveryUrls(beIn.getDiscoveryURLs(), beOut.getDiscoveryURLs());
TckValidator.checkContacts(beIn.getContacts(), beOut.getContacts());
TckValidator.checkCategories(beIn.getCategoryBag(), beOut.getCategoryBag());
TckValidator.checkSignatures(beIn.getSignature(), beOut.getSignature());
return beOut;
} catch (Throwable e) {
logger.error(e.getMessage(), e);
Assert.fail("No exception should be thrown");
}