Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.Message


        {
            MuleMessage muleMessage = context.getMessage();
            Object payload = muleMessage.getPayload();
            assertTrue(payload instanceof Message);
           
            Message jabberMessage = (Message) payload;
            if (jabberMessage.getBody().equals(testMessage))
            {
                latch.countDown();
            }
        }
View Full Code Here


        return new DefaultMuleMessage(NullPayload.getInstance(), connector.getMuleContext());
    }

    protected void sendMessage(MuleEvent event) throws Exception
    {
        Message jabberMessage = event.getMessage().getPayload(DataTypeFactory.create(Message.class));
        conversation.dispatch(jabberMessage);

        if (logger.isDebugEnabled())
        {
            String recipient = XmppConnector.getRecipient(endpoint);
            logger.debug("Message \"" + jabberMessage.getBody()
                + "\" successfully sent to " + recipient);
        }
    }
View Full Code Here

        Map<String, Object> properties = new HashMap<String, Object>();
        addXmppPacketProperties(packet, properties);

        if (packet instanceof Message)
        {
            Message xmppMessage = (Message) packet;
            addXmppMessageProperties(xmppMessage, properties);
        }
       
        message.addInboundProperties(properties);
    }
View Full Code Here

        // in time before the next poll call comes in
        long frequency = getFrequency();
        long tenPercent = (long)(frequency * 0.1);
        long pollTimeout = frequency - tenPercent;
       
        Message xmppMessage = conversation.receive(pollTimeout);
        if (xmppMessage == null)
        {
            return;
        }
       
View Full Code Here

   
    protected void assertReceivedPacketEqualsMessageSent(Packet packet)
    {
        assertNotNull(packet);
        assertTrue(packet instanceof Message);
        Message messageFromJabber = (Message) packet;
        assertEquals(TEST_MESSAGE, messageFromJabber.getBody());       
    }
View Full Code Here

    }

    @Override
    protected MuleMessage doRequest(long timeout) throws Exception
    {
        Message message = null;
        if (timeout == MuleEvent.TIMEOUT_WAIT_FOREVER)
        {
            message = conversation.receive();
        }
        else
View Full Code Here

        MuleClient client = new MuleClient(muleContext);
        MuleMessage muleMessage = client.request(url, RECEIVE_TIMEOUT);
        assertNotNull(muleMessage);

        Message xmppMessage = (Message) muleMessage.getPayload();
        assertEquals(expectedXmppMessageType(), xmppMessage.getType());
        assertEquals(TEST_MESSAGE, xmppMessage.getBody());
    }
View Full Code Here

    }

    @Override
    protected Object getValidTransportMessage() throws Exception
    {
        Message xmppMessage = new Message();
        xmppMessage.setBody(TEST_MESSAGE);
        return xmppMessage;
    }
View Full Code Here

   
    public void testPacketWithMessageProperties() throws Exception
    {
        String uuid = UUID.getUUID();
       
        Message payload = (Message) getValidTransportMessage();
        payload.setSubject("the subject");
        payload.setProperty("foo", "foo-value");
        payload.setPacketID(uuid);
    
        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage message = factory.create(payload, encoding);
        assertNotNull(message);
        assertEquals(Message.class, message.getPayload().getClass());
View Full Code Here

        return cnn;
    }

    public Object getValidMessage() throws Exception
    {
        Message message = new Message("ross@jabber.org");
        message.setBody("Hello");
        return message;
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.packet.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.