Package com.sun.jini.test.impl.mercury

Examples of com.sun.jini.test.impl.mercury.TestGenerator


  RemoteEventListener mbRel = getMailboxListener(mr);
  logger.log(Level.INFO, "Got RemoteEventListener ref {0}", mbRel);

  // Create an event generator and pass it the
  // mailbox's remote event listener.
  TestGenerator myGen = TestUtils.createGenerator(manager);
  logger.log(Level.INFO, "Got TestGenerator ref {0}", myGen);
  EventRegistration evtReg =
      myGen.register(EVENT_ID,       // Event ID to use
         null,      // handback
         mbRel,          // Notification target
         DURATION1)// Lease duration
  logger.log(Level.INFO, "Got EventRegistration ref {0}", evtReg);
  Lease tgl = evtReg.getLease();
  checkLease(tgl, DURATION1);
  logger.log(Level.INFO, "EventRegistration lease good until "
        + new Date(tgl.getExpiration()));

  // Create two listener objects
  TestListener myListener = TestUtils.createDisableListener(manager, mr);
  logger.log(Level.INFO, "Got TestListener ref {0}", myListener);
  int eventCount = 0;

  // Generate some events
  logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events");
  RemoteEvent[] events = new RemoteEvent[NUM_EVENTS];
  for (i = 0; i < NUM_EVENTS; i++) {
      events[i] = myGen.generateEvent(evtReg.getID(), 3);
  }

  RemoteEvent[] bogus = {
      new RemoteEvent(myGen, 9999, 9999, null),
      new RemoteEvent(myGen, 5678, 1234, null),
View Full Code Here


  // Get the mailbox service provided listener
  RemoteEventListener mbRel = getMailboxListener(mr);

  // Create an event generator and pass it the
  // mailbox's remote event listener.
  TestGenerator myGen = TestUtils.createGenerator(manager);
  EventRegistration evtReg =
      myGen.register(EVENT_ID,  // Event ID to use
         null,    // handback
         mbRel,    // Notification target
         DURATION1)// Lease duration
  Lease tgl = evtReg.getLease();
  checkLease(tgl, DURATION1);

  TestListener goodListener = TestUtils.createListener(manager);
  int goodCount = 0;

  // Generate some events
  logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events");
  RemoteEvent[] events = new RemoteEvent[NUM_EVENTS];
  for (i = 0; i < NUM_EVENTS; i++) {
      events[i] = myGen.generateEvent(evtReg.getID(), 3);
  }

  RemoteEvent[] bogus = {
      new RemoteEvent(myGen, 9999, 9999, null),
      new RemoteEvent(myGen, 5678, 1234, null),
  };

  //
  // Kill event mailbox service
  //
  shutdown(0);

  // Enable the first of our listener objects
  // Enable good listener
  logger.log(Level.INFO, "Enabling good listener");
  mr.enableDelivery(goodListener);

  goodCount = 5;
  logger.log(Level.INFO, "Wating for event delivery of " + goodCount);
        waitForEvents(goodListener, goodCount, MAX_WAIT);
  logger.log(Level.INFO, "Asserting event count");
  assertCount(goodListener, goodCount);
  logger.log(Level.INFO, "Verifying events");
  assertEvents(goodListener, events);

  logger.log(Level.INFO, "Generating another event");
  RemoteEvent re = myGen.generateEvent(evtReg.getID(), 3);
  goodCount++;
  logger.log(Level.INFO, "Wating for event delivery" + goodCount);
        waitForEvents(goodListener, goodCount, MAX_WAIT);
  logger.log(Level.INFO, "Asserting event count");
  assertCount(goodListener, goodCount);
View Full Code Here

  logger.log(Level.INFO, "Getting pull mailbox listener");
  RemoteEventListener mbRel = getPullMailboxListener(mr);

  // Create an event generator and pass it the
  // mailbox's remote event listener.
  TestGenerator myGen = TestUtils.createGenerator(manager);
  EventRegistration evtReg =
      myGen.register(EVENT_ID,  // Event ID to use
         null,    // handback
         mbRel,    // Notification target
         DURATION1)// Lease duration
  Lease tgl = evtReg.getLease();
  checkLease(tgl, DURATION1);

  int goodCount = 0;

  // Generate some events
  logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events");
  RemoteEvent[] events = new RemoteEvent[NUM_EVENTS];
  for (i = 0; i < NUM_EVENTS; i++) {
      events[i] = myGen.generateEvent(evtReg.getID(), 3);
  }

  RemoteEvent[] bogus = {
      new RemoteEvent(myGen, 9999, 9999, null),
      new RemoteEvent(myGen, 5678, 1234, null),
  };

  //
  // Kill event mailbox service
  //
  shutdown(0);

  goodCount = NUM_EVENTS;
  logger.log(Level.INFO, "Getting events");
  getCollectedRemoteEvents(tpl, mr, goodCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(tpl, goodCount);
  logger.log(Level.INFO, "Verifying events");
  assertEvents(tpl, events);

  logger.log(Level.INFO, "Generating another event");
  RemoteEvent re = myGen.generateEvent(evtReg.getID(), 3);
  goodCount++;
  getCollectedRemoteEvents(tpl, mr, goodCount, MAX_WAIT);
  logger.log(Level.INFO, "Verifying event delivery");
  assertCount(tpl, goodCount);
  logger.log(Level.INFO, "Verifying events");
View Full Code Here

TOP

Related Classes of com.sun.jini.test.impl.mercury.TestGenerator

Copyright © 2018 www.massapicom. 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.