test_class.declarator: EVENT_ID = 1
test_class.modifier: public static final
test_class.original_string: public static final long EVENT_ID = 1;
test_class.type: long
test_class.var_name: EVENT_ID
test_class.declarator: USER_ID = 1
test_class.modifier: public static final
test_class.original_string: public static final long USER_ID = 1;
test_class.type: long
test_class.var_name: USER_ID
test_class.declarator: ACCOUNT_ID = 1
test_class.modifier: public static final
test_class.original_string: public static final long ACCOUNT_ID = 1;
test_class.type: long
test_class.var_name: ACCOUNT_ID
test_class.declarator: staticFieldValues = new HashMap<>()
test_class.modifier: protected
test_class.original_string: protected Map<String, Object> staticFieldValues = new HashMap<>();
test_class.type: Map<String, Object>
test_class.var_name: staticFieldValues
test_class.declarator: publishedEvents = new ArrayList<>()
test_class.modifier: protected
test_class.original_string: protected List<Event> publishedEvents = new ArrayList<>();
test_class.type: List<Event>
test_class.var_name: publishedEvents
test_class.declarator: eventDao
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected EventDao eventDao;
test_class.type: EventDao
test_class.var_name: eventDao
test_class.declarator: accountDao
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected AccountDao accountDao;
test_class.type: AccountDao
test_class.var_name: accountDao
test_class.declarator: userDao
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected UserDao userDao;
test_class.type: UserDao
test_class.var_name: userDao
test_class.declarator: projectDao
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected ProjectDao projectDao;
test_class.type: ProjectDao
test_class.var_name: projectDao
test_class.declarator: entityMgr
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected EntityManager entityMgr;
test_class.type: EntityManager
test_class.var_name: entityMgr
test_class.declarator: configDao
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected ConfigurationDao configDao;
test_class.type: ConfigurationDao
test_class.var_name: configDao
test_class.declarator: eventBus
test_class.modifier: @Mock
      protected
test_class.original_string: @Mock
      protected EventBus eventBus;
test_class.type: EventBus
test_class.var_name: eventBus
test_class.file: server/src/test/java/com/cloud/event/ActionEventUtilsTest.java
test_class.identifier: ActionEventUtilsTest
test_case.body: @Test
      public void testPopulateFirstClassEntities() {
          AccountVO account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
          account.setId(ACCOUNT_ID);
          UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone",
                  UUID.randomUUID().toString(), User.Source.UNKNOWN);
  
          Mockito.when(accountDao.findById(ACCOUNT_ID)).thenReturn(account);
          Mockito.when(userDao.findById(USER_ID)).thenReturn(user);
  
          CallContext.register(user, account);
  
          //Inject some entity UUIDs into the call context
          String instanceUuid = UUID.randomUUID().toString();
          String ipUuid = UUID.randomUUID().toString();
          CallContext.current().putContextParameter(VirtualMachine.class, instanceUuid);
          CallContext.current().putContextParameter(IpAddress.class, ipUuid);
  
          ActionEventUtils.onActionEvent(USER_ID, ACCOUNT_ID, account.getDomainId(), "StaticNat", "Test event");
  
          //Assertions
          Assert.assertNotEquals(publishedEvents.size(), 0);
          Assert.assertEquals(publishedEvents.size(), 1);
  
          Event event = publishedEvents.get(0);
          Assert.assertNotNull(event.getDescription());
  
          JsonObject json = new JsonParser().parse(event.getDescription()).getAsJsonObject();
  
          Assert.assertTrue(json.has("VirtualMachine"));
          Assert.assertTrue(json.has("IpAddress"));
          Assert.assertEquals(json.get("VirtualMachine").getAsString(), instanceUuid);
          Assert.assertEquals(json.get("IpAddress").getAsString(), ipUuid);
  
          CallContext.unregister();
      }
test_case.class_method_signature: ActionEventUtilsTest.testPopulateFirstClassEntities()
test_case.full_signature: @Test public void testPopulateFirstClassEntities()
test_case.identifier: testPopulateFirstClassEntities
test_case.invocations: setId toString randomUUID thenReturn when findById thenReturn when findById register toString randomUUID toString randomUUID putContextParameter current putContextParameter current onActionEvent getDomainId assertNotEquals size assertEquals size get assertNotNull getDescription getAsJsonObject parse getDescription assertTrue has assertTrue has assertEquals getAsString get assertEquals getAsString get unregister
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPopulateFirstClassEntities()
focal_class.declarator: s_logger = LoggerFactory.getLogger(ActionEventUtils.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(ActionEventUtils.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: s_eventDao
focal_class.modifier: private static
focal_class.original_string: private static EventDao s_eventDao;
focal_class.type: EventDao
focal_class.var_name: s_eventDao
focal_class.declarator: s_accountDao
focal_class.modifier: private static
focal_class.original_string: private static AccountDao s_accountDao;
focal_class.type: AccountDao
focal_class.var_name: s_accountDao
focal_class.declarator: s_projectDao
focal_class.modifier: private static
focal_class.original_string: private static ProjectDao s_projectDao;
focal_class.type: ProjectDao
focal_class.var_name: s_projectDao
focal_class.declarator: s_userDao
focal_class.modifier: protected static
focal_class.original_string: protected static UserDao s_userDao;
focal_class.type: UserDao
focal_class.var_name: s_userDao
focal_class.declarator: s_eventBus = null
focal_class.modifier: protected static
focal_class.original_string: protected static EventBus s_eventBus = null;
focal_class.type: EventBus
focal_class.var_name: s_eventBus
focal_class.declarator: s_entityMgr
focal_class.modifier: protected static
focal_class.original_string: protected static EntityManager s_entityMgr;
focal_class.type: EntityManager
focal_class.var_name: s_entityMgr
focal_class.declarator: s_configDao
focal_class.modifier: protected static
focal_class.original_string: protected static ConfigurationDao s_configDao;
focal_class.type: ConfigurationDao
focal_class.var_name: s_configDao
focal_class.declarator: EventDetails = "event_details"
focal_class.modifier: public static final
focal_class.original_string: public static final String EventDetails = "event_details";
focal_class.type: String
focal_class.var_name: EventDetails
focal_class.declarator: EventId = "event_id"
focal_class.modifier: public static final
focal_class.original_string: public static final String EventId = "event_id";
focal_class.type: String
focal_class.var_name: EventId
focal_class.declarator: EntityType = "entity_type"
focal_class.modifier: public static final
focal_class.original_string: public static final String EntityType = "entity_type";
focal_class.type: String
focal_class.var_name: EntityType
focal_class.declarator: EntityUuid = "entity_uuid"
focal_class.modifier: public static final
focal_class.original_string: public static final String EntityUuid = "entity_uuid";
focal_class.type: String
focal_class.var_name: EntityUuid
focal_class.declarator: EntityDetails = "entity_details"
focal_class.modifier: public static final
focal_class.original_string: public static final String EntityDetails = "entity_details";
focal_class.type: String
focal_class.var_name: EntityDetails
focal_class.declarator: eventDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      EventDao eventDao;
focal_class.type: EventDao
focal_class.var_name: eventDao
focal_class.declarator: accountDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      AccountDao accountDao;
focal_class.type: AccountDao
focal_class.var_name: accountDao
focal_class.declarator: userDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      UserDao userDao;
focal_class.type: UserDao
focal_class.var_name: userDao
focal_class.declarator: projectDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      ProjectDao projectDao;
focal_class.type: ProjectDao
focal_class.var_name: projectDao
focal_class.declarator: entityMgr
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      EntityManager entityMgr;
focal_class.type: EntityManager
focal_class.var_name: entityMgr
focal_class.declarator: configDao
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      ConfigurationDao configDao;
focal_class.type: ConfigurationDao
focal_class.var_name: configDao
focal_class.file: server/src/main/java/com/cloud/event/ActionEventUtils.java
focal_class.identifier: ActionEventUtils
focal_class.class_method_signature: ActionEventUtils.ActionEventUtils()
focal_class.full_signature: public  ActionEventUtils()
focal_class.identifier: ActionEventUtils
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ActionEventUtils()
focal_class.class_method_signature: ActionEventUtils.init()
focal_class.full_signature: @PostConstruct void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: ActionEventUtils.onActionEvent(Long userId, Long accountId, Long domainId, String type, String description)
focal_class.full_signature: public static Long onActionEvent(Long userId, Long accountId, Long domainId, String type, String description)
focal_class.identifier: onActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, Long domainId, String type, String description)
focal_class.return: Long
focal_class.signature: Long onActionEvent(Long userId, Long accountId, Long domainId, String type, String description)
focal_class.class_method_signature: ActionEventUtils.onScheduledActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.full_signature: public static Long onScheduledActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.identifier: onScheduledActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.return: Long
focal_class.signature: Long onScheduledActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.class_method_signature: ActionEventUtils.startNestedActionEvent(String eventType, String eventDescription)
focal_class.full_signature: public static void startNestedActionEvent(String eventType, String eventDescription)
focal_class.identifier: startNestedActionEvent
focal_class.modifiers: public static
focal_class.parameters: (String eventType, String eventDescription)
focal_class.return: void
focal_class.signature: void startNestedActionEvent(String eventType, String eventDescription)
focal_class.class_method_signature: ActionEventUtils.onStartedActionEventFromContext(String eventType, String eventDescription, boolean eventDisplayEnabled)
focal_class.full_signature: public static void onStartedActionEventFromContext(String eventType, String eventDescription, boolean eventDisplayEnabled)
focal_class.identifier: onStartedActionEventFromContext
focal_class.modifiers: public static
focal_class.parameters: (String eventType, String eventDescription, boolean eventDisplayEnabled)
focal_class.return: void
focal_class.signature: void onStartedActionEventFromContext(String eventType, String eventDescription, boolean eventDisplayEnabled)
focal_class.class_method_signature: ActionEventUtils.onStartedActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.full_signature: public static Long onStartedActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.identifier: onStartedActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.return: Long
focal_class.signature: Long onStartedActionEvent(Long userId, Long accountId, String type, String description, boolean eventDisplayEnabled, long startEventId)
focal_class.class_method_signature: ActionEventUtils.onCompletedActionEvent(Long userId, Long accountId, String level, String type, String description, long startEventId)
focal_class.full_signature: public static Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, String description, long startEventId)
focal_class.identifier: onCompletedActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, String level, String type, String description, long startEventId)
focal_class.return: Long
focal_class.signature: Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, String description, long startEventId)
focal_class.class_method_signature: ActionEventUtils.onCompletedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description, long startEventId)
focal_class.full_signature: public static Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description, long startEventId)
focal_class.identifier: onCompletedActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description, long startEventId)
focal_class.return: Long
focal_class.signature: Long onCompletedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description, long startEventId)
focal_class.class_method_signature: ActionEventUtils.onCreatedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description)
focal_class.full_signature: public static Long onCreatedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description)
focal_class.identifier: onCreatedActionEvent
focal_class.modifiers: public static
focal_class.parameters: (Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description)
focal_class.return: Long
focal_class.signature: Long onCreatedActionEvent(Long userId, Long accountId, String level, String type, boolean eventDisplayEnabled, String description)
focal_class.class_method_signature: ActionEventUtils.persistActionEvent(Long userId, Long accountId, Long domainId, String level, String type,
                                              Event.State state, boolean eventDisplayEnabled, String description, Long startEventId)
focal_class.full_signature: private static Event persistActionEvent(Long userId, Long accountId, Long domainId, String level, String type,
                                              Event.State state, boolean eventDisplayEnabled, String description, Long startEventId)
focal_class.identifier: persistActionEvent
focal_class.modifiers: private static
focal_class.parameters: (Long userId, Long accountId, Long domainId, String level, String type,
                                              Event.State state, boolean eventDisplayEnabled, String description, Long startEventId)
focal_class.return: Event
focal_class.signature: Event persistActionEvent(Long userId, Long accountId, Long domainId, String level, String type,
                                              Event.State state, boolean eventDisplayEnabled, String description, Long startEventId)
focal_class.class_method_signature: ActionEventUtils.publishOnEventBus(long userId, long accountId, String eventCategory, String eventType, Event.State state, String description)
focal_class.full_signature: private static void publishOnEventBus(long userId, long accountId, String eventCategory, String eventType, Event.State state, String description)
focal_class.identifier: publishOnEventBus
focal_class.modifiers: private static
focal_class.parameters: (long userId, long accountId, String eventCategory, String eventType, Event.State state, String description)
focal_class.return: void
focal_class.signature: void publishOnEventBus(long userId, long accountId, String eventCategory, String eventType, Event.State state, String description)
focal_class.class_method_signature: ActionEventUtils.getEntityUuid(Class<?> entityType, Object entityId)
focal_class.full_signature: private static String getEntityUuid(Class<?> entityType, Object entityId)
focal_class.identifier: getEntityUuid
focal_class.modifiers: private static
focal_class.parameters: (Class<?> entityType, Object entityId)
focal_class.return: String
focal_class.signature: String getEntityUuid(Class<?> entityType, Object entityId)
focal_class.class_method_signature: ActionEventUtils.getDomainId(long accountId)
focal_class.full_signature: private static long getDomainId(long accountId)
focal_class.identifier: getDomainId
focal_class.modifiers: private static
focal_class.parameters: (long accountId)
focal_class.return: long
focal_class.signature: long getDomainId(long accountId)
focal_class.class_method_signature: ActionEventUtils.populateFirstClassEntities(Map<String, String> eventDescription)
focal_class.full_signature: private static void populateFirstClassEntities(Map<String, String> eventDescription)
focal_class.identifier: populateFirstClassEntities
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> eventDescription)
focal_class.return: void
focal_class.signature: void populateFirstClassEntities(Map<String, String> eventDescription)
focal_method.body: private static void populateFirstClassEntities(Map<String, String> eventDescription){
  
          CallContext context = CallContext.current();
          Map<Object, Object> contextMap = context.getContextParameters();
  
          for(Map.Entry<Object, Object> entry : contextMap.entrySet()){
              try{
                  Class<?> clz = (Class<?>)entry.getKey();
                  if(clz != null && Identity.class.isAssignableFrom(clz)){
                      String uuid = getEntityUuid(clz, entry.getValue());
                      eventDescription.put(ReflectUtil.getEntityName(clz), uuid);
                  }
              } catch (Exception e){
                  s_logger.trace("Caught exception while populating first class entities for event bus, moving on");
              }
          }
  
      }
focal_method.class_method_signature: ActionEventUtils.populateFirstClassEntities(Map<String, String> eventDescription)
focal_method.full_signature: private static void populateFirstClassEntities(Map<String, String> eventDescription)
focal_method.identifier: populateFirstClassEntities
focal_method.invocations: current getContextParameters entrySet getKey isAssignableFrom getEntityUuid getValue put getEntityName trace
focal_method.modifiers: private static
focal_method.parameters: (Map<String, String> eventDescription)
focal_method.return: void
focal_method.signature: void populateFirstClassEntities(Map<String, String> eventDescription)