org.ovirt.engine.core.compat.Version.getMinor()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.ovirt.engine.core.compat.Version.getMinor()方法的一些代码示例,展示了Version.getMinor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getMinor()方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Version
类名称:Version
方法名:getMinor

Version.getMinor介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

public List<String> getSupportedClusterLevels() {
  Set<Version> versions = getConfigurationValueDefault(ConfigValues.SupportedClusterLevels);
  if (versions == null) {
    return Collections.emptyList();
  }
  return versions.stream()
    .map(version -> String.format("%s.%s", version.getMajor(), version.getMinor()))
    .collect(toList());
}

代码示例来源:origin: oVirt/ovirt-engine

public OS(String name, Version version, String fullVersion) {
  Objects.requireNonNull(name);
  Objects.requireNonNull(version);
  this.name = name.trim();
  this.version = new Version(version.getMajor(), version.getMinor(), version.getBuild(), version.getRevision());
  this.fullVersion = fullVersion;
}

代码示例来源:origin: oVirt/ovirt-engine

public static boolean greaterOrEqual(org.ovirt.engine.core.compat.Version a, org.ovirt.engine.core.compat.Version b) {
  return a.getMajor() != b.getMajor() ? a.getMajor() >= b.getMajor() : a.getMinor() >= b.getMinor();
}

代码示例来源:origin: oVirt/ovirt-engine

public static boolean greaterOrEqual(Version a, org.ovirt.engine.core.compat.Version b) {
    return !a.getMajor().equals(b.getMajor()) ? a.getMajor().compareTo(b.getMajor()) >= 0 : a.getMinor()
        .compareTo(b.getMinor()) >= 0;
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private boolean isVMWithMemoryCompatible(VM vm) {
  if (vm == null || vm.getCustomCompatibilityVersion() != null) {
    return true;
  }
  Version recentClusterVersion = vm.getClusterCompatibilityVersion();
  // the cluster version in which the memory snapshot was taken
  Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin();
  // The originalClusterVersion is null if the snapshot originates in <3.6 .
  // Otherwise it is stored in OVF as OvfProperties.CLUSTER_COMPATIBILITY_VERSION and contains cluster
  // version at the time of snapshot's creation. Populated by OvfReader.
  return originalClusterVersion != null
      && recentClusterVersion.getMajor() == originalClusterVersion.getMajor()
      && recentClusterVersion.getMinor() == originalClusterVersion.getMinor();
}

代码示例来源:origin: oVirt/ovirt-engine

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;
}

代码示例来源:origin: oVirt/ovirt-engine

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;
}

代码示例来源:origin: oVirt/ovirt-engine

public Version getPartialVersion() {
  Version initial = getGuestAgentVersion();
  return initial == null ? null : new Version(initial.getMajor(), initial.getMinor());
}

代码示例来源:origin: oVirt/ovirt-engine

@Mapping(from = List.class, to = Versions.class)
public static Versions map(List<org.ovirt.engine.core.compat.Version> entity, Versions template) {
  Versions model = template != null ? template : new Versions();
  for (org.ovirt.engine.core.compat.Version version : entity) {
    Version v = new Version();
    v.setMajor(version.getMajor());
    v.setMinor(version.getMinor());
    model.getVersions().add(v);
  }
  return model;
}

代码示例来源:origin: oVirt/ovirt-engine

if (iso.getMinor() > hostVersion.getMinor() || iso.getBuild() > hostVersion.getBuild()) {
  return true;

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void shouldHandleStrangeMajorVersion() {
  final OS validOs = OS.fromPackageVersionString("Centos - 7. - release");
  assertThat(validOs.isValid()).isTrue();
  assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
  assertThat(validOs.getVersion().getMinor()).isEqualTo(-1);
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void shouldHandleNumMinorVersion() {
  final OS validOs = OS.fromPackageVersionString("Centos - 7.3 - release");
  assertThat(validOs.isValid()).isTrue();
  assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
  assertThat(validOs.getVersion().getMinor()).isEqualTo(3);
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void shouldHandleNumMajorVersion() {
  final OS validOs = OS.fromPackageVersionString("Centos - 7 - release");
  assertThat(validOs.isValid()).isTrue();
  assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
  assertThat(validOs.getVersion().getMinor()).isEqualTo(-1);
}

代码示例来源:origin: oVirt/ovirt-engine

public static Version map(org.ovirt.engine.core.compat.Version versionEngine) {
  Version versionApi = new Version();
  versionApi.setMajor(versionEngine.getMajor() >= 0 ? versionEngine.getMajor() : null);
  versionApi.setMinor(versionEngine.getMinor() >= 0 ? versionEngine.getMinor() : null);
  versionApi.setBuild(versionEngine.getBuild() >= 0 ? versionEngine.getBuild() : null);
  versionApi.setRevision(versionEngine.getRevision() >= 0 ? versionEngine.getRevision() : null);
  return versionApi;
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void shouldHandleAlNumFullVersion() {
  final OS validOs = OS.fromPackageVersionString("Centos - 7.3.2Server - release");
  assertThat(validOs.isValid()).isTrue();
  assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
  assertThat(validOs.getVersion().getMinor()).isEqualTo(3);
  assertThat(validOs.getVersion().getBuild()).isEqualTo(2);
}

代码示例来源:origin: oVirt/ovirt-engine

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;
}

相关文章