@Test public void testReadChannelListen() throws Exception { DeviceLocator deviceLocator = createDeviceLocator(driver.getDriverId(), "", "", null); ChannelLocator channelLocator = createChannelLocator("1", deviceLocator); driver.channels.put(channelLocator, new AtomicInteger()); ChannelConfiguration configuration = channelManager.addChannel(channelLocator, Direction.DIRECTION_INPUT, ChannelConfiguration.LISTEN_FOR_UPDATE); assertEquals(1, driver.listenChannelsCount); assertEquals(1, driver.listenChannels.size()); assertEquals(channelLocator, driver.listenChannels.get(0).getChannelLocator()); List<SampledValueContainer> list = new ArrayList<SampledValueContainer>(); SampledValueContainer container = new SampledValueContainer(channelLocator); container.setSampledValue(new SampledValue(new IntegerValue(1), System.currentTimeMillis(), Quality.GOOD)); list.add(container); driver.channelUpdatelistener.channelsUpdated(list); SampledValue sampledValue = channelManager.getChannelValue(configuration); assertEquals(1, sampledValue.getValue().getIntegerValue()); container.setSampledValue(new SampledValue(new IntegerValue(2), System.currentTimeMillis(), Quality.GOOD)); list.clear(); list.add(container); driver.channelUpdatelistener.channelsUpdated(list); sampledValue = channelManager.getChannelValue(configuration); assertEquals(2, sampledValue.getValue().getIntegerValue()); }
ChannelLocator getChannelLocator() { return channelLocator; }
Channel { ChannelLocator getChannelLocator() { return channelLocator; } }
Channel { ChannelLocator getChannelLocator() { return channelLocator; } Channel(Driver driver, ChannelLocator channelLocator); }
Channel { ChannelLocator getChannelLocator() { return channelLocator; } Channel(Driver driver, ChannelLocator channelLocator);  }
Channel { ChannelLocator getChannelLocator() { return channelLocator; } Channel(Driver driver, ChannelLocator channelLocator);   }