Issue #2566 Update BandwidthGraphDataAdaptor to handle case when there are no reservations.

Change-Id: Ie9eb7e3e1a5bc8ac4a8ccf9532686d97f584bf1c

Former-commit-id: 6515d6a9e5 [formerly 112649eff2] [formerly 96dc3b65b1 [formerly 14171c13dd5f127df0b90a5db9a9e11b301ffc5f]]
Former-commit-id: 96dc3b65b1
Former-commit-id: 79efc3b53a
This commit is contained in:
Brad Gonzales 2013-12-11 17:05:39 -06:00
parent cdf86e65ec
commit 3f5c25ff46

View file

@ -61,6 +61,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
* Jul 11, 2013 2106 djohnson Use priority straight from the BandwidthSubscription.
* Sep 20, 2013 2397 bgonzale Add Map of Bucket Descriptions to BandwidthGraphData.
* Nov 27, 2013 2545 mpduff Get data by network
* Dec 11, 2013 2566 bgonzale handle case when there are no reservations.
*
* </pre>
*
@ -130,6 +131,7 @@ class BandwidthGraphDataAdapter {
final List<BandwidthReservation> bandwidthReservations = retrievalPlan
.getBandwidthReservationsForBucket(bucket);
if (bandwidthReservations != null) {
for (BandwidthReservation reservation : bandwidthReservations) {
if (!reservations.containsKey(reservation.getId())) {
reservations.put(reservation.getId(),
@ -139,6 +141,7 @@ class BandwidthGraphDataAdapter {
}
}
}
}
// Create time windows for each subscription retrieval by aggregating
// them with any reservations they have
@ -177,10 +180,14 @@ class BandwidthGraphDataAdapter {
List<Long> binStartTimes = new ArrayList<Long>();
binStartTimes.add(retrieval.getStartTime().getTimeInMillis());
for (BandwidthReservation reservation : reservations.get(retrieval
.getIdentifier())) {
List<BandwidthReservation> retrievalReservations = reservations
.get(retrieval.getIdentifier());
if (retrievalReservations != null) {
for (BandwidthReservation reservation : retrievalReservations) {
binStartTimes.add(reservation.getBandwidthBucket());
}
}
window.setBinStartTimes(binStartTimes);
windowData.addTimeWindow(window);
}