本文整理了Java中org.ovirt.engine.core.compat.Version.<init>()
方法的一些代码示例,展示了Version.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.<init>()
方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Version
类名称:Version
方法名:<init>
暂无
代码示例来源:origin: oVirt/ovirt-engine
private List<ServerCpu> getServerCpuList(String version) {
return getEntity(
List.class, QueryType.GetAllServerCpuList,
new GetAllServerCpuListParameters(new Version(version)),
version
);
}
代码示例来源:origin: oVirt/ovirt-engine
public static Set<AdditionalFeature> getClusterFeatures(BackendResource resource, String version) {
Set<AdditionalFeature> addlFeatures = resource.getEntity(Set.class,
QueryType.GetClusterFeaturesByVersionAndCategory,
new GetClusterFeaturesByVersionAndCategoryParameters(new Version(version),
resource.getCurrent().getApplicationMode()),
"features for version:" + version);
return addlFeatures;
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void equals() {
assertEquals(new Version(), new Version());
assertEquals(new Version(1, 2), new Version(1, 2));
assertEquals(new Version(1, 2), new Version("1.2"));
assertEquals(new Version(1, 2, 3), new Version("1.2.3"));
assertEquals(new Version(1, 2, 3, 4), new Version("1.2.3.4"));
// nulls and other data types
assertNotEquals(new Version(), null);
assertNotEquals(new Version(), "foo");
assertNotEquals(new Version(), 1d);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void shouldDetectNewerOs() {
assertThat(new OS("os1", new Version("6.3"), "").isNewerThan(new OS("os1", new Version("6.2"), ""))).isTrue();
assertThat(new OS("os1", new Version("7.1"), "").isNewerThan(new OS("os1", new Version("6.2"), ""))).isTrue();
assertThat(new OS("os1", new Version("6.2"), "").isNewerThan(new OS("os1", new Version("6.3"), ""))).isFalse();
assertThat(new OS("os1", new Version("5.4"), "").isNewerThan(new OS("os1", new Version("6.3"), ""))).isFalse();
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void shouldDetectEqualOs() {
assertThat(new OS("RHEL", new Version("6.3"), "")
.isSameOsFamily(new OS("oVirt Node", new Version("6.3"), ""))).isTrue();
assertThat(new OS("RHEL", new Version("6.3"), "")
.isSameOsFamily(new OS("RHEV Hypervisor", new Version("6.3"), ""))).isTrue();
assertThat(new OS("oVirt Node", new Version("6.3"), "")
.isSameOsFamily(new OS("RHEV Hypervisor", new Version("6.3"), ""))).isTrue();
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void shouldDetectSameMajorVersion() {
assertThat(new OS("test", new Version("6.3"), "").isSameMajorVersion(new OS("test", new Version("6.6"), "")))
.isTrue();
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void greaterOrEqual() {
assertTrue(VersionUtils.greaterOrEqual(new Version(1, 1), new Version(1, 0)));
assertTrue(VersionUtils.greaterOrEqual(new Version(1, 1), new Version(1, 1)));
assertTrue(VersionUtils.greaterOrEqual(new Version(1, 1, 1), new Version(1, 1)));
// an integer beyond the ones cached in Integer
assertTrue(VersionUtils.greaterOrEqual(new Version(6789, 9876, 1), new Version(6789, 6789)));
assertTrue(VersionUtils.greaterOrEqual(new Version("2"), new Version(1, 1)));
assertFalse(VersionUtils.greaterOrEqual(new Version(1, 0), new Version(2, 0)));
assertFalse(VersionUtils.greaterOrEqual(new Version(1, 1), new Version(2, 0)));
}
代码示例来源:origin: oVirt/ovirt-engine
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;
}
代码示例来源:origin: oVirt/ovirt-engine
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;
}
代码示例来源:origin: oVirt/ovirt-engine
public Configurator() {
// Set default configuration values
String locale = LocaleInfo.getCurrentLocale().getLocaleName();
// doc package uses hyphens in the locale name dirs
localeDir = locale.replaceAll("_", "-"); //$NON-NLS-1$ //$NON-NLS-2$
setSpiceVersion(new Version(4, 4));
setBackendPort("8700"); //$NON-NLS-1$
setLogLevel("INFO"); //$NON-NLS-1$
setPollingTimerInterval(5000);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetAllSupportedNetworkFiltersByVersionMediumVersion() {
final Version version = new Version("4.2");
assertFirstVersionOnly(version);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetAllSupportedNetworkFiltersByVersionFirstVersion() {
final Version version = new Version("4.1");
assertFirstVersionOnly(version);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testToString() {
assertEquals("1.0", new Version("1.0").toString());
assertEquals("1.0", new Version("1.0").toString());
assertEquals("1.2.3", new Version(1, 2, 3).toString());
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetAllSupportedNetworkFiltersByInvalidVersion() {
final Version version = new Version(INVALID_VERSION);
final List<NetworkFilter> allNetworkFilter = dao.getAllSupportedNetworkFiltersByVersion(version);
assertTrue(allNetworkFilter.isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testAddValueVersion() {
Version verision = new Version(this.random.nextInt(), this.random.nextInt());
paramSource.addValue(paramName, verision);
assertEquals(
verision.toString(),
paramSource.getValue(paramName), "wrong value returned from parameter source");
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void greaterOrEqualWithCompat() {
assertTrue(VersionUtils.greaterOrEqual(modelVersion(1, 0, null, null), new Version(1, 0)));
assertTrue(VersionUtils.greaterOrEqual(modelVersion(1, 1, null, null), new Version(1, 1)));
assertTrue(VersionUtils.greaterOrEqual(modelVersion(1, 1, 1, null), new Version(1, 1)));
assertTrue(VersionUtils.greaterOrEqual(modelVersion(6789, 9876, 1, null), new Version(6789, 9876)));
assertFalse(VersionUtils.greaterOrEqual(modelVersion(1, 0, null, null), new Version(2, 0)));
assertFalse(VersionUtils.greaterOrEqual(modelVersion(1, null, null, null), new Version(2, 0)));
// note that the major version can not be null
// Assert.assertFalse(VersionUtils.greaterOrEqual(modelVersion(null, null, null, null), new Version(2, 0)));
}
代码示例来源:origin: oVirt/ovirt-engine
protected void setUpGetUserBySessionExpectations() {
QueryReturnValue returnValue = new QueryReturnValue();
returnValue.setSucceeded(true);
DbUser dbUser = new DbUser();
dbUser.setId(Guid.Empty);
returnValue.setReturnValue(dbUser);
when(backend.runQuery(eq(QueryType.GetUserBySessionId), eqParams(QueryParametersBase.class, new String[0], new Object[0]))).thenReturn(returnValue);
QueryReturnValue productVersionQueryResult = new QueryReturnValue();
productVersionQueryResult.setSucceeded(true);
productVersionQueryResult.setReturnValue(new Version(MAJOR, MINOR, BUILD, REVISION));
when(backend.runQuery(eq(QueryType.GetProductVersion), getProductVersionParams())).thenReturn(productVersionQueryResult);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetAllSupportedNetworkFiltersByVersion() {
final Version version = new Version("4.3");
final List<NetworkFilter> allNetworkFilter = dao.getAllSupportedNetworkFiltersByVersion(version);
assertNotNull(allNetworkFilter);
assertEquals(3, allNetworkFilter.size());
NetworkFilter expectedNetworkFilter = initOvirtNoFilter();
assertEquals(expectedNetworkFilter, allNetworkFilter.get(1));
expectedNetworkFilter = expectedNetworkFilter();
assertEquals(expectedNetworkFilter, allNetworkFilter.get(0));
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void biggerThanOrEquals() {
assertFalse(Version.v4_2.greaterOrEquals(Version.v4_3));
assertTrue(Version.v4_3.greaterOrEquals(Version.v4_2));
assertTrue(Version.v4_3.greaterOrEquals(new Version("4.3")));
}
@Test
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void smallerThanOrEquals() {
assertTrue(Version.v4_3.lessOrEquals(new Version("4.3")));
assertTrue(Version.v4_2.lessOrEquals(Version.v4_3));
assertFalse(Version.v4_3.lessOrEquals(Version.v4_2));
}
}
内容来源于网络,如有侵权,请联系作者删除!