Examples of MessageRecipient


Examples of com.volantis.mps.recipient.MessageRecipient

        Iterator itr = failures.getIterator();

        if (itr.hasNext()) {
            mesg.append("<h3>Failures are</h3>");
            while (itr.hasNext()) {
                MessageRecipient rec = (MessageRecipient) itr.next();
                try {
                    String reason = rec.getFailureReason();
                    if(rec.getAddress() != null) {
                        mesg.append(rec.getAddress().toString()).append(" (");
                    } else if(rec.getMSISDN() != null) {
                        mesg.append(rec.getMSISDN()).append(" (");
                    } else {
                        mesg.append("UNKNOWN-ADDRESS").append(" (");
                    }

                    if (reason == null) {
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

        MessageRecipients messageRecipients = new MessageRecipients();

        for (int i = 0; i < type.length; i++) {
            if (type[i].equals(inType)) {
                if (!names[i].equals("")) {
                    MessageRecipient messageRecipient = new MessageRecipient();

                    // Is there a channel for this index? Is it not empty?
                    if (channel.length > i && !channel[i].equals("")) {
                        // set the channel for the recipient
                        messageRecipient.setChannelName(channel[i]);

                        if (channel[i].equals("smsc")) {
                            // The channel is smsc so set the MSISDN rather
                            // than the address
                            messageRecipient.setMSISDN(names[i]);
                        } else if (channel[i].equals("wappush")) {
                            // The channel is wappush so set the MSISDN rather
                            // than the address
                            messageRecipient.setMSISDN(names[i]);
                        } else if (channel[i].equals("mmsc") &&
                                names[i].charAt(0) == '+') {
                            messageRecipient.setMSISDN(names[i]);
                        } else {
                            messageRecipient.setAddress(
                                    new InternetAddress(names[i]));
                        }
                    } else {
                        // channel is not present or empty so use smtp
                        // as default - This will have to be changed if the
                        // smtp channel is not present in the mcs-config file
                        messageRecipient.setChannelName("smtp");
                    }

                    // If there is a device then set it otherwise let MPS use
                    // the defaults
                    if (devices.length > i) {
                        String device = devices[i];
                        if (!device.equals("")) {
                            messageRecipient.setDeviceName(device);
                        }
                    }

                    // Add recipient to the list of MessageRecipients
                    messageRecipients.addRecipient(messageRecipient);
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

        // Create some recipients
        MessageRecipients messageRecipients = createTestRecipients ();

        // Create a sender
        MessageRecipient messageSender =
                new MessageRecipient ( new InternetAddress ( "mps@volantis.com" ),
                        "Master" );

        // And now send that message to those recipients from that sender! :-)
        MessageRecipients failures = channel.sendImpl ( multiChannelMessage,
                messageRecipients,
                messageSender );
        assertNotNull ( "Should be a failure list, even if it is empty",
                failures );
        assertTrue ( "Expected some failures",
                failures.getIterator ().hasNext () );

        // Can't access recipients by index (annoyingly) so iterate over the
        // one expected failure here (Note: a mismatched channel is not a
        // failure, as it is expected that the message will be sent to the
        // other channel during the same batch send in a running MPS).
        for ( Iterator i = failures.getIterator (); i.hasNext (); ) {
            MessageRecipient recipient = ( MessageRecipient ) i.next ();
            System.out.println ( "Failure:\n" );
            assertEquals ( "Failed recipient MSISDN should match",
                    "failure",
                    recipient.getMSISDN () );
            assertEquals ( "Failed recipient channel name should match",
                    CHANNEL_NAME,
                    recipient.getChannelName () );
        }
    }
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

            throws RecipientException, AddressException {
        // Create a list
        MessageRecipients messageRecipients = new MessageRecipients ();

        // Create a recipient
        MessageRecipient recipient = new MessageRecipient ();
        recipient.setMSISDN ( "0123456789" );
        recipient.setAddress ( new InternetAddress ( "test@volantis.com" ) );
        recipient.setChannelName ( CHANNEL_NAME );
        recipient.setDeviceName ( "Master" );
        messageRecipients.addRecipient ( recipient );

        // Create a recipient
        recipient = new MessageRecipient ();
        recipient.setMSISDN ( "+44123456789" );
        recipient.setAddress ( new InternetAddress ( "me@volantis.com" ) );
        recipient.setChannelName ( CHANNEL_NAME );
        recipient.setDeviceName ( "Master" );
        messageRecipients.addRecipient ( recipient );

        // Create a recipient
        recipient = new MessageRecipient ();
        recipient.setMSISDN ( "failure" );
        recipient.setAddress ( new InternetAddress ( "you@volantis.com" ) );
        recipient.setChannelName ( CHANNEL_NAME );
        recipient.setDeviceName ( "Master" );
        messageRecipients.addRecipient ( recipient );

        // Create a recipient - intentionally for a different channel
        recipient = new MessageRecipient ();
        recipient.setMSISDN ( "1234567890" );
        recipient.setAddress ( new InternetAddress ( "them@volantis.com" ) );
        recipient.setChannelName ( "SMTP" );
        recipient.setDeviceName ( "Master" );
        messageRecipients.addRecipient ( recipient );

        // Return the list
        return messageRecipients;
    }
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

        super.setUp();

        message = new MultiChannelMessageImpl("http://localhost:8080/dummy",
                "Test message");
        recipients = new MessageRecipients();
        MessageRecipient recipient = new MessageRecipient(
                new InternetAddress("recipient@volantis.com"), "PC");
        recipients.addRecipient(recipient);
        sender = new MessageRecipient();
        sender.setAddress( new InternetAddress("test@volantis.com"));
        testSimulator = new TestSimulator(PORT);
        listener = new MessageListener();
        //testSimulator.start(listener);
    }
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

                    MessageRecipients failures =
                            adapter.sendImpl(mockMessage, recipients, sender);
                    // Record if not all of the messages were sent successfully.
                    final Iterator iterator = failures.getIterator();
                    while(iterator.hasNext()) {
                        MessageRecipient failure =
                                (MessageRecipient) iterator.next();
                        failureReasons.add(failure.getFailureReason());
                    }
                } catch (RecipientException e) {
                    fail(e.getMessage());
                } catch (MessageException e) {
                    fail(e.getMessage());
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

        final Map mpsRecipients = getRecipients(sendRequest.getRecipients());

        final MultiChannelMessage mcMessage =
                createMultiChannelMessage(sendRequest.getMessage());
        addRecipients(session, mpsRecipients);
        final MessageRecipient from = getSender(sendRequest.getSender());
        final MessageRecipients failures =
                sendMessage(session, mcMessage, from);

        final Failures result = aggregateResults(failures);
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

                    mapping.get(recipients[i].getRecipientType());

            // Translate the current Recipient into a MessageRecipient and add
            // it to the target MessageRecipients.
            try {
                MessageRecipient mpsRecipient = createMessageRecipient(recipients[i]);
                target.addRecipient(mpsRecipient);
            } catch (RecipientException e) {
                LOGGER.warn("add-recipient-failure", recipients[i]);
            }
        }
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

        }

        if (failures != null) {
            for (Iterator iterator = failures.getIterator();
                 iterator.hasNext();) {
                MessageRecipient failure = (MessageRecipient) iterator.next();
                try {
                    Recipient recipient = getFailedRecipient(failure);
                    recipient.setFailureReason(failure.getFailureReason());
                    recipient.setChannel(failure.getChannelName());
                    result.add(recipient);
                } catch (RecipientException e) {
                    LOGGER.warn("recipient-conversion-failure", failure, e);
                }
            }
View Full Code Here

Examples of com.volantis.mps.recipient.MessageRecipient

                }
                return null;
            }

            try {
                MessageRecipient result = new MessageRecipient();
                if (null != sender.getSMTPAddress()) {
                    result.setAddress(getInternetAddress(
                            sender.getSMTPAddress().getValue()));
                }
                if (null != sender.getMSISDN()) {
                    result.setMSISDN(sender.getMSISDN().getValue());
                }
                return result;
            } catch (RecipientException e) {
                LOGGER.warn("add-recipient-failure", sender);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.