use of org.ovirt.engine.api.model.Version in project ovirt-engine by oVirt.
the class HostMapper method mapOperatingSystem.
private static OperatingSystem mapOperatingSystem(VDS entity) {
final OperatingSystem model = new OperatingSystem();
if (StringUtils.isNotBlank(entity.getHostOs())) {
OS hostOs = OS.fromPackageVersionString(entity.getHostOs());
Version version = new Version();
if (hostOs.getVersion().getMajor() != VERSION_NOT_SET) {
version.setMajor(hostOs.getVersion().getMajor());
}
if (hostOs.getVersion().getMinor() != VERSION_NOT_SET) {
version.setMinor(hostOs.getVersion().getMinor());
}
if (hostOs.getVersion().getBuild() != VERSION_NOT_SET) {
version.setBuild(hostOs.getVersion().getBuild());
}
version.setFullVersion(hostOs.getFullVersion());
model.setVersion(version);
model.setType(hostOs.getName());
}
model.setCustomKernelCmdline(Objects.toString(entity.getCurrentKernelCmdline(), ""));
model.setReportedKernelCmdline(entity.getKernelArgs());
return model;
}
use of org.ovirt.engine.api.model.Version in project ovirt-engine by oVirt.
the class BackendClustersResourceTest method setUpStoragePool.
protected StoragePool setUpStoragePool(int index) {
StoragePool pool = mock(StoragePool.class);
org.ovirt.engine.core.compat.Version version = new org.ovirt.engine.core.compat.Version(2, 2);
if (index != -1) {
when(pool.getId()).thenReturn(GUIDS[index]);
}
when(pool.getCompatibilityVersion()).thenReturn(version);
return pool;
}
use of org.ovirt.engine.api.model.Version in project ovirt-engine by oVirt.
the class BackendClustersResourceTest method testAddClusterSpecificVersion.
@Test
public void testAddClusterSpecificVersion() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetEntityExpectations(QueryType.GetStoragePoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, setUpStoragePool(-1));
setUpGetEntityExpectations(QueryType.GetManagementNetwork, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, null);
setUpCreationExpectations(ActionType.AddCluster, ManagementNetworkOnClusterOperationParameters.class, new String[] { "Cluster.CompatibilityVersion" }, new Object[] { new org.ovirt.engine.core.compat.Version(2, 3) }, true, true, GUIDS[0], QueryType.GetClusterById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
org.ovirt.engine.api.model.Cluster model = getModel(0);
model.getDataCenter().setId(GUIDS[1].toString());
model.setVersion(new Version());
model.getVersion().setMajor(2);
model.getVersion().setMinor(3);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof org.ovirt.engine.api.model.Cluster);
verifyModel((org.ovirt.engine.api.model.Cluster) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Version in project ovirt-engine by oVirt.
the class VersionMapperTest method testNoMatchDoesntCrash.
/**
* Checks that a version string that doesn't match the version number pattern doesn't generate an exception, and
* that the complete version string is reported in the {@code full_version} property.
*/
@Test
public void testNoMatchDoesntCrash() {
Version version = VersionMapper.fromVersionString("ugly");
assertNotNull(version);
assertEquals("ugly", version.getFullVersion());
}
use of org.ovirt.engine.api.model.Version in project ovirt-engine by oVirt.
the class VersionMapperTest method testNullStringProducesNullVersion.
/**
* Checks that a null version string results in a null version object.
*/
@Test
public void testNullStringProducesNullVersion() {
Version version = VersionMapper.fromVersionString(null);
assertNull(version);
}
Aggregations