Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 39FBC10E14 for ; Wed, 5 Jun 2013 00:29:07 +0000 (UTC) Received: (qmail 46579 invoked by uid 500); 5 Jun 2013 00:29:07 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 46534 invoked by uid 500); 5 Jun 2013 00:29:07 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 46413 invoked by uid 99); 5 Jun 2013 00:29:07 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jun 2013 00:29:07 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C285B3152D8; Wed, 5 Jun 2013 00:29:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kelveny@apache.org To: commits@cloudstack.apache.org Date: Wed, 05 Jun 2013 00:29:07 -0000 Message-Id: <2d6f655b82144d2daa9850a5d7343234@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: updated refs/heads/vmsync to 3327371 Add unit test back for async-job after job project structure re-org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3327371f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3327371f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3327371f Branch: refs/heads/vmsync Commit: 3327371f97b7137f6e837c080e4ec5cc54afa525 Parents: 70728a7 Author: Kelven Yang Authored: Tue Jun 4 17:16:12 2013 -0700 Committer: Kelven Yang Committed: Tue Jun 4 17:16:12 2013 -0700 ---------------------------------------------------------------------- server/pom.xml | 2 + .../com/cloud/async/AsyncJobTestConfiguration.java | 23 +- .../cloud/async/MockVirtualMachineManagerImpl.java | 198 ++++++-------- .../cloud/async/SyncQueueTestConfiguration.java | 14 +- .../test/com/cloud/async/TestAsyncJobManager.java | 21 +- .../test/com/cloud/async/TestSyncQueueManager.java | 3 + server/test/resources/AsyncJobTestContext.xml | 7 +- 7 files changed, 126 insertions(+), 142 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index 758a1de..dfbf07d 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -125,7 +125,9 @@ **/com/cloud/upgrade/*.java + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/com/cloud/async/AsyncJobTestConfiguration.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/async/AsyncJobTestConfiguration.java b/server/test/com/cloud/async/AsyncJobTestConfiguration.java index 03dff84..7195a75 100644 --- a/server/test/com/cloud/async/AsyncJobTestConfiguration.java +++ b/server/test/com/cloud/async/AsyncJobTestConfiguration.java @@ -14,23 +14,26 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package com.cloud.async; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobDao; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJournalDao; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJournalDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDaoImpl; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueManager; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueManagerImpl; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.cloud.api.ApiDispatcher; -import com.cloud.async.dao.AsyncJobDao; -import com.cloud.async.dao.AsyncJobDaoImpl; -import com.cloud.async.dao.AsyncJobJoinMapDao; -import com.cloud.async.dao.AsyncJobJoinMapDaoImpl; -import com.cloud.async.dao.AsyncJobJournalDao; -import com.cloud.async.dao.AsyncJobJournalDaoImpl; -import com.cloud.async.dao.SyncQueueDao; -import com.cloud.async.dao.SyncQueueDaoImpl; -import com.cloud.async.dao.SyncQueueItemDao; -import com.cloud.async.dao.SyncQueueItemDaoImpl; import com.cloud.cluster.ClusterManager; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.dao.ConfigurationDao; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java b/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java index e42893b..1408afd 100644 --- a/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java +++ b/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java @@ -23,6 +23,8 @@ import java.util.Map; import javax.naming.ConfigurationException; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; + import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.deploy.DeployDestination; @@ -43,6 +45,7 @@ import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.StoragePool; import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VolumeVO; import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -117,83 +120,69 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager { } @Override - public T allocate(T vm, VMTemplateVO template, + public boolean allocate(String vmInstanceName, VMTemplateVO template, ServiceOfferingVO serviceOffering, Pair rootDiskOffering, List> dataDiskOfferings, List> networks, Map params, DeploymentPlan plan, - HypervisorType hyperType, Account owner) - throws InsufficientCapacityException { - // TODO Auto-generated method stub - return null; - } - - @Override - public T allocate(T vm, VMTemplateVO template, - ServiceOfferingVO serviceOffering, Long rootSize, - Pair dataDiskOffering, - List> networks, DeploymentPlan plan, - HypervisorType hyperType, Account owner) - throws InsufficientCapacityException { + HypervisorType hyperType, Account owner) { // TODO Auto-generated method stub - return null; + return false; } @Override - public T allocate(T vm, VMTemplateVO template, + public boolean allocate(String vmInstanceName, VMTemplateVO template, ServiceOfferingVO serviceOffering, List> networkProfiles, - DeploymentPlan plan, HypervisorType hyperType, Account owner) - throws InsufficientCapacityException { + DeploymentPlan plan, HypervisorType hyperType, Account owner) { // TODO Auto-generated method stub - return null; + return false; } @Override - public T start(T vm, Map params, - User caller, Account account) throws InsufficientCapacityException, - ResourceUnavailableException { + public void start(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account) { // TODO Auto-generated method stub - return null; + } @Override - public T start(T vm, Map params, - User caller, Account account, DeploymentPlan planToDeploy) - throws InsufficientCapacityException, ResourceUnavailableException { + public void start(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account, + DeploymentPlan planToDeploy) { // TODO Auto-generated method stub - return null; + } @Override - public boolean stop(T vm, User caller, - Account account) throws ResourceUnavailableException { + public void stop(String vmUuid, @Deprecated User caller, + @Deprecated Account account) { // TODO Auto-generated method stub - return false; + } @Override - public boolean expunge(T vm, User caller, - Account account) throws ResourceUnavailableException { + public void expunge(String vmUuid, @Deprecated User caller, + @Deprecated Account account) { // TODO Auto-generated method stub - return false; + } @Override - public void registerGuru(Type type, - VirtualMachineGuru guru) { + public void registerGuru(Type type, VirtualMachineGuru guru) { // TODO Auto-generated method stub } - public VirtualMachineGuru getVmGuru(T vm) { + @Override + public Collection getRegisteredGurus() { // TODO Auto-generated method stub - return null; - } + return null; + } @Override - public Collection> getRegisteredGurus() { + public VirtualMachineGuru getVmGuru(VirtualMachine vm) { // TODO Auto-generated method stub return null; } @@ -206,50 +195,44 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager { } @Override - public T advanceStart(T vm, - Map params, User caller, Account account) + public void advanceStart(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException { // TODO Auto-generated method stub - return null; + } @Override - public T advanceStart(T vm, - Map params, User caller, Account account, + public void advanceStart(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account, DeploymentPlan planToDeploy) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException { // TODO Auto-generated method stub - return null; + } @Override - public boolean advanceStop(T vm, boolean forced, - User caller, Account account) throws ResourceUnavailableException, - OperationTimedoutException, ConcurrentOperationException { + public void advanceStop(String vmUuid, boolean cleanup, + @Deprecated User caller, @Deprecated Account account) + throws ResourceUnavailableException, OperationTimedoutException, + ConcurrentOperationException { // TODO Auto-generated method stub - return false; + } @Override - public boolean advanceExpunge(T vm, User caller, - Account account) throws ResourceUnavailableException, + public void advanceExpunge(String vmUuid, @Deprecated User caller, + @Deprecated Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException { // TODO Auto-generated method stub - return false; - } - - @Override - public boolean remove(T vm, User caller, - Account account) { - // TODO Auto-generated method stub - return false; + } @Override - public boolean destroy(T vm, User caller, - Account account) throws AgentUnavailableException, + public boolean destroy(String vmUuid, @Deprecated User caller, + @Deprecated Account account) throws ResourceUnavailableException, OperationTimedoutException, ConcurrentOperationException { // TODO Auto-generated method stub return false; @@ -264,7 +247,7 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager { } @Override - public T migrate(T vm, long srcHostId, + public VirtualMachine migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException { @@ -273,43 +256,30 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager { } @Override - public T reboot(T vm, Map params, - User caller, Account account) throws InsufficientCapacityException, - ResourceUnavailableException { - // TODO Auto-generated method stub - return null; - } - - @Override - public T advanceReboot(T vm, - Map params, User caller, Account account) - throws InsufficientCapacityException, ResourceUnavailableException, - ConcurrentOperationException, OperationTimedoutException { - // TODO Auto-generated method stub - return null; - } - - @Override - public VMInstanceVO findByIdAndType(Type type, long vmId) { + public VirtualMachine migrateWithStorage(String vmUuid, long srcId, + long destId, Map volumeToPool) + throws ResourceUnavailableException, ConcurrentOperationException, + ManagementServerException, VirtualMachineMigrationException { // TODO Auto-generated method stub return null; } @Override - public boolean isVirtualMachineUpgradable(VirtualMachine vm, - ServiceOffering offering) { + public void reboot(String vmUuid, User caller, Account account) { // TODO Auto-generated method stub - return false; + } @Override - public VMInstanceVO findById(long vmId) { + public void advanceReboot(String vmUuid, User caller, Account account) + throws InsufficientCapacityException, ResourceUnavailableException, + ConcurrentOperationException, OperationTimedoutException { // TODO Auto-generated method stub - return null; + } @Override - public T storageMigration(T vm, + public VirtualMachine storageMigration(String vmUuid, StoragePool storagePoolId) { // TODO Auto-generated method stub return null; @@ -352,55 +322,57 @@ public class MockVirtualMachineManagerImpl implements VirtualMachineManager { } @Override - public NicTO toNicTO(NicProfile nic, HypervisorType hypervisorType) { + public VirtualMachineTO toVmTO(VirtualMachineProfile profile) { // TODO Auto-generated method stub return null; } @Override - public VirtualMachineTO toVmTO( - VirtualMachineProfile profile) { - // TODO Auto-generated method stub - return null; - } - - @Override - public VMInstanceVO reConfigureVm(VMInstanceVO vm, + public boolean reConfigureVm(VirtualMachine vm, ServiceOffering newServiceOffering, boolean sameHost) throws ResourceUnavailableException, ConcurrentOperationException { // TODO Auto-generated method stub - return null; + return false; } @Override - public VMInstanceVO findHostAndMigrate(Type vmType, VMInstanceVO vm, - Long newSvcOfferingId) throws InsufficientCapacityException, - ConcurrentOperationException, ResourceUnavailableException, - VirtualMachineMigrationException, ManagementServerException { + public boolean findHostAndMigrate(String vmUuid, Long newSvcOfferingId) + throws InsufficientCapacityException, ConcurrentOperationException, + ResourceUnavailableException, VirtualMachineMigrationException, + ManagementServerException { // TODO Auto-generated method stub - return null; + return false; } @Override - public T migrateForScale(T vm, long srcHostId, + public boolean migrateForScale(String vmUuid, long srcHostId, DeployDestination dest, Long newSvcOfferingId) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException { // TODO Auto-generated method stub + return false; + } + + @Override + public VirtualMachine processVmStartWork(String vmUuid, + Map params, User caller, Account account, + DeploymentPlan planToDeploy) throws InsufficientCapacityException, + ConcurrentOperationException, ResourceUnavailableException { + // TODO Auto-generated method stub return null; } - + @Override - public T processVmStartWork(T vm, Map params, User caller, Account account, DeploymentPlan planToDeploy) - throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { - - return vm; - } - + public boolean processVmStopWork(String vmUuid, boolean forced, User user, + Account account) throws AgentUnavailableException, + OperationTimedoutException, ConcurrentOperationException { + // TODO Auto-generated method stub + return false; + } + @Override - public boolean processVmStopWork(T vm, boolean forced, User user, Account account) - throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException { - - return true; + public NicTO toNicTO(NicProfile nic, HypervisorType hypervisorType) { + // TODO Auto-generated method stub + return null; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/com/cloud/async/SyncQueueTestConfiguration.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/async/SyncQueueTestConfiguration.java b/server/test/com/cloud/async/SyncQueueTestConfiguration.java index 424a3d6..e7826a7 100644 --- a/server/test/com/cloud/async/SyncQueueTestConfiguration.java +++ b/server/test/com/cloud/async/SyncQueueTestConfiguration.java @@ -16,16 +16,18 @@ // under the License. package com.cloud.async; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueDaoImpl; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDaoImpl; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueManager; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueManagerImpl; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.cloud.async.dao.AsyncJobJoinMapDao; -import com.cloud.async.dao.AsyncJobJoinMapDaoImpl; -import com.cloud.async.dao.SyncQueueDao; -import com.cloud.async.dao.SyncQueueDaoImpl; -import com.cloud.async.dao.SyncQueueItemDao; -import com.cloud.async.dao.SyncQueueItemDaoImpl; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.dao.ConfigurationDao; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/com/cloud/async/TestAsyncJobManager.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/async/TestAsyncJobManager.java b/server/test/com/cloud/async/TestAsyncJobManager.java index 93b7972..6202e0d 100644 --- a/server/test/com/cloud/async/TestAsyncJobManager.java +++ b/server/test/com/cloud/async/TestAsyncJobManager.java @@ -24,6 +24,18 @@ import java.util.List; import javax.inject.Inject; import junit.framework.TestCase; +import org.apache.cloudstack.framework.jobs.AsyncJob; +import org.apache.cloudstack.framework.jobs.AsyncJobConstants; +import org.apache.cloudstack.framework.jobs.AsyncJobManager; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJoinMapDao; +import org.apache.cloudstack.framework.jobs.dao.AsyncJobJournalDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueDao; +import org.apache.cloudstack.framework.jobs.dao.SyncQueueItemDao; +import org.apache.cloudstack.framework.jobs.impl.AsyncJobJoinMapVO; +import org.apache.cloudstack.framework.jobs.impl.AsyncJobJournalVO; +import org.apache.cloudstack.framework.jobs.impl.AsyncJobMonitor; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueItemVO; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueVO; import org.apache.cloudstack.framework.messagebus.MessageBus; import org.apache.cloudstack.framework.messagebus.PublishScope; import org.apache.cloudstack.messagebus.TopicConstants; @@ -36,13 +48,6 @@ import org.mockito.Mockito; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.cloud.async.AsyncJobJournalVO; -import com.cloud.async.AsyncJobManager; -import com.cloud.async.AsyncJobMonitor; -import com.cloud.async.dao.AsyncJobJoinMapDao; -import com.cloud.async.dao.AsyncJobJournalDao; -import com.cloud.async.dao.SyncQueueDao; -import com.cloud.async.dao.SyncQueueItemDao; import com.cloud.cluster.ClusterManager; import com.cloud.user.AccountManager; import com.cloud.user.AccountVO; @@ -212,7 +217,7 @@ public class TestAsyncJobManager extends TestCase { }); thread.start(); - jobMonitor.registerActiveTask(1, 1, false); + jobMonitor.registerActiveTask(1); asyncMgr.waitAndCheck(new String[] {"VM"}, 5000L, 10000L, new Predicate() { public boolean checkCondition() { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/com/cloud/async/TestSyncQueueManager.java ---------------------------------------------------------------------- diff --git a/server/test/com/cloud/async/TestSyncQueueManager.java b/server/test/com/cloud/async/TestSyncQueueManager.java index 4c55427..f6af7b3 100644 --- a/server/test/com/cloud/async/TestSyncQueueManager.java +++ b/server/test/com/cloud/async/TestSyncQueueManager.java @@ -22,6 +22,9 @@ import javax.inject.Inject; import junit.framework.TestCase; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueItemVO; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueManager; +import org.apache.cloudstack.framework.jobs.impl.SyncQueueVO; import org.apache.log4j.Logger; import org.junit.After; import org.junit.Assert; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3327371f/server/test/resources/AsyncJobTestContext.xml ---------------------------------------------------------------------- diff --git a/server/test/resources/AsyncJobTestContext.xml b/server/test/resources/AsyncJobTestContext.xml index 3674f15..fc8085e 100644 --- a/server/test/resources/AsyncJobTestContext.xml +++ b/server/test/resources/AsyncJobTestContext.xml @@ -27,29 +27,26 @@ - - - - + - +