Index: juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java =================================================================== --- juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java (revision 1559519) +++ juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java (working copy) @@ -14,7 +14,6 @@ * limitations under the License. * */ - package org.apache.juddi.api.impl; import java.util.List; @@ -61,516 +60,529 @@ import org.uddi.v3_service.DispositionReportFaultMessage; import org.uddi.v3_service.UDDIInquiryPortType; - /** * This implements the UDDI v3 Inquiry API web service + * * @author Jeff Faath */ -@WebService(serviceName="UDDIInquiryService", - endpointInterface="org.uddi.v3_service.UDDIInquiryPortType", - targetNamespace = "urn:uddi-org:v3_service") +@WebService(serviceName = "UDDIInquiryService", + endpointInterface = "org.uddi.v3_service.UDDIInquiryPortType", + targetNamespace = "urn:uddi-org:v3_service") public class UDDIInquiryImpl extends AuthenticatedService implements UDDIInquiryPortType { + private static Log log = LogFactory.getLog(UDDIInquiryImpl.class); + private UDDIServiceCounter serviceCounter; - private static Log log = LogFactory.getLog(UDDIInquiryImpl.class); - private UDDIServiceCounter serviceCounter; - - public UDDIInquiryImpl() { - super(); - serviceCounter = ServiceCounterLifecycleResource.getServiceCounter(UDDIInquiryImpl.class); - } - - public BindingDetail findBinding(FindBinding body) - throws DispositionReportFaultMessage { + public UDDIInquiryImpl() { + super(); + serviceCounter = ServiceCounterLifecycleResource.getServiceCounter(UDDIInquiryImpl.class); + } + + public BindingDetail findBinding(FindBinding body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateFindBinding(body); + new ValidateInquiry(null).validateFindBinding(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_BINDING, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_BINDING, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); - findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); + org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); + findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); - List keysFound = InquiryHelper.findBinding(body, findQualifiers, em); + List keysFound = InquiryHelper.findBinding(body, findQualifiers, em); - if (keysFound!=null && keysFound.size() == 0) { - if (body.getServiceKey() != null) { + if (keysFound != null && keysFound.size() == 0) { + if (body.getServiceKey() != null) { // Check that we were passed a valid serviceKey per - // 5.1.12.4 of the UDDI v3 spec - String serviceKey = body.getServiceKey(); - org.apache.juddi.model.BusinessService modelBusinessService = null; - try { - em.find(org.apache.juddi.model.BusinessService.class, serviceKey); - } catch (ClassCastException e) {} - if (modelBusinessService == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey)); + // 5.1.12.4 of the UDDI v3 spec + String serviceKey = body.getServiceKey(); + org.apache.juddi.model.BusinessService modelBusinessService = null; + try { + em.find(org.apache.juddi.model.BusinessService.class, serviceKey); + } catch (ClassCastException e) { + } + if (modelBusinessService == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey)); + } - } - } - BindingDetail result = InquiryHelper.getBindingDetailFromKeys(body, findQualifiers, em, keysFound); - tx.rollback(); + } + } + BindingDetail result = InquiryHelper.getBindingDetailFromKeys(body, findQualifiers, em, keysFound); + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_BINDING, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.FIND_BINDING, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public BusinessList findBusiness(FindBusiness body) - throws DispositionReportFaultMessage { + public BusinessList findBusiness(FindBusiness body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateFindBusiness(body); + new ValidateInquiry(null).validateFindBusiness(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); - findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); + org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); + findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); - List keysFound = InquiryHelper.findBusiness(body, findQualifiers, em); + List keysFound = InquiryHelper.findBusiness(body, findQualifiers, em); - BusinessList result = InquiryHelper.getBusinessListFromKeys(body, findQualifiers, em, keysFound); + BusinessList result = InquiryHelper.getBusinessListFromKeys(body, findQualifiers, em, keysFound); - tx.rollback(); + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public RelatedBusinessesList findRelatedBusinesses(FindRelatedBusinesses body) - throws DispositionReportFaultMessage { + public RelatedBusinessesList findRelatedBusinesses(FindRelatedBusinesses body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateFindRelatedBusinesses(body, false); + new ValidateInquiry(null).validateFindRelatedBusinesses(body, false); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_RELATEDBUSINESSES, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_RELATEDBUSINESSES, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } // TODO: findQualifiers aren't really used for this call, except maybe for sorting. Sorting must be done in Java due to the retrieval method used. Right now - // no sorting is performed. - org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); - findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); + // no sorting is performed. + org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); + findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); - RelatedBusinessesList result = InquiryHelper.getRelatedBusinessesList(body, em); + RelatedBusinessesList result = InquiryHelper.getRelatedBusinessesList(body, em); - tx.rollback(); + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_RELATEDBUSINESSES, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.FIND_RELATEDBUSINESSES, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public ServiceList findService(FindService body) - throws DispositionReportFaultMessage { + public ServiceList findService(FindService body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateFindService(body); + new ValidateInquiry(null).validateFindService(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_SERVICE, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_SERVICE, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); - findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); + org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); + findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); - List keysFound = InquiryHelper.findService(body, findQualifiers, em); + List keysFound = InquiryHelper.findService(body, findQualifiers, em); - if (keysFound.size() == 0) { - if (body.getBusinessKey() != null) { + if (keysFound == null || keysFound.size() == 0) { + if (body.getBusinessKey() != null) { // Check that we were passed a valid businessKey per - // 5.1.12.4 of the UDDI v3 spec - String businessKey = body.getBusinessKey(); - org.apache.juddi.model.BusinessEntity modelBusinessEntity = null; - try { - modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey); - } catch (ClassCastException e) {} - if (modelBusinessEntity == null) { - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey)); - } - } - } + // 5.1.12.4 of the UDDI v3 spec + String businessKey = body.getBusinessKey(); + org.apache.juddi.model.BusinessEntity modelBusinessEntity = null; + try { + modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey); + } catch (ClassCastException e) { + } + if (modelBusinessEntity == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey)); + } + } + } - ServiceList result = InquiryHelper.getServiceListFromKeys(body, findQualifiers, em, keysFound); + ServiceList result = InquiryHelper.getServiceListFromKeys(body, findQualifiers, em, keysFound); - tx.rollback(); + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_SERVICE, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.FIND_SERVICE, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public TModelList findTModel(FindTModel body) - throws DispositionReportFaultMessage { + public TModelList findTModel(FindTModel body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateFindTModel(body, false); + new ValidateInquiry(null).validateFindTModel(body, false); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.FAILED, procTime); + throw drfm; } - - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); - findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - List keysFound = InquiryHelper.findTModel(body, findQualifiers, em); + org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers(); + findQualifiers.mapApiFindQualifiers(body.getFindQualifiers()); - TModelList result = InquiryHelper.getTModelListFromKeys(body, findQualifiers, em, keysFound); + List keysFound = InquiryHelper.findTModel(body, findQualifiers, em); - tx.rollback(); + TModelList result = InquiryHelper.getTModelListFromKeys(body, findQualifiers, em, keysFound); + + tx.rollback(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public BindingDetail getBindingDetail(GetBindingDetail body) - throws DispositionReportFaultMessage { + public BindingDetail getBindingDetail(GetBindingDetail body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateGetBindingDetail(body); + new ValidateInquiry(null).validateGetBindingDetail(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.FIND_TMODEL, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - BindingDetail result = new BindingDetail(); + BindingDetail result = new BindingDetail(); - List bindingKeyList = body.getBindingKey(); - for (String bindingKey : bindingKeyList) { - org.apache.juddi.model.BindingTemplate modelBindingTemplate = null; - try { - modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey); - } catch (ClassCastException e) {} - if (modelBindingTemplate == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", bindingKey)); + List bindingKeyList = body.getBindingKey(); + for (String bindingKey : bindingKeyList) { + org.apache.juddi.model.BindingTemplate modelBindingTemplate = null; + try { + modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey); + } catch (ClassCastException e) { + } + if (modelBindingTemplate == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BindingTemplateNotFound", bindingKey)); + } - org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate(); + org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate(); - MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate); + MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate); - result.getBindingTemplate().add(apiBindingTemplate); - } + result.getBindingTemplate().add(apiBindingTemplate); + } - tx.commit(); + tx.commit(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_BINDINGDETAIL, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.GET_BINDINGDETAIL, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public BusinessDetail getBusinessDetail(GetBusinessDetail body) - throws DispositionReportFaultMessage { + public BusinessDetail getBusinessDetail(GetBusinessDetail body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateGetBusinessDetail(body); + new ValidateInquiry(null).validateGetBusinessDetail(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_BUSINESSDETAIL, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.GET_BUSINESSDETAIL, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - BusinessDetail result = new BusinessDetail(); + BusinessDetail result = new BusinessDetail(); - List businessKeyList = body.getBusinessKey(); - for (String businessKey : businessKeyList) { - org.apache.juddi.model.BusinessEntity modelBusinessEntity = null; - try { - modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey); - } catch (ClassCastException e) {} - if (modelBusinessEntity == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey)); + List businessKeyList = body.getBusinessKey(); + for (String businessKey : businessKeyList) { + org.apache.juddi.model.BusinessEntity modelBusinessEntity = null; + try { + modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey); + } catch (ClassCastException e) { + } + if (modelBusinessEntity == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", businessKey)); + } - org.uddi.api_v3.BusinessEntity apiBusinessEntity = new org.uddi.api_v3.BusinessEntity(); + org.uddi.api_v3.BusinessEntity apiBusinessEntity = new org.uddi.api_v3.BusinessEntity(); - MappingModelToApi.mapBusinessEntity(modelBusinessEntity, apiBusinessEntity); + MappingModelToApi.mapBusinessEntity(modelBusinessEntity, apiBusinessEntity); - result.getBusinessEntity().add(apiBusinessEntity); - } + result.getBusinessEntity().add(apiBusinessEntity); + } - tx.commit(); + tx.commit(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_BUSINESSDETAIL, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.GET_BUSINESSDETAIL, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public OperationalInfos getOperationalInfo(GetOperationalInfo body) - throws DispositionReportFaultMessage { + public OperationalInfos getOperationalInfo(GetOperationalInfo body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateGetOperationalInfo(body); + new ValidateInquiry(null).validateGetOperationalInfo(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_OPERATIONALINFO, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.GET_OPERATIONALINFO, QueryStatus.FAILED, procTime); + throw drfm; } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - OperationalInfos result = new OperationalInfos(); + OperationalInfos result = new OperationalInfos(); - List entityKeyList = body.getEntityKey(); - for (String entityKey : entityKeyList) { - org.apache.juddi.model.UddiEntity modelUddiEntity = null; - try { - modelUddiEntity = em.find(org.apache.juddi.model.UddiEntity.class, entityKey); - } catch (ClassCastException e) {} - if (modelUddiEntity == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.EntityNotFound", entityKey)); + List entityKeyList = body.getEntityKey(); + for (String entityKey : entityKeyList) { + org.apache.juddi.model.UddiEntity modelUddiEntity = null; + try { + modelUddiEntity = em.find(org.apache.juddi.model.UddiEntity.class, entityKey); + } catch (ClassCastException e) { + } + if (modelUddiEntity == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.EntityNotFound", entityKey)); + } - org.uddi.api_v3.OperationalInfo apiOperationalInfo = new org.uddi.api_v3.OperationalInfo(); + org.uddi.api_v3.OperationalInfo apiOperationalInfo = new org.uddi.api_v3.OperationalInfo(); - MappingModelToApi.mapOperationalInfo(modelUddiEntity, apiOperationalInfo); + MappingModelToApi.mapOperationalInfo(modelUddiEntity, apiOperationalInfo); - result.getOperationalInfo().add(apiOperationalInfo); - } + result.getOperationalInfo().add(apiOperationalInfo); + } - tx.commit(); + tx.commit(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_OPERATIONALINFO, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.GET_OPERATIONALINFO, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } - - - public ServiceDetail getServiceDetail(GetServiceDetail body) - throws DispositionReportFaultMessage { - long startTime = System.currentTimeMillis(); - try { - new ValidateInquiry(null).validateGetServiceDetail(body); - } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_SERVICEDETAIL, QueryStatus.FAILED, procTime); - throw drfm; + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } } - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); + public ServiceDetail getServiceDetail(GetServiceDetail body) + throws DispositionReportFaultMessage { + long startTime = System.currentTimeMillis(); + try { + new ValidateInquiry(null).validateGetServiceDetail(body); + } catch (DispositionReportFaultMessage drfm) { + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.GET_SERVICEDETAIL, QueryStatus.FAILED, procTime); + throw drfm; + } - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - ServiceDetail result = new ServiceDetail(); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - List serviceKeyList = body.getServiceKey(); - for (String serviceKey : serviceKeyList) { - org.apache.juddi.model.BusinessService modelBusinessService = null; - try { - modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey); - } catch (ClassCastException e){} - if (modelBusinessService == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey)); + ServiceDetail result = new ServiceDetail(); - org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService(); + List serviceKeyList = body.getServiceKey(); + for (String serviceKey : serviceKeyList) { + org.apache.juddi.model.BusinessService modelBusinessService = null; + try { + modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey); + } catch (ClassCastException e) { + } + if (modelBusinessService == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ServiceNotFound", serviceKey)); + } - MappingModelToApi.mapBusinessService(modelBusinessService, apiBusinessService); + org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService(); - result.getBusinessService().add(apiBusinessService); - } + MappingModelToApi.mapBusinessService(modelBusinessService, apiBusinessService); - tx.commit(); + result.getBusinessService().add(apiBusinessService); + } + + tx.commit(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_SERVICEDETAIL, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.GET_SERVICEDETAIL, QueryStatus.SUCCESS, procTime); - return result; + return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - - public TModelDetail getTModelDetail(GetTModelDetail body) - throws DispositionReportFaultMessage { + public TModelDetail getTModelDetail(GetTModelDetail body) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); try { - new ValidateInquiry(null).validateGetTModelDetail(body); + new ValidateInquiry(null).validateGetTModelDetail(body); } catch (DispositionReportFaultMessage drfm) { - long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_TMODELDETAIL, QueryStatus.FAILED, procTime); - throw drfm; + long procTime = System.currentTimeMillis() - startTime; + serviceCounter.update(InquiryQuery.GET_TMODELDETAIL, QueryStatus.FAILED, procTime); + throw drfm; } - - EntityManager em = PersistenceManager.getEntityManager(); - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); - if (isAuthenticated()) - this.getEntityPublisher(em, body.getAuthInfo()); + EntityManager em = PersistenceManager.getEntityManager(); + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); - TModelDetail result = new TModelDetail(); + if (isAuthenticated()) { + this.getEntityPublisher(em, body.getAuthInfo()); + } - List tmodelKeyList = body.getTModelKey(); - for (String tmodelKey : tmodelKeyList) { - org.apache.juddi.model.Tmodel modelTModel = null; - try { - modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey); - } catch (ClassCastException e) {} - if (modelTModel == null) - throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", tmodelKey)); + TModelDetail result = new TModelDetail(); - org.uddi.api_v3.TModel apiTModel = new org.uddi.api_v3.TModel(); + List tmodelKeyList = body.getTModelKey(); + for (String tmodelKey : tmodelKeyList) { + org.apache.juddi.model.Tmodel modelTModel = null; + try { + modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey); + } catch (ClassCastException e) { + } + if (modelTModel == null) { + throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", tmodelKey)); + } - MappingModelToApi.mapTModel(modelTModel, apiTModel); + org.uddi.api_v3.TModel apiTModel = new org.uddi.api_v3.TModel(); - result.getTModel().add(apiTModel); - } + MappingModelToApi.mapTModel(modelTModel, apiTModel); - tx.commit(); + result.getTModel().add(apiTModel); + } + + tx.commit(); long procTime = System.currentTimeMillis() - startTime; - serviceCounter.update(InquiryQuery.GET_TMODELDETAIL, QueryStatus.SUCCESS, procTime); + serviceCounter.update(InquiryQuery.GET_TMODELDETAIL, QueryStatus.SUCCESS, procTime); - return result; - } finally { - if (tx.isActive()) { - tx.rollback(); - } - em.close(); - } - } + return result; + } finally { + if (tx.isActive()) { + tx.rollback(); + } + em.close(); + } + } - private boolean isAuthenticated() { - boolean result = false; - try { - result = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTHENTICATE_INQUIRY); - } catch (ConfigurationException e) { - log.error("Configuration exception occurred retrieving: " + Property.JUDDI_AUTHENTICATE_INQUIRY, e); - } - return result; - } + private boolean isAuthenticated() { + boolean result = false; + try { + result = AppConfig.getConfiguration().getBoolean(Property.JUDDI_AUTHENTICATE_INQUIRY); + } catch (ConfigurationException e) { + log.error("Configuration exception occurred retrieving: " + Property.JUDDI_AUTHENTICATE_INQUIRY, e); + } + return result; + } } Index: juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java =================================================================== --- juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (revision 1559519) +++ juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (working copy) @@ -235,7 +235,7 @@ throw new FatalErrorException(new ErrorMessage("errors.NullInput")); } - if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().size() == 0) { + if (body.getCategoryBag() == null && body.getFindTModel() == null && body.getTModelBag() == null && body.getName().isEmpty() && (body.getBusinessKey()==null || body.getBusinessKey().length()==0)) { throw new FatalErrorException(new ErrorMessage("errors.findservice.NoInput")); } Index: uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java =================================================================== --- uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java (revision 1559519) +++ uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java (working copy) @@ -61,7 +61,7 @@ * @author Alex O'Ree */ public class UDDI_141_JIRAIntegrationTest { - + public UDDI_141_JIRAIntegrationTest() throws RemoteException { } private static Log logger = LogFactory.getLog(UDDI_141_JIRAIntegrationTest.class); @@ -71,6 +71,7 @@ static UDDIPublicationPortType publicationJoe = null; static TckTModel tckTModelJoe = null; static TckBusiness tckBusinessJoe = null; + static TckBusinessService tckServiceJoe = null; static UDDISubscriptionPortType subscriptionSam = null; static UDDIInquiryPortType inquiryJoeSam = null; static UDDIPublicationPortType publicationSam = null; @@ -95,7 +96,7 @@ static final String str51 = "111111111111111111111111111111111111111111111111111"; static final String str50 = "11111111111111111111111111111111111111111111111111"; static final String MISSING_RESOURCE = "Can't find resource for bundle"; - + @AfterClass public static void stopManager() throws ConfigurationException { tckTModelJoe.deleteCreatedTModels(authInfoJoe); @@ -102,23 +103,23 @@ tckTModelSam.deleteCreatedTModels(authInfoSam); manager.stop(); } - + @BeforeClass public static void startManager() throws ConfigurationException { logger.info("UDDI_141_JIRAIntegrationTest"); manager = new UDDIClient(); manager.start(); - + logger.debug("Getting auth tokens.."); try { Transport transport = manager.getTransport(); security = transport.getUDDISecurityService(); - + publicationJoe = transport.getUDDIPublishService(); inquiryJoe = transport.getUDDIInquiryService(); - + subscriptionJoe = transport.getUDDISubscriptionService(); - + authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); authInfoSam = TckSecurity.getAuthToken(security, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); //Assert.assertNotNull(authInfoJoe); @@ -127,14 +128,14 @@ TckSecurity.setCredentials((BindingProvider) publicationJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); TckSecurity.setCredentials((BindingProvider) inquiryJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); TckSecurity.setCredentials((BindingProvider) subscriptionJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); - + } tckTModelJoe = new TckTModel(publicationJoe, inquiryJoe); tckBusinessJoe = new TckBusiness(publicationJoe, inquiryJoe); - - + tckServiceJoe = new TckBusinessService(publicationJoe, inquiryJoe); + transport = manager.getTransport(); - + publicationSam = transport.getUDDIPublishService(); inquiryJoeSam = transport.getUDDIInquiryService(); if (!TckPublisher.isUDDIAuthMode()) { @@ -145,15 +146,13 @@ subscriptionSam = transport.getUDDISubscriptionService(); tckTModelSam = new TckTModel(publicationSam, inquiryJoeSam); tckBusinessSam = new TckBusiness(publicationSam, inquiryJoeSam); - - - + } catch (Exception e) { logger.error(e.getMessage(), e); Assert.fail("Could not obtain authInfo token."); } } - + static void HandleException(Exception ex) { System.err.println("Error caught of type " + ex.getClass().getCanonicalName()); ex.printStackTrace(); @@ -168,7 +167,7 @@ } } } - + @Test public void JUDDI_JIRA_571_Part1_Test() { //add a business @@ -185,7 +184,7 @@ n.setValue("JUDDI_JIRA_571_Part1_Test no lang"); be.getName().add(n); sb.getBusinessEntity().add(be); - + be = new BusinessEntity(); n = new Name(); n.setValue("JUDDI_JIRA_571_Part1_Test with lang"); @@ -196,12 +195,12 @@ BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(1).getBusinessKey()); - + } catch (Exception ex) { HandleException(ex); Assert.fail("unexpected failure"); } - + int found1 = 0; FindBusiness fb = new FindBusiness(); fb.setAuthInfo(authInfoJoe); @@ -226,9 +225,7 @@ if (found1 != 2) { failuremsg += "No lang defined, " + found1 + " records found instead of 2"; } - - - + found1 = 0; fb = new FindBusiness(); fb.setAuthInfo(authInfoJoe); @@ -254,16 +251,15 @@ if (found1 != 1) { failuremsg += "Lang defined, " + found1 + " records found instead of 1"; } - - + DeleteBusinesses(businesskeysToDelete, authInfoJoe, publicationJoe); if (failuremsg.length() > 0) { Assert.fail(failuremsg); } System.out.println("Pass"); - + } - + @Test public void JUDDI_JIRA_571_Part2_Test() { //add a service @@ -271,8 +267,6 @@ //find service with lang defined, expecting one result //find service without lang defined, expecting 2 results - - List businesskeysToDelete = new ArrayList(); List targetServiceKeys = new ArrayList(); String failuremsg = ""; @@ -284,7 +278,7 @@ n.setValue("JUDDI_JIRA_571_Part2_Test no lang"); be.getName().add(n); sb.getBusinessEntity().add(be); - + BusinessService bs = new BusinessService(); n = new Name(); n.setValue("Service1 No Lang"); @@ -291,7 +285,7 @@ bs.getName().add(n); be.setBusinessServices(new BusinessServices()); be.getBusinessServices().getBusinessService().add(bs); - + bs = new BusinessService(); n = new Name(); n.setValue("Service2 Lang"); @@ -303,12 +297,12 @@ businesskeysToDelete.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); targetServiceKeys.add(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey()); targetServiceKeys.add(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(1).getServiceKey()); - + } catch (Exception ex) { HandleException(ex); Assert.fail("unexpected failure"); } - + int found1 = 0; FindService fb = new FindService(); fb.setAuthInfo(authInfoJoe); @@ -333,9 +327,7 @@ if (found1 != 2) { failuremsg += "No lang defined, " + found1 + " records found instead of 2"; } - - - + found1 = 0; fb = new FindService(); fb.setAuthInfo(authInfoJoe); @@ -361,16 +353,15 @@ if (found1 != 1) { failuremsg += "Lang defined, " + found1 + " records found instead of 1"; } - - + DeleteBusinesses(businesskeysToDelete, authInfoJoe, publicationJoe); if (failuremsg.length() > 0) { Assert.fail(failuremsg); } System.out.println("Pass"); - + } - + @Test public void JUDDI_571_Part3_Test() { //add a tmodel @@ -378,9 +369,8 @@ //find tmodel with lang defined, expecting one result //find tmodel without lang defined, expecting 2 results - List businesskeysToDelete = new ArrayList(); - + String failuremsg = ""; System.out.println("JUDDI_571_Part3_Test"); SaveTModel sb = new SaveTModel(); @@ -390,7 +380,7 @@ n.setValue("JUDDI_571_Part3_Test no lang"); be.setName(n); sb.getTModel().add(be); - + be = new TModel(); n = new Name(); n.setValue("JUDDI_571_Part3_Test lang"); @@ -397,7 +387,7 @@ n.setLang("en"); be.setName(n); sb.getTModel().add(be); - + try { TModelDetail saveTModel = publicationJoe.saveTModel(sb); businesskeysToDelete.add(saveTModel.getTModel().get(0).getTModelKey()); @@ -406,7 +396,7 @@ HandleException(ex); Assert.fail("unexpected failure"); } - + int found1 = 0; FindTModel fb = new FindTModel(); fb.setAuthInfo(authInfoJoe); @@ -431,9 +421,7 @@ if (found1 != 2) { failuremsg += "No lang defined, " + found1 + " records found instead of 2"; } - - - + found1 = 0; fb = new FindTModel(); fb.setAuthInfo(authInfoJoe); @@ -459,26 +447,23 @@ if (found1 != 1) { failuremsg += "Lang defined, " + found1 + " records found instead of 1"; } - - + DeleteTModels(businesskeysToDelete); if (failuremsg.length() > 0) { Assert.fail(failuremsg); } System.out.println("Pass"); - + } - + @Test public void JUDDI_574() { //make a test model with a lang //search for it by name - //confirm that the lang is present - List businesskeysToDelete = new ArrayList(); - + String failuremsg = ""; System.out.println("JUDDI_574"); SaveTModel sb = new SaveTModel(); @@ -489,7 +474,7 @@ n.setLang("en"); be.setName(n); sb.getTModel().add(be); - + try { TModelDetail saveTModel = publicationJoe.saveTModel(sb); businesskeysToDelete.add(saveTModel.getTModel().get(0).getTModelKey()); @@ -519,7 +504,7 @@ + " has a null or empty lang"; } } - + } } } catch (Exception ex) { @@ -529,13 +514,13 @@ if (found1 != 1) { failuremsg += "found " + found1 + " records found instead of 1"; } - + DeleteTModels(businesskeysToDelete); if (failuremsg.length() > 0) { Assert.fail(failuremsg); } System.out.println("Pass"); - + } /** @@ -547,7 +532,7 @@ public void JUDDI_590() throws Exception { //create two businesses System.out.println("JUDDI_590"); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -567,7 +552,7 @@ } catch (SOAPFaultException ex) { HandleException(ex); } - + sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); @@ -588,7 +573,6 @@ HandleException(ex); } - //create an assertion on one end AddPublisherAssertions apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoJoe); @@ -624,7 +608,6 @@ ex.printStackTrace(); } - //aprove the assertion from sam apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoSam); @@ -661,7 +644,7 @@ msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete"; } } - + assertionStatusReport = publicationJoe.getAssertionStatusReport(authInfoJoe, CompletionStatus.STATUS_TO_KEY_INCOMPLETE); for (int i = 0; i < assertionStatusReport.size(); i++) { JAXB.marshal(assertionStatusReport.get(i), System.out); @@ -676,7 +659,7 @@ msg = "Stage3: status is " + assertionStatusReport.get(i).getCompletionStatus().toString() + " instead of complete"; } } - + } } catch (Exception ex) { ok = false; @@ -685,13 +668,12 @@ List biz = new ArrayList(); biz.add(samBiz); DeleteBusinesses(biz, authInfoSam, publicationSam); - + biz = new ArrayList(); biz.add(joeBiz); DeleteBusinesses(biz, authInfoJoe, publicationJoe); Assert.assertTrue(msg, ok); - - + } /** @@ -703,7 +685,7 @@ public void JUDDI_590_1() throws Exception { //create two businesses System.out.println("JUDDI_590_1"); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -723,7 +705,7 @@ } catch (SOAPFaultException ex) { HandleException(ex); } - + sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); @@ -744,7 +726,6 @@ HandleException(ex); } - //create an assertion on one end AddPublisherAssertions apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoJoe); @@ -802,17 +783,16 @@ ok = false; ex.printStackTrace(); } - + List biz = new ArrayList(); biz.add(samBiz); DeleteBusinesses(biz, authInfoSam, publicationSam); - + biz = new ArrayList(); biz.add(joeBiz); DeleteBusinesses(biz, authInfoJoe, publicationJoe); Assert.assertTrue(msg, ok); - - + } UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl(); @@ -823,17 +803,16 @@ */ @Test public void JIRA_597() throws Exception { - + System.out.println("JIRA_597"); - + int port = 7000; String hostname = TckPublisher.getProperties().getProperty("bindaddress"); if (hostname == null) { hostname = InetAddress.getLocalHost().getHostName(); } - - - TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); + + TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; Endpoint ep = null; @@ -867,14 +846,14 @@ instanceInfo.setTModelKey("uddi:uddi.org:transport:http"); bt.setTModelInstanceDetails(new TModelInstanceDetails()); bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo); - + bs.getBindingTemplates().getBindingTemplate().add(bt); - + bs.getBindingTemplates().getBindingTemplate().add(bt); be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); - + List deleteme = new ArrayList(); deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //ok Joe's callback is setup @@ -888,7 +867,6 @@ sb.getBusinessEntity().add(be); BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb); - //ok Joe now needs to subscribe for Sam's business Holder> list = new Holder>(); list.value = new ArrayList(); @@ -902,7 +880,7 @@ gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, 1); s.setExpiresAfter(df.newXMLGregorianCalendar(gcal)); - + s.setNotificationInterval(df.newDuration(5000)); list.value.add(s); subscriptionJoe.saveSubscription(authInfoJoe, list); @@ -923,7 +901,7 @@ Thread.sleep(1000); maxwait = maxwait - 1000; } - TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); + TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); @@ -932,8 +910,7 @@ if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) { Assert.fail("no callbacks were recieved."); } - - + } /** @@ -947,19 +924,18 @@ public void JIRA_596() throws Exception { System.out.println("JIRA_596"); int port = 9000; - + String hostname = TckPublisher.getProperties().getProperty("bindaddress"); if (hostname == null) { hostname = InetAddress.getLocalHost().getHostName(); } - // String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName(); - TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); + TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); //UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl(); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; - + Endpoint ep = null; boolean ok = false; do { @@ -995,7 +971,7 @@ sb.getBusinessEntity().add(be); logger.info("setting up joe's callback business"); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); - + List deleteme = new ArrayList(); deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //ok Joe's callback is setup @@ -1023,7 +999,7 @@ gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, 1); s.setExpiresAfter(df.newXMLGregorianCalendar(gcal)); - + s.setNotificationInterval(df.newDuration(5000)); list.value.add(s); logger.info("subscribing joe's to updates for sam's business"); @@ -1046,7 +1022,7 @@ Thread.sleep(1000); maxwait = maxwait - 1000; } - TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); + TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); @@ -1058,7 +1034,7 @@ } logger.info("callback response was " + UDDISubscriptionListenerImpl.notifcationMap.get(0)); logger.info("PASS"); - + } //once more without any relationship @@ -1076,7 +1052,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1091,12 +1067,12 @@ bt.setAccessPoint(new AccessPoint()); bt.getAccessPoint().setValue("http://JIRA_575_BT/UDDI_CALLBACK"); bt.getAccessPoint().setUseType("endPoint"); - + TModelInstanceInfo instanceInfo = new TModelInstanceInfo(); instanceInfo.setTModelKey(madeupTmodel); bt.setTModelInstanceDetails(new TModelInstanceDetails()); bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo); - + bs.getBindingTemplates().getBindingTemplate().add(bt); be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); @@ -1107,10 +1083,9 @@ } catch (Exception ex) { logger.error(ex.getMessage()); } - - + } - + @Test public void JIRA_575_KR_Biz() throws Exception { System.out.println("JIRA_575_KR_Biz"); @@ -1124,7 +1099,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1134,7 +1109,7 @@ be.setCategoryBag(new CategoryBag()); be.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val")); sb.getBusinessEntity().add(be); - + try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); Assert.fail("unexpected success"); @@ -1141,9 +1116,9 @@ } catch (Exception ex) { logger.error(ex.getMessage()); } - + } - + @Test public void JIRA_575_IDENT_Biz() throws Exception { System.out.println("JIRA_575_IDENT_Biz"); @@ -1157,7 +1132,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1167,7 +1142,7 @@ be.setIdentifierBag(new IdentifierBag()); be.getIdentifierBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val")); sb.getBusinessEntity().add(be); - + try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); Assert.fail("unexpected success"); @@ -1174,9 +1149,9 @@ } catch (Exception ex) { logger.error(ex.getMessage()); } - + } - + @Test public void JIRA_575_KR_TMODEL() throws Exception { System.out.println("JIRA_575_KR_TMODEL"); @@ -1190,7 +1165,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveTModel stm = new SaveTModel(); stm.setAuthInfo(authInfoJoe); TModel tm = new TModel(); @@ -1205,7 +1180,7 @@ logger.error(ex.getMessage()); } } - + @Test public void JIRA_575_KRGRP_TMODEL() throws Exception { System.out.println("JIRA_575_KRGRP_TMODEL"); @@ -1219,7 +1194,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveTModel stm = new SaveTModel(); stm.setAuthInfo(authInfoJoe); TModel tm = new TModel(); @@ -1235,7 +1210,7 @@ logger.error(ex.getMessage()); } } - + @Test public void JIRA_575_KRGRP_Biz() throws Exception { System.out.println("JIRA_575_KRGRP_Biz"); @@ -1249,7 +1224,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1260,9 +1235,9 @@ //be.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val")); be.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup()); be.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel); - + sb.getBusinessEntity().add(be); - + try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); Assert.fail("unexpected success"); @@ -1269,9 +1244,9 @@ } catch (Exception ex) { logger.error(ex.getMessage()); } - + } - + @Test public void JIRA_575_KRGRP_PA() throws Exception { System.out.println("JIRA_575_KRGRP_PA"); @@ -1285,14 +1260,13 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - - + tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckTModelSam.saveSamSyndicatorTmodel(authInfoSam); - + tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam); - + AddPublisherAssertions apa = new AddPublisherAssertions(); apa.setAuthInfo(authInfoJoe); PublisherAssertion pa = new PublisherAssertion(); @@ -1312,7 +1286,7 @@ tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam); } } - + @Test public void JIRA_575_SVC_KR() throws Exception { System.out.println("JIRA_575_SVC_KR"); @@ -1326,7 +1300,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1339,10 +1313,10 @@ //bs.setBindingTemplates(new BindingTemplates()); bs.setCategoryBag(new CategoryBag()); bs.getCategoryBag().getKeyedReference().add(new KeyedReference(madeupTmodel, "name", "val")); - + be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); - + try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); Assert.fail("unexpected success"); @@ -1350,7 +1324,7 @@ logger.error(ex.getMessage()); } } - + @Test public void JIRA_575_SVC_KRGRP() throws Exception { System.out.println("JIRA_575_SVC_KRGRP"); @@ -1364,7 +1338,7 @@ } catch (Exception ex) { } Assume.assumeTrue(tModelDetail == null); - + SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); @@ -1378,11 +1352,10 @@ bs.setCategoryBag(new CategoryBag()); bs.getCategoryBag().getKeyedReferenceGroup().add(new KeyedReferenceGroup()); bs.getCategoryBag().getKeyedReferenceGroup().get(0).setTModelKey(madeupTmodel); - - + be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); - + try { BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); Assert.fail("unexpected success"); @@ -1390,7 +1363,6 @@ logger.error(ex.getMessage()); } } - private void DeleteBusinesses(List businesskeysToDelete, String authinfo, UDDIPublicationPortType pub) { //cleanup @@ -1403,6 +1375,7 @@ ex.printStackTrace(); } } + private void DeleteBusinesses(String businesskeysToDelete, String authinfo, UDDIPublicationPortType pub) { //cleanup try { @@ -1414,7 +1387,7 @@ ex.printStackTrace(); } } - + private void DeleteTModels(List businesskeysToDelete) { //cleanup @@ -1427,6 +1400,37 @@ ex.printStackTrace(); } } + + /** + * https://issues.apache.org/jira/browse/JUDDI-809 + * + * Someone calling find service can specify only the business key + * http://uddi.org/pubs/uddi-v3.0.2-20041019.htm#_Toc525464300 + * + * @throws Exception + */ + @Test + public void JUDDI_809() throws Exception { + //find the first business + try { + tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); + tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); + tckServiceJoe.saveJoePublisherService(authInfoJoe); + + //call find_service using that business key + FindService fs = new FindService(); + fs.setAuthInfo(authInfoJoe); + fs.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY); + ServiceList findService = inquiryJoe.findService(fs); + Assert.assertNotNull(findService); + Assert.assertNotNull(findService.getServiceInfos()); + Assert.assertNotNull(findService.getServiceInfos().getServiceInfo()); + Assert.assertFalse(findService.getServiceInfos().getServiceInfo().isEmpty()); + } finally { + tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); + tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); + } + + } - }