Package org.jboss.aerogear.simplepush.protocol

Examples of org.jboss.aerogear.simplepush.protocol.Ack


        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


public class AckImplTest {

    @Test
    public void equalsContractReflexive() {
        final Ack x = new AckImpl("ch1", 10L);
        assertThat(x, equalTo(x));
    }
View Full Code Here

        assertThat(x, equalTo(x));
    }

    @Test
    public void equalsContractSymetric() {
        final Ack x = new AckImpl("ch1", 10L);
        final Ack y = new AckImpl("ch1", 10L);
        assertThat(x, equalTo(y));
        assertThat(y, equalTo(x));
        assertThat(x.hashCode(), equalTo(y.hashCode()));
    }
View Full Code Here

        assertThat(x.hashCode(), equalTo(y.hashCode()));
    }

    @Test
    public void equalsContractTransitive() {
        final Ack x = new AckImpl("ch1", 10L);
        final Ack y = new AckImpl("ch1", 10L);
        final Ack z = new AckImpl("ch1", 10L);
        assertThat(x, equalTo(y));
        assertThat(y, equalTo(z));
        assertThat(x, equalTo(z));
    }
View Full Code Here

        assertThat(x, equalTo(z));
    }

    @Test
    public void equalsContractConsistent() {
        final Ack x = new AckImpl("ch1", 10L);
        final Ack y = new AckImpl("ch2", 10L);
        assertThat(x.equals(y), is(false));
    }
View Full Code Here

        assertThat(x.equals(y), is(false));
    }

    @Test
    public void equalsContractNull() {
        final Ack x = new AckImpl("ch1", 10L);
        assertThat(x.equals(null), is(false));
    }
View Full Code Here

        assertThat(x.equals(null), is(false));
    }

    @Test
    public void versionNotPartOfContract() {
        final Ack x = new AckImpl("ch1", 11L);
        final Ack y = new AckImpl("ch1", 12L);
        assertThat(x.equals(y), is(true));
    }
View Full Code Here

        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

        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

Related Classes of org.jboss.aerogear.simplepush.protocol.Ack

Copyright © 2018 www.massapicom. 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.