Examples of onMessage()


Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

      Message msg = new Message(factory2.getMessageType(), UUID.randomUUID().toString());
      msg.setTgtSessionId("some other session id");
      msg.setTgtName("");
      msgList.add(msg);
    }
    executor.onMessage("someInstance", msgList, changeContext);

    Thread.sleep(1000);

    AssertJUnit.assertTrue(factory._processedMsgIds.size() == nMsgs1);
    AssertJUnit.assertTrue(factory2._processedMsgIds.size() == 0);
View Full Code Here

Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

    exceptionMsg.setTgtName("Localhost_1123");
    exceptionMsg.setSrcName("127.101.1.23_2234");
    exceptionMsg.setCorrelationId(UUID.randomUUID().toString());
    msgList.add(exceptionMsg);

    executor.onMessage("someInstance", msgList, changeContext);

    Thread.sleep(1000);

    AssertJUnit.assertTrue(factory._processedMsgIds.size() == nMsgs1);
    AssertJUnit.assertTrue(factory._handlersCreated == nMsgs1);
View Full Code Here

Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

      msgList.add(msg);
      msg.setTgtName("Localhost_1123");
      msg.setSrcName("127.101.1.23_2234");
      msgListToCancel.add(msg);
    }
    executor.onMessage("someInstance", msgList, changeContext);
    Thread.sleep(500);
    for (int i = 0; i < nMsgs2; i++) {
      // executor.cancelTask(msgListToCancel.get(i), changeContext);
      HelixTask task = new HelixTask(msgListToCancel.get(i), changeContext, null, null);
      executor.cancelTask(task);
View Full Code Here

Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

      msg.setTgtName("Localhost_1123");
      msg.setSrcName("127.101.1.23_2234");
      msgList.add(msg);
    }
    NotificationContext changeContext = new NotificationContext(manager);
    executor.onMessage("some", msgList, changeContext);
    Thread.sleep(500);
    for (ExecutorService svc : executor._executorMap.values()) {
      Assert.assertFalse(svc.isShutdown());
    }
    Assert.assertTrue(factory._processedMsgIds.size() > 0);
View Full Code Here

Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

      msg.setTgtName("Localhost_1123");
      msg.setSrcName("127.101.1.23_2234");
      msg.setExecutionTimeout((i + 1) * 600);
      msgList.add(msg);
    }
    executor.onMessage("someInstance", msgList, changeContext);

    Thread.sleep(4000);

    AssertJUnit.assertTrue(factory._handlersCreated == nMsgs2);
    AssertJUnit.assertEquals(factory._timedOutMsgIds.size(), 2);
View Full Code Here

Examples of org.apache.helix.messaging.handling.HelixTaskExecutor.onMessage()

      msg.setSrcName("127.101.1.23_2234");
      msg.setExecutionTimeout((i + 1) * 600);
      msg.setRetryCount(1);
      msgList.add(msg);
    }
    executor.onMessage("someInstance", msgList, changeContext);
    Thread.sleep(3500);
    AssertJUnit.assertEquals(factory._processedMsgIds.size(), 3);
    AssertJUnit.assertTrue(msgList.get(0).getRecord().getSimpleField("Cancelcount").equals("2"));
    AssertJUnit.assertTrue(msgList.get(1).getRecord().getSimpleField("Cancelcount").equals("1"));
    AssertJUnit.assertEquals(factory._timedOutMsgIds.size(), 2);
View Full Code Here

Examples of org.apache.james.protocols.smtp.hook.MessageHook.onMessage()

                for (int i = 0; i < count; i++) {
                    MessageHook rawHandler = (MessageHook) messageHandlers.get(i);
                    session.getLogger().debug("executing message handler " + rawHandler);

                    long start = System.currentTimeMillis();
                    HookResult hRes = rawHandler.onMessage(session, mail);
                    long executionTime = System.currentTimeMillis() - start;

                    if (rHooks != null) {
                        for (int i2 = 0; i2 < rHooks.size(); i2++) {
                            Object rHook = rHooks.get(i2);
View Full Code Here

Examples of org.apache.james.smtpserver.SetMimeHeaderHandler.onMessage()

        SetMimeHeaderHandler header = new SetMimeHeaderHandler();

        header.setHeaderName(HEADER_NAME);
        header.setHeaderValue(HEADER_VALUE);
        header.onMessage(mockedSMTPSession, mockedMail);

        assertEquals(HEADER_VALUE, mockedMail.getMessage()
                .getHeader(HEADER_NAME)[0]);
    }
View Full Code Here

Examples of org.apache.james.smtpserver.fastfail.SpamAssassinHandler.onMessage()

        SpamAssassinHandler handler = new SpamAssassinHandler();

        handler.setSpamdHost(SPAMD_HOST);
        handler.setSpamdPort(port);
        handler.setSpamdRejectionHits(200.0);
        HookResult response = handler.onMessage(session, mockedMail);

        assertEquals("Email was not rejected", response.getResult(), HookReturnCode.DECLINED);
        assertEquals("email was not spam", mockedMail.getAttribute(
                SpamAssassinInvoker.FLAG_MAIL_ATTRIBUTE_NAME), "NO");
        assertNotNull("spam hits", mockedMail.getAttribute(
View Full Code Here

Examples of org.apache.james.smtpserver.fastfail.URIRBLHandler.onMessage()

        URIRBLHandler handler = new URIRBLHandler();

        handler.setDNSService(setupMockedDnsServer());
        handler.setUriRblServer(servers);
        HookResult response = handler.onMessage(session, mockedMail);

        assertEquals("Email was not rejected", response.getResult(),HookReturnCode.DECLINED);
    }
   
    public void testBlocked() throws IOException, MessagingException {
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.