@Test public void removeChannel() throws ChannelNotFoundException { final String channelId = "testChannelId"; final String uaid = UUIDUtil.newUAID(); server.handleRegister(new RegisterMessageImpl(channelId), uaid); assertThat(server.getChannel(channelId).getChannelId(), is(equalTo(channelId))); assertThat(server.removeChannel(channelId, UUIDUtil.newUAID()), is(false)); assertThat(server.removeChannel(channelId, uaid), is(true)); assertThat(server.removeChannel(channelId, uaid), is(false)); }
public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return false; }
DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return false; } }
DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return false; } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); }
DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return false; } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); @Override HelloResponse handleHandshake(final HelloMessage handshake); @Override RegisterResponse handleRegister(final RegisterMessage register, final String uaid); @Override Notification handleNotification(final String endpointToken, final String body); @Override UnregisterResponse handleUnregister(final UnregisterMessage unregister, final String uaid); @Override Set<Ack> handleAcknowledgement(final AckMessage ackMessage, final String uaid); @Override Set<Ack> getUnacknowledged(final String uaid); String getUAID(final String channelId); Channel getChannel(final String channelId); boolean hasChannel(final String uaid, final String channelId); boolean removeChannel(final String channnelId, final String uaid); @Override void removeAllChannels(final String uaid); @Override SimplePushServerConfig config(); static byte[] generateAndStorePrivateKey(final DataStore store, final SimplePushServerConfig config); }
DefaultSimplePushServer implements SimplePushServer { public boolean removeChannel(final String channnelId, final String uaid) { try { final Channel channel = store.getChannel(channnelId); if (channel.getUAID().equals(uaid)) { store.removeChannels(new HashSet<String>(Arrays.asList(channnelId))); return true; } } catch (final ChannelNotFoundException ignored) { } return false; } DefaultSimplePushServer(final DataStore store, final SimplePushServerConfig config, final byte[] privateKey); @Override HelloResponse handleHandshake(final HelloMessage handshake); @Override RegisterResponse handleRegister(final RegisterMessage register, final String uaid); @Override Notification handleNotification(final String endpointToken, final String body); @Override UnregisterResponse handleUnregister(final UnregisterMessage unregister, final String uaid); @Override Set<Ack> handleAcknowledgement(final AckMessage ackMessage, final String uaid); @Override Set<Ack> getUnacknowledged(final String uaid); String getUAID(final String channelId); Channel getChannel(final String channelId); boolean hasChannel(final String uaid, final String channelId); boolean removeChannel(final String channnelId, final String uaid); @Override void removeAllChannels(final String uaid); @Override SimplePushServerConfig config(); static byte[] generateAndStorePrivateKey(final DataStore store, final SimplePushServerConfig config);  }