Examples of Failures


Examples of com.volantis.mps.bms.Failures

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

        Failures failures = parser.readFailures(in);
        assertEquals(3, failures.getRecipients().length);

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

        Recipient alice = recipients[0];
        assertEquals("alice@volantis.com", alice.getAddress().getValue());
        assertEquals("smtp", alice.getChannel());
        assertEquals("Nokia-6600", alice.getDeviceName());
View Full Code Here

Examples of com.volantis.mps.bms.Failures

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

        Failures failures = factory.createFailures();

        failures.add(recipient);

        address = factory.createSMTPAddress("bob@volantis.com");
        recipient = factory.createRecipient(address, "Nokia-6800");
        recipient.setChannel("smtp");

        failures.add(recipient);

        address = factory.createSMTPAddress("dave@volantis.com");
        recipient = factory.createRecipient(address, "Samsung-D700");
        recipient.setChannel("smtp");

        failures.add(recipient);

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

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

Examples of com.volantis.mps.bms.Failures

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

        Failures failures = parser.readFailures(in);
        assertEquals(3, failures.getRecipients().length);

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

        Recipient alice = recipients[0];
        assertEquals("alice@volantis.com", alice.getAddress().getValue());
        assertEquals("smtp", alice.getChannel());
        assertEquals("Nokia-6600", alice.getDeviceName());
View Full Code Here

Examples of com.volantis.mps.bms.Failures

        MessageService messageService =
                MessageServiceFactory.getDefaultInstance()
                        .createMessageService(endpoint);

        Failures failures = messageService.process(request);

        if (failures.isEmpty()) {
            System.out.println("Success!");
            System.exit(0);
        }

        System.out.println("Failed");
View Full Code Here

Examples of com.volantis.mps.bms.Failures

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

        final Failures result = aggregateResults(failures);

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Exiting send with " + result.getRecipients().length +
                    " failures.");
        }

        return result;
    }
View Full Code Here

Examples of com.volantis.mps.bms.Failures

     * @param failures a MessageRecipients object containing the recipients
     *                 that the message could not be sent to.
     * @return a Collection - not null.
     */
    private Failures aggregateResults(MessageRecipients failures) {
        final Failures result = MessageFactory.getDefaultInstance().createFailures();

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Entered aggregateResults");
        }

        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.bms.Failures

        // Create an internal message service to process the request.
        InternalMessageService service =
                (InternalMessageService)MessageServiceFactory.
                        getDefaultInstance().createMessageService("internal:");

        Failures failures;
        try {
            failures = service.process(sendRequest, session);
        } catch (MessageServiceException e) {
            throw new ServletException(e.getMessage(), e);
        }
View Full Code Here

Examples of com.volantis.mps.bms.Failures

     */
    private Failures doRequest(InputStream inputXML, ModelParser parser)
            throws MessageServiceException {
        HttpURLConnection connection = openConnection();
        doPOST(connection, inputXML);
        Failures result = readResponse(connection, parser);
        connection.disconnect();
        return result;
    }
View Full Code Here

Examples of com.volantis.mps.bms.Failures

     */
    private Failures readResponse(
            HttpURLConnection connection, ModelParser parser)
            throws MessageServiceException {
        InputStream readIn = getResponseInputStream(connection);
        Failures result = parser.readFailures(readIn);
        IOUtils.closeQuietly(readIn);
        return result;
    }
View Full Code Here

Examples of org.assertj.core.internal.Failures

  protected BinaryDiff binaryDiff;

  @Before
  public void setUp() {
    actual = mock(File.class);
    failures = spy(new Failures());
    files = new Files();
    files.failures = failures;
    diff = mock(Diff.class);
    files.diff = diff;
    binaryDiff = mock(BinaryDiff.class);
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.