diff --git a/server/pom.xml b/server/pom.xml index 758a1dee84d..dfbf07d6801 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -125,7 +125,9 @@ **/com/cloud/upgrade/*.java + diff --git a/server/test/com/cloud/async/AsyncJobTestConfiguration.java b/server/test/com/cloud/async/AsyncJobTestConfiguration.java index 03dff84a03d..7195a752198 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; diff --git a/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java b/server/test/com/cloud/async/MockVirtualMachineManagerImpl.java index e42893b2b57..1408afdafa6 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 { + HypervisorType hyperType, Account owner) { // TODO Auto-generated method stub - return null; + return false; } @Override - public T allocate(T vm, VMTemplateVO template, - ServiceOfferingVO serviceOffering, Long rootSize, - Pair dataDiskOffering, - List> networks, DeploymentPlan plan, - HypervisorType hyperType, Account owner) - throws InsufficientCapacityException { - // TODO Auto-generated method stub - return null; - } - - @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 { - // TODO Auto-generated method stub - return null; - } - - @Override - public T start(T vm, Map params, - User caller, Account account) throws InsufficientCapacityException, - ResourceUnavailableException { - // TODO Auto-generated method stub - return null; - } - - @Override - public T start(T vm, Map params, - User caller, Account account, DeploymentPlan planToDeploy) - throws InsufficientCapacityException, ResourceUnavailableException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean stop(T vm, User caller, - Account account) throws ResourceUnavailableException { + DeploymentPlan plan, HypervisorType hyperType, Account owner) { // TODO Auto-generated method stub return false; } @Override - public boolean expunge(T vm, User caller, - Account account) throws ResourceUnavailableException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void registerGuru(Type type, - VirtualMachineGuru guru) { + public void start(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account) { // TODO Auto-generated method stub } - public VirtualMachineGuru getVmGuru(T vm) { + @Override + public void start(String vmUuid, Map params, + @Deprecated User caller, @Deprecated Account account, + DeploymentPlan planToDeploy) { // TODO Auto-generated method stub - return null; - } + + } @Override - public Collection> getRegisteredGurus() { + public void stop(String vmUuid, @Deprecated User caller, + @Deprecated Account account) { + // TODO Auto-generated method stub + + } + + @Override + public void expunge(String vmUuid, @Deprecated User caller, + @Deprecated Account account) { + // TODO Auto-generated method stub + + } + + @Override + public void registerGuru(Type type, VirtualMachineGuru guru) { + // TODO Auto-generated method stub + + } + + @Override + public Collection getRegisteredGurus() { + // TODO Auto-generated method stub + return null; + } + + @Override + 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, + public void advanceStop(String vmUuid, boolean cleanup, + @Deprecated User caller, @Deprecated Account account) + throws ResourceUnavailableException, OperationTimedoutException, + ConcurrentOperationException { + // TODO Auto-generated method stub + + } + + @Override + 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 advanceExpunge(T vm, User caller, - 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 { + 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 T advanceReboot(T vm, - Map params, User caller, Account account) + public void reboot(String vmUuid, User caller, Account account) { + // TODO Auto-generated method stub + + } + + @Override + public void advanceReboot(String vmUuid, User caller, Account account) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, OperationTimedoutException { // TODO Auto-generated method stub - return null; + } @Override - public VMInstanceVO findByIdAndType(Type type, long vmId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isVirtualMachineUpgradable(VirtualMachine vm, - ServiceOffering offering) { - // TODO Auto-generated method stub - return false; - } - - @Override - public VMInstanceVO findById(long vmId) { - // 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; } } diff --git a/server/test/com/cloud/async/SyncQueueTestConfiguration.java b/server/test/com/cloud/async/SyncQueueTestConfiguration.java index 424a3d6945b..e7826a70bbf 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; diff --git a/server/test/com/cloud/async/TestAsyncJobManager.java b/server/test/com/cloud/async/TestAsyncJobManager.java index 93b7972c0f5..6202e0d23db 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() { diff --git a/server/test/com/cloud/async/TestSyncQueueManager.java b/server/test/com/cloud/async/TestSyncQueueManager.java index 4c554273506..f6af7b389c2 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; diff --git a/server/test/resources/AsyncJobTestContext.xml b/server/test/resources/AsyncJobTestContext.xml index 3674f158d97..fc8085eb09a 100644 --- a/server/test/resources/AsyncJobTestContext.xml +++ b/server/test/resources/AsyncJobTestContext.xml @@ -27,29 +27,26 @@ - - - - + - +