Package com.vmware.aurora.vc.vcevent

Examples of com.vmware.aurora.vc.vcevent.VcEventListener


   @Test
   public void testEventListener() throws Exception {
      List<VcCluster> clusters = VcInventory.getClusters();
      VcCluster cluster;         // Will pick the first cluster.
      VcEventListener eventListener = VcContext.getEventListener();

      receivedEventCount = 0;
      /* GeneralUser is a "fake" event not triggered by any cms vc task. */
      VcEventListener.installExtEventHandler(VcEventType.GeneralUser, this);

      if (clusters != null && (cluster = clusters.get(0)) != null) {
         int eventCount = 1;     // Take it easy - can't delete individual events from VC.
         AuAssert.check(eventListener != null);

         for (int i = 0; i < eventCount; i++ ) {
            System.out.println("Posting GeneralUserEvent to cluster: " + cluster.getName());
            eventListener.postGeneralUserEvent(cluster, "FakeGeneralUserEvent", "" +
                  "CMS -> VC GeneralUserEvent", "Administrator");
         }
         System.out.println("Waiting for GeneralUserEvent");
         while (getReceivedEventCount() < eventCount) {
            Thread.sleep(100);
         }
         System.out.println("Event count: " + eventListener.getTotalEventCount());
         VcEventListener.removeExtEventHandler(VcEventType.GeneralUser, this);
      }
   }
View Full Code Here


    * @param targetMoRef        either clutser or datacenter
    * @throws Exception
    */
   private static void startEventListener(ManagedObjectReference targetMoRef)
   throws Exception {
      eventListener = new VcEventListener(targetMoRef);
      eventListener.setDaemon(true);
      eventListener.start();
      eventListener.waitUntilStarted();
      /*
       * If something went wrong during initialization of VcEventListener thread,
View Full Code Here

TOP

Related Classes of com.vmware.aurora.vc.vcevent.VcEventListener

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.