Examples of AckImpl


Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

        jpaDataStore.saveUnacknowledged(channel1.getChannelId(), 11);
        jpaDataStore.saveUnacknowledged(channel2.getChannelId(), 3);
        final Set<Ack> storedUpdates = jpaDataStore.getUnacknowledged(uaid);
        assertThat(storedUpdates.size(), is(2));

        jpaDataStore.removeAcknowledged(uaid, acks(new AckImpl(channel1.getChannelId(), 11)));
        assertThat(jpaDataStore.getUnacknowledged(uaid).size(), is(1));
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

            if (unacks.isEmpty()) {
                return Collections.emptySet();
            }
            final Set<Ack> acks = new HashSet<Ack>(unacks.size());
            for (String channelId : unacks) {
                acks.add(new AckImpl(channelId, Long.valueOf(jedis.get(ackLookupKey(channelId)))));
            }
            return acks;
        } finally {
            jedisPool.returnResource(jedis);
        }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

            return Collections.emptySet();
        }
        final Set<Ack> unacks = new HashSet<Ack>(rows.size());
        for (Row row : rows) {
            final JsonNode json = row.getValueAsNode().get(DOC_FIELD);
            unacks.add(new AckImpl(json.get(CHID_FIELD).asText(), json.get(VERSION_FIELD).asLong()));
        }
        return unacks;
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

    private static Set<Ack> acks(final Ack ...acks) {
        return new HashSet<Ack>(Arrays.asList(acks));
    }

    private Ack ack(final String channelId, final long version) {
        return new AckImpl(channelId, version);
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

    private Ack ack(final String channelId, final long version) {
        return new AckImpl(channelId, version);
    }

    private static Ack ack(final Channel channel) {
        return new AckImpl(channel.getChannelId(), channel.getVersion());
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

        final String channelId = UUID.randomUUID().toString();
        final String uaid = UUIDUtil.newUAID();
        final RegisterResponse registerResponse = server.handleRegister(new RegisterMessageImpl(channelId), uaid);
        final String endpointToken = extractEndpointToken(registerResponse.getPushEndpoint());
        Notification notification = server.handleNotification(endpointToken, "version=1");
        assertThat(notification.ack(), equalTo((Ack)new AckImpl(channelId, 1L)));
        assertThat(server.getChannel(channelId).getVersion(), is(1L));
        server.handleNotification(endpointToken, "version=2");
        assertThat(server.getChannel(channelId).getVersion(), is(2L));
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

        final RegisterResponse registerResponse2 = server.handleRegister(new RegisterMessageImpl(channelId_2), uaid);
        final String endpointToken2 = extractEndpointToken(registerResponse2.getPushEndpoint());
        server.handleNotification(endpointToken1, "version=10");
        server.handleNotification(endpointToken2, "version=23");

        final Ack ackChannel_1 = new AckImpl(channelId_1, 10L);
        final Set<Ack> unacked = server.handleAcknowledgement(new AckMessageImpl(asSet(ackChannel_1)), uaid);
        assertThat(unacked, hasItem(new AckImpl(channelId_2, 23L)));
    }
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

                assertNotNull(ack.getVersion());
                messageLatch.countDown();
            }
        });

        client.getWebsocketClient().sendText(JsonUtil.toJson(new NotificationMessageImpl(new AckImpl(UUIDUtil.newUAID(), 1))));

        //wait for the communication to happen
        messageLatch.await(1000, TimeUnit.MILLISECONDS);

        //then
View Full Code Here

Examples of org.jboss.aerogear.simplepush.protocol.impl.AckImpl

        final Long version = Long.valueOf(VersionExtractor.extractVersion(body));
        final String channelId = store.updateVersion(endpointToken, version);
        if (channelId == null) {
            throw new ChannelNotFoundException("Could not find channel for endpoint [" + endpointToken + "]", null);
        }
        final Ack ack = new AckImpl(channelId, version);
        final String uaid = store.saveUnacknowledged(channelId, ack.getVersion());
        return new Notification(uaid, ack);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.