@Test public void saveChannel() { final InMemoryDataStore store = new InMemoryDataStore(); final Channel channel = mockChannel(UUIDUtil.newUAID(), "channel-1", 1, "endpointToken"); final boolean saved = store.saveChannel(channel); assertThat(saved, is(true)); }
@Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; }
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; } }
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; }  }
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; }  @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 boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; }  @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);  }