test_class.declarator: notifier = null
test_class.modifier: protected
test_class.original_string: protected ESXiNotifier notifier = null;
test_class.type: ESXiNotifier
test_class.var_name: notifier
test_class.file: vsm/src/test/java/com/abiquo/vsm/redis/pubsub/notifier/impl/TestESXiNotifier.java
test_class.identifier: TestESXiNotifier
test_class.superclass: extends TestNotifierBase<ESXiNotifier>
test_case.body: @Test
      public void test_move()
      {
          VirtualMachine vm = new VirtualMachine();
          PhysicalMachine pm0 = new PhysicalMachine();
          PhysicalMachine pm1 = new PhysicalMachine();
  
          pm0.setId(0);
          pm0.setAddress("http://10.30.1.203:443/");
          pm0.setUsername("");
          pm0.setPassword("");
          pm0.setType(Type.VMX_04.name());
  
          pm1.setId(1);
          pm1.setAddress("http://10.30.1.205:443/");
          pm1.setUsername("");
          pm1.setPassword("");
          pm1.setType(Type.VMX_04.name());
  
          vm.setId(0);
          vm.setLastKnownState(null);
          vm.setName("ABQ_" + UUID.randomUUID().toString());
          vm.setPhysicalMachine(pm0);
  
          List<VirtualSystemEvent> notifications;
  
          // Should notify a CREATED event if the vm.getPhysicalMachine is different that the
          // machine where the event was produced.
          notifications = notifier.processEvent(vm, pm1, VMEventType.CREATED);
          assertEquals(notifications.size(), 1);
          assertTrue(containsMovedEvent(notifications));
          assertTrue(notificationsFromMachine(notifications, pm1));
  
          // No notifications of a DESTROYED event if the vm.getPhysicalMachine is different that the
          // machine where the event was produced.
          vm.setPhysicalMachine(pm1);
          notifications = notifier.processEvent(vm, pm0, VMEventType.DESTROYED);
          assertTrue(notifications.isEmpty());
  
          // Should notify a DESTROYED event if the vm.getPhysicalMachine is the same that produced
          // the event.
          vm.setPhysicalMachine(pm0);
          notifications = notifier.processEvent(vm, pm0, VMEventType.DESTROYED);
          assertFalse(containsMovedEvent(notifications));
          assertTrue(notificationsFromMachine(notifications, pm0));
  
          // Only detects movement with CREATED events.
          vm.setPhysicalMachine(pm0);
          notifications = notifier.processEvent(vm, pm1, VMEventType.POWER_ON);
          assertTrue(notifications.isEmpty());
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.POWER_OFF);
          assertTrue(notifications.isEmpty());
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.PAUSED);
          assertTrue(notifications.isEmpty());
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.RESUMED);
          assertTrue(notifications.isEmpty());
      }
test_case.class_method_signature: TestESXiNotifier.test_move()
test_case.full_signature: @Test public void test_move()
test_case.identifier: test_move
test_case.invocations: setId setAddress setUsername setPassword setType name setId setAddress setUsername setPassword setType name setId setLastKnownState setName toString randomUUID setPhysicalMachine processEvent assertEquals size assertTrue containsMovedEvent assertTrue notificationsFromMachine setPhysicalMachine processEvent assertTrue isEmpty setPhysicalMachine processEvent assertFalse containsMovedEvent assertTrue notificationsFromMachine setPhysicalMachine processEvent assertTrue isEmpty processEvent assertTrue isEmpty processEvent assertTrue isEmpty processEvent assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_move()
focal_class.declarator: logger = LoggerFactory.getLogger(ESXiNotifier.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger logger = LoggerFactory.getLogger(ESXiNotifier.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: vsm/src/main/java/com/abiquo/vsm/redis/pubsub/notifier/impl/ESXiNotifier.java
focal_class.identifier: ESXiNotifier
focal_class.class_method_signature: ESXiNotifier.processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_class.full_signature: @Override public List<VirtualSystemEvent> processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_class.identifier: processEvent
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_class.return: List<VirtualSystemEvent>
focal_class.signature: List<VirtualSystemEvent> processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_class.superclass: extends GenericNotifier
focal_method.body: @Override
      public List<VirtualSystemEvent> processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
      {
          logger.trace(String.format("Processing %s %s event from machine %s",
              virtualMachine.getName(), event.name(), machine.getAddress()));
  
          List<VirtualSystemEvent> notifications = new ArrayList<VirtualSystemEvent>();
  
          switch (event)
          {
              case CREATED:
                  notifications.addAll(deduceMoveEvent(virtualMachine, machine, event));
                  break;
  
              case POWER_ON:
              case POWER_OFF:
              case PAUSED:
              case RESUMED:
              case DESTROYED:
  
                  if (samePhysicalMachineAddress(virtualMachine.getPhysicalMachine(), machine)
                      && !alreadyNotified(virtualMachine, event))
                  {
                      notifications.add(buildVirtualSystemEvent(virtualMachine, event));
                  }
  
                  break;
  
              default:
                  break;
          }
  
          return notifications;
      }
focal_method.class_method_signature: ESXiNotifier.processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_method.full_signature: @Override public List<VirtualSystemEvent> processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_method.identifier: processEvent
focal_method.invocations: trace format getName name getAddress addAll deduceMoveEvent samePhysicalMachineAddress getPhysicalMachine alreadyNotified add buildVirtualSystemEvent
focal_method.modifiers: @Override public
focal_method.parameters: (final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)
focal_method.return: List<VirtualSystemEvent>
focal_method.signature: List<VirtualSystemEvent> processEvent(final VirtualMachine virtualMachine,
          final PhysicalMachine machine, final VMEventType event)