@Test public void removeChannels() throws ChannelNotFoundException { final InMemoryDataStore store = new InMemoryDataStore(); final String uaid1 = UUIDUtil.newUAID(); final String uaid2 = UUIDUtil.newUAID(); store.saveChannel(mockChannel(uaid1, "channel-1", 1, "endpointToken1")); store.saveChannel(mockChannel(uaid2, "channel-2", 1, "endpointToken2")); store.saveChannel(mockChannel(uaid1, "channel-3", 1, "endpointToken3")); store.saveChannel(mockChannel(uaid2, "channel-4", 1, "endpointToken4")); store.removeChannels(uaid2); assertThat(hasChannel("channel-1", store), is(true)); assertThat(hasChannel("channel-2", store), is(false)); assertThat(hasChannel("channel-3", store), is(true)); assertThat(hasChannel("channel-4", store), is(false)); }
@Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); }
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); } }
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); }  }
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); }  @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel ch); @Override Channel getChannel(final String channelId); @Override void removeChannels(final String uaid); @Override void removeChannels(final Set<String> channelIds); @Override Set<String> getChannelIds(final String uaid); @Override String updateVersion(final String endpointToken, final long version); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked); }
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); }  @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel ch); @Override Channel getChannel(final String channelId); @Override void removeChannels(final String uaid); @Override void removeChannels(final Set<String> channelIds); @Override Set<String> getChannelIds(final String uaid); @Override String updateVersion(final String endpointToken, final long version); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked);  }