public static CallContext register(User callingUser, Account callingAccount) { return register(callingUser, callingAccount, UUID.randomUUID().toString()); }
public static CallContext registerSystemCallContextOnceOnly() { try { CallContext context = s_currentContext.get(); if (context == null) { return register(null, null, User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, UUID.randomUUID().toString()); } assert context.getCallingUserId() == User.UID_SYSTEM : "You are calling a very specific method that registers a one time system context. This method is meant for background threads that does processing."; return context; } catch (Exception e) { s_logger.error("Failed to register the system call context.", e); throw new CloudRuntimeException("Failed to register system call context", e); } }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); CallContext.register(Mockito.mock(User.class), Mockito.mock(Account.class)); }
public static CallContext register(long callingUserId, long callingAccountId, String contextId) throws CloudAuthenticationException { Account account = s_entityMgr.findById(Account.class, callingAccountId); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId)); } User user = s_entityMgr.findById(User.class, callingUserId); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId)); } return register(user, account, contextId); }
public static CallContext register(long callingUserId, long callingAccountId) throws CloudAuthenticationException { Account account = s_entityMgr.findById(Account.class, callingAccountId); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId)); } User user = s_entityMgr.findById(User.class, callingUserId); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId)); } return register(user, account); }
@Before public void setUp() { CallContext.init(entityMgr); CallContext.register(Mockito.mock(User.class), Mockito.mock(Account.class)); }
protected static CallContext register(User callingUser, Account callingAccount, Long userId, Long accountId, String contextId) { /* Unit tests will have multiple times of setup/tear-down call to this, remove assertions to all unit test to run assert s_currentContext.get() == null : "There's a context already so what does this new register context mean? " + s_currentContext.get().toString(); if (s_currentContext.get() != null) { // FIXME: This should be removed soon. I added this check only to surface all the places that have this problem. throw new CloudRuntimeException("There's a context already so what does this new register context mean? " + s_currentContext.get().toString()); } */ CallContext callingContext = null; if (userId == null || accountId == null) { callingContext = new CallContext(callingUser, callingAccount, contextId); } else { callingContext = new CallContext(userId, accountId, contextId); } s_currentContext.set(callingContext); NDC.push("ctx-" + UuidUtils.first(contextId)); if (s_logger.isTraceEnabled()) { s_logger.trace("Registered: " + callingContext); } s_currentContextStack.get().push(callingContext); return callingContext; }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); ReflectionTestUtils.setField(createAccountCmd, "domainId", domainId); ReflectionTestUtils.setField(createAccountCmd, "accountType", accountType); CallContext.register(Mockito.mock(User.class), Mockito.mock(Account.class)); }
s_logger.info("User signature: " + signature + " is not equaled to computed signature: " + computedSignature); } else { CallContext.register(user, account);
CallContext.register(accountMgr.getSystemUser(), accountMgr.getSystemAccount()); sb.insert(0, "(userId=" + User.UID_SYSTEM + " accountId=" + Account.ACCOUNT_ID_SYSTEM + " sessionId=" + null + ") "); final String responseText = handleRequest(parameterMap, responseType, sb);
public static CallContext register(String callingUserUuid, String callingAccountUuid) { Account account = s_entityMgr.findByUuid(Account.class, callingAccountUuid); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, callingAccountUuid); } User user = s_entityMgr.findByUuid(User.class, callingUserUuid); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, callingUserUuid); } return register(user, account); }
assert (vm != null); CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated()); try { Method handler = getHandler(joinRecord.getWakeupHandler());
CallContext ctx = CallContext.register(user, accountObject); if(contextDetails != null){ Type objectMapType = new TypeToken<Map<Object, Object>>() {}.getType();
CallContext.register(work.getUserId(), work.getAccountId());