test_class.declarator: entityMgr
test_class.modifier: @Mock
test_class.original_string: @Mock
      EntityManager entityMgr;
test_class.type: EntityManager
test_class.var_name: entityMgr
test_class.file: api/src/test/java/org/apache/cloudstack/context/CallContextTest.java
test_class.identifier: CallContextTest
test_case.body: @Test
      public void testGetContextParameter() {
          CallContext currentContext = CallContext.current();
  
          Assert.assertEquals("There is nothing in the context. It should return null", null, currentContext.getContextParameter("key"));
          Assert.assertTrue("There is nothing in the context. The map should be empty", currentContext.getContextParameters().isEmpty());
  
          UUID objectUUID = UUID.randomUUID();
          UUID stringUUID = UUID.randomUUID();
  
          //Case1: when an entry with the object class is present
          currentContext.putContextParameter(User.class, objectUUID);
          Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(User.class));
          Assert.assertEquals("current context map should have exactly one entry", 1, currentContext.getContextParameters().size());
  
          //Case2: when an entry with the object class name as String is present
          currentContext.putContextParameter(Account.class.toString(), stringUUID);
          //object is put with key as Account.class.toString but get with key as Account.class
          Assert.assertEquals("it should return stringUUID: " + stringUUID, stringUUID, currentContext.getContextParameter(Account.class));
          Assert.assertEquals("current context map should have exactly two entries", 2, currentContext.getContextParameters().size());
  
          //Case3: when an entry with both object class and object class name as String is present
          //put an entry of account class object in the context
          currentContext.putContextParameter(Account.class, objectUUID);
          //since both object and string a present in the current context, it should return object value
          Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(Account.class));
          Assert.assertEquals("current context map should have exactly three entries", 3, currentContext.getContextParameters().size());
      }
test_case.class_method_signature: CallContextTest.testGetContextParameter()
test_case.full_signature: @Test public void testGetContextParameter()
test_case.identifier: testGetContextParameter
test_case.invocations: current assertEquals getContextParameter assertTrue isEmpty getContextParameters randomUUID randomUUID putContextParameter assertEquals getContextParameter assertEquals size getContextParameters putContextParameter toString assertEquals getContextParameter assertEquals size getContextParameters putContextParameter assertEquals getContextParameter assertEquals size getContextParameters
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetContextParameter()
focal_class.declarator: s_logger = LoggerFactory.getLogger(CallContext.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(CallContext.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: s_currentContext = new ManagedThreadLocal<CallContext>()
focal_class.modifier: private static
focal_class.original_string: private static ManagedThreadLocal<CallContext> s_currentContext = new ManagedThreadLocal<CallContext>();
focal_class.type: ManagedThreadLocal<CallContext>
focal_class.var_name: s_currentContext
focal_class.declarator: s_currentContextStack = new ManagedThreadLocal<Stack<CallContext>>() {
          @Override
          protected Stack<CallContext> initialValue() {
              return new Stack<CallContext>();
          }
      }
focal_class.modifier: private static
focal_class.original_string: private static ManagedThreadLocal<Stack<CallContext>> s_currentContextStack = new ManagedThreadLocal<Stack<CallContext>>() {
          @Override
          protected Stack<CallContext> initialValue() {
              return new Stack<CallContext>();
          }
      };
focal_class.type: ManagedThreadLocal<Stack<CallContext>>
focal_class.var_name: s_currentContextStack
focal_class.declarator: contextId
focal_class.modifier: private
focal_class.original_string: private String contextId;
focal_class.type: String
focal_class.var_name: contextId
focal_class.declarator: account
focal_class.modifier: private
focal_class.original_string: private Account account;
focal_class.type: Account
focal_class.var_name: account
focal_class.declarator: accountId
focal_class.modifier: private
focal_class.original_string: private long accountId;
focal_class.type: long
focal_class.var_name: accountId
focal_class.declarator: startEventId = 0
focal_class.modifier: private
focal_class.original_string: private long startEventId = 0;
focal_class.type: long
focal_class.var_name: startEventId
focal_class.declarator: eventDescription
focal_class.modifier: private
focal_class.original_string: private String eventDescription;
focal_class.type: String
focal_class.var_name: eventDescription
focal_class.declarator: eventDetails
focal_class.modifier: private
focal_class.original_string: private String eventDetails;
focal_class.type: String
focal_class.var_name: eventDetails
focal_class.declarator: eventType
focal_class.modifier: private
focal_class.original_string: private String eventType;
focal_class.type: String
focal_class.var_name: eventType
focal_class.declarator: isEventDisplayEnabled = true
focal_class.modifier: private
focal_class.original_string: private boolean isEventDisplayEnabled = true;
focal_class.type: boolean
focal_class.var_name: isEventDisplayEnabled
focal_class.declarator: user
focal_class.modifier: private
focal_class.original_string: private User user;
focal_class.type: User
focal_class.var_name: user
focal_class.declarator: userId
focal_class.modifier: private
focal_class.original_string: private long userId;
focal_class.type: long
focal_class.var_name: userId
focal_class.declarator: context = new HashMap<Object, Object>()
focal_class.modifier: private final
focal_class.original_string: private final Map<Object, Object> context = new HashMap<Object, Object>();
focal_class.type: Map<Object, Object>
focal_class.var_name: context
focal_class.declarator: project
focal_class.modifier: private
focal_class.original_string: private Project project;
focal_class.type: Project
focal_class.var_name: project
focal_class.declarator: s_entityMgr
focal_class.modifier: static
focal_class.original_string: static EntityManager s_entityMgr;
focal_class.type: EntityManager
focal_class.var_name: s_entityMgr
focal_class.file: api/src/main/java/org/apache/cloudstack/context/CallContext.java
focal_class.identifier: CallContext
focal_class.class_method_signature: CallContext.init(EntityManager entityMgr)
focal_class.full_signature: public static void init(EntityManager entityMgr)
focal_class.identifier: init
focal_class.modifiers: public static
focal_class.parameters: (EntityManager entityMgr)
focal_class.return: void
focal_class.signature: void init(EntityManager entityMgr)
focal_class.class_method_signature: CallContext.CallContext()
focal_class.full_signature: protected  CallContext()
focal_class.identifier: CallContext
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  CallContext()
focal_class.class_method_signature: CallContext.CallContext(long userId, long accountId, String contextId)
focal_class.full_signature: protected  CallContext(long userId, long accountId, String contextId)
focal_class.identifier: CallContext
focal_class.modifiers: protected
focal_class.parameters: (long userId, long accountId, String contextId)
focal_class.signature:  CallContext(long userId, long accountId, String contextId)
focal_class.class_method_signature: CallContext.CallContext(User user, Account account, String contextId)
focal_class.full_signature: protected  CallContext(User user, Account account, String contextId)
focal_class.identifier: CallContext
focal_class.modifiers: protected
focal_class.parameters: (User user, Account account, String contextId)
focal_class.signature:  CallContext(User user, Account account, String contextId)
focal_class.class_method_signature: CallContext.putContextParameter(Object key, Object value)
focal_class.full_signature: public void putContextParameter(Object key, Object value)
focal_class.identifier: putContextParameter
focal_class.modifiers: public
focal_class.parameters: (Object key, Object value)
focal_class.return: void
focal_class.signature: void putContextParameter(Object key, Object value)
focal_class.class_method_signature: CallContext.getContextParameter(Object key)
focal_class.full_signature: public Object getContextParameter(Object key)
focal_class.identifier: getContextParameter
focal_class.modifiers: public
focal_class.parameters: (Object key)
focal_class.return: Object
focal_class.signature: Object getContextParameter(Object key)
focal_class.class_method_signature: CallContext.getCallingUserId()
focal_class.full_signature: public long getCallingUserId()
focal_class.identifier: getCallingUserId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getCallingUserId()
focal_class.class_method_signature: CallContext.getCallingUser()
focal_class.full_signature: public User getCallingUser()
focal_class.identifier: getCallingUser
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: User
focal_class.signature: User getCallingUser()
focal_class.class_method_signature: CallContext.getContextId()
focal_class.full_signature: public String getContextId()
focal_class.identifier: getContextId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getContextId()
focal_class.class_method_signature: CallContext.getCallingAccount()
focal_class.full_signature: public Account getCallingAccount()
focal_class.identifier: getCallingAccount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Account
focal_class.signature: Account getCallingAccount()
focal_class.class_method_signature: CallContext.current()
focal_class.full_signature: public static CallContext current()
focal_class.identifier: current
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: CallContext
focal_class.signature: CallContext current()
focal_class.class_method_signature: CallContext.register(User callingUser, Account callingAccount, String contextId)
focal_class.full_signature: public static CallContext register(User callingUser, Account callingAccount, String contextId)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (User callingUser, Account callingAccount, String contextId)
focal_class.return: CallContext
focal_class.signature: CallContext register(User callingUser, Account callingAccount, String contextId)
focal_class.class_method_signature: CallContext.register(User callingUser, Account callingAccount, Long userId, Long accountId, String contextId)
focal_class.full_signature: protected static CallContext register(User callingUser, Account callingAccount, Long userId, Long accountId, String contextId)
focal_class.identifier: register
focal_class.modifiers: protected static
focal_class.parameters: (User callingUser, Account callingAccount, Long userId, Long accountId, String contextId)
focal_class.return: CallContext
focal_class.signature: CallContext register(User callingUser, Account callingAccount, Long userId, Long accountId, String contextId)
focal_class.class_method_signature: CallContext.registerPlaceHolderContext()
focal_class.full_signature: public static CallContext registerPlaceHolderContext()
focal_class.identifier: registerPlaceHolderContext
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: CallContext
focal_class.signature: CallContext registerPlaceHolderContext()
focal_class.class_method_signature: CallContext.register(User callingUser, Account callingAccount)
focal_class.full_signature: public static CallContext register(User callingUser, Account callingAccount)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (User callingUser, Account callingAccount)
focal_class.return: CallContext
focal_class.signature: CallContext register(User callingUser, Account callingAccount)
focal_class.class_method_signature: CallContext.registerSystemCallContextOnceOnly()
focal_class.full_signature: public static CallContext registerSystemCallContextOnceOnly()
focal_class.identifier: registerSystemCallContextOnceOnly
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: CallContext
focal_class.signature: CallContext registerSystemCallContextOnceOnly()
focal_class.class_method_signature: CallContext.register(String callingUserUuid, String callingAccountUuid)
focal_class.full_signature: public static CallContext register(String callingUserUuid, String callingAccountUuid)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (String callingUserUuid, String callingAccountUuid)
focal_class.return: CallContext
focal_class.signature: CallContext register(String callingUserUuid, String callingAccountUuid)
focal_class.class_method_signature: CallContext.register(long callingUserId, long callingAccountId)
focal_class.full_signature: public static CallContext register(long callingUserId, long callingAccountId)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (long callingUserId, long callingAccountId)
focal_class.return: CallContext
focal_class.signature: CallContext register(long callingUserId, long callingAccountId)
focal_class.class_method_signature: CallContext.register(long callingUserId, long callingAccountId, String contextId)
focal_class.full_signature: public static CallContext register(long callingUserId, long callingAccountId, String contextId)
focal_class.identifier: register
focal_class.modifiers: public static
focal_class.parameters: (long callingUserId, long callingAccountId, String contextId)
focal_class.return: CallContext
focal_class.signature: CallContext register(long callingUserId, long callingAccountId, String contextId)
focal_class.class_method_signature: CallContext.unregisterAll()
focal_class.full_signature: public static void unregisterAll()
focal_class.identifier: unregisterAll
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void unregisterAll()
focal_class.class_method_signature: CallContext.unregister()
focal_class.full_signature: public static CallContext unregister()
focal_class.identifier: unregister
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: CallContext
focal_class.signature: CallContext unregister()
focal_class.class_method_signature: CallContext.setStartEventId(long startEventId)
focal_class.full_signature: public void setStartEventId(long startEventId)
focal_class.identifier: setStartEventId
focal_class.modifiers: public
focal_class.parameters: (long startEventId)
focal_class.return: void
focal_class.signature: void setStartEventId(long startEventId)
focal_class.class_method_signature: CallContext.getStartEventId()
focal_class.full_signature: public long getStartEventId()
focal_class.identifier: getStartEventId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getStartEventId()
focal_class.class_method_signature: CallContext.getCallingAccountId()
focal_class.full_signature: public long getCallingAccountId()
focal_class.identifier: getCallingAccountId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getCallingAccountId()
focal_class.class_method_signature: CallContext.getCallingAccountUuid()
focal_class.full_signature: public String getCallingAccountUuid()
focal_class.identifier: getCallingAccountUuid
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getCallingAccountUuid()
focal_class.class_method_signature: CallContext.getCallingUserUuid()
focal_class.full_signature: public String getCallingUserUuid()
focal_class.identifier: getCallingUserUuid
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getCallingUserUuid()
focal_class.class_method_signature: CallContext.setEventDetails(String eventDetails)
focal_class.full_signature: public void setEventDetails(String eventDetails)
focal_class.identifier: setEventDetails
focal_class.modifiers: public
focal_class.parameters: (String eventDetails)
focal_class.return: void
focal_class.signature: void setEventDetails(String eventDetails)
focal_class.class_method_signature: CallContext.getEventDetails()
focal_class.full_signature: public String getEventDetails()
focal_class.identifier: getEventDetails
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getEventDetails()
focal_class.class_method_signature: CallContext.getEventType()
focal_class.full_signature: public String getEventType()
focal_class.identifier: getEventType
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getEventType()
focal_class.class_method_signature: CallContext.setEventType(String eventType)
focal_class.full_signature: public void setEventType(String eventType)
focal_class.identifier: setEventType
focal_class.modifiers: public
focal_class.parameters: (String eventType)
focal_class.return: void
focal_class.signature: void setEventType(String eventType)
focal_class.class_method_signature: CallContext.getEventDescription()
focal_class.full_signature: public String getEventDescription()
focal_class.identifier: getEventDescription
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getEventDescription()
focal_class.class_method_signature: CallContext.setEventDescription(String eventDescription)
focal_class.full_signature: public void setEventDescription(String eventDescription)
focal_class.identifier: setEventDescription
focal_class.modifiers: public
focal_class.parameters: (String eventDescription)
focal_class.return: void
focal_class.signature: void setEventDescription(String eventDescription)
focal_class.class_method_signature: CallContext.getProject()
focal_class.full_signature: public Project getProject()
focal_class.identifier: getProject
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Project
focal_class.signature: Project getProject()
focal_class.class_method_signature: CallContext.setProject(Project project)
focal_class.full_signature: public void setProject(Project project)
focal_class.identifier: setProject
focal_class.modifiers: public
focal_class.parameters: (Project project)
focal_class.return: void
focal_class.signature: void setProject(Project project)
focal_class.class_method_signature: CallContext.isEventDisplayEnabled()
focal_class.full_signature: public boolean isEventDisplayEnabled()
focal_class.identifier: isEventDisplayEnabled
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isEventDisplayEnabled()
focal_class.class_method_signature: CallContext.setEventDisplayEnabled(boolean eventDisplayEnabled)
focal_class.full_signature: public void setEventDisplayEnabled(boolean eventDisplayEnabled)
focal_class.identifier: setEventDisplayEnabled
focal_class.modifiers: public
focal_class.parameters: (boolean eventDisplayEnabled)
focal_class.return: void
focal_class.signature: void setEventDisplayEnabled(boolean eventDisplayEnabled)
focal_class.class_method_signature: CallContext.getContextParameters()
focal_class.full_signature: public Map<Object, Object> getContextParameters()
focal_class.identifier: getContextParameters
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<Object, Object>
focal_class.signature: Map<Object, Object> getContextParameters()
focal_class.class_method_signature: CallContext.putContextParameters(Map<Object, Object> details)
focal_class.full_signature: public void putContextParameters(Map<Object, Object> details)
focal_class.identifier: putContextParameters
focal_class.modifiers: public
focal_class.parameters: (Map<Object, Object> details)
focal_class.return: void
focal_class.signature: void putContextParameters(Map<Object, Object> details)
focal_class.class_method_signature: CallContext.setActionEventInfo(String eventType, String description)
focal_class.full_signature: public static void setActionEventInfo(String eventType, String description)
focal_class.identifier: setActionEventInfo
focal_class.modifiers: public static
focal_class.parameters: (String eventType, String description)
focal_class.return: void
focal_class.signature: void setActionEventInfo(String eventType, String description)
focal_class.class_method_signature: CallContext.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public Object getContextParameter(Object key) {
          Object value = context.get(key);
          //check if the value is present in the toString value of the key
          //due to a bug in the way we update the key by serializing and deserializing, it sometimes gets toString value of the key. @see com.cloud.api.ApiAsyncJobDispatcher#runJob
          if(value == null ) {
              value = context.get(key.toString());
          }
          return value;
      }
focal_method.class_method_signature: CallContext.getContextParameter(Object key)
focal_method.full_signature: public Object getContextParameter(Object key)
focal_method.identifier: getContextParameter
focal_method.invocations: get get toString
focal_method.modifiers: public
focal_method.parameters: (Object key)
focal_method.return: Object
focal_method.signature: Object getContextParameter(Object key)