return viewProps;
}
};
panel.setPlot(new PlotView.Builder(ShellPlotPackageImplementation.class).build());
ShellPlotPackageImplementation testPackage = (ShellPlotPackageImplementation) panel.getPlot().returnPlottingPackage();
panel.getPlot().addDataSet("PUI1");
panel.getPlot().addDataSet("PUI2");
// Make feed Data
Map<String, List<Map<String, String>>> theData = new Hashtable<String, List<Map<String, String>>>();
List<Map<String, String>> dataSetA = new ArrayList<Map<String, String>>();
List<Map<String, String>> dataSetB = new ArrayList<Map<String, String>>();
// data set A two points
Map<String, String> dataAPoint1 = new Hashtable<String, String>();
dataAPoint1.put(FeedProvider.NORMALIZED_TIME_KEY, "1");
dataAPoint1.put(FeedProvider.NORMALIZED_VALUE_KEY, valueFifty);
dataAPoint1.put(FeedProvider.NORMALIZED_IS_VALID_KEY, "TRUE");
dataAPoint1.put(FeedProvider.NORMALIZED_TELEMETRY_STATUS_CLASS_KEY, "1");
RenderingInfo ri1 = new RenderingInfo(valueFifty, Color.BLACK, "X", Color.BLACK, true);
Mockito.when(feed1.getRenderingInfo(Mockito.anyMap())).thenReturn(ri1);
Map<String, String> dataAPoint2 = new Hashtable<String, String>();
dataAPoint2.put(FeedProvider.NORMALIZED_TIME_KEY, "1");
dataAPoint2.put(FeedProvider.NORMALIZED_VALUE_KEY, "86.2");
dataAPoint2.put(FeedProvider.NORMALIZED_IS_VALID_KEY, "TRUE");
dataAPoint2.put(FeedProvider.NORMALIZED_TELEMETRY_STATUS_CLASS_KEY, "1");
dataSetA.add(dataAPoint1);
dataSetA.add(dataAPoint2);
theData.put("PUI1", dataSetA);
// data set B two points
Map<String, String> dataBPoint1 = new Hashtable<String, String>();
dataBPoint1.put(FeedProvider.NORMALIZED_TIME_KEY, "1");
dataBPoint1.put(FeedProvider.NORMALIZED_VALUE_KEY, "25.0");
dataBPoint1.put(FeedProvider.NORMALIZED_IS_VALID_KEY, "TRUE");
dataBPoint1.put(FeedProvider.NORMALIZED_TELEMETRY_STATUS_CLASS_KEY, "1");
RenderingInfo ri2 = new RenderingInfo("25.0", Color.BLACK, "X", Color.BLACK, true);
Mockito.when(feed2.getRenderingInfo(Mockito.anyMap())).thenReturn(ri2);
Map<String, String> dataBPoint2 = new Hashtable<String, String>();
dataBPoint2.put(FeedProvider.NORMALIZED_TIME_KEY, "1");
dataBPoint2.put(FeedProvider.NORMALIZED_VALUE_KEY, "110.9");
dataBPoint2.put(FeedProvider.NORMALIZED_IS_VALID_KEY, "TRUE");
dataBPoint2.put(FeedProvider.NORMALIZED_TELEMETRY_STATUS_CLASS_KEY, "1");
dataSetB.add(dataBPoint1);
dataSetB.add(dataBPoint2);
theData.put("PUI2", dataSetB);
Mockito.when(feed1.getSubscriptionId()).thenReturn("PUI1");
Mockito.when(feed2.getSubscriptionId()).thenReturn("PUI2");
Field pda = PlotViewManifestation.class.getDeclaredField("plotDataAssigner");
pda.setAccessible(true);
PlotDataAssigner plotDataAssigner = (PlotDataAssigner) pda.get(panel);
plotDataAssigner.getVisibleFeedProviders().add(feed1);
plotDataAssigner.getVisibleFeedProviders().add(feed2);
Assert.assertEquals(panel.getMaxFeedValue(), 0.0);
Assert.assertEquals(panel.getMinFeedValue(), 0.0);
// Push feed to plot.
panel.updateFromFeed(theData);
// Check data made it to the plot
Map<String, ArrayList<Double>> plotDataSet = testPackage.getDataSet();
Assert.assertNotNull(plotDataSet);
Assert.assertEquals(plotDataSet.size(), 2);
Assert.assertTrue(plotDataSet.containsKey("pui2"));
Assert.assertTrue(plotDataSet.containsKey("pui1"));