Package org.jboss.aerogear.simplepush.server.datastore.model

Examples of org.jboss.aerogear.simplepush.server.datastore.model.AckDTO


            @Override
            public String perform(final EntityManager em) {
                final ChannelDTO channel = em.find(ChannelDTO.class, channelId);
                final UserAgentDTO userAgent = channel.getUserAgent();
                final Set<AckDTO> dtos = new HashSet<AckDTO>();
                dtos.add(new AckDTO(userAgent, channel.getChannelId(), version));
                userAgent.setAcks(dtos);
                em.merge(userAgent);
                return userAgent.getUaid();
            }
        };
View Full Code Here


        final String channelId = UUID.randomUUID().toString();
        final String uaid = UUIDUtil.newUAID();
        final UserAgentDTO userAgent = persist(uaid, channelId, 10, "/endpoint/" + channelId);

        entityManager.getTransaction().begin();
        final AckDTO update = new AckDTO(userAgent, channelId, 10);
        entityManager.persist(update);
        entityManager.getTransaction().commit();

        entityManager.getTransaction().begin();
        final AckDTO up = entityManager.find(AckDTO.class, channelId);
        assertThat(up.getUserAgent(), equalTo(userAgent));
        assertThat(up.getChannelId(), equalTo(channelId));
        assertThat(up.getVersion(), equalTo(10L));
        entityManager.getTransaction().commit();
    }
View Full Code Here

        final String channelId = UUID.randomUUID().toString();
        final String uaid = UUIDUtil.newUAID();
        final UserAgentDTO userAgent = persist(uaid, channelId, 10, "/endpoint/" + channelId);

        entityManager.getTransaction().begin();
        final AckDTO update = new AckDTO(userAgent, channelId, 10);
        entityManager.persist(update);
        entityManager.getTransaction().commit();

        entityManager.getTransaction().begin();
        final UserAgentDTO userAgentToUpdate = entityManager.find(UserAgentDTO.class, uaid);
        final AckDTO newUpdate = new AckDTO(userAgent, channelId, 11);
        userAgentToUpdate.setAcks(new HashSet<AckDTO>(Arrays.asList(newUpdate)));
        entityManager.merge(userAgentToUpdate);
        entityManager.getTransaction().commit();

        entityManager.getTransaction().begin();
        final AckDTO updated = entityManager.find(AckDTO.class, channelId);
        assertThat(updated.getVersion(), is(11L));
    }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.simplepush.server.datastore.model.AckDTO

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.