Updated Branches:
  refs/heads/vmsync cd6aea101 -> b8261b870

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java 
b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 06c1d5d..e7b9c81 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -454,7 +454,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @ActionEvent(eventType = EventTypes.EVENT_VM_RESETPASSWORD, 
eventDescription = "resetting Vm password", async = true)
     public UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password)
             throws ResourceUnavailableException, InsufficientCapacityException 
{
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Long vmId = cmd.getId();
         UserVmVO userVm = _vmDao.findById(cmd.getId());
         _vmDao.loadDetails(userVm);
@@ -511,7 +511,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     private boolean resetVMPasswordInternal(Long vmId,
             String password) throws ResourceUnavailableException,
             InsufficientCapacityException {
-        Long userId = UserContext.current().getCallerUserId();
+        Long userId = UserContext.current().getCallingUserId();
         VMInstanceVO vmInstance = _vmDao.findById(vmId);
 
         if (password == null || password.equals("")) {
@@ -580,7 +580,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     public UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd)
             throws ResourceUnavailableException, InsufficientCapacityException 
{
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Account owner = _accountMgr.finalizeOwner(caller, 
cmd.getAccountName(), cmd.getDomainId(), cmd.getProjectId());
         Long vmId = cmd.getId();
 
@@ -638,7 +638,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     }
 
     private boolean resetVMSSHKeyInternal(Long vmId, String SSHPublicKey, 
String password) throws ResourceUnavailableException, 
InsufficientCapacityException {
-        Long userId = UserContext.current().getCallerUserId();
+        Long userId = UserContext.current().getCallingUserId();
         VMInstanceVO vmInstance = _vmDao.findById(vmId);
 
         VMTemplateVO template = 
_templateDao.findByIdIncludingRemoved(vmInstance.getTemplateId());
@@ -755,7 +755,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
 
     private UserVm upgradeStoppedVirtualMachine(Long vmId, Long svcOffId) 
throws ResourceAllocationException {
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         // Verify input parameters
         UserVmVO vmInstance = _vmDao.findById(vmId);
@@ -824,7 +824,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
         Long vmId = cmd.getVmId();
         Long networkId = cmd.getNetworkId();
         String ipAddress = cmd.getIpAddress();
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         UserVmVO vmInstance = _vmDao.findById(vmId);
         if(vmInstance == null) {
@@ -902,7 +902,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws 
InvalidParameterValueException, PermissionDeniedException, 
CloudRuntimeException {
         Long vmId = cmd.getVmId();
         Long nicId = cmd.getNicId();
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         UserVmVO vmInstance = _vmDao.findById(vmId);
         if(vmInstance == null) {
@@ -965,7 +965,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd 
cmd) throws InvalidParameterValueException, CloudRuntimeException {
         Long vmId = cmd.getVmId();
         Long nicId = cmd.getNicId();
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         UserVmVO vmInstance = _vmDao.findById(vmId);
         if (vmInstance == null){
@@ -1092,7 +1092,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
     @Override
     public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId) 
throws ResourceUnavailableException, ConcurrentOperationException, 
ManagementServerException, VirtualMachineMigrationException{
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         // Verify input parameters
         VirtualMachine vmInstance = _vmInstanceDao.findById(vmId);
@@ -1244,7 +1244,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
             throws ResourceAllocationException, CloudRuntimeException {
 
         Long vmId = cmd.getId();
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         // Verify input parameters
         UserVmVO vm = _vmDao.findById(vmId.longValue());
@@ -1443,9 +1443,6 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
     @Override
     public boolean expunge(UserVmVO vm, long callerUserId, Account caller) {
-        UserContext ctx = UserContext.current();
-        ctx.setAccountId(vm.getAccountId());
-
         try {
             List<VolumeVO> rootVol = 
_volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT);
             // expunge the vm
@@ -1601,7 +1598,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
         @Override
         public void run() {
-            UserContext.registerContext(_accountMgr.getSystemUser().getId(), 
_accountMgr.getSystemAccount(), null, false);
+            UserContext.register(_accountMgr.getSystemUser().getId(), 
_accountMgr.getSystemAccount(), null, false);
             GlobalLock scanLock = GlobalLock.getInternLock("UserVMExpunge");
             try {
                 if 
(scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
@@ -1635,7 +1632,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                 }
             } finally {
                 scanLock.releaseRef();
-                UserContext.unregisterContext();
+                UserContext.unregister();
             }
         }
     }
@@ -1657,7 +1654,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
         Long id = cmd.getId();
         Long osTypeId = cmd.getOsTypeId();
         String userData = cmd.getUserData();
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         // Input validation
         UserVmVO vmInstance = null;
@@ -1677,7 +1674,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                     "Can't enable ha for the vm as it's created from the 
Service offering having HA disabled");
         }
 
-        _accountMgr.checkAccess(UserContext.current().getCaller(), null, true,
+        _accountMgr.checkAccess(UserContext.current().getCallingAccount(), 
null, true,
                 vmInstance);
 
         if (displayName == null) {
@@ -1795,7 +1792,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @ActionEvent(eventType = EventTypes.EVENT_VM_REBOOT, eventDescription = 
"rebooting Vm", async = true)
     public UserVm rebootVirtualMachine(RebootVMCmd cmd)
             throws InsufficientCapacityException, ResourceUnavailableException 
{
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Long vmId = cmd.getId();
 
         // Verify input parameters
@@ -1818,7 +1815,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
             throw new InvalidParameterValueException("Unable to find service 
offering: " + serviceOfferingId + " corresponding to the vm");
         }
 
-        return rebootVirtualMachine(UserContext.current().getCallerUserId(),
+        return rebootVirtualMachine(UserContext.current().getCallingUserId(),
                 vmId);
     }
 
@@ -1832,7 +1829,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @Override
     @DB
     public InstanceGroupVO createVmGroup(CreateVMGroupCmd cmd) {
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Long domainId = cmd.getDomainId();
         String accountName = cmd.getAccountName();
         String groupName = cmd.getGroupName();
@@ -1887,7 +1884,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
     @Override
     public boolean deleteVmGroup(DeleteVMGroupCmd cmd) {
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Long groupId = cmd.getId();
 
         // Verify input parameters
@@ -2040,7 +2037,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
            List<Long> affinityGroupIdList)
                     throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException, 
StorageUnavailableException, ResourceAllocationException {
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         List<NetworkVO> networkList = new ArrayList<NetworkVO>();
 
         // Verify that caller can perform actions in behalf of vm owner
@@ -2100,7 +2097,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
            List<Long> affinityGroupIdList) throws 
InsufficientCapacityException, ConcurrentOperationException,
            ResourceUnavailableException, StorageUnavailableException, 
ResourceAllocationException {
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         List<NetworkVO> networkList = new ArrayList<NetworkVO>();
         boolean isSecurityGroupEnabledNetworkUsed = false;
         boolean isVmWare = (template.getHypervisorType() == 
HypervisorType.VMware || (hypervisor != null && hypervisor == 
HypervisorType.VMware));
@@ -2215,7 +2212,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
            IpAddresses defaultIps, Boolean displayvm, String keyboard, 
List<Long> affinityGroupIdList)
                     throws InsufficientCapacityException, 
ConcurrentOperationException, ResourceUnavailableException, 
StorageUnavailableException, ResourceAllocationException {
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         List<NetworkVO> networkList = new ArrayList<NetworkVO>();
 
         // Verify that caller can perform actions in behalf of vm owner
@@ -3031,8 +3028,8 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     public UserVm stopVirtualMachine(long vmId, boolean forced)
             throws ConcurrentOperationException {
         // Input validation
-        Account caller = UserContext.current().getCaller();
-        Long userId = UserContext.current().getCallerUserId();
+        Account caller = UserContext.current().getCallingAccount();
+        Long userId = UserContext.current().getCallingUserId();
 
         // if account is removed, return error
         if (caller != null && caller.getRemoved() != null) {
@@ -3079,7 +3076,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                 Network guestNetwork = _networkDao.findById(networkId);
                 NetworkOffering offering = 
_configMgr.getNetworkOffering(guestNetwork.getNetworkOfferingId());
                 assert (offering.getAssociatePublicIP() == true) : "User VM 
should not have system owned public IP associated with it when offering 
configured not to associate public IP.";
-                _rulesMgr.disableStaticNat(ip.getId(), ctx.getCaller(), 
ctx.getCallerUserId(), true);
+                _rulesMgr.disableStaticNat(ip.getId(), 
ctx.getCallingAccount(), ctx.getCallingUserId(), true);
             } catch (Exception ex) {
                 s_logger.warn(
                         "Failed to disable static nat and release system ip "
@@ -3113,9 +3110,9 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                     throws ConcurrentOperationException, 
ResourceUnavailableException,
                     InsufficientCapacityException {
         // Input validation
-        Account callerAccount = UserContext.current().getCaller();
+        Account callerAccount = UserContext.current().getCallingAccount();
         UserVO callerUser = _userDao.findById(UserContext.current()
-                .getCallerUserId());
+                .getCallingUserId());
 
         // if account is removed, return error
         if (callerAccount != null && callerAccount.getRemoved() != null) {
@@ -3145,7 +3142,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
 
         Host destinationHost = null;
         if (hostId != null) {
-            Account account = UserContext.current().getCaller();
+            Account account = UserContext.current().getCallingAccount();
             if (!_accountService.isRootAdmin(account.getType())) {
                 throw new PermissionDeniedException(
                         "Parameter hostid can only be specified by a Root 
Admin, permission denied");
@@ -3258,8 +3255,8 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @Override
     public UserVm destroyVm(long vmId) throws ResourceUnavailableException,
     ConcurrentOperationException {
-        Account caller = UserContext.current().getCaller();
-        Long userId = UserContext.current().getCallerUserId();
+        Account caller = UserContext.current().getCallingAccount();
+        Long userId = UserContext.current().getCallingUserId();
 
         // Verify input parameters
         UserVmVO vm = _vmDao.findById(vmId);
@@ -3531,7 +3528,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @Override
     public VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool) {
         // access check - only root admin can migrate VM
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Caller is not a root admin, permission denied 
to migrate the VM");
@@ -3604,7 +3601,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
             throws ResourceUnavailableException, ConcurrentOperationException,
             ManagementServerException, VirtualMachineMigrationException {
         // access check - only root admin can migrate VM
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Caller is not a root admin, permission denied 
to migrate the VM");
@@ -3698,7 +3695,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
             Map<String, String> volumeToPool) throws 
ResourceUnavailableException, ConcurrentOperationException,
             ManagementServerException, VirtualMachineMigrationException {
         // Access check - only root administrator can migrate VM.
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Caller is not a root admin, permission denied 
to migrate the VM");
@@ -3821,7 +3818,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
         // VERIFICATIONS and VALIDATIONS
 
         // VV 1: verify the two users
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN
                 && caller.getType() != Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { // 
only
             // root
@@ -4158,7 +4155,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
                             // if the network offering has persistent set to 
true, implement the network
                             if (requiredOfferings.get(0).getIsPersistent()) {
                                 DeployDestination dest = new 
DeployDestination(zone, null, null, null);
-                                UserVO callerUser = 
_userDao.findById(UserContext.current().getCallerUserId());
+                                UserVO callerUser = 
_userDao.findById(UserContext.current().getCallingUserId());
                                 Journal journal = new 
Journal.LogJournal("Implementing " + newNetwork, s_logger);
                                 ReservationContext context = new 
ReservationContextImpl(UUID.randomUUID().toString(),
                                         journal, callerUser, caller);
@@ -4226,7 +4223,7 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
     @Override
     public UserVm restoreVM(RestoreVMCmd cmd) throws 
InsufficientCapacityException, ResourceUnavailableException {
         // Input validation
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         long vmId = cmd.getVmId();
         Long newTemplateId = cmd.getTemplateId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 037cbf3..2d744c8 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3664,4 +3664,5 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
         return false;
 
     }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobDispatcher.java 
b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
index 40ab0df..0292db9 100644
--- a/server/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -16,10 +16,6 @@
 // under the License.
 package com.cloud.vm;
 
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
@@ -30,9 +26,10 @@ import 
org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 
 import com.cloud.api.ApiSerializerHelper;
-import com.cloud.user.AccountVO;
+import com.cloud.dao.EntityManager;
 import com.cloud.user.UserContext;
 import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.UuidUtils;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.dao.VMInstanceDao;
 
@@ -43,8 +40,11 @@ public class VmWorkJobDispatcher extends AdapterBase 
implements AsyncJobDispatch
        @Inject private AsyncJobManager _asyncJobMgr;
     @Inject private AccountDao _accountDao;
     @Inject private VMInstanceDao _instanceDao;
+    @Inject
+    private EntityManager _entityMgr;
     
-    private final Map<String, Method> _handlerMap = new HashMap<String, 
Method>();
+    public final static String Start = "start";
+    public final static String Stop = "stop";
 
        @Override
     public void runJob(AsyncJob job) {
@@ -55,69 +55,21 @@ public class VmWorkJobDispatcher extends AdapterBase 
implements AsyncJobDispatch
                VmWork work = 
(VmWork)ApiSerializerHelper.fromSerializedString(job.getCmdInfo());
                assert(work != null);
                
-            AccountVO account = _accountDao.findById(work.getAccountId());
-            assert(account != null);
-            
             VMInstanceVO vm = _instanceDao.findById(work.getVmId());
             assert(vm != null);
     
-            //
-            // Due to legcy massive generic usage in 
VirtualMachineManagerImpl, we can't dispatch job handling
-            // directly to VirtualMachineManagerImpl, since most handling 
method are generic method.
-            //
-            // to solve the problem, we have to go through an instantiated 
VirtualMachineGuru so that it can carry
-            // down correct type back to VirtualMachineManagerImpl. It is sad 
that we have to write code like this
-            //
-            VirtualMachineGuru guru = _vmMgr.getVmGuru(vm);
-            assert(guru != null);
-            if(guru == null) {
-               s_logger.error("Unable to find virtual Guru for VM type: " + 
vm.getType());
-            }
-            
-            UserContext.registerContext(work.getUserId(), account, null, 
false);
-            try {
-               Method handler = getHandler(guru, cmd);
-               if(handler != null) {
-                               handler.invoke(guru, work);
-                       _asyncJobMgr.completeAsyncJob(job.getId(), 
AsyncJobConstants.STATUS_SUCCEEDED, 0, null);
-               } else {
-                       s_logger.error("Unable to find VM work handler. " + 
cmd);
-                       
-                       _asyncJobMgr.completeAsyncJob(job.getId(), 
AsyncJobConstants.STATUS_FAILED, 0, null);
-               }
-            } finally {
-                UserContext.unregisterContext();
+            UserContext context = UserContext.register(work.getUserId(), 
work.getAccountId(), UuidUtils.first(job.getUuid()));
+            if (cmd.equals(Start)) {
+                _vmMgr.start(vm.getUuid(), null, context.getCallingUser(), 
context.getCallingAccount());
+            } else if (cmd.equals(Stop)) {
+                _vmMgr.stop(vm.getUuid(), context.getCallingUser(), 
context.getCallingAccount());
             }
+            _asyncJobMgr.completeAsyncJob(job.getId(), 
AsyncJobConstants.STATUS_SUCCEEDED, 0, null);
         } catch(Throwable e) {
                s_logger.error("Unexpected exception", e);
-            _asyncJobMgr.completeAsyncJob(job.getId(), 
AsyncJobConstants.STATUS_FAILED, 0, null);
+            _asyncJobMgr.completeAsyncJob(job.getId(), 
AsyncJobConstants.STATUS_FAILED, 0, e);
+        } finally {
+            UserContext.unregister();
         }
        }
-       
-    private Method getHandler(VirtualMachineGuru guru, String cmd) {
-               
-               synchronized(_handlerMap) {
-                       Class<?> clz = guru.getClass();
-                       String key = clz.getCanonicalName() + cmd;
-                       Method method = _handlerMap.get(key);
-                       if(method != null)
-                               return method;
-                       
-                       try {
-                               method = clz.getMethod(cmd, VmWork.class);
-                               method.setAccessible(true);
-                       } catch (SecurityException e) {
-                               assert(false);
-                               s_logger.error("Unexpected exception", e);
-                               return null;
-                       } catch (NoSuchMethodException e) {
-                               assert(false);
-                               s_logger.error("Unexpected exception", e);
-                               return null;
-                       }
-                       
-                       _handlerMap.put(key, method);
-                       return method;
-               }
-       }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java 
b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
index 17963f7..82d48c8 100644
--- a/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
+++ b/server/src/com/cloud/vm/VmWorkJobWakeupDispatcher.java
@@ -77,7 +77,7 @@ public class VmWorkJobWakeupDispatcher extends AdapterBase 
implements AsyncJobDi
                VMInstanceVO vm = _instanceDao.findById(work.getVmId());
                assert(vm != null);
            
-               UserContext.registerContext(work.getUserId(), account, null, 
false);
+               UserContext.register(work.getUserId(), account, null, false);
                try {
                        Method handler = 
getHandler(joinRecord.getWakeupHandler());
                        if(handler != null) {
@@ -88,7 +88,7 @@ public class VmWorkJobWakeupDispatcher extends AdapterBase 
implements AsyncJobDi
                                " when waking up job-" + job.getId());
                        }
                } finally {
-                   UserContext.unregisterContext();
+                   UserContext.unregister();
                }
            } catch(Throwable e) {
                s_logger.warn("Unexpected exception in waking up job-" + 
job.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java 
b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index 3454c94..187835d 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -233,7 +233,7 @@ public class VMSnapshotManagerImpl extends ManagerBase 
implements VMSnapshotMana
     }
 
     protected Account getCaller(){
-        return UserContext.current().getCaller();
+        return UserContext.current().getCallingAccount();
     }
     
     @Override
@@ -664,7 +664,7 @@ public class VMSnapshotManagerImpl extends ManagerBase 
implements VMSnapshotMana
                     "VM Snapshot reverting failed due to vm snapshot is not in 
the state of Created.");
         }
 
-        UserVO callerUser = 
_userDao.findById(UserContext.current().getCallerUserId());
+        UserVO callerUser = 
_userDao.findById(UserContext.current().getCallingUserId());
         
         UserVmVO vm = null;
         Long hostId = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java 
b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
index efe18c3..c2d6b97 100644
--- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
+++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
@@ -85,7 +85,7 @@ public class AffinityGroupServiceImpl extends ManagerBase 
implements AffinityGro
     public AffinityGroup createAffinityGroup(String account, Long domainId, 
String affinityGroupName,
             String affinityGroupType, String description) {
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Account owner = _accountMgr.finalizeOwner(caller, account, domainId, 
null);
 
         if (_affinityGroupDao.isNameInUse(owner.getAccountId(), 
owner.getDomainId(), affinityGroupName)) {
@@ -128,7 +128,7 @@ public class AffinityGroupServiceImpl extends ManagerBase 
implements AffinityGro
     public boolean deleteAffinityGroup(Long affinityGroupId, String account, 
Long domainId, String affinityGroupName)
             throws ResourceInUseException {
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Account owner = _accountMgr.finalizeOwner(caller, account, domainId, 
null);
 
         AffinityGroupVO group = null;
@@ -180,7 +180,7 @@ public class AffinityGroupServiceImpl extends ManagerBase 
implements AffinityGro
     public Pair<List<? extends AffinityGroup>, Integer> 
listAffinityGroups(Long affinityGroupId, String affinityGroupName, String 
affinityGroupType, Long vmId, Long startIndex, Long pageSize) {
         Filter searchFilter = new Filter(AffinityGroupVO.class, "id", 
Boolean.TRUE, startIndex, pageSize);
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
 
         Long accountId = caller.getAccountId();
         Long domainId = caller.getDomainId();
@@ -322,7 +322,7 @@ public class AffinityGroupServiceImpl extends ManagerBase 
implements AffinityGro
                     + "; make sure the virtual machine is stopped and not in 
an error state before updating.");
         }
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         Account owner = _accountMgr.getAccount(vmInstance.getAccountId());
 
         // check that the affinity groups exist

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index ac3b8f5..ffbbcdb 100644
--- 
a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ 
b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -99,7 +99,7 @@ public class ApplicationLoadBalancerManagerImpl extends 
ManagerBase implements A
             throw new InvalidParameterValueException("Can't find guest network 
by id");
         }
         
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         _accountMgr.checkAccess(caller, AccessType.UseNetwork, false, 
guestNtwk);
         
         Network sourceIpNtwk = _networkModel.getNetwork(sourceIpNetworkId);
@@ -373,7 +373,7 @@ public class ApplicationLoadBalancerManagerImpl extends 
ManagerBase implements A
         
         Map<String, String> tags = cmd.getTags();
 
-        Account caller = UserContext.current().getCaller();
+        Account caller = UserContext.current().getCallingAccount();
         List<Long> permittedAccounts = new ArrayList<Long>();
 
         Ternary<Long, Boolean, ListProjectResourcesCriteria> 
domainIdRecursiveListProject = new Ternary<Long, Boolean, 
ListProjectResourcesCriteria>(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
 
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
index 96ac76e..d437c71 100644
--- 
a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
+++ 
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
@@ -151,7 +151,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements 
GlobalLoadBalancingR
     public boolean 
assignToGlobalLoadBalancerRule(AssignToGlobalLoadBalancerRuleCmd 
assignToGslbCmd) {
 
         UserContext ctx = UserContext.current();
-        Account caller = ctx.getCaller();
+        Account caller = ctx.getCallingAccount();
 
         long gslbRuleId =  assignToGslbCmd.getGlobalLoadBalancerRuleId();
         GlobalLoadBalancerRuleVO gslbRule = _gslbRuleDao.findById(gslbRuleId);
@@ -282,7 +282,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements 
GlobalLoadBalancingR
     public boolean 
removeFromGlobalLoadBalancerRule(RemoveFromGlobalLoadBalancerRuleCmd 
removeFromGslbCmd) {
 
         UserContext ctx = UserContext.current();
-        Account caller = ctx.getCaller();
+        Account caller = ctx.getCallingAccount();
 
         long gslbRuleId =  removeFromGslbCmd.getGlobalLoadBalancerRuleId();
         GlobalLoadBalancerRuleVO gslbRule = _gslbRuleDao.findById(gslbRuleId);
@@ -379,7 +379,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements 
GlobalLoadBalancingR
     public boolean 
deleteGlobalLoadBalancerRule(DeleteGlobalLoadBalancerRuleCmd deleteGslbCmd) {
 
         UserContext ctx = UserContext.current();
-        Account caller = ctx.getCaller();
+        Account caller = ctx.getCallingAccount();
 
         long gslbRuleId =  deleteGslbCmd.getGlobalLoadBalancerId();
         GlobalLoadBalancerRuleVO gslbRule = _gslbRuleDao.findById(gslbRuleId);
@@ -448,7 +448,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements 
GlobalLoadBalancingR
         }
 
         UserContext ctx = UserContext.current();
-        Account caller = ctx.getCaller();
+        Account caller = ctx.getCallingAccount();
 
         _accountMgr.checkAccess(caller, 
SecurityChecker.AccessType.ModifyEntry, true, gslbRule);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/configuration/ConfigurationManagerTest.java 
b/server/test/com/cloud/configuration/ConfigurationManagerTest.java
index 5c1cabf..75b5bc2 100755
--- a/server/test/com/cloud/configuration/ConfigurationManagerTest.java
+++ b/server/test/com/cloud/configuration/ConfigurationManagerTest.java
@@ -112,7 +112,7 @@ public class ConfigurationManagerTest {
 
         when(configurationMgr._vlanDao.acquireInLockTable(anyLong(), 
anyInt())).thenReturn(vlan);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field dedicateIdField = 
_dedicatePublicIpRangeClass.getDeclaredField("id");
         dedicateIdField.setAccessible(true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/network/DedicateGuestVlanRangesTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/DedicateGuestVlanRangesTest.java 
b/server/test/com/cloud/network/DedicateGuestVlanRangesTest.java
index e81d722..82ebd54 100644
--- a/server/test/com/cloud/network/DedicateGuestVlanRangesTest.java
+++ b/server/test/com/cloud/network/DedicateGuestVlanRangesTest.java
@@ -90,7 +90,7 @@ public class DedicateGuestVlanRangesTest {
         
when(networkService._accountMgr.getAccount(anyLong())).thenReturn(account);
         when(networkService._accountDao.findActiveAccount(anyString(), 
anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field accountNameField = 
_dedicateGuestVlanRangeClass.getDeclaredField("accountName");
         accountNameField.setAccessible(true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/vm/UserVmManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/UserVmManagerTest.java 
b/server/test/com/cloud/vm/UserVmManagerTest.java
index 88529a4..2c70ee7 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -277,7 +277,7 @@ public class UserVmManagerTest {
        // UserContext.current().setEventDetails("Vm Id: "+getId());
         Account account = new AccountVO("testaccount", 1L, "networkdomain", 
(short) 0, "uuid");
         //AccountVO(String accountName, long domainId, String networkDomain, 
short type, int regionId)
-       UserContext.registerContext(1, account, null, true);
+       UserContext.register(1, account, null, true);
 
         when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 
@@ -442,7 +442,7 @@ public class UserVmManagerTest {
         // caller is of type 0
         Account caller = new AccountVO("testaccount", 1, "networkdomain", 
(short) 0,
                 UUID.randomUUID().toString());
-        UserContext.registerContext(1, caller, null, true);
+        UserContext.register(1, caller, null, true);
 
         _userVmMgr.moveVMToUser(cmd);
     }
@@ -469,7 +469,7 @@ public class UserVmManagerTest {
         // caller is of type 0
         Account caller = new AccountVO("testaccount", 1, "networkdomain", 
(short) 1,
                 UUID.randomUUID().toString());
-        UserContext.registerContext(1, caller, null, true);
+        UserContext.register(1, caller, null, true);
 
         Account oldAccount = new AccountVO("testaccount", 1, "networkdomain", 
(short) 0,
                 UUID.randomUUID().toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/vpc/NetworkACLManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/NetworkACLManagerTest.java 
b/server/test/com/cloud/vpc/NetworkACLManagerTest.java
index 76b811f..197be27 100644
--- a/server/test/com/cloud/vpc/NetworkACLManagerTest.java
+++ b/server/test/com/cloud/vpc/NetworkACLManagerTest.java
@@ -91,7 +91,7 @@ public class NetworkACLManagerTest extends TestCase{
     public void setUp() {
         ComponentContext.initComponentsLifeCycle();
         Account account = new AccountVO("testaccount", 1, "testdomain", 
(short) 0, UUID.randomUUID().toString());
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
         acl = Mockito.mock(NetworkACLVO.class);
         aclItem = Mockito.mock(NetworkACLItemVO.class);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/vpc/NetworkACLServiceTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/NetworkACLServiceTest.java 
b/server/test/com/cloud/vpc/NetworkACLServiceTest.java
index e71fabf..e34c52c 100644
--- a/server/test/com/cloud/vpc/NetworkACLServiceTest.java
+++ b/server/test/com/cloud/vpc/NetworkACLServiceTest.java
@@ -78,7 +78,7 @@ public class NetworkACLServiceTest extends TestCase{
     public void setUp() {
         ComponentContext.initComponentsLifeCycle();
         Account account = new AccountVO("testaccount", 1, "testdomain", 
(short) 0, UUID.randomUUID().toString());
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         createACLItemCmd = new CreateNetworkACLCmd(){
             @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/com/cloud/vpc/VpcTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/VpcTest.java 
b/server/test/com/cloud/vpc/VpcTest.java
index 52e837e..e490606 100644
--- a/server/test/com/cloud/vpc/VpcTest.java
+++ b/server/test/com/cloud/vpc/VpcTest.java
@@ -97,7 +97,7 @@ public class VpcTest extends TestCase {
     public void setUp() {
         ComponentContext.initComponentsLifeCycle();
         Account account = new AccountVO("testaccount", 1, "testdomain", 
(short) 0, UUID.randomUUID().toString());
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
         vpc = new VpcVO(1, "myvpc", "myvpc", 2, 1, 1, "10.0.1.0/16", 
"mydomain");
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
----------------------------------------------------------------------
diff --git 
a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java 
b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
index 484b044..99b168a 100644
--- a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
+++ b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
@@ -117,7 +117,7 @@ public class AffinityApiUnitTest {
         acct.setAccountName("user");
         acct.setDomainId(domainId);
 
-        UserContext.registerContext(1, acct, null, true);
+        UserContext.register(1, acct, null, true);
 
         when(_acctMgr.finalizeOwner((Account) anyObject(), anyString(), 
anyLong(), anyLong())).thenReturn(acct);
         when(_processor.getType()).thenReturn("mock");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
----------------------------------------------------------------------
diff --git 
a/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java 
b/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
index 461cbbd..6e92a84 100644
--- a/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
+++ b/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
@@ -133,7 +133,7 @@ public class ApplicationLoadBalancerTest extends TestCase{
         
         Mockito.when(_accountMgr.getSystemUser()).thenReturn(new UserVO(1));
         Mockito.when(_accountMgr.getSystemAccount()).thenReturn(new 
AccountVO(2));
-        UserContext.registerContext(_accountMgr.getSystemUser().getId(), 
_accountMgr.getSystemAccount(), null, false);
+        UserContext.register(_accountMgr.getSystemUser().getId(), 
_accountMgr.getSystemAccount(), null, false);
         
         
Mockito.when(_ntwkModel.areServicesSupportedInNetwork(Mockito.anyLong(), 
Mockito.any(Network.Service.class))).thenReturn(true);
         

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git 
a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java 
b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index f862a2a..0d3c7af 100644
--- 
a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ 
b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -19,12 +19,6 @@ package org.apache.cloudstack.networkoffering;
 
 import java.io.IOException;
 
-import org.apache.cloudstack.acl.SecurityChecker;
-import org.apache.cloudstack.region.PortableIpDaoImpl;
-import org.apache.cloudstack.region.dao.RegionDaoImpl;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
-import org.apache.cloudstack.test.utils.SpringUtils;
 import org.mockito.Mockito;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -35,6 +29,13 @@ import 
org.springframework.core.type.classreading.MetadataReader;
 import org.springframework.core.type.classreading.MetadataReaderFactory;
 import org.springframework.core.type.filter.TypeFilter;
 
+import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.region.PortableIpDaoImpl;
+import org.apache.cloudstack.region.PortableIpRangeDaoImpl;
+import org.apache.cloudstack.region.dao.RegionDaoImpl;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
+import org.apache.cloudstack.test.utils.SpringUtils;
+
 import com.cloud.agent.AgentManager;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.query.dao.UserAccountJoinDaoImpl;
@@ -108,7 +109,6 @@ import com.cloud.user.AccountDetailsDao;
 import com.cloud.user.AccountManager;
 import com.cloud.user.ResourceLimitService;
 import com.cloud.user.UserContext;
-import com.cloud.user.UserContextInitializer;
 import com.cloud.user.dao.AccountDaoImpl;
 import com.cloud.user.dao.UserDaoImpl;
 import com.cloud.vm.dao.InstanceGroupDaoImpl;
@@ -116,7 +116,6 @@ import com.cloud.vm.dao.NicDaoImpl;
 import com.cloud.vm.dao.NicSecondaryIpDaoImpl;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDaoImpl;
-import org.apache.cloudstack.region.PortableIpRangeDaoImpl;
 
 @Configuration
 @ComponentScan(basePackageClasses={
@@ -313,11 +312,6 @@ public class ChildTestConfiguration {
     }
 
     @Bean
-    public UserContextInitializer userContextInitializer() {
-        return Mockito.mock(UserContextInitializer.class);
-    }
-
-    @Bean
     public NetworkManager networkManager() {
         return Mockito.mock(NetworkManager.class);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
----------------------------------------------------------------------
diff --git 
a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
 
b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
index 4a2c867..a23822b 100644
--- 
a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ 
b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -86,7 +86,7 @@ public class CreateNetworkOfferingTest extends TestCase{
         Mockito.when(accountMgr.getSystemUser()).thenReturn(new UserVO(1));
         Mockito.when(accountMgr.getSystemAccount()).thenReturn(new 
AccountVO(2));
 
-        UserContext.registerContext(accountMgr.getSystemUser().getId(), 
accountMgr.getSystemAccount(), null, false);
+        UserContext.register(accountMgr.getSystemUser().getId(), 
accountMgr.getSystemAccount(), null, false);
     }
 
     //Test Shared network offerings

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54de6b48/server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java
----------------------------------------------------------------------
diff --git 
a/server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java
 
b/server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java
index ab54534..44802e0 100644
--- 
a/server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java
+++ 
b/server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java
@@ -499,7 +499,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -564,7 +564,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
         Account account = (Account) new AccountVO("testaccount", 3, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -651,7 +651,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -710,7 +710,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
 
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -783,7 +783,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
 
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -845,7 +845,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
 
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -891,7 +891,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);
@@ -939,7 +939,7 @@ public class GlobalLoadBalancingRulesServiceImplTest 
extends TestCase {
         Account account = (Account) new AccountVO("testaccount", 1, 
"networkdomain", (short) 0, UUID.randomUUID().toString());
         
when(gslbServiceImpl._accountMgr.getAccount(anyLong())).thenReturn(account);
 
-        UserContext.registerContext(1, account, null, true);
+        UserContext.register(1, account, null, true);
 
         Field gslbRuleId = _class.getDeclaredField("id");
         gslbRuleId.setAccessible(true);

Reply via email to