Repository: juddi Updated Branches: refs/heads/master 538158da0 -> 690bfb015
JUDDI-242 adding findBinding by tModel cat bag tests JUDDI-899 fixing a bug where subscriptions were not picking up changes in binding templates due to ModifiedIncludingChildren not being set correctly for parent objects Project: http://git-wip-us.apache.org/repos/asf/juddi/repo Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/690bfb01 Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/690bfb01 Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/690bfb01 Branch: refs/heads/master Commit: 690bfb0157cb9c6a54f367f231326b432ecb6a33 Parents: 538158d Author: Alex <[email protected]> Authored: Thu Jan 1 13:09:18 2015 -0500 Committer: Alex <[email protected]> Committed: Thu Jan 1 13:09:18 2015 -0500 ---------------------------------------------------------------------- .../juddi/api/impl/UDDIPublicationImpl.java | 104 ++++++------ ...090_SubscriptionListenerIntegrationBase.java | 158 +++++++++++-------- .../UDDI_110_FindBusinessIntegrationTest.java | 14 -- 3 files changed, 147 insertions(+), 129 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/juddi/blob/690bfb01/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java ---------------------------------------------------------------------- diff --git a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java index 98c6c15..b683aee 100644 --- a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java +++ b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java @@ -101,8 +101,8 @@ import org.uddi.v3_service.UDDIPublicationPortType; * replication and several bug fixes */ @WebService(serviceName = "UDDIPublicationService", - endpointInterface = "org.uddi.v3_service.UDDIPublicationPortType", - targetNamespace = "urn:uddi-org:v3_service") + endpointInterface = "org.uddi.v3_service.UDDIPublicationPortType", + targetNamespace = "urn:uddi-org:v3_service") public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPublicationPortType { private static Log log = LogFactory.getLog(UDDIInquiryImpl.class); @@ -124,7 +124,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub @Override public void addPublisherAssertions(AddPublisherAssertions body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -148,8 +148,8 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub boolean persistNewAssertion = true; if (existingPubAssertion != null) { if (modelPubAssertion.getTmodelKey().equalsIgnoreCase(existingPubAssertion.getTmodelKey()) - && modelPubAssertion.getKeyName().equalsIgnoreCase(existingPubAssertion.getKeyName()) - && modelPubAssertion.getKeyValue().equalsIgnoreCase(existingPubAssertion.getKeyValue())) { + && modelPubAssertion.getKeyName().equalsIgnoreCase(existingPubAssertion.getKeyName()) + && modelPubAssertion.getKeyValue().equalsIgnoreCase(existingPubAssertion.getKeyValue())) { // This pub assertion is already been "asserted". Simply need to set the "check" value on the existing (and persistent) assertion if (publisher.isOwner(existingPubAssertion.getBusinessEntityByFromKey())) { existingPubAssertion.setFromCheck("true"); @@ -160,7 +160,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub persistNewAssertion = false; } else { - // Otherwise, it is a new relationship between these entities. Remove the old one so the new one can be added. + // Otherwise, it is a new relationship between these entities. Remove the old one so the new one can be added. // TODO: the model only seems to allow one assertion per two business (primary key is fromKey and toKey). Spec seems to imply as // many relationships as desired (the differentiator would be the keyedRef values). em.remove(existingPubAssertion); @@ -198,7 +198,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.ADD_PUBLISHERASSERTIONS, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.ADD_PUBLISHERASSERTIONS, QueryStatus.FAILED, procTime); @@ -212,7 +212,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public void deleteBinding(DeleteBinding body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -237,7 +237,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_BINDING, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_BINDING, QueryStatus.FAILED, procTime); @@ -271,7 +271,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public void deleteBusiness(DeleteBusiness body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -322,7 +322,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public void deletePublisherAssertions(DeletePublisherAssertions body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -347,7 +347,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_PUBLISHERASSERTIONS, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_PUBLISHERASSERTIONS, QueryStatus.FAILED, procTime); @@ -375,7 +375,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public void deleteService(DeleteService body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -400,7 +400,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_SERVICE, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.DELETE_SERVICE, QueryStatus.FAILED, procTime); @@ -428,7 +428,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public void deleteTModel(DeleteTModel body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -481,8 +481,8 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public List<AssertionStatusItem> getAssertionStatusReport(String authInfo, - CompletionStatus completionStatus) - throws DispositionReportFaultMessage { + CompletionStatus completionStatus) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -497,7 +497,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub tx.commit(); long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.GET_ASSERTIONSTATUSREPORT, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { @@ -513,7 +513,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public List<PublisherAssertion> getPublisherAssertions(String authInfo) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -542,12 +542,12 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub tx.commit(); long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.GET_PUBLISHERASSERTIONS, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.GET_PUBLISHERASSERTIONS, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -558,7 +558,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public RegisteredInfo getRegisteredInfo(GetRegisteredInfo body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -618,13 +618,13 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub tx.commit(); long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.GET_REGISTEREDINFO, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.GET_REGISTEREDINFO, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -635,7 +635,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public BindingDetail saveBinding(SaveBinding body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -662,7 +662,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub MappingApiToModel.mapBindingTemplate(apiBindingTemplate, modelBindingTemplate, modelBusinessService); - setOperationalInfo(em, modelBindingTemplate, publisher, false); + setOperationalInfo(em, modelBindingTemplate, publisher, true); em.persist(modelBindingTemplate); @@ -679,13 +679,13 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_BINDING, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_BINDING, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -696,7 +696,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public BusinessDetail saveBusiness(SaveBusiness body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); if (!body.getBusinessEntity().isEmpty()) { log.debug("Inbound save business request for key " + body.getBusinessEntity().get(0).getBusinessKey()); @@ -739,13 +739,13 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_BUSINESS, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_BUSINESS, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } catch (Exception ex) { StringWriter sw = new StringWriter(); @@ -763,7 +763,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public ServiceDetail saveService(SaveService body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -803,13 +803,13 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_SERVICE, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_SERVICE, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -820,7 +820,7 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } public TModelDetail saveTModel(SaveTModel body) - throws DispositionReportFaultMessage { + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -857,13 +857,13 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_TMODEL, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); return result; } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SAVE_TMODEL, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -875,8 +875,8 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub @Override public void setPublisherAssertions(String authInfo, - Holder<List<PublisherAssertion>> publisherAssertion) - throws DispositionReportFaultMessage { + Holder<List<PublisherAssertion>> publisherAssertion) + throws DispositionReportFaultMessage { long startTime = System.currentTimeMillis(); EntityManager em = PersistenceManager.getEntityManager(); @@ -892,7 +892,6 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, businessKeysFound); //TODO this has to be reworked to record what was deleted. - // First, wipe out all previous assertions associated with this publisher DeletePublisherAssertionByBusinessQuery.delete(em, businessKeysFound); @@ -914,7 +913,6 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub modelPubAssertion.setFromCheck("false"); modelPubAssertion.setToCheck("false"); - if (publisher.isOwner(modelPubAssertion.getBusinessEntityByFromKey())) { modelPubAssertion.setFromCheck("true"); } @@ -923,21 +921,21 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub } em.persist(modelPubAssertion); - changes.add(getChangeRecord_NewAssertion(apiPubAssertion, modelPubAssertion, node)); } tx.commit(); - for (int i=0; i < changes.size(); i++) + for (int i = 0; i < changes.size(); i++) { ReplicationNotifier.Enqueue(changes.get(i)); + } long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SET_PUBLISHERASSERTIONS, - QueryStatus.SUCCESS, procTime); + QueryStatus.SUCCESS, procTime); } catch (DispositionReportFaultMessage drfm) { long procTime = System.currentTimeMillis() - startTime; serviceCounter.update(PublicationQuery.SET_PUBLISHERASSERTIONS, - QueryStatus.FAILED, procTime); + QueryStatus.FAILED, procTime); throw drfm; } finally { if (tx.isActive()) { @@ -1029,16 +1027,24 @@ public class UDDIPublicationImpl extends AuthenticatedService implements UDDIPub uddiEntity.setModified(now); uddiEntity.setModifiedIncludingChildren(now); - if (!isChild) { - org.apache.juddi.model.BusinessService parent = em.find(org.apache.juddi.model.BusinessService.class, uddiEntity.getBusinessService().getEntityKey()); + //if (!isChild) { + org.apache.juddi.model.BusinessService parent = em.find(org.apache.juddi.model.BusinessService.class, uddiEntity.getBusinessService().getEntityKey()); + if (parent != null) { parent.setModifiedIncludingChildren(now); em.persist(parent); // JUDDI-421: now the businessEntity parent will have it's modifiedIncludingChildren set org.apache.juddi.model.BusinessEntity businessParent = em.find(org.apache.juddi.model.BusinessEntity.class, parent.getBusinessEntity().getEntityKey()); - businessParent.setModifiedIncludingChildren(now); - em.persist(businessParent); + if (businessParent != null) { + businessParent.setModifiedIncludingChildren(now); + em.persist(businessParent); + } else { + logger.warn("Parent business is null for saved binding template!"); + } + } else { + logger.warn("Parent service is null for saved binding template!"); } + // } String nodeId = ""; try { http://git-wip-us.apache.org/repos/asf/juddi/blob/690bfb01/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerIntegrationBase.java ---------------------------------------------------------------------- diff --git a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerIntegrationBase.java b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerIntegrationBase.java index eb0c72a..ad34486 100644 --- a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerIntegrationBase.java +++ b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_090_SubscriptionListenerIntegrationBase.java @@ -18,6 +18,7 @@ package org.apache.juddi.v3.tck; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import javax.xml.bind.JAXB; import javax.xml.datatype.DatatypeFactory; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; @@ -34,6 +35,7 @@ import org.junit.Ignore; import org.junit.Test; import org.uddi.api_v3.AccessPoint; import org.uddi.api_v3.AddPublisherAssertions; +import org.uddi.api_v3.BindingDetail; import org.uddi.api_v3.BindingTemplate; import org.uddi.api_v3.BindingTemplates; import org.uddi.api_v3.BusinessEntity; @@ -419,7 +421,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); logger.info("updating Mary's business ********** "); - updatePublisherBusiness(authInfoMary, saveMaryPublisherBusiness, publicationMary); + updatePublisherBusiness(authInfoMary, saveMaryPublisherBusiness, publicationMary, "Updated Name"); boolean found = verifyDelivery("Updated Name"); @@ -434,7 +436,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -547,8 +549,8 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { * @param biz * @param pub */ - public static void updatePublisherBusiness(String auth, BusinessEntity biz, UDDIPublicationPortType pub) throws Exception { - biz.getName().add(new Name("Updated Name", "en")); + public static void updatePublisherBusiness(String auth, BusinessEntity biz, UDDIPublicationPortType pub, String name) throws Exception { + biz.getName().add(new Name(name, null)); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(auth); sb.getBusinessEntity().add(biz); @@ -918,10 +920,8 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { } } - - - - /** + + /** * PUBLISHERASSERTION tests joe want's updates on mary's binding * * @throws Exception @@ -957,7 +957,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport()); - + holder.value.add(sub); subscriptionJoe.saveSubscription(authInfoJoe, holder); logger.info("subscription saved for " + holder.value.get(0).getSubscriptionKey()); @@ -992,7 +992,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -1083,7 +1083,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -1103,9 +1103,8 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { // /** - * find related businesses - * i.e. setup subscriptions for all related businesses to joe's biz - * then setup PA between Joe and Mary + * find related businesses i.e. setup subscriptions for all related + * businesses to joe's biz then setup PA between Joe and Mary * * @throws Exception */ @@ -1122,9 +1121,9 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { String before = TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); - + tckTModelMary.saveMaryPublisherTmodel(authInfoMary); - + BusinessEntity saveMaryPublisherBusiness = tckBusinessMary.saveMaryPublisherBusiness(authInfoMary); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessServiceJoe.saveJoePublisherService(authInfoJoe); @@ -1147,7 +1146,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { //tckSubscriptionListenerJoe.saveNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION3_XML); //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); - + logger.info("saving Mary's publisher assertion********** "); AddPublisherAssertions pa = new AddPublisherAssertions(); pa.setAuthInfo(authInfoMary); @@ -1156,8 +1155,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { pas.setFromKey(TckBusiness.MARY_BUSINESS_KEY); pas.setKeyedReference(new KeyedReference(UDDIConstants.RELATIONSHIPS, "parent", "parent-child")); pa.getPublisherAssertion().add(pas); - - + publicationMary.addPublisherAssertions(pa); logger.info("saving Joe's publisher assertion********** "); pa = new AddPublisherAssertions(); @@ -1169,18 +1167,18 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { pa.getPublisherAssertion().add(pas); publicationJoe.addPublisherAssertions(pa); - //expecting that Joe gets notified that joe's and mary's businesses are now "related" + //expecting that Joe gets notified that joe's and mary's businesses are now "related" boolean found = verifyDelivery(TckBusiness.MARY_BUSINESS_KEY); DeletePublisherAssertions deletePublisherAssertions = new DeletePublisherAssertions(); deletePublisherAssertions.setAuthInfo(authInfoMary); deletePublisherAssertions.getPublisherAssertion().add(pas); publicationMary.deletePublisherAssertions(deletePublisherAssertions); - - deletePublisherAssertions = new DeletePublisherAssertions(); + + deletePublisherAssertions = new DeletePublisherAssertions(); deletePublisherAssertions.setAuthInfo(authInfoJoe); deletePublisherAssertions.getPublisherAssertion().add(pas); // publicationJoe.deletePublisherAssertions(deletePublisherAssertions); - + if (!found) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); @@ -1192,7 +1190,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -1237,7 +1235,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { bs.setBusinessKey(saveMaryPublisherBusiness.getBusinessKey()); bs.setServiceKey(TckTModel.MARY_KEY_PREFIX + UUID.randomUUID().toString()); bs.getName().add(new Name("Mary's service for " + getTransport(), null)); - + bs.setBindingTemplates(new BindingTemplates()); BindingTemplate bt = new BindingTemplate(); bt.setAccessPoint(new AccessPoint("http://localhost", "endPoint")); @@ -1264,11 +1262,10 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindBinding(new FindBinding()); - //FAIL sub.getSubscriptionFilter().getFindBinding().setServiceKey(bs.getServiceKey()); + //FAIL sub.getSubscriptionFilter().getFindBinding().setServiceKey(bs.getServiceKey()); sub.getSubscriptionFilter().getFindBinding().setTModelBag(new TModelBag()); - + //At least one of either a tModelBag or a find_tModel argument SHOULD be supplied, unless a categoryBag based search is being used. - sub.getSubscriptionFilter().getFindBinding().getTModelBag().getTModelKey().add(WSDMQosConstants.METRIC_FAULT_COUNT_KEY); //joe wants updates to mary's binding @@ -1279,7 +1276,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); logger.info("updating Mary's binding ********** "); - String newcontent= updatePublisherBindingAddTMI(authInfoMary, bt, publicationMary); + String newcontent = updatePublisherBindingAddTMI(authInfoMary, bt, publicationMary); boolean found = verifyDelivery(newcontent); @@ -1294,7 +1291,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -1311,11 +1308,16 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { } } - - + + /** + * joe wants updates on all services with wsdm qos tmi. mary updates a + * binding to trigger the call back + * + * @throws Exception + */ @Test - @Ignore - public void joePublisherUpdate_FIND_BINDING_BY_CATBAG() throws Exception { + //@Ignore + public void joePublisherUpdate_FIND_BINDING_BY_CATBAG() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); Assume.assumeNotNull(getHostame()); logger.info("joePublisherUpdate_" + getTransport() + "_FIND_BINDING_BY_CATBAG"); @@ -1336,7 +1338,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { bs.setBusinessKey(saveMaryPublisherBusiness.getBusinessKey()); bs.setServiceKey(TckTModel.MARY_KEY_PREFIX + UUID.randomUUID().toString()); bs.getName().add(new Name("Mary's service for " + getTransport(), null)); - + bs.setBindingTemplates(new BindingTemplates()); BindingTemplate bt = new BindingTemplate(); bt.setAccessPoint(new AccessPoint("http://localhost", "endPoint")); @@ -1363,13 +1365,10 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindBinding(new FindBinding()); - //sub.getSubscriptionFilter().getFindBinding().setServiceKey(bs.getServiceKey()); - sub.getSubscriptionFilter().getFindBinding().setTModelBag(new TModelBag()); - + //At least one of either a tModelBag or a find_tModel argument SHOULD be supplied, unless a categoryBag based search is being used. - - sub.getSubscriptionFilter().getFindBinding().getTModelBag().getTModelKey().add("uddi:uddi.org:categorization:types"); - + sub.getSubscriptionFilter().getFindBinding().setCategoryBag(new CategoryBag()); + sub.getSubscriptionFilter().getFindBinding().getCategoryBag().getKeyedReference().add(new KeyedReference("uddi:uddi.org:categorization:types", UDDIConstants.CategorizationTypes_Cacheable, "Cacheable")); holder.value.add(sub); subscriptionJoe.saveSubscription(authInfoJoe, holder); @@ -1377,10 +1376,37 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { //tckSubscriptionListenerJoe.saveNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION3_XML); //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); - logger.info("updating Mary's binding ********** "); - String newcontent= updatePublisherBindingAddCategory(authInfoMary, bt, publicationMary,"uddi:uddi.org:categorization:types"); + logger.info("dumping mary's binding before.... "); + JAXB.marshal(bs, System.out); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); - boolean found = verifyDelivery(newcontent); + logger.info("updating Mary's binding ********** "); + // BindingDetail after=new BindingDetail(); + /*GetBindingDetail bindingDetail = new GetBindingDetail(); + bindingDetail.setAuthInfo(authInfoMary); + bindingDetail.getBindingKey().add(bs.getBindingTemplates().getBindingTemplate().get(0).getBindingKey());*/ + BindingDetail bindingDetail1 = null;//inquiryMary.getBindingDetail(bindingDetail); + bindingDetail1 = updatePublisherBindingAddCategory(authInfoMary, bt, publicationMary, new KeyedReference("uddi:uddi.org:categorization:types", UDDIConstants.CategorizationTypes_Cacheable, "Cacheable"), bindingDetail1); + + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + logger.info("dumping mary's binding after.... "); + JAXB.marshal(bindingDetail1, System.out); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + System.out.println("#####################################"); + boolean found = verifyDelivery(UDDIConstants.CategorizationTypes_Cacheable); if (!found) { logger.warn("Test failed, dumping business list"); @@ -1393,7 +1419,7 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { logger.error("No exceptions please."); e.printStackTrace(); - Assert.fail(); + Assert.fail(e.getMessage()); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); @@ -1410,8 +1436,6 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { } } - - //find binding private void updatePublisherService(String authInfo, BusinessService bs, UDDIPublicationPortType pub) throws Exception { @@ -1424,11 +1448,12 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { /** * returns a string used to confirm delivery of an update + * * @param authInfo * @param bt * @param pub * @return - * @throws Exception + * @throws Exception */ private String updatePublisherBinding(String authInfo, BindingTemplate bt, UDDIPublicationPortType pub) throws Exception { SaveBinding sb = new SaveBinding(); @@ -1439,43 +1464,44 @@ public abstract class UDDI_090_SubscriptionListenerIntegrationBase { pub.saveBinding(sb); return ret; } - + /** * returns a string used to confirm delivery of an update + * * @param authInfo * @param bt * @param pub * @param cat * @return - * @throws Exception + * @throws Exception */ private String updatePublisherBindingAddTMI(String authInfo, BindingTemplate bt, UDDIPublicationPortType pub) throws Exception { SaveBinding sb = new SaveBinding(); sb.setAuthInfo(authInfo); - if (bt.getTModelInstanceDetails()==null) - bt.setTModelInstanceDetails(new TModelInstanceDetails()); - TModelInstanceInfo tii = new TModelInstanceInfo(); + if (bt.getTModelInstanceDetails() == null) { + bt.setTModelInstanceDetails(new TModelInstanceDetails()); + } + TModelInstanceInfo tii = new TModelInstanceInfo(); tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY); tii.setInstanceDetails(new InstanceDetails()); tii.getInstanceDetails().setInstanceParms("400"); - bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii); - sb.getBindingTemplate().add(bt); + bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii); + sb.getBindingTemplate().add(bt); pub.saveBinding(sb); return WSDMQosConstants.METRIC_FAULT_COUNT_KEY; } - - //TODO potential test case This argument specifies the filtering criteria which limits the scope of a subscription to a subset of registry records. It is required except when renewing an existing subscription. - private String updatePublisherBindingAddCategory(String authInfo, BindingTemplate bt, UDDIPublicationPortType pub, String cat) throws Exception{ - SaveBinding sb = new SaveBinding(); + //TODO potential test case This argument specifies the filtering criteria which limits the scope of a subscription to a subset of registry records. It is required except when renewing an existing subscription. + private BindingDetail updatePublisherBindingAddCategory(String authInfo, BindingTemplate bt, UDDIPublicationPortType pub, KeyedReference cat, BindingDetail outSaveBinding) throws Exception { + SaveBinding sb = new SaveBinding(); sb.setAuthInfo(authInfo); - if (bt.getCategoryBag()==null) - bt.setCategoryBag(new CategoryBag()); - bt.getCategoryBag().getKeyedReference().add(new KeyedReference(cat, UDDIConstants.CategorizationTypes_Cacheable, "Cacheable")); - sb.getBindingTemplate().add(bt); - pub.saveBinding(sb); - return UDDIConstants.CategorizationTypes_Cacheable; + if (bt.getCategoryBag() == null) { + bt.setCategoryBag(new CategoryBag()); + } + bt.getCategoryBag().getKeyedReference().add(cat); + sb.getBindingTemplate().add(bt); + return pub.saveBinding(sb); + //return UDDIConstants.CategorizationTypes_Cacheable; } - } http://git-wip-us.apache.org/repos/asf/juddi/blob/690bfb01/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_110_FindBusinessIntegrationTest.java ---------------------------------------------------------------------- diff --git a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_110_FindBusinessIntegrationTest.java b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_110_FindBusinessIntegrationTest.java index fadcc99..71a3244 100644 --- a/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_110_FindBusinessIntegrationTest.java +++ b/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_110_FindBusinessIntegrationTest.java @@ -113,20 +113,6 @@ public class UDDI_110_FindBusinessIntegrationTest { @Test public void findBusinessByTModelBag() { Assume.assumeTrue(TckPublisher.isEnabled()); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); - System.out.println("##########################################################"); try { tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY); tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
