Examples of PtPDestination


Examples of org.xmlBlaster.test.util.PtPDestination

      // this.counter = 0;

      this.destinations = new PtPDestination[this.numDestinations];
      for (int i=0; i < this.numDestinations; i++)
         this.destinations[i] = new PtPDestination(this.glob, this.subjectName + "/" + (i+1));
      log.info("XmlBlaster is ready for testing");
      try {
         I_XmlBlasterAccess con = glob.getXmlBlasterAccess(); // Find orb
         String passwd = "secret";
         ConnectQos connectQos = new ConnectQos(glob, "src_" + this.subjectName, passwd); // == "<qos>...</qos>";
View Full Code Here

Examples of org.xmlBlaster.test.util.PtPDestination

   private void checkWithReconnect(int dest, boolean wantsPtP, int expected, long delay) {
      try {
         this.destinations[dest].shutdown(false);
         String sessionName = this.destinations[dest].getSessionName().getRelativeName();
         this.destinations[dest] = new PtPDestination(this.glob, sessionName);
         this.destinations[dest] .init(wantsPtP, false, 1, 1, 3, 1);
         this.destinations[dest] .check(delay, expected);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
View Full Code Here

Examples of org.xmlBlaster.test.util.PtPDestination

      long subjMaxEntriesCache = 2;
     
      long exLimit = cbMaxEntries + subjMaxEntries + 2;

     
      this.destination = new PtPDestination(this.glob, "joe/1");
      /** wants PtP messages and does not shutdown */
      boolean wantsPtP = true;
      boolean shutdownCB = false;
      try {
         this.destination.init(wantsPtP, shutdownCB, cbMaxEntries, cbMaxEntriesCache, subjMaxEntries, subjMaxEntriesCache);
      }
      catch (XmlBlasterException ex) {
         assertTrue("an exception while initing the destination should not occur " + ex.getMessage(), false);              
      }
     
      for (int i=0; i < exLimit; i++) {
         try {
            doPublish(i, oid, doGc, PUB_DELAY);
         }
         catch (Exception ex) {
            assertTrue("an exception on publish '" + i + "' should not occur " + ex.getMessage(), false);
         }
      }
        
      int ret = this.destination.getUpdateInterceptor().waitOnUpdate(3000L*exLimit, (int)exLimit);
      assertEquals("wrong number of entries arrived", (int)exLimit, ret);
      // wait half a second more to see if more messages come
      ret = this.destination.getUpdateInterceptor().waitOnUpdate(500L, (int)exLimit+1);
      assertEquals("wrong number of entries arrived", (int)exLimit, ret);
     
      Msg[] msg = this.destination.getUpdateInterceptor().getMsgs();
      assertEquals("wrong number of messages", exLimit, msg.length);
      for (int i=0; i < exLimit; i++) {
         assertEquals("wrong message sequence at ", i, msg[i].getContentInt());
      }
      this.destination.getUpdateInterceptor().clear();     

      // now stop the receiver by shutting down its cbServer and fill cbQueue and subjQueue
      this.destination.getConnection().leaveServer(null);

      for (long i=exLimit; i < 2 * exLimit; i++) {
         try {
            doPublish((int)i, oid, doGc, PUB_DELAY);
         }
         catch (XmlBlasterException ex) {
            assertTrue("an exception on publish '" + i + "' should not occur " + ex.getMessage(), false);
         }
      }
      this.destination.check(250L, 0);
     
      for (long i=2*exLimit; i < 2*exLimit + 2; i++) {
         try {
            doPublish((int)i, oid, doGc, PUB_DELAY);
            assertTrue("an exception on publish '" + i + "' should have occurred ", false);
         }
         catch (XmlBlasterException ex) {
            log.info("this is an allowed exception since queues are overflown");
         }
      }

      this.destination.check(250L, 0);

      // stop and restart the server
      EmbeddedXmlBlaster.stopXmlBlaster(this.serverThread);
      this.serverThread = EmbeddedXmlBlaster.startXmlBlaster(Util.getOtherServerPorts(this.serverPort));

      // reconnect to server (for the destination, the publisher never left)
      this.destination = new PtPDestination(this.glob, "joe/1");
      /** wants PtP messages and does not shutdown */
     
      try {
         // we pass -1 -1 for the subject queue to avoid reconviguration
         // otherwise it will shut down the callback
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.