Issue #2038 Correct required size estimations for subscription updates

Change-Id: I7994cb1492a4a541b6fe4720179fe928b3365db0

Former-commit-id: c22c156945 [formerly 757c711d2e] [formerly 9156ec8c2d] [formerly c22c156945 [formerly 757c711d2e] [formerly 9156ec8c2d] [formerly 94eeac2f7d [formerly 9156ec8c2d [formerly 2fb575c534a756a835cc072429ba78a417d3c445]]]]
Former-commit-id: 94eeac2f7d
Former-commit-id: 7a196095cb [formerly e383aa83e1] [formerly a02c9d52556a7097e15119b2711569548c47a69b [formerly c227436a3e]]
Former-commit-id: 9a2f0831aef2aea83818d7bca5ee9fc9cc5099df [formerly f6b7d97fd2]
Former-commit-id: 89b926e15e
This commit is contained in:
Dustin Johnson 2013-06-12 12:04:08 -05:00
parent e661155551
commit 010458e6d2
6 changed files with 44 additions and 7 deletions

View file

@ -100,7 +100,8 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add Shared sites.
* Jun 04, 2013 223 mpduff Modify for point data.
* Jun 04, 2013 223 mpduff Modify for point data.
* Jun 12, 2013 2038 djohnson No longer modal.
*
* </pre>
*
@ -185,7 +186,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
* true for new subscription, false for edit
*/
public CreateSubscriptionDlg(Shell parent, boolean create) {
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
super(parent, SWT.DIALOG_TRIM,
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
this.create = create;

View file

@ -51,6 +51,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Nov 29, 2012 djohnson Initial creation
* May 22, 2013 1650 djohnson Add more bandwidth information.
* Jun 12, 2013 2038 djohnson Maximum allowed size is returned in kilobytes.
*
* </pre>
*
@ -133,7 +134,7 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog {
sizeLabel
.setText("Maximum allowed size with current latency: "
+ SizeUtil
.prettyByteSize(configuration.maximumAllowedSize));
.prettyKiloByteSize(configuration.maximumAllowedSize));
sizeLabel
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}

View file

@ -83,6 +83,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 14, 2013 2000 djohnson Check for subscription overlap/duplication.
* May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
* Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
*
* </pre>
*
@ -649,9 +650,14 @@ public class SubscriptionService implements ISubscriptionService {
return new SubscriptionServiceResult(true);
case EDIT_SUBSCRIPTIONS:
if (!result.config.isNotAbleToScheduleOnlyTheSubscription()) {
new SubscriptionManagerAction()
.loadSubscriptionManager(SubscriptionManagerFilters
.getByNames(result.config.wouldBeUnscheduledSubscriptions));
VizApp.runSync(new Runnable() {
@Override
public void run() {
new SubscriptionManagerAction()
.loadSubscriptionManager(SubscriptionManagerFilters
.getByNames(result.config.wouldBeUnscheduledSubscriptions));
}
});
}
return new SubscriptionServiceResult(true);
default:

View file

@ -33,6 +33,7 @@ import java.util.Set;
* ------------ ---------- ----------- --------------------------
* Nov 29, 2012 1286 djohnson Initial creation
* May 28, 2013 1650 djohnson More information when failing to schedule.
* Jun 12, 2013 2038 djohnson Maximum allowed size is returned in kilobytes.
*
* </pre>
*
@ -84,7 +85,7 @@ public interface IProposeScheduleResponse {
* Get the required dataset size for the subscription to not unschedule any
* subscriptions.
*
* @return the required dataset size
* @return the required dataset size, in kilobytes
*/
long getRequiredDataSetSize();
}

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Mar 29, 2013 1841 djohnson Renamed to UserSubscription.
* May 15, 2013 1040 mpduff Added addOfficeId.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Jun 12, 2013 2038 djohnson Set registryId from each constructor with arguments.
*
* </pre>
*
@ -103,6 +104,7 @@ public class SiteSubscription extends RecurringSubscription {
public SiteSubscription(SiteSubscription sub) {
super(sub);
this.setOwner(sub.getOwner());
this.setId(RegistryUtil.getRegistryObjectKey(this));
}
@XmlAttribute

View file

@ -73,6 +73,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Feb 26, 2013 1643 djohnson BandwidthService extends reusable class.
* Feb 27, 2013 1644 djohnson Bandwidth service is the WFO version.
* May 20, 2013 1650 djohnson Add test for returning required dataset size.
* Jun 12, 2013 2038 djohnson Add test for returning required dataset size on subscription update.
*
* </pre>
*
@ -393,6 +394,31 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
expectedRequiredDataSetSize, requiredDataSetSize);
}
@Test
public void testProposeScheduleSubscriptionsSecondDoesntFitReturnsRequiredSizeForSubscriptionUpdate() {
Subscription subscription = createSubscriptionThatFillsHalfABucket();
subscription.getTime().setCycleTimes(
Arrays.asList(Integer.valueOf(6), Integer.valueOf(8)));
Set<String> unscheduledSubscriptions = service.schedule(subscription);
verifyNoSubscriptionsWereUnscheduled(unscheduledSubscriptions);
// We can only fit up to a bucket
final long expectedRequiredDataSetSize = createSubscriptionThatFillsUpABucket()
.getDataSetSize();
// Try to update the subscription to fill two buckets
subscription.setDataSetSize(createSubscriptionThatFillsUpTwoBuckets()
.getDataSetSize());
final long requiredDataSetSize = service.proposeSchedule(subscription)
.getRequiredDataSetSize();
assertEquals(
"The required dataset size should have been returned from propose schedule!",
expectedRequiredDataSetSize, requiredDataSetSize);
}
@Test
public void testDetermineRequiredSizeReturnsZeroIfUnableToFitAtAll() {