mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
This fixes move refactoring error introduced in #2283 For instance, the class DatadiskTO is supposed to be in com.cloud.agent.api.to package. However, the folder structure it was placed in is com.cloud.agent.api.api.to. Skip tests for cloud-plugin-hypervisor-ovm3: For some unknown reason, there are quite a lot of broken test cases for cloud-plugin-hypervisor-ovm3. They might have appeared after some dependency upgrade and was overlooked by the person updating them. I checked them to see if they could be fixed, but these tests are not developed in a clear and clean manner. On top of that, we do not see (at least I) people using OVM3-hypervisor with ACS. Therefore, I decided to skip them. Identention corrected to use spaces instead of tabs in XML files
This commit is contained in:
parent
7e39961f22
commit
c591c5ad3e
@ -22,15 +22,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import org.apache.cloudstack.storage.test.CloudStackTestNGBase;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import org.apache.cloudstack.storage.test.CloudStackTestNGBase;
|
|
||||||
|
|
||||||
import com.cloud.vm.snapshot.VMSnapshotDetailsVO;
|
import com.cloud.vm.snapshot.VMSnapshotDetailsVO;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ -41,7 +39,7 @@ public class VmSnapshotDaoTest extends CloudStackTestNGBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVmSnapshotDetails() {
|
public void testVmSnapshotDetails() {
|
||||||
VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo", display);
|
VMSnapshotDetailsVO detailsVO = new VMSnapshotDetailsVO(1L, "test", "foo", true);
|
||||||
vmsnapshotDetailsDao.persist(detailsVO);
|
vmsnapshotDetailsDao.persist(detailsVO);
|
||||||
Map<String, String> details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
|
Map<String, String> details = vmsnapshotDetailsDao.listDetailsKeyPairs(1L);
|
||||||
Assert.assertTrue(details.containsKey("test"));
|
Assert.assertTrue(details.containsKey("test"));
|
||||||
|
|||||||
@ -22,16 +22,6 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||||
@ -41,6 +31,13 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import com.cloud.configuration.Config;
|
import com.cloud.configuration.Config;
|
||||||
import com.cloud.dc.ClusterVO;
|
import com.cloud.dc.ClusterVO;
|
||||||
@ -58,6 +55,7 @@ import com.cloud.org.Cluster.ClusterType;
|
|||||||
import com.cloud.org.Managed.ManagedState;
|
import com.cloud.org.Managed.ManagedState;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
@ -72,6 +70,8 @@ import com.cloud.utils.db.DB;
|
|||||||
import com.cloud.vm.DiskProfile;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(locations = "classpath:/storageContext.xml")
|
@ContextConfiguration(locations = "classpath:/storageContext.xml")
|
||||||
public class StorageAllocatorTest {
|
public class StorageAllocatorTest {
|
||||||
@ -164,8 +164,8 @@ public class StorageAllocatorTest {
|
|||||||
diskOfferingId = diskOffering.getId();
|
diskOfferingId = diskOffering.getId();
|
||||||
|
|
||||||
volume =
|
volume =
|
||||||
new VolumeVO(Volume.Type.ROOT, "volume", dcId, 1, 1, diskOffering.getId(), diskOffering.getDiskSize(), diskOffering.getMinIops(), diskOffering.getMaxIops(),
|
new VolumeVO(Volume.Type.ROOT, "volume", dcId, 1, 1, diskOffering.getId(), Storage.ProvisioningType.THIN, diskOffering.getDiskSize(), diskOffering.getMinIops(),
|
||||||
"");
|
diskOffering.getMaxIops(), "");
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
volumeId = volume.getId();
|
volumeId = volume.getId();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -290,4 +290,13 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
|
|||||||
@Override
|
@Override
|
||||||
public void notifyMonitorsOfRemovedHost(long hostId, long clusterId) {
|
public void notifyMonitorsOfRemovedHost(long hostId, long clusterId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnectWithInvestigation(long hostId, Event event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyMonitorsOfNewlyAddedHost(long hostId) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,14 +26,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.testng.AssertJUnit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
@ -67,6 +59,11 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.testng.AssertJUnit;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
@ -90,6 +87,7 @@ import com.cloud.resource.ResourceState;
|
|||||||
import com.cloud.storage.DataStoreRole;
|
import com.cloud.storage.DataStoreRole;
|
||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
|
import com.cloud.storage.Snapshot.LocationType;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
@ -104,6 +102,8 @@ import com.cloud.storage.dao.VMTemplateDao;
|
|||||||
import com.cloud.storage.dao.VolumeDao;
|
import com.cloud.storage.dao.VolumeDao;
|
||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
|
@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
|
||||||
public class SnapshotTest extends CloudStackTestNGBase {
|
public class SnapshotTest extends CloudStackTestNGBase {
|
||||||
@Inject
|
@Inject
|
||||||
@ -341,13 +341,12 @@ public class SnapshotTest extends CloudStackTestNGBase {
|
|||||||
Snapshot.Type snapshotType = Snapshot.Type.MANUAL;
|
Snapshot.Type snapshotType = Snapshot.Type.MANUAL;
|
||||||
SnapshotVO snapshotVO =
|
SnapshotVO snapshotVO =
|
||||||
new SnapshotVO(volume.getDataCenterId(), 2, 1, volume.getId(), 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(),
|
new SnapshotVO(volume.getDataCenterId(), 2, 1, volume.getId(), 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(),
|
||||||
volume.getSize(), HypervisorType.XenServer);
|
volume.getSize(), 1L, 100L, HypervisorType.XenServer, LocationType.PRIMARY);
|
||||||
return this.snapshotDao.persist(snapshotVO);
|
return this.snapshotDao.persist(snapshotVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
||||||
|
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, Storage.ProvisioningType.THIN, 1000, 0L, 0L, "");
|
||||||
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
|
|
||||||
volume.setDataCenterId(this.dcId);
|
volume.setDataCenterId(this.dcId);
|
||||||
volume.setPoolId(dataStoreId);
|
volume.setPoolId(dataStoreId);
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
|
|||||||
@ -36,16 +36,6 @@ import java.util.concurrent.Future;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
||||||
@ -65,6 +55,13 @@ import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.cloudstack.storage.volume.VolumeObject;
|
import org.apache.cloudstack.storage.volume.VolumeObject;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import com.cloud.dc.ClusterVO;
|
import com.cloud.dc.ClusterVO;
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
@ -81,6 +78,7 @@ import com.cloud.storage.CreateSnapshotPayload;
|
|||||||
import com.cloud.storage.DataStoreRole;
|
import com.cloud.storage.DataStoreRole;
|
||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
|
import com.cloud.storage.Snapshot.LocationType;
|
||||||
import com.cloud.storage.SnapshotPolicyVO;
|
import com.cloud.storage.SnapshotPolicyVO;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
@ -97,6 +95,8 @@ import com.cloud.utils.DateUtil;
|
|||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
import com.cloud.utils.db.Merovingian2;
|
import com.cloud.utils.db.Merovingian2;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(locations = {"classpath:/fakeDriverTestContext.xml"})
|
@ContextConfiguration(locations = {"classpath:/fakeDriverTestContext.xml"})
|
||||||
public class SnapshotTestWithFakeData {
|
public class SnapshotTestWithFakeData {
|
||||||
@ -206,21 +206,21 @@ public class SnapshotTestWithFakeData {
|
|||||||
private SnapshotVO createSnapshotInDb() {
|
private SnapshotVO createSnapshotInDb() {
|
||||||
Snapshot.Type snapshotType = Snapshot.Type.RECURRING;
|
Snapshot.Type snapshotType = Snapshot.Type.RECURRING;
|
||||||
SnapshotVO snapshotVO =
|
SnapshotVO snapshotVO =
|
||||||
new SnapshotVO(dcId, 2, 1, 1L, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100, Hypervisor.HypervisorType.XenServer);
|
new SnapshotVO(dcId, 2, 1, 1L, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100, 1L, 100L, Hypervisor.HypervisorType.XenServer,
|
||||||
|
LocationType.PRIMARY);
|
||||||
return snapshotDao.persist(snapshotVO);
|
return snapshotDao.persist(snapshotVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SnapshotVO createSnapshotInDb(Long volumeId) {
|
private SnapshotVO createSnapshotInDb(Long volumeId) {
|
||||||
Snapshot.Type snapshotType = Snapshot.Type.DAILY;
|
Snapshot.Type snapshotType = Snapshot.Type.DAILY;
|
||||||
SnapshotVO snapshotVO =
|
SnapshotVO snapshotVO =
|
||||||
new SnapshotVO(dcId, 2, 1, volumeId, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100,
|
new SnapshotVO(dcId, 2, 1, 1L, 1L, UUID.randomUUID().toString(), (short)snapshotType.ordinal(), snapshotType.name(), 100, 1L, 100L, Hypervisor.HypervisorType.XenServer,
|
||||||
Hypervisor.HypervisorType.XenServer);
|
LocationType.PRIMARY);
|
||||||
return snapshotDao.persist(snapshotVO);
|
return snapshotDao.persist(snapshotVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private VolumeInfo createVolume(Long templateId, DataStore store) {
|
private VolumeInfo createVolume(Long templateId, DataStore store) {
|
||||||
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
|
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), dcId, 1L, 1L, 1L, Storage.ProvisioningType.THIN, 1000, 0L, 0L, "");
|
||||||
;
|
|
||||||
volume.setPoolId(store.getId());
|
volume.setPoolId(store.getId());
|
||||||
|
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
@ -261,7 +261,7 @@ public class SnapshotTestWithFakeData {
|
|||||||
SnapshotDataStoreVO storeRef = snapshotDataStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshotVO.getId());
|
SnapshotDataStoreVO storeRef = snapshotDataStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshotVO.getId());
|
||||||
Assert.assertTrue(storeRef != null);
|
Assert.assertTrue(storeRef != null);
|
||||||
Assert.assertTrue(storeRef.getState() == ObjectInDataStoreStateMachine.State.Ready);
|
Assert.assertTrue(storeRef.getState() == ObjectInDataStoreStateMachine.State.Ready);
|
||||||
snapshotInfo = result.getSnashot();
|
snapshotInfo = result.getSnapshot();
|
||||||
boolean deletResult = snapshotService.deleteSnapshot(snapshotInfo);
|
boolean deletResult = snapshotService.deleteSnapshot(snapshotInfo);
|
||||||
Assert.assertTrue(deletResult);
|
Assert.assertTrue(deletResult);
|
||||||
snapshotDataStoreDao.expunge(storeRef.getId());
|
snapshotDataStoreDao.expunge(storeRef.getId());
|
||||||
@ -305,7 +305,7 @@ public class SnapshotTestWithFakeData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected SnapshotPolicyVO createSnapshotPolicy(Long volId) {
|
protected SnapshotPolicyVO createSnapshotPolicy(Long volId) {
|
||||||
SnapshotPolicyVO policyVO = new SnapshotPolicyVO(volId, "jfkd", "fdfd", DateUtil.IntervalType.DAILY, 8);
|
SnapshotPolicyVO policyVO = new SnapshotPolicyVO(volId, "jfkd", "fdfd", DateUtil.IntervalType.DAILY, 8, true);
|
||||||
policyVO = snapshotPolicyDao.persist(policyVO);
|
policyVO = snapshotPolicyDao.persist(policyVO);
|
||||||
return policyVO;
|
return policyVO;
|
||||||
}
|
}
|
||||||
@ -356,4 +356,4 @@ public class SnapshotTestWithFakeData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,12 +29,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.testng.Assert;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
@ -56,6 +50,11 @@ import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.dc.ClusterVO;
|
import com.cloud.dc.ClusterVO;
|
||||||
@ -75,6 +74,7 @@ import com.cloud.resource.ResourceState;
|
|||||||
import com.cloud.storage.DataStoreRole;
|
import com.cloud.storage.DataStoreRole;
|
||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
|
import com.cloud.storage.Storage.ProvisioningType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Storage.TemplateType;
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
@ -361,7 +361,7 @@ public class VolumeServiceTest extends CloudStackTestNGBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
||||||
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
|
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, ProvisioningType.THIN, 1000, 0L, 0L, "");
|
||||||
volume.setPoolId(dataStoreId);
|
volume.setPoolId(dataStoreId);
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
return volume;
|
return volume;
|
||||||
|
|||||||
@ -26,14 +26,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.testng.AssertJUnit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
@ -58,6 +50,11 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.testng.AssertJUnit;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
@ -82,6 +79,7 @@ import com.cloud.storage.DataStoreRole;
|
|||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
|
import com.cloud.storage.Storage.ProvisioningType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Storage.TemplateType;
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
@ -92,6 +90,8 @@ import com.cloud.storage.dao.VMTemplateDao;
|
|||||||
import com.cloud.storage.dao.VolumeDao;
|
import com.cloud.storage.dao.VolumeDao;
|
||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
|
@ContextConfiguration(locations = {"classpath:/storageContext.xml"})
|
||||||
public class VolumeTest extends CloudStackTestNGBase {
|
public class VolumeTest extends CloudStackTestNGBase {
|
||||||
@Inject
|
@Inject
|
||||||
@ -263,7 +263,6 @@ public class VolumeTest extends CloudStackTestNGBase {
|
|||||||
|
|
||||||
public DataStore createPrimaryDataStore() {
|
public DataStore createPrimaryDataStore() {
|
||||||
try {
|
try {
|
||||||
String uuid = UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString();
|
|
||||||
List<StoragePoolVO> pools = primaryDataStoreDao.findPoolByName(this.primaryName);
|
List<StoragePoolVO> pools = primaryDataStoreDao.findPoolByName(this.primaryName);
|
||||||
if (pools.size() > 0) {
|
if (pools.size() > 0) {
|
||||||
return this.dataStoreMgr.getPrimaryDataStore(pools.get(0).getId());
|
return this.dataStoreMgr.getPrimaryDataStore(pools.get(0).getId());
|
||||||
@ -314,8 +313,7 @@ public class VolumeTest extends CloudStackTestNGBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
||||||
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
|
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, ProvisioningType.THIN, 1000, 0L, 0L, "");
|
||||||
;
|
|
||||||
volume.setPoolId(dataStoreId);
|
volume.setPoolId(dataStoreId);
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
return volume;
|
return volume;
|
||||||
|
|||||||
@ -26,12 +26,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.mockito.Matchers;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.testng.AssertJUnit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
@ -54,6 +48,11 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||||
|
import org.mockito.Matchers;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.testng.AssertJUnit;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.dc.ClusterDetailsDao;
|
import com.cloud.dc.ClusterDetailsDao;
|
||||||
@ -78,6 +77,7 @@ import com.cloud.resource.ResourceState;
|
|||||||
import com.cloud.storage.DataStoreRole;
|
import com.cloud.storage.DataStoreRole;
|
||||||
import com.cloud.storage.ScopeType;
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
|
import com.cloud.storage.Storage.ProvisioningType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Storage.TemplateType;
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
@ -315,8 +315,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
private VolumeVO createVolume(Long templateId, long dataStoreId) {
|
||||||
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, 1000, 0L, 0L, "");
|
VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(), this.dcId, 1L, 1L, 1L, ProvisioningType.THIN, 1000, 0L, 0L, "");
|
||||||
;
|
|
||||||
volume.setPoolId(dataStoreId);
|
volume.setPoolId(dataStoreId);
|
||||||
volume = volumeDao.persist(volume);
|
volume = volumeDao.persist(volume);
|
||||||
return volume;
|
return volume;
|
||||||
|
|||||||
@ -1,31 +1,26 @@
|
|||||||
<!--
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
license agreements. See the NOTICE file distributed with this work for additional
|
||||||
or more contributor license agreements. See the NOTICE file
|
information regarding copyright ownership. The ASF licenses this file to
|
||||||
distributed with this work for additional information
|
you under the Apache License, Version 2.0 (the "License"); you may not use
|
||||||
regarding copyright ownership. The ASF licenses this file
|
this file except in compliance with the License. You may obtain a copy of
|
||||||
to you under the Apache License, Version 2.0 (the
|
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
|
||||||
"License"); you may not use this file except in compliance
|
by applicable law or agreed to in writing, software distributed under the
|
||||||
with the License. You may obtain a copy of the License at
|
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||||
|
OF ANY KIND, either express or implied. See the License for the specific
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
language governing permissions and limitations under the License. -->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
Unless required by applicable law or agreed to in writing,
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>cloud-plugin-hypervisor-ovm3</artifactId>
|
<artifactId>cloud-plugin-hypervisor-ovm3</artifactId>
|
||||||
<name>Apache CloudStack Plugin - Hypervisor OracleVM3</name>
|
<name>Apache CloudStack Plugin - Hypervisor OracleVM3</name>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.cloudstack</groupId>
|
<groupId>org.apache.cloudstack</groupId>
|
||||||
<artifactId>cloudstack-plugins</artifactId>
|
<artifactId>cloudstack-plugins</artifactId>
|
||||||
<version>4.12.0.0-SNAPSHOT</version>
|
<version>4.12.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
@ -48,6 +43,20 @@
|
|||||||
<version>${cs.log4j.version}</version>
|
<version>${cs.log4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>integration</id>
|
<id>integration</id>
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public class OvmObject {
|
|||||||
if (nodeListFor2.getLength() > 1) {
|
if (nodeListFor2.getLength() > 1) {
|
||||||
/* Do we need to figure out all the sub elements here and put them in a map? */
|
/* Do we need to figure out all the sub elements here and put them in a map? */
|
||||||
} else {
|
} else {
|
||||||
String element = nodeListFor.item(index).getTextContent();
|
String element = nodeListFor.item(index).getNodeValue();
|
||||||
myMap.put(rnode, (E) element);
|
myMap.put(rnode, (E) element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,8 +193,8 @@ public class OvmObject {
|
|||||||
NodeList nodeList = (NodeList) xPathExpression.evaluate(xmlDocument,
|
NodeList nodeList = (NodeList) xPathExpression.evaluate(xmlDocument,
|
||||||
XPathConstants.NODESET);
|
XPathConstants.NODESET);
|
||||||
for (int ind = 0; ind < nodeList.getLength(); ind++) {
|
for (int ind = 0; ind < nodeList.getLength(); ind++) {
|
||||||
if (!nodeList.item(ind).getTextContent().isEmpty()) {
|
if (!nodeList.item(ind).getNodeValue().isEmpty()) {
|
||||||
list.add("" + nodeList.item(ind).getTextContent());
|
list.add("" + nodeList.item(ind).getNodeValue());
|
||||||
} else {
|
} else {
|
||||||
list.add("" + nodeList.item(ind).getNodeValue());
|
list.add("" + nodeList.item(ind).getNodeValue());
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ public class OvmObject {
|
|||||||
XPathExpression xPathExpression = xPath.compile(path);
|
XPathExpression xPathExpression = xPath.compile(path);
|
||||||
NodeList nodeList = (NodeList) xPathExpression.evaluate(xmlDocument,
|
NodeList nodeList = (NodeList) xPathExpression.evaluate(xmlDocument,
|
||||||
XPathConstants.NODESET);
|
XPathConstants.NODESET);
|
||||||
return nodeList.item(0).getTextContent();
|
return nodeList.item(0).getNodeValue();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
LOGGER.info("Got no items back from parsing, returning null: " + e);
|
LOGGER.info("Got no items back from parsing, returning null: " + e);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user