Search in sources :

Example 51 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class NetworkFilterDaoTest method testGetAllSupportedNetworkFiltersByVersionFirstVersion.

@Test
public void testGetAllSupportedNetworkFiltersByVersionFirstVersion() {
    final Version version = new Version("3.0");
    assertFirstVersionOnly(version);
}
Also used : Version(org.ovirt.engine.core.compat.Version) Test(org.junit.Test)

Example 52 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class BackendDataCenterResourceTest method getVersions.

protected List<Version> getVersions() {
    Version version = mock(Version.class);
    when(version.getMajor()).thenReturn(2);
    when(version.getMinor()).thenReturn(3);
    List<Version> versions = new ArrayList<>();
    versions.add(version);
    return versions;
}
Also used : Version(org.ovirt.engine.core.compat.Version) ArrayList(java.util.ArrayList)

Example 53 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class BackendApiResourceTest method setUpGetSystemVersionExpectations.

protected void setUpGetSystemVersionExpectations() {
    QueryReturnValue productRpmQueryResult = new QueryReturnValue();
    productRpmQueryResult.setSucceeded(true);
    productRpmQueryResult.setReturnValue(SYSTEM_VERSION);
    when(backend.runQuery(eq(QueryType.GetConfigurationValue), getProductRPMVersionParams())).thenReturn(productRpmQueryResult);
    QueryReturnValue productVersionQueryResult = new QueryReturnValue();
    productVersionQueryResult.setSucceeded(true);
    productVersionQueryResult.setReturnValue(new Version(MAJOR, MINOR, BUILD, REVISION));
    when(backend.runQuery(eq(QueryType.GetProductVersion), getProductVersionParams())).thenReturn(productVersionQueryResult);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Version(org.ovirt.engine.core.compat.Version)

Example 54 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class UpdateClusterCommandTest method vmsAreUpdatedByTheOrderOfTheirIds.

@Test
public void vmsAreUpdatedByTheOrderOfTheirIds() {
    final Cluster newerCluster = createDefaultCluster();
    newerCluster.setCompatibilityVersion(new Version(1, 2));
    createCommand(newerCluster);
    cmd.init();
    VmStatic vm1 = new VmStatic();
    vm1.setId(VM_ID1);
    VmStatic vm2 = new VmStatic();
    vm2.setId(VM_ID2);
    VmStatic vm3 = new VmStatic();
    vm3.setId(VM_ID3);
    when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3));
    // the VMs ordered by Guids: v2, v3, v1
    assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate());
}
Also used : Version(org.ovirt.engine.core.compat.Version) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) Test(org.junit.Test)

Example 55 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class VersionStorageFormatUtilTest method versionHasMatchingFormat.

@Theory
public void versionHasMatchingFormat(Version v) {
    StorageFormatType sft = VersionStorageFormatUtil.getForVersion(v);
    assertNotNull(String.format("Missing format for version %s", v), sft);
    Version earliestSupported = VersionStorageFormatUtil.getEarliestVersionSupported(sft);
    assertNotNull(String.format("Missing earliest version for format %s", sft), earliestSupported);
    assertTrue(String.format("Earliest supported version (%s) should no be later than the version requiring this type (%s)", earliestSupported, v), v.compareTo(earliestSupported) >= 0);
}
Also used : Version(org.ovirt.engine.core.compat.Version) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) Theory(org.junit.experimental.theories.Theory)

Aggregations

Version (org.ovirt.engine.core.compat.Version)102 ArrayList (java.util.ArrayList)24 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)20 Guid (org.ovirt.engine.core.compat.Guid)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)17 Map (java.util.Map)16 List (java.util.List)15 HashSet (java.util.HashSet)14 VDS (org.ovirt.engine.core.common.businessentities.VDS)14 HashMap (java.util.HashMap)13 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)12 VM (org.ovirt.engine.core.common.businessentities.VM)11 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)11 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)11 Arrays (java.util.Arrays)10 MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)10 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)10 Collection (java.util.Collection)9 Collections (java.util.Collections)9 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)9