@Test public void subscribe() { final Subscription reg = server.subscribe(); assertThat(reg.id(), is(notNullValue())); }
@Override public Subscription subscribe() { final String id = UUID.randomUUID().toString(); final String pushResourceId = UUID.randomUUID().toString(); final Subscription subscription = new DefaultSubscription(id, pushResourceId); store.saveSubscription(subscription); return subscription; }
DefaultWebPushServer implements WebPushServer { @Override public Subscription subscribe() { final String id = UUID.randomUUID().toString(); final String pushResourceId = UUID.randomUUID().toString(); final Subscription subscription = new DefaultSubscription(id, pushResourceId); store.saveSubscription(subscription); return subscription; } }
DefaultWebPushServer implements WebPushServer { @Override public Subscription subscribe() { final String id = UUID.randomUUID().toString(); final String pushResourceId = UUID.randomUUID().toString(); final Subscription subscription = new DefaultSubscription(id, pushResourceId); store.saveSubscription(subscription); return subscription; } DefaultWebPushServer(final DataStore store, final WebPushServerConfig config, final byte[] privateKey); }
DefaultWebPushServer implements WebPushServer { @Override public Subscription subscribe() { final String id = UUID.randomUUID().toString(); final String pushResourceId = UUID.randomUUID().toString(); final Subscription subscription = new DefaultSubscription(id, pushResourceId); store.saveSubscription(subscription); return subscription; } DefaultWebPushServer(final DataStore store, final WebPushServerConfig config, final byte[] privateKey); @Override Subscription subscribe(); @Override Optional<Subscription> subscriptionById(final String id); @Override Optional<Subscription> subscriptionByToken(final String subscriptionToken); @Override Optional<Subscription> subscriptionByPushToken(final String pushToken); @Override Optional<Subscription> subscriptionByReceiptToken(final String receiptToken); @Override List<PushMessage> removeSubscription(final String id); @Override void saveMessage(final PushMessage msg); @Override List<PushMessage> waitingDeliveryMessages(final String subId); @Override void saveSentMessage(final PushMessage msg); @Override Optional<PushMessage> sentMessage(final String pushMsgResource); @Override WebPushServerConfig config(); static byte[] generateAndStorePrivateKey(final DataStore store, final WebPushServerConfig config); @Override String generateEndpointToken(final String value); @Override String generateEndpointToken(final String firstId, final String secondId); }
DefaultWebPushServer implements WebPushServer { @Override public Subscription subscribe() { final String id = UUID.randomUUID().toString(); final String pushResourceId = UUID.randomUUID().toString(); final Subscription subscription = new DefaultSubscription(id, pushResourceId); store.saveSubscription(subscription); return subscription; } DefaultWebPushServer(final DataStore store, final WebPushServerConfig config, final byte[] privateKey); @Override Subscription subscribe(); @Override Optional<Subscription> subscriptionById(final String id); @Override Optional<Subscription> subscriptionByToken(final String subscriptionToken); @Override Optional<Subscription> subscriptionByPushToken(final String pushToken); @Override Optional<Subscription> subscriptionByReceiptToken(final String receiptToken); @Override List<PushMessage> removeSubscription(final String id); @Override void saveMessage(final PushMessage msg); @Override List<PushMessage> waitingDeliveryMessages(final String subId); @Override void saveSentMessage(final PushMessage msg); @Override Optional<PushMessage> sentMessage(final String pushMsgResource); @Override WebPushServerConfig config(); static byte[] generateAndStorePrivateKey(final DataStore store, final WebPushServerConfig config); @Override String generateEndpointToken(final String value); @Override String generateEndpointToken(final String firstId, final String secondId);  }