@Test public void testChannelChangedListener() 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()); ChannelEventListenerImpl listener = new ChannelEventListenerImpl(); listener.type = EventType.VALUE_CHANGED; listener.channelLocator = channelLocator; { List<ChannelConfiguration> list = new ArrayList<ChannelConfiguration>(); list.add(configuration); channelManager.registerChangedListener(list, listener); } for (int i = 0; i < 10; i++) { List<SampledValueContainer> list = new ArrayList<SampledValueContainer>(); SampledValueContainer container = new SampledValueContainer(channelLocator); container.setSampledValue(new SampledValue(new IntegerValue(i), System.currentTimeMillis(), Quality.GOOD)); list.clear(); list.add(container); driver.channelUpdatelistener.channelsUpdated(list); driver.channelUpdatelistener.channelsUpdated(list); } assertEquals(10, listener.integer.get()); }
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);   }