Package com.jms.client.entity

Examples of com.jms.client.entity.Message


    }

    @Test
    public void testDestroyAll() throws Exception {
        LOGGER.info("destroy all");
        Message entity = FakeStaticMessageFactory.createMessage();
        entity = jpaController.create(entity);
        assertTrue("Entity not created properly", (entity.getId() > 0L));

        final long ASSERT_ENTITIES_SIZE = 0L;

        jpaController.destroyAll(entity.getClientId());
        long size = jpaController.getCount(entity.getClientId());
        assertEquals("Entity not removed properly", ASSERT_ENTITIES_SIZE, size);
    }
View Full Code Here


    }

    @Test
    public void testFindEntities() throws Exception {
        LOGGER.info("findEntities");
        Message entity = FakeStaticMessageFactory.createMessage();
        entity = jpaController.create(entity);
        assertTrue("Entity not created properly", (entity.getId() > 0L));

        final long ASSERT_SIZE = 1L;
        List<Message> foundEntities = jpaController.findEntities(entity.getClientId());
        assertEquals("No entities has been found", ASSERT_SIZE, foundEntities.size());
    }
View Full Code Here

    }

    @Test
    public void testFindEntity() throws Exception {
        LOGGER.info("findEntity");
        Message entity = FakeStaticMessageFactory.createMessage();
        entity = jpaController.create(entity);
        assertTrue("Entity not created properly", (entity.getId() > 0L));

        final long ASSERT_CREATED_ENTITY_ID = entity.getId();

        Message foundEntity = jpaController.findEntity(ASSERT_CREATED_ENTITY_ID);
        assertNotNull("Entity not found", foundEntity);
    }
View Full Code Here

    }

    @Test
    public void testGetCount() throws Exception {
        LOGGER.info("getCount");
        Message entity = FakeStaticMessageFactory.createMessage();
        entity = jpaController.create(entity);
        assertTrue("Entity not created properly", (entity.getId() > 0L));

        final long ASSERT_SIZE = 1L;
        long size = jpaController.getCount(entity.getClientId());
        assertEquals("No entities has been found", ASSERT_SIZE, size);
    }
View Full Code Here

     * @throws Exception
     */
    public static com.jms.client.entity.Message convert(javax.jms.Message sourceMessage) throws Exception {
        Validate.notNull(sourceMessage, "Message must not be null");

        com.jms.client.entity.Message message = new Message();

        Map<String, String> headers = JmsUtility.jmsHeadersAsMap(sourceMessage);
        Map<String, String> properties = JmsUtility.jmsPropertiesAsMap(sourceMessage);
        String body = JmsUtility.jmsMessageBodyAsString(sourceMessage);
        String jmsMessageID = sourceMessage.getJMSMessageID();
        String destinationName = JmsUtility.getDestinationName(sourceMessage.getJMSDestination());
        String jmsType = sourceMessage.getJMSType();
        long jmsTimestamp = sourceMessage.getJMSTimestamp();
        int jmsDeliveryMode = sourceMessage.getJMSDeliveryMode();
        MessageType messageType = JmsUtility.getMessageType(sourceMessage);
        DestinationType destinationType = JmsUtility.getDestinationType(sourceMessage.getJMSDestination());
        Calendar time = GregorianCalendar.getInstance();
        time.setTimeInMillis(jmsTimestamp);

        String headersString = StringFormatterHelper.formatMap(headers, "\n");
        String propertiesString = StringFormatterHelper.formatMap(properties, "\n");

        message.setHeaders(headersString);
        message.setProperties(propertiesString);
        message.setBody(body);
        message.setJmsId(jmsMessageID);
        message.setDestinationJmsType(jmsType);
        message.setDestinationName(destinationName);
        message.setDestinationType(destinationType);
        message.setTimestamp(time);
        message.setType(messageType);
        message.setDeliveryMode(DeliveryMode.fromIndex(jmsDeliveryMode));

        return message;
    }
View Full Code Here

TOP

Related Classes of com.jms.client.entity.Message

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.