Package com.volantis.mps.bms

Examples of com.volantis.mps.bms.SendRequest


    public void testSendRequestBasicDeserialization() throws Exception {
        InputStream in = new ByteArrayInputStream(
                SEND_REQUEST_BASIC.getBytes(UTF_8));

        SendRequest request = parser.readSendRequest(in);

        assertEquals(1, request.getRecipients().length);

        Recipient recipient = request.getRecipients()[0];
        assertEquals("alice@volantis.com", recipient.getAddress().getValue());
        assertEquals("smtp", recipient.getChannel());
        assertEquals("Nokia-6600", recipient.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, recipient.getRecipientType());

        assertEquals("Hello", request.getMessage().getSubject());
        assertEquals(new URL("http://localhost:8080/volantis/welcome/welcome.xdime"),
                request.getMessage().getURL());

        assertNotNull("default sender", request.getSender());
        assertNull(request.getSender().getSMTPAddress());
        assertNull(request.getSender().getMSISDN());
    }
View Full Code Here


        Address address = factory.createSMTPAddress("alice@volantis.com");
        Recipient alice = factory.createRecipient(address, "Nokia-6600");
        alice.setChannel("smtp");

        SendRequest request = factory.createSendRequest();
        request.addRecipient(alice);

        Message message = factory.createMessage(
                new URL("http://localhost:8080/volantis/welcome/welcome.xdime"));
        message.setSubject("Hello");
        request.setMessage(message);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        parser.write(request, out);

        assertXMLEqual(SEND_REQUEST_BASIC_WITH_TYPE, out.toString(UTF_8));
View Full Code Here

    public void testSendRequestBasicWithEmbeddedContentDeserilization()
        throws Exception {

        InputStream in = new ByteArrayInputStream(
                SEND_REQUEST_BASIC_EMBEDDED_CONTENT.getBytes(UTF_8));
        SendRequest request = parser.readSendRequest(in);

        assertEquals(1, request.getRecipients().length);

        Recipient recipient = request.getRecipients()[0];
        assertEquals("alice@volantis.com", recipient.getAddress().getValue());
        assertEquals("smtp", recipient.getChannel());
        assertEquals("Nokia-6600", recipient.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, recipient.getRecipientType());

        assertEquals(MESSAGE,
                request.getMessage().getContent());

        assertNotNull("default sender", request.getSender());
        assertNull(request.getSender().getSMTPAddress());
        assertNull(request.getSender().getMSISDN());
    }
View Full Code Here

        Address address = factory.createSMTPAddress("alice@volantis.com");
        Recipient alice = factory.createRecipient(address, "Nokia-6600");
        alice.setChannel("smtp");

        SendRequest request = factory.createSendRequest();
        request.addRecipient(alice);

        Message message = factory.createMessage(MESSAGE);
        request.setMessage(message);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        parser.write(request, out);

        assertXMLEqual(SEND_REQUEST_BASIC_EMBEDDED_CONTENT_WITH_TYPE,
View Full Code Here

    public void testMultipleRecipientsSendRequest() throws Exception {
        InputStream in = new ByteArrayInputStream(
                SEND_REQUEST_MULTIPLE_RECIPIENT.getBytes(UTF_8));

        SendRequest request = parser.readSendRequest(in);

        final Recipient[] recipients = request.getRecipients();

        assertEquals(4, recipients.length);

        Recipient alice = recipients[0];
        assertEquals("alice@volantis.com", alice.getAddress().getValue());
        assertEquals("smtp", alice.getChannel());
        assertEquals("Nokia-6600", alice.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, alice.getRecipientType());

        Recipient bob = recipients[1];
        assertEquals("bob@volantis.com", bob.getAddress().getValue());
        assertEquals("smtp", bob.getChannel());
        assertEquals("Nokia-6800", bob.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, bob.getRecipientType());

        Recipient carol = recipients[2];
        assertEquals("carol@volantis.com", carol.getAddress().getValue());
        assertEquals("smtp", carol.getChannel());
        assertEquals("SonyEriccson-973i", carol.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, carol.getRecipientType());

        Recipient dave = recipients[3];
        assertEquals("dave@volantis.com", dave.getAddress().getValue());
        assertEquals("smtp", dave.getChannel());
        assertEquals("Samsung-D700", dave.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, dave.getRecipientType());

        assertEquals("Goodbye", request.getMessage().getSubject());
        assertEquals(new URL("http://some.host.com:6000/volantis/welcome/welcome.xdime"),
                request.getMessage().getURL());

        assertNotNull("Default sender", request.getSender());
        assertNull(request.getSender().getMSISDN());
        assertNull(request.getSender().getSMTPAddress());
    }
View Full Code Here

    public void testSenderIsDeserializedCorrectly() throws Exception {
        InputStream in = new ByteArrayInputStream(
                SEND_REQUEST_BASIC_WITH_SENDER.getBytes(UTF_8));

        SendRequest request = parser.readSendRequest(in);

        final Recipient[] recipients = request.getRecipients();

        assertEquals(1, recipients.length);

        Recipient alice = recipients[0];
        assertEquals("alice@volantis.com", alice.getAddress().getValue());
        assertEquals("smtp", alice.getChannel());
        assertEquals("Nokia-6600", alice.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, alice.getRecipientType());

        assertEquals("Hello", request.getMessage().getSubject());
        assertEquals(new URL("http://localhost:8080/volantis/welcome/welcome.xdime"),
                request.getMessage().getURL());

        assertEquals("eve@volantis.com",
                request.getSender().getSMTPAddress().getValue());
    }
View Full Code Here

    public void testRoundingTrippingOfSendRequest() throws Exception {
        InputStream in = new ByteArrayInputStream(
                SEND_REQUEST_MULTIPLE_RECIPIENT_WITH_SENDER.getBytes(UTF_8));

        SendRequest request = parser.readSendRequest(in);

        final Recipient[] recipients = request.getRecipients();

        assertEquals(4, recipients.length);

        Recipient alice = recipients[0];
        assertEquals("alice@volantis.com", alice.getAddress().getValue());
        assertEquals("smtp", alice.getChannel());
        assertEquals("Nokia-6600", alice.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, alice.getRecipientType());

        Recipient bob = recipients[1];
        assertEquals("bob@volantis.com", bob.getAddress().getValue());
        assertEquals("smtp", bob.getChannel());
        assertEquals("Nokia-6800", bob.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, bob.getRecipientType());

        Recipient carol = recipients[2];
        assertEquals("carol@volantis.com", carol.getAddress().getValue());
        assertEquals("smtp", carol.getChannel());
        assertEquals("SonyEriccson-973i", carol.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, carol.getRecipientType());

        Recipient dave = recipients[3];
        assertEquals("dave@volantis.com", dave.getAddress().getValue());
        assertEquals("smtp", dave.getChannel());
        assertEquals("Samsung-D700", dave.getDeviceName());
        assertEquals("Default type has been assigned",
                RecipientType.TO, dave.getRecipientType());

        assertEquals("Goodbye", request.getMessage().getSubject());
        assertEquals(new URL("http://some.host.com:6000/volantis/welcome/welcome.xdime"),
                request.getMessage().getURL());

        assertEquals("eve@volantis.com",
                request.getSender().getSMTPAddress().getValue());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        parser.write(request, out);

        assertXMLEqual(SEND_REQUEST_MULTIPLE_RECIPIENT_WITH_SENDER_AND_TYPES,
View Full Code Here


        Message message = createMessage(factory);
        message.setSubject("hello from sample test client");

        SendRequest request = factory.createSendRequest();
        request.addRecipient(recipient);
        request.setMessage(message);
        Sender sender = factory.createSender(null, address);
        request.setSender(sender);

        MessageService messageService =
                MessageServiceFactory.getDefaultInstance()
                        .createMessageService(endpoint);
View Full Code Here

        setSession(request.getSession());

        ModelParser parser =
                ModelParserFactory.getDefaultInstance().createModelParser();

        SendRequest sendRequest = parser.readSendRequest(
                request.getInputStream());

        IOUtils.closeQuietly(request.getInputStream());

        // Create an internal message service to process the request.
View Full Code Here

TOP

Related Classes of com.volantis.mps.bms.SendRequest

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.