test_class.declarator: notifier = null
test_class.modifier: protected
test_class.original_string: protected KVMNotifier notifier = null;
test_class.type: KVMNotifier
test_class.var_name: notifier
test_class.file: vsm/src/test/java/com/abiquo/vsm/redis/pubsub/notifier/impl/TestKVMNotifier.java
test_class.identifier: TestKVMNotifier
test_class.superclass: extends TestNotifierBase<KVMNotifier>
test_case.body: @Test
      public void test_migration()
      {
          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.KVM.name());
  
          pm1.setId(1);
          pm1.setAddress("http://10.30.1.205:443/");
          pm1.setUsername("");
          pm1.setPassword("");
          pm1.setType(Type.KVM.name());
  
          vm.setId(0);
          vm.setLastKnownState(null);
          vm.setName("ABQ_" + UUID.randomUUID().toString());
          vm.setPhysicalMachine(pm0);
  
          List<VirtualSystemEvent> notifications;
  
          // Live migration
          notifications = notifier.processEvent(vm, pm1, VMEventType.RESUMED);
          assertEquals(notifications.size(), 2);
          assertTrue(containsMovedEvent(notifications));
          assertTrue(containsEvent(VMEventType.POWER_ON, notifications));
          assertTrue(notificationsFromMachine(notifications, pm1));
  
          vm.setPhysicalMachine(pm1);
          notifications = notifier.processEvent(vm, pm0, VMEventType.POWER_OFF);
          assertTrue(notifications.isEmpty());
  
          vm.setPhysicalMachine(pm1);
          notifications = notifier.processEvent(vm, pm1, VMEventType.CREATED);
          assertTrue(notifications.isEmpty());
  
          // Migration
          vm.setPhysicalMachine(pm0);
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.POWER_ON);
          assertEquals(notifications.size(), 2);
          assertTrue(containsMovedEvent(notifications));
          assertTrue(containsEvent(VMEventType.POWER_ON, notifications));
          assertTrue(notificationsFromMachine(notifications, pm1));
  
          vm.setPhysicalMachine(pm1);
          notifications = notifier.processEvent(vm, pm0, VMEventType.POWER_OFF);
          assertTrue(notifications.isEmpty());
  
          vm.setPhysicalMachine(pm1);
          notifications = notifier.processEvent(vm, pm1, VMEventType.CREATED);
          assertTrue(notifications.isEmpty());
  
          // Non-movement
          vm.setPhysicalMachine(pm0);
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.POWER_OFF);
          assertFalse(containsMovedEvent(notifications));
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.PAUSED);
          assertFalse(containsMovedEvent(notifications));
  
          notifications = notifier.processEvent(vm, pm1, VMEventType.CREATED);
          assertFalse(containsMovedEvent(notifications));
      }
test_case.class_method_signature: TestKVMNotifier.test_migration()
test_case.full_signature: @Test public void test_migration()
test_case.identifier: test_migration
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 containsEvent assertTrue notificationsFromMachine setPhysicalMachine processEvent assertTrue isEmpty setPhysicalMachine processEvent assertTrue isEmpty setPhysicalMachine processEvent assertEquals size assertTrue containsMovedEvent assertTrue containsEvent assertTrue notificationsFromMachine setPhysicalMachine processEvent assertTrue isEmpty setPhysicalMachine processEvent assertTrue isEmpty setPhysicalMachine processEvent assertFalse containsMovedEvent processEvent assertFalse containsMovedEvent processEvent assertFalse containsMovedEvent
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_migration()
focal_class.declarator: logger = LoggerFactory.getLogger(KVMNotifier.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger logger = LoggerFactory.getLogger(KVMNotifier.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: mustNotifyMovement
focal_class.modifier: private final
focal_class.original_string: private final Set<VMEventType> mustNotifyMovement;
focal_class.type: Set<VMEventType>
focal_class.var_name: mustNotifyMovement
focal_class.declarator: validEvents
focal_class.modifier: private final
focal_class.original_string: private final Set<VMEventType> validEvents;
focal_class.type: Set<VMEventType>
focal_class.var_name: validEvents
focal_class.file: vsm/src/main/java/com/abiquo/vsm/redis/pubsub/notifier/impl/KVMNotifier.java
focal_class.identifier: KVMNotifier
focal_class.class_method_signature: KVMNotifier.KVMNotifier()
focal_class.full_signature: public  KVMNotifier()
focal_class.identifier: KVMNotifier
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  KVMNotifier()
focal_class.class_method_signature: KVMNotifier.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.class_method_signature: KVMNotifier.buildMovementNotifications(VirtualMachine virtualMachine,
          final PhysicalMachine machine)
focal_class.full_signature: protected List<VirtualSystemEvent> buildMovementNotifications(VirtualMachine virtualMachine,
          final PhysicalMachine machine)
focal_class.identifier: buildMovementNotifications
focal_class.modifiers: protected
focal_class.parameters: (VirtualMachine virtualMachine,
          final PhysicalMachine machine)
focal_class.return: List<VirtualSystemEvent>
focal_class.signature: List<VirtualSystemEvent> buildMovementNotifications(VirtualMachine virtualMachine,
          final PhysicalMachine machine)
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()));
  
          if (samePhysicalMachineAddress(virtualMachine.getPhysicalMachine(), machine))
          {
              if (validEvents.contains(event) && !alreadyNotified(virtualMachine, event))
              {
                  return Collections.singletonList(buildVirtualSystemEvent(virtualMachine, event));
              }
          }
          else if (mustNotifyMovement.contains(event))
          {
              return buildMovementNotifications(virtualMachine, machine);
          }
  
          return Collections.emptyList();
      }
focal_method.class_method_signature: KVMNotifier.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 samePhysicalMachineAddress getPhysicalMachine contains alreadyNotified singletonList buildVirtualSystemEvent contains buildMovementNotifications emptyList
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)