From 866a11a9f08606a68a38b47be3b8814d5f9ef30d Mon Sep 17 00:00:00 2001 From: Brad Gonzales Date: Mon, 11 Nov 2013 08:20:44 -0600 Subject: [PATCH] Issue #2506 BandwidthManagers now sends notifications for Subscription/BandwidthSubscription creates and deletes. Amend: Separate update from create notifications in LifecycleManagerImpl. Refactored notification sending in EdexBandwidthManager. Fixed error in LifecycleManagerImpl refactor. Added comment to isRecurringSubscription. Change-Id: Idc9e8544b156fed40d6aed41511c07138f302f77 Former-commit-id: 8f70fb1d0ca0b1bbf82e89d4afe0d8323f9cd216 [formerly 7684f7bd51770a41e68700f1d4408a6aad5cd877] Former-commit-id: aea0e847aa7537b23047d9c76b0e84c96ee822a5 --- .../subscription/CreateSubscriptionDlg.java | 10 +-- .../subscription/GroupAddDlg.java | 4 +- .../subscription/SubscriptionManagerDlg.java | 7 +- .../DataDeliveryRegistryObjectTypes.java | 16 +++++ .../META-INF/MANIFEST.MF | 1 + .../registry/event/RemoveRegistryEvent.java | 26 ++++++- .../META-INF/MANIFEST.MF | 3 +- .../bandwidth/EdexBandwidthManager.java | 71 +++++++++++++++++++ .../spring/datadelivery-service-handlers.xml | 1 - .../GroupDefinitionServiceHandler.java | 16 +---- .../lifecycle/LifecycleManagerImpl.java | 21 ++++-- .../bandwidth/BandwidthManagerIntTest.java | 3 +- .../handlers/GroupDefinitionServiceTest.java | 22 +----- 13 files changed, 139 insertions(+), 62 deletions(-) diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java index e7a9c3efeb..598080bcb4 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java @@ -143,6 +143,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf; * Oct 23, 2013 2484 dhladky Unique ID for subscriptions updated. * Oct 21, 2013 2292 mpduff Close dialog on OK. * Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message. + * Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created. * * * @@ -1179,12 +1180,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog { public void done(final IJobChangeEvent event) { try { final IStatus status = event.getResult(); - final boolean subscriptionCreated = status.isOK(); - if (subscriptionCreated) { - sendSubscriptionNotification(subscription, - username); - } if (!Strings.isNullOrEmpty(status.getMessage())) { guiThreadTaskExecutor.runAsync(new Runnable() { @@ -1286,10 +1282,6 @@ public class CreateSubscriptionDlg extends CaveSWTDialog { return false; } - subscriptionNotificationService - .sendUpdatedSubscriptionNotification(subscription, - username); - } catch (RegistryHandlerException e) { statusHandler.handle(Priority.PROBLEM, "Unable to update subscription.", e); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java index 3134507a9d..22c1bccf2e 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/GroupAddDlg.java @@ -67,6 +67,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf; * Apr 08, 2013 1826 djohnson Remove delivery options. * May 14, 2013 1040 mpduff Changed to add office Id rather than setting it. * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. + * Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created. * * * @@ -279,9 +280,6 @@ public class GroupAddDlg extends CaveSWTDialog { return false; } - subscriptionNotificationService.sendCreatedSubscriptionNotification( - subscription, username); - // refresh table callback.handleRefresh(); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java index b77cd64892..dc02ddcba3 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java @@ -142,6 +142,7 @@ import com.raytheon.viz.ui.presenter.IDisplay; * Sep 25. 2013 2409 mpduff Add check for widget disposed after calling configuration. * Oct 25, 2013 2292 mpduff Move overlap checks to edex. * Nov 06, 2013 2358 mpduff Resurrected file management code. + * Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is deleted. * * * @author mpduff @@ -1330,12 +1331,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements .get(ISubscriptionHandler.class); try { handler.delete(username, subscriptions); - - for (Subscription subscription : subscriptions) { - subscriptionNotificationService - .sendDeletedSubscriptionNotification(subscription, - username); - } } catch (RegistryHandlerException e) { exceptions.add(e); } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java index 0d5207cea9..4ba8bd7327 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/DataDeliveryRegistryObjectTypes.java @@ -34,6 +34,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil; * Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry. * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * Oct 11, 2013 2460 dhladky Restored Adhoc to registry store, WFO only. + * Nov 12, 2013 2506 bgonzale Added is recurring subscription method. * * * @@ -65,4 +66,19 @@ public final class DataDeliveryRegistryObjectTypes { public static final String PROVIDER = RegistryUtil .getObjectType(Provider.class); + + /** + * Is the object type a recurring subscription type, excluding adhoc + * subscriptions. + * + * @param objectType + * @return true if the objectType is a recurring subscription type; false + * otherwise. + */ + public static final boolean isRecurringSubscription(String objectType) { + return DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION + .equals(objectType) + || DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION + .equals(objectType); + } } diff --git a/edexOsgi/com.raytheon.uf.common.registry.event/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.registry.event/META-INF/MANIFEST.MF index 581328dc3d..a452b11917 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.event/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.registry.event/META-INF/MANIFEST.MF @@ -9,3 +9,4 @@ Export-Package: com.raytheon.uf.common.registry.event Require-Bundle: com.raytheon.uf.common.serialization;bundle-version="1.12.1174", com.raytheon.uf.common.event;bundle-version="1.0.0", com.raytheon.uf.common.stats;bundle-version="1.0.0" +Import-Package: oasis.names.tc.ebxml.regrep.xsd.rim.v4 diff --git a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java index 5d68c86a72..77820fb6cf 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java +++ b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RemoveRegistryEvent.java @@ -20,6 +20,8 @@ package com.raytheon.uf.common.registry.event; * further licensing information. **/ +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; + import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; /** @@ -33,7 +35,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 16, 2012 jsanchez Initial creation - * Nov 08, 2013 2506 bgonzale Added constructors. + * Nov 08, 2013 2506 bgonzale Added constructors. Added object deleted field. + * Added RegistryObjectType field. * * * @@ -47,13 +50,17 @@ public class RemoveRegistryEvent extends RegistryEvent { private String username; + private RegistryObjectType removedObject; + public RemoveRegistryEvent() { } - public RemoveRegistryEvent(String username, String id) { + public RemoveRegistryEvent(String username, String id, + RegistryObjectType removedObject) { super(id, null, null, Action.DELETE); this.username = username; + this.removedObject = removedObject; } public String getUsername() { @@ -64,6 +71,21 @@ public class RemoveRegistryEvent extends RegistryEvent { this.username = username; } + /** + * @return the removedObject + */ + public RegistryObjectType getRemovedObject() { + return removedObject; + } + + /** + * @param removedObject + * the removedObject to set + */ + public void setRemovedObject(RegistryObjectType removedObject) { + this.removedObject = removedObject; + } + @Override public String toString() { return "Remove " + super.toString(); diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF index 123d1e0365..b7c2f5cb8f 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF @@ -16,5 +16,6 @@ Require-Bundle: com.raytheon.uf.common.datadelivery.bandwidth;bundle-version="1. com.raytheon.uf.common.status;bundle-version="1.12.1174", com.google.guava;bundle-version="1.0.0", com.raytheon.uf.edex.core;bundle-version="1.12.1174", - com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0" + com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0", + com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0" Import-Package: com.raytheon.edex.site diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java index 9f228cc506..5085db74af 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java @@ -19,6 +19,8 @@ **/ package com.raytheon.uf.edex.datadelivery.bandwidth; +import static com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders.Type.JAXB; + import java.text.ParseException; import java.util.Calendar; import java.util.Date; @@ -37,6 +39,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import com.google.common.eventbus.AllowConcurrentEvents; import com.google.common.eventbus.Subscribe; +import com.raytheon.edex.site.SiteUtil; import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest; import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType; import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription; @@ -53,8 +56,11 @@ import com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHan import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; import com.raytheon.uf.common.event.EventBus; +import com.raytheon.uf.common.registry.ebxml.encoder.RegistryEncoders; import com.raytheon.uf.common.registry.event.InsertRegistryEvent; +import com.raytheon.uf.common.registry.event.RegistryEvent; import com.raytheon.uf.common.registry.event.RemoveRegistryEvent; +import com.raytheon.uf.common.registry.event.UpdateRegistryEvent; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.serialization.SerializationException; @@ -100,6 +106,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil; * 10/23/2013 2385 bphillip Change schedule method to scheduleAdhoc * Nov 04, 2013 2506 bgonzale Added removeBandwidthSubscriptions method. * Added subscriptionNotificationService field. + * Send notifications. * * * @@ -325,6 +332,17 @@ public abstract class EdexBandwidthManager + event.getId() + "]"); removeBandwidthSubscriptions(event.getId()); + try { + Subscription sub = (Subscription) RegistryEncoders + .ofType(JAXB).decodeObject( + ((RemoveRegistryEvent) event).getRemovedObject()); + sendSubscriptionNotificationEvent(event, sub); + } catch (SerializationException e) { + statusHandler + .handle(Priority.PROBLEM, + "Failed to retrieve deleted object from RemoveRegistryEvent", + e); + } } } } @@ -368,6 +386,59 @@ public abstract class EdexBandwidthManager + "]"); } } + Subscription sub = getRegistryObjectById(subscriptionHandler, + re.getId()); + sendSubscriptionNotificationEvent(re, sub); + } + + /** + * Create a hook into the EDEX Notification sub-system to receive + * UpdateRegistryEvents. Filter for subscription specific events. + * + * @param event + */ + @Subscribe + @AllowConcurrentEvents + public void registryEventListener(UpdateRegistryEvent event) { + Subscription sub = getRegistryObjectById(subscriptionHandler, + event.getId()); + sendSubscriptionNotificationEvent(event, sub); + } + + private void sendSubscriptionNotificationEvent(RegistryEvent event, + Subscription sub) { + final String objectType = event.getObjectType(); + + if (DataDeliveryRegistryObjectTypes.isRecurringSubscription(objectType)) { + if (sub != null) { + boolean isApplicableForTheLocalSite = sub.getOfficeIDs() + .contains(SiteUtil.getSite()); + if (isApplicableForTheLocalSite) { + switch (event.getAction()) { + case UPDATE: + subscriptionNotificationService + .sendUpdatedSubscriptionNotification(sub, + sub.getOwner()); + break; + case INSERT: + subscriptionNotificationService + .sendCreatedSubscriptionNotification(sub, + sub.getOwner()); + break; + case DELETE: + subscriptionNotificationService + .sendDeletedSubscriptionNotification(sub, + sub.getOwner()); + break; + default: + statusHandler.handle( + Priority.PROBLEM, + "Invalid RegistryEvent action: " + + event.getAction()); + } + } + } + } } private DataSetMetaData getDataSetMetaData(String id) { diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-service-handlers.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-service-handlers.xml index b99a3c9616..df59b4c1f3 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-service-handlers.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/res/spring/datadelivery-service-handlers.xml @@ -18,7 +18,6 @@ - diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/src/com/raytheon/uf/edex/datadelivery/service/services/GroupDefinitionServiceHandler.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/src/com/raytheon/uf/edex/datadelivery/service/services/GroupDefinitionServiceHandler.java index c2b9abb06c..83fa583c3f 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.service/src/com/raytheon/uf/edex/datadelivery/service/services/GroupDefinitionServiceHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.service/src/com/raytheon/uf/edex/datadelivery/service/services/GroupDefinitionServiceHandler.java @@ -29,7 +29,6 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService; -import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler; @@ -45,6 +44,7 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 18, 2013 1441 djohnson Initial creation + * Nov 12, 2013 2506 bgonzale Refactored out notification service. * * * @@ -55,17 +55,13 @@ import com.raytheon.uf.edex.auth.resp.AuthorizationResponse; public class GroupDefinitionServiceHandler extends AbstractPrivilegedRequestHandler { - private final ISubscriptionNotificationService notificationService; - /** * Constructor. * * @param notificationService * the subscription notification service */ - public GroupDefinitionServiceHandler( - ISubscriptionNotificationService notificationService) { - this.notificationService = notificationService; + public GroupDefinitionServiceHandler() { } /** @@ -104,14 +100,6 @@ public class GroupDefinitionServiceHandler extends for (Subscription sub : subsForGroup) { sub.setGroupName(GroupDefinition.NO_GROUP); handler.update(sub); - - // TODO: Would be nice to use a subset of the - // SubscriptionService functionality here so we didn't have to - // manually send the subscription updated notification - String username = user != null ? user.uniqueId().toString() - : "none"; - notificationService.sendUpdatedSubscriptionNotification(sub, - username); } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java index 98bbec64b1..b14f8f0ea4 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java @@ -65,6 +65,7 @@ import com.raytheon.uf.common.registry.event.InsertRegistryEvent; import com.raytheon.uf.common.registry.event.RegistryEvent.Action; import com.raytheon.uf.common.registry.event.RegistryStatisticsEvent; import com.raytheon.uf.common.registry.event.RemoveRegistryEvent; +import com.raytheon.uf.common.registry.event.UpdateRegistryEvent; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.time.util.TimeUtil; @@ -103,6 +104,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor; * 8/1/2013 1693 bphillip Added check references and refactored submit objects to conform to EBXML 4.0 spec * 9/11/2013 2254 bphillip Cleaned up creation of auditable events * 10/23/2013 1538 bphillip Changed QueryRequest constructor call + * Nov 08, 2013 2506 bgonzale Added RegistryObjectType to RemoveRegistryEvent. + * Separate update from create notifications. * * * @@ -300,7 +303,7 @@ public class LifecycleManagerImpl implements LifecycleManager { if (objectType != null && !objectType.equals(RegistryObjectTypes.ASSOCIATION)) { RemoveRegistryEvent event = new RemoveRegistryEvent( - request.getUsername(), obj.getId()); + request.getUsername(), obj.getId(), obj); event.setAction(Action.DELETE); event.setLid(obj.getLid()); event.setObjectType(objectType); @@ -485,10 +488,9 @@ public class LifecycleManagerImpl implements LifecycleManager { // gives a close estimate to amount taken on each object // individually, this will be millis in most cases, hopefully - long avTimePerRecord = 0; - if (!objs.isEmpty()) { - avTimePerRecord = totalTime / objs.size(); - for (RegistryObjectType obj : objs) { + long avTimePerRecord = objs.isEmpty() ? 0 : totalTime / objs.size(); + if (!objsCreated.isEmpty()) { + for (RegistryObjectType obj : objsCreated) { EventBus.publish(new InsertRegistryEvent(obj.getId(), obj .getLid(), obj.getObjectType())); EventBus.publish(new RegistryStatisticsEvent(obj @@ -496,6 +498,15 @@ public class LifecycleManagerImpl implements LifecycleManager { avTimePerRecord)); } } + if (!objsUpdated.isEmpty()) { + for (RegistryObjectType obj : objsUpdated) { + EventBus.publish(new UpdateRegistryEvent(obj.getId(), obj + .getLid(), obj.getObjectType())); + EventBus.publish(new RegistryStatisticsEvent(obj + .getObjectType(), obj.getStatus(), obj.getOwner(), + avTimePerRecord)); + } + } return response; } diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java index 69a9ed5c8d..62e22066c5 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java @@ -107,6 +107,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent; * Sept 25, 2013 1797 dhladky separated time from gridded time * Oct 10, 2013 1797 bgonzale Refactored registry Time objects. * Oct 21, 2013 2292 mpduff Implement multiple data types + * Nov 08, 2013 2506 bgonzale Added RegistryObjectType to RemoveRegistryEvent. * * * @@ -1000,7 +1001,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest private void sendDeletedSubscriptionEvent(Subscription subscription) { RemoveRegistryEvent event = new RemoveRegistryEvent( - subscription.getOwner(), subscription.getId()); + subscription.getOwner(), subscription.getId(), null); event.setObjectType(DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION); bandwidthManager.subscriptionRemoved(event); } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java index 35f6168dd4..cf6106db0f 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/GroupDefinitionServiceTest.java @@ -23,11 +23,6 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.emptyCollectionOf; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import java.rmi.RemoteException; @@ -40,7 +35,6 @@ import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; import com.raytheon.uf.common.datadelivery.service.GroupDefinitionService; -import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil; import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionServiceHandler; @@ -58,6 +52,7 @@ import com.raytheon.uf.edex.datadelivery.service.services.GroupDefinitionService * Feb 26, 2013 1643 djohnson Change exception type thrown. * Mar 28, 2013 1841 djohnson Subscription is now UserSubscription. * Jun 24, 2013 2106 djohnson RegistryManager is gone. + * Nov 12, 2013 2506 bgonzale Refactored out notification service. * * * @@ -73,14 +68,11 @@ public class GroupDefinitionServiceTest { private IGroupDefinitionHandler groupHandler; - private final ISubscriptionNotificationService subscriptionNotificationService = mock(ISubscriptionNotificationService.class); - private final GroupDefinitionService service = new GroupDefinitionService() { @Override protected Object getResponseFromServer( GroupDefinitionServiceRequest request) throws Exception { - return new GroupDefinitionServiceHandler( - subscriptionNotificationService).handleRequest(request); + return new GroupDefinitionServiceHandler().handleRequest(request); } }; @@ -116,16 +108,6 @@ public class GroupDefinitionServiceTest { is(emptyCollectionOf(Subscription.class))); } - @Test - public void deletingAGroupNotifiesOfSubscriptionUpdates() - throws RemoteException, RegistryHandlerException { - service.deleteGroupDefinition(group); - - verify(subscriptionNotificationService, times(2)) - .sendUpdatedSubscriptionNotification(any(Subscription.class), - anyString()); - } - @Test public void deletingAGroupDeletesTheGroup() throws RemoteException, RegistryHandlerException {