Examples of AckImpl


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

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

                if (userAgent == null) {
                    return Collections.emptySet();
                }
                final HashSet<Ack> acks = new HashSet<Ack>();
                for (AckDTO ackDTO : userAgent.getAcks()) {
                    acks.add(new AckImpl(ackDTO.getChannelId(), ackDTO.getVersion()));
                }
                return acks;
            }
        };
        return jpaExecutor.execute(getUnacks);
View Full Code Here

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

                delete.executeUpdate();
                final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid);
                final Set<AckDTO> acks = userAgent.getAcks();
                final Set<Ack> unacked = new HashSet<Ack>(acks.size());
                for (AckDTO ackDto : acks) {
                    unacked.add(new AckImpl(ackDto.getChannelId(), ackDto.getVersion()));
                }
                return unacked;
            }
        };
        return jpaExecutor.execute(removeAck);
View Full Code Here

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

            final JsonNode node = oc.readTree(jp);
            final JsonNode acksNode = node.get(AckMessage.UPDATES_FIELD);
            final Set<Ack> acks = new HashSet<Ack>();
            if (acksNode.isArray()) {
                for (JsonNode ackNode : acksNode) {
                    acks.add(new AckImpl(ackNode.get("channelID").asText(), ackNode.get("version").asLong()));
                }
            }
            return new AckMessageImpl(acks);
        }
View Full Code Here

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

            final Set<Ack> acks = new HashSet<Ack>();
            if (updatesNode.isArray()) {
                for (JsonNode channelNode : updatesNode) {
                    final JsonNode versionNode = channelNode.get(NotificationMessage.VERSION_FIELD);
                    final JsonNode channelIdNode = channelNode.get(RegisterMessage.CHANNEL_ID_FIELD);
                    acks.add(new AckImpl(channelIdNode.asText(), versionNode.asLong()));
                }
            }
            return new NotificationMessageImpl(acks);
        }
View Full Code Here

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

        store.saveChannel(channel2);

        store.saveUnacknowledged(channel1.getChannelId(), channel1.getVersion());
        store.saveUnacknowledged(channel2.getChannelId(), channel2.getVersion());

        final Set<Ack> acks = asSet(new AckImpl(channel1.getChannelId(), channel1.getVersion()));
        final Set<Ack> unacknowledged = store.removeAcknowledged(channel1.getUAID(), acks);
        assertThat(unacknowledged.size(), is(1));
        assertThat(unacknowledged, hasItem(new AckImpl(channel2.getChannelId(), channel2.getVersion())));
    }
View Full Code Here

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

        if (channel == null) {
            throw new ChannelNotFoundException("Could not find channel", channelId);
        }
        final String uaid = channel.getUAID();
        final Set<Ack> newAcks = Collections.newSetFromMap(new ConcurrentHashMap<Ack, Boolean>());
        newAcks.add(new AckImpl(channelId, version));
        while (true) {
            final Set<Ack> currentAcks = unacked.get(uaid);
            if (currentAcks == null) {
                final Set<Ack> previous = unacked.putIfAbsent(uaid, newAcks);
                if (previous != null) {
View Full Code Here

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

        final String endpointToken = CryptoUtil.endpointToken(uaid, channelId, CryptoUtil.secretKey("testKey", keySalt));
        return new DefaultChannel(uaid, channelId, version, endpointToken);
    }

    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

        final String endpointToken2 = extractEndpointToken(registerResponse2.getPushEndpoint());
        sendNotification(endpointToken2, 1L, simplePushServer);

        final Set<Ack> unacked = sendAcknowledge(channel, ack(channelId1, 1L));
        assertThat(unacked.size(), is(1));
        assertThat(unacked, hasItem(new AckImpl(channelId2, 1L)));
        channel.close();
    }
View Full Code Here

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

            final SimplePushServer simplePushServer) throws ChannelNotFoundException {
        simplePushServer.handleNotification(endpointToken, "version=" + version);
    }

    private Ack ack(final String channelId, final Long version) {
        return new AckImpl(channelId, version);
    }
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.