MonitoredStream { public MonitoredStream() { } MonitoredStream();  MonitoredStream(StreamGroup par); StreamGroup getStreamGroup(); List<StreamWorkSlotQueue> getQueues(); synchronized void addQueues(StreamWorkSlotQueue queue); synchronized boolean removeQueue(StreamWorkSlotQueue queue); int hashCode(); boolean equals(Object other); String getVersion(); void setVersion(String version); void setQueues(List<StreamWorkSlotQueue> queues);  }
@Test public void testMonitoredStream() { StreamGroup streamGroup = new StreamGroup(); StreamSortSpec streamSortSpec = new StreamSortSpec(); streamSortSpec.setWindowPeriod("PT10S"); StreamPartition streamPartition = new StreamPartition(); List<String> columns = new ArrayList<>(); columns.add("jobId"); streamPartition.setColumns(columns); streamPartition.setSortSpec(streamSortSpec); streamPartition.setStreamId("test"); streamPartition.setType(StreamPartition.Type.GROUPBY); streamGroup.addStreamPartition(streamPartition); WorkSlot workSlot = new WorkSlot("setTopologyName", "setBoltId"); List<WorkSlot> workSlots = new ArrayList<>(); workSlots.add(workSlot); StreamWorkSlotQueue streamWorkSlotQueue = new StreamWorkSlotQueue(streamGroup, false, new HashMap<>(), workSlots); MonitoredStream monitoredStream = new MonitoredStream(streamGroup); Assert.assertEquals(null, monitoredStream.getVersion()); Assert.assertTrue(monitoredStream.getQueues().isEmpty()); Assert.assertEquals(streamGroup, monitoredStream.getStreamGroup()); monitoredStream.addQueues(streamWorkSlotQueue); Assert.assertEquals(streamWorkSlotQueue, monitoredStream.getQueues().get(0)); MonitoredStream monitoredStream1 = new MonitoredStream(streamGroup); Assert.assertTrue(monitoredStream.equals(monitoredStream1)); Assert.assertTrue(monitoredStream.hashCode() == monitoredStream1.hashCode()); monitoredStream.removeQueue(streamWorkSlotQueue); Assert.assertTrue(monitoredStream.getQueues().isEmpty()); Assert.assertTrue(monitoredStream.equals(monitoredStream1)); Assert.assertTrue(monitoredStream.hashCode() == monitoredStream1.hashCode()); }