test_class.declarator: INVALID_EVENT = "INVALID_EVENT"
test_class.modifier: protected static final
test_class.original_string: protected static final String INVALID_EVENT = "INVALID_EVENT";
test_class.type: String
test_class.var_name: INVALID_EVENT
test_class.file: api/src/test/java/com/abiquo/api/eventing/VSMEventProcessorTest.java
test_class.identifier: VSMEventProcessorTest
test_class.superclass: extends VSMEventProcessorTestBase
test_case.body: @Test
      public void test_lockedToPaused()
      {
          assertStage(createVirtualMachineStage().in(LOCKED).expecting(PAUSED)
              .onEvent(VMEventType.PAUSED));
      }
test_case.class_method_signature: VSMEventProcessorTest.test_lockedToPaused()
test_case.full_signature: @Test public void test_lockedToPaused()
test_case.identifier: test_lockedToPaused
test_case.invocations: assertStage onEvent expecting in createVirtualMachineStage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_lockedToPaused()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(VSMEventProcessor.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger LOGGER = LoggerFactory.getLogger(VSMEventProcessor.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: virtualMachineRep
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected VirtualMachineRep virtualMachineRep;
focal_class.type: VirtualMachineRep
focal_class.var_name: virtualMachineRep
focal_class.declarator: tracer
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected TracerLogger tracer;
focal_class.type: TracerLogger
focal_class.var_name: tracer
focal_class.declarator: allocatorService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected VirtualMachineAllocatorService allocatorService;
focal_class.type: VirtualMachineAllocatorService
focal_class.var_name: allocatorService
focal_class.declarator: remoteServiceService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RemoteServiceService remoteServiceService;
focal_class.type: RemoteServiceService
focal_class.var_name: remoteServiceService
focal_class.declarator: vsm
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected VsmServiceStub vsm;
focal_class.type: VsmServiceStub
focal_class.var_name: vsm
focal_class.declarator: stateByEvent =
          new HashMap<VMEventType, VirtualMachineState>()
          {
              {
                  put(VMEventType.POWER_OFF, VirtualMachineState.OFF);
                  put(VMEventType.POWER_ON, VirtualMachineState.ON);
                  put(VMEventType.PAUSED, VirtualMachineState.PAUSED);
                  put(VMEventType.RESUMED, VirtualMachineState.ON);
                  put(VMEventType.DESTROYED, VirtualMachineState.NOT_ALLOCATED);
                  put(VMEventType.MOVED, VirtualMachineState.LOCKED); // TODO Move to enterprise
              }
          }
focal_class.modifier: protected final
focal_class.original_string: protected final Map<VMEventType, VirtualMachineState> stateByEvent =
          new HashMap<VMEventType, VirtualMachineState>()
          {
              {
                  put(VMEventType.POWER_OFF, VirtualMachineState.OFF);
                  put(VMEventType.POWER_ON, VirtualMachineState.ON);
                  put(VMEventType.PAUSED, VirtualMachineState.PAUSED);
                  put(VMEventType.RESUMED, VirtualMachineState.ON);
                  put(VMEventType.DESTROYED, VirtualMachineState.NOT_ALLOCATED);
                  put(VMEventType.MOVED, VirtualMachineState.LOCKED); // TODO Move to enterprise
              }
          };
focal_class.type: Map<VMEventType, VirtualMachineState>
focal_class.var_name: stateByEvent
focal_class.declarator: traceEventByEvent =
          new HashMap<VMEventType, EventType>()
          {
              {
                  put(VMEventType.POWER_OFF, EventType.VM_POWEROFF);
                  put(VMEventType.POWER_ON, EventType.VM_POWERON);
                  put(VMEventType.PAUSED, EventType.VM_PAUSED);
                  put(VMEventType.RESUMED, EventType.VM_RESUMED);
                  put(VMEventType.DESTROYED, EventType.VM_DESTROY);
                  put(VMEventType.MOVED, EventType.VM_MOVED);
              }
          }
focal_class.modifier: protected final
focal_class.original_string: protected final Map<VMEventType, EventType> traceEventByEvent =
          new HashMap<VMEventType, EventType>()
          {
              {
                  put(VMEventType.POWER_OFF, EventType.VM_POWEROFF);
                  put(VMEventType.POWER_ON, EventType.VM_POWERON);
                  put(VMEventType.PAUSED, EventType.VM_PAUSED);
                  put(VMEventType.RESUMED, EventType.VM_RESUMED);
                  put(VMEventType.DESTROYED, EventType.VM_DESTROY);
                  put(VMEventType.MOVED, EventType.VM_MOVED);
              }
          };
focal_class.type: Map<VMEventType, EventType>
focal_class.var_name: traceEventByEvent
focal_class.file: api/src/main/java/com/abiquo/api/eventing/VSMEventProcessor.java
focal_class.identifier: VSMEventProcessor
focal_class.interfaces: implements VSMCallback
focal_class.class_method_signature: VSMEventProcessor.VSMEventProcessor(final EntityManager em)
focal_class.full_signature: public  VSMEventProcessor(final EntityManager em)
focal_class.identifier: VSMEventProcessor
focal_class.modifiers: public
focal_class.parameters: (final EntityManager em)
focal_class.signature:  VSMEventProcessor(final EntityManager em)
focal_class.class_method_signature: VSMEventProcessor.VSMEventProcessor()
focal_class.full_signature: public  VSMEventProcessor()
focal_class.identifier: VSMEventProcessor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  VSMEventProcessor()
focal_class.class_method_signature: VSMEventProcessor.onEvent(final VirtualSystemEvent notification)
focal_class.full_signature: @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void onEvent(final VirtualSystemEvent notification)
focal_class.identifier: onEvent
focal_class.modifiers: @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public
focal_class.parameters: (final VirtualSystemEvent notification)
focal_class.return: void
focal_class.signature: void onEvent(final VirtualSystemEvent notification)
focal_class.class_method_signature: VSMEventProcessor.updateMachineState(final VirtualMachine machine,
          final VirtualSystemEvent notification)
focal_class.full_signature: protected VirtualMachine updateMachineState(final VirtualMachine machine,
          final VirtualSystemEvent notification)
focal_class.identifier: updateMachineState
focal_class.modifiers: protected
focal_class.parameters: (final VirtualMachine machine,
          final VirtualSystemEvent notification)
focal_class.return: VirtualMachine
focal_class.signature: VirtualMachine updateMachineState(final VirtualMachine machine,
          final VirtualSystemEvent notification)
focal_class.class_method_signature: VSMEventProcessor.processEvent(final VirtualMachine virtualMachine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.full_signature: protected VirtualMachine processEvent(final VirtualMachine virtualMachine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.identifier: processEvent
focal_class.modifiers: protected
focal_class.parameters: (final VirtualMachine virtualMachine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.return: VirtualMachine
focal_class.signature: VirtualMachine processEvent(final VirtualMachine virtualMachine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.class_method_signature: VSMEventProcessor.logAndTraceVirtualMachineStateUpdated(final VirtualMachine machine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.full_signature: protected void logAndTraceVirtualMachineStateUpdated(final VirtualMachine machine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.identifier: logAndTraceVirtualMachineStateUpdated
focal_class.modifiers: protected
focal_class.parameters: (final VirtualMachine machine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.return: void
focal_class.signature: void logAndTraceVirtualMachineStateUpdated(final VirtualMachine machine,
          final VMEventType event, final VirtualSystemEvent notification)
focal_class.class_method_signature: VSMEventProcessor.traceVirtualMachineStateUpdated(final VirtualSystemEvent notification,
          final String message)
focal_class.full_signature: protected void traceVirtualMachineStateUpdated(final VirtualSystemEvent notification,
          final String message)
focal_class.identifier: traceVirtualMachineStateUpdated
focal_class.modifiers: protected
focal_class.parameters: (final VirtualSystemEvent notification,
          final String message)
focal_class.return: void
focal_class.signature: void traceVirtualMachineStateUpdated(final VirtualSystemEvent notification,
          final String message)
focal_class.class_method_signature: VSMEventProcessor.eventFromString(final String name)
focal_class.full_signature: protected VMEventType eventFromString(final String name)
focal_class.identifier: eventFromString
focal_class.modifiers: protected
focal_class.parameters: (final String name)
focal_class.return: VMEventType
focal_class.signature: VMEventType eventFromString(final String name)
focal_class.class_method_signature: VSMEventProcessor.onVMDestroyedEvent(final VirtualMachine virtualMachine, final VMEventType event,
          final VirtualSystemEvent notification)
focal_class.full_signature: protected void onVMDestroyedEvent(final VirtualMachine virtualMachine, final VMEventType event,
          final VirtualSystemEvent notification)
focal_class.identifier: onVMDestroyedEvent
focal_class.modifiers: protected
focal_class.parameters: (final VirtualMachine virtualMachine, final VMEventType event,
          final VirtualSystemEvent notification)
focal_class.return: void
focal_class.signature: void onVMDestroyedEvent(final VirtualMachine virtualMachine, final VMEventType event,
          final VirtualSystemEvent notification)
focal_class.class_method_signature: VSMEventProcessor.unsubscribeVirtualMachine(final VirtualMachine virtualMachine)
focal_class.full_signature: protected void unsubscribeVirtualMachine(final VirtualMachine virtualMachine)
focal_class.identifier: unsubscribeVirtualMachine
focal_class.modifiers: protected
focal_class.parameters: (final VirtualMachine virtualMachine)
focal_class.return: void
focal_class.signature: void unsubscribeVirtualMachine(final VirtualMachine virtualMachine)
focal_method.body: @Override
      @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
      public void onEvent(final VirtualSystemEvent notification)
      {
          LOGGER.debug("New notification received, {}.", notification.toString());
  
          // Check if notification contains a valid event
          VMEventType event = eventFromString(notification.getEventType());
  
          if (stateByEvent.get(event) == null)
          {
              LOGGER.error("Unknown event {}. Just ignoring it.", notification.getEventType());
              return;
          }
  
          // Update virtual machine state
          VirtualMachine machine = virtualMachineRep.findByName(notification.getVirtualSystemId());
  
          if (machine != null)
          {
              virtualMachineRep.update(updateMachineState(machine, notification));
          }
      }
focal_method.class_method_signature: VSMEventProcessor.onEvent(final VirtualSystemEvent notification)
focal_method.full_signature: @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void onEvent(final VirtualSystemEvent notification)
focal_method.identifier: onEvent
focal_method.invocations: debug toString eventFromString getEventType get error getEventType findByName getVirtualSystemId update updateMachineState
focal_method.modifiers: @Override @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public
focal_method.parameters: (final VirtualSystemEvent notification)
focal_method.return: void
focal_method.signature: void onEvent(final VirtualSystemEvent notification)