Examples of PostOffice


Examples of hermes.postoffice.PostOffice

    assertEquals(beings[5].getInteractionsWith(beings[1]), 3);
  }
 
  @Test
  public void test_LockUpdateRate() {
    World w = new World(new PostOffice(), new HCamera());
    w.lockUpdateRate(5);
    long time = System.currentTimeMillis();
    w.update();
    long elapsed = System.currentTimeMillis() - time;
    assertEquals(elapsed,200,5);
View Full Code Here

Examples of hermes.postoffice.PostOffice

  class TestWorld1 extends World {

    int nUpdates;
   
    public TestWorld1(int nUpdates) {
      super(new PostOffice(5000,5001), new HCamera());
      this.nUpdates = nUpdates;
    }
View Full Code Here

Examples of hermes.postoffice.PostOffice

    boolean postUpdated = false;
    boolean setupCalled = false;
    boolean shutdownCalled = false;
   
    public TestWorld2() {
      super(new PostOffice(), new HCamera());
    }
View Full Code Here

Examples of net.myexperiments.gos.messaging.PostOffice

     * Setup System
     *
     */
//    layout = new CreateWorld(this);
    scheduler = new EventQueue(this);
    GOSPS = new PostOffice();
    /**
     *
     * Create console
     *
     */
 
View Full Code Here

Examples of ninja.postoffice.Postoffice

    public void testSending() throws Exception {

        // ////////////////////////////////////////////////////////////////////
        // Setup the mockpostoffice
        // ////////////////////////////////////////////////////////////////////
        Postoffice postoffice = new PostofficeMockImpl();

        // /////////////////////////////////////////////////////////////////////
        // Sending of first mail.
        // /////////////////////////////////////////////////////////////////////
        Mail firstMail = new MailImpl();

        firstMail.setSubject("first mail");
        firstMail.addTo("to@localhost");
        firstMail.setFrom("from@localhost");
        firstMail.setBodyText("simple body text");

        // make sure that mocked mailer did not send email previously
        assertEquals(null, ((PostofficeMockImpl) postoffice).getLastSentMail());

        postoffice.send(firstMail);

        // and test that mail has been sent.
        assertEquals("first mail", ((PostofficeMockImpl) postoffice).getLastSentMail().getSubject());
        assertTrue(((PostofficeMockImpl) postoffice).getLastSentMail().getTos()
                .contains("to@localhost"));
        assertTrue(((PostofficeMockImpl) postoffice).getLastSentMail().getFrom().equals(
                "from@localhost"));
        assertTrue(((PostofficeMockImpl) postoffice).getLastSentMail().getBodyText().equals(
                "simple body text"));

        // /////////////////////////////////////////////////////////////////////
        // Sending of another mail. Check that mock mailer handles repeated
        // sending correctly.
        // /////////////////////////////////////////////////////////////////////
        Mail secondMail = new MailImpl();

        secondMail.setSubject("second mail");
        secondMail.addTo("to@localhost");
        secondMail.setFrom("from@localhost");
        secondMail.setBodyText("simple body text");

        // send simple mail via mocked postoffice
        postoffice.send(secondMail);

        // and test that mail has been sent.
        assertEquals("second mail", ((PostofficeMockImpl) postoffice).getLastSentMail().getSubject());
        assertTrue(((PostofficeMockImpl) postoffice).getLastSentMail().getTos()
                .contains("to@localhost"));
View Full Code Here

Examples of org.hornetq.core.postoffice.PostOffice

      if (server == null)
      {
         throw new IllegalArgumentException("No server at " + node);
      }

      PostOffice po = server.getPostOffice();

      long start = System.currentTimeMillis();

      int messageCount = 0;
View Full Code Here

Examples of org.hornetq.core.postoffice.PostOffice

      if (server == null)
      {
         throw new IllegalArgumentException("No server at " + node);
      }

      PostOffice po = server.getPostOffice();

      long start = System.currentTimeMillis();

      int bindingCount = 0;

      int totConsumers = 0;

      do
      {
         bindingCount = 0;

         totConsumers = 0;

         Bindings bindings = po.getBindingsForAddress(new SimpleString(address));

         for (Binding binding : bindings.getBindings())
         {
            if (binding instanceof LocalQueueBinding && local || binding instanceof RemoteQueueBinding && !local)
            {
               QueueBinding qBinding = (QueueBinding)binding;

               bindingCount++;

               totConsumers += qBinding.consumerCount();
            }
         }

         if (bindingCount == count && totConsumers == consumerCount)
         {
            return;
         }

         Thread.sleep(10);
      }
      while (System.currentTimeMillis() - start < ClusterTestBase.WAIT_TIMEOUT);

      // System.out.println(threadDump(" - fired by ClusterTestBase::waitForBindings"));

      String msg = "Timed out waiting for bindings (bindingCount = " + bindingCount +
                   ", totConsumers = " +
                   totConsumers +
                   ")";

      ClusterTestBase.log.error(msg);

      // Sending thread dump into junit report.. trying to get some information about the server case the binding didn't
      // arrive
      System.out.println(UnitTestCase.threadDump(msg));

      Bindings bindings = po.getBindingsForAddress(new SimpleString(address));

      System.out.println("=======================================================================");
      System.out.println("Binding information for address = " + address + " on node " + node);

      for (Binding binding : bindings.getBindings())
View Full Code Here

Examples of org.hornetq.core.postoffice.PostOffice

      File testdir = new File(getTestDir());
      deleteDirectory(testdir);

      Configuration configuration = createDefaultConfig();

      PostOffice postOffice = new FakePostOffice();

      final JournalStorageManager journal = new JournalStorageManager(configuration, execFactory);

      try
      {
View Full Code Here

Examples of org.hornetq.core.postoffice.PostOffice

      if (server == null)
      {
         throw new IllegalArgumentException("No server at " + node);
      }

      PostOffice po = server.getPostOffice();

      long start = System.currentTimeMillis();

      int messageCount = 0;
View Full Code Here

Examples of org.hornetq.core.postoffice.PostOffice

      if (server == null)
      {
         throw new IllegalArgumentException("No server at " + node);
      }

      PostOffice po = server.getPostOffice();

      long start = System.currentTimeMillis();

      int bindingCount = 0;

      int totConsumers = 0;

      do
      {
         bindingCount = 0;

         totConsumers = 0;

         Bindings bindings = po.getBindingsForAddress(new SimpleString(address));

         for (Binding binding : bindings.getBindings())
         {
            if (binding instanceof LocalQueueBinding && local || binding instanceof RemoteQueueBinding && !local)
            {
               QueueBinding qBinding = (QueueBinding)binding;

               bindingCount++;

               totConsumers += qBinding.consumerCount();
            }
         }

         if (bindingCount == count && totConsumers == consumerCount)
         {
            return;
         }

         Thread.sleep(10);
      }
      while (System.currentTimeMillis() - start < ClusterTestBase.WAIT_TIMEOUT);

      // System.out.println(threadDump(" - fired by ClusterTestBase::waitForBindings"));

      String msg = "Timed out waiting for bindings (bindingCount = " + bindingCount +
                   ", totConsumers = " +
                   totConsumers +
                   ")";

      ClusterTestBase.log.error(msg);

      // Sending thread dump into junit report.. trying to get some information about the server case the binding didn't
      // arrive
      System.out.println(UnitTestCase.threadDump(msg));

      Bindings bindings = po.getBindingsForAddress(new SimpleString(address));

      System.out.println("=======================================================================");
      System.out.println("Binding information for address = " + address + " on node " + node);

      for (Binding binding : bindings.getBindings())
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.