当前位置: 首页>>代码示例>>Java>>正文


Java Version.equals方法代码示例

本文整理汇总了Java中org.elasticsearch.Version.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Version.equals方法的具体用法?Java Version.equals怎么用?Java Version.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.Version的用法示例。


在下文中一共展示了Version.equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAllVersionsTested

import org.elasticsearch.Version; //导入方法依赖的package包/类
public void testAllVersionsTested() throws Exception {
    SortedSet<String> expectedVersions = new TreeSet<>();
    for (Version v : VersionUtils.allReleasedVersions()) {
        if (VersionUtils.isSnapshot(v)) continue;  // snapshots are unreleased, so there is no backcompat yet
        if (v.isRelease() == false) continue; // no guarantees for prereleases
        if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion())) continue; // we can only support one major version backward
        if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
        expectedVersions.add("index-" + v.toString() + ".zip");
    }

    for (String index : indexes) {
        if (expectedVersions.remove(index) == false) {
            logger.warn("Old indexes tests contain extra index: {}", index);
        }
    }
    if (expectedVersions.isEmpty() == false) {
        StringBuilder msg = new StringBuilder("Old index tests are missing indexes:");
        for (String expected : expectedVersions) {
            msg.append("\n" + expected);
        }
        fail(msg.toString());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:OldIndexBackwardsCompatibilityIT.java

示例2: testRestoreOldSnapshots

import org.elasticsearch.Version; //导入方法依赖的package包/类
public void testRestoreOldSnapshots() throws Exception {
    String repo = "test_repo";
    String snapshot = "test_1";
    List<String> repoVersions = repoVersions();
    assertThat(repoVersions.size(), greaterThan(0));
    for (String version : repoVersions) {
        createRepo("repo", version, repo);
        testOldSnapshot(version, repo, snapshot);
    }

    SortedSet<String> expectedVersions = new TreeSet<>();
    for (Version v : VersionUtils.allReleasedVersions()) {
        if (VersionUtils.isSnapshot(v)) continue;  // snapshots are unreleased, so there is no backcompat yet
        if (v.isRelease() == false) continue; // no guarantees for prereleases
        if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion())) continue; // we only support versions N and N-1
        if (v.equals(Version.CURRENT)) continue; // the current version is always compatible with itself
        expectedVersions.add(v.toString());
    }

    for (String repoVersion : repoVersions) {
        if (expectedVersions.remove(repoVersion) == false) {
            logger.warn("Old repositories tests contain extra repo: {}", repoVersion);
        }
    }
    if (expectedVersions.isEmpty() == false) {
        StringBuilder msg = new StringBuilder("Old repositories tests are missing versions:");
        for (String expected : expectedVersions) {
            msg.append("\n" + expected);
        }
        fail(msg.toString());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:RestoreBackwardsCompatIT.java

示例3: green

import org.elasticsearch.Version; //导入方法依赖的package包/类
/**
 * Waits for cluster to attain green state.
 */
public void green() {

  if(!USE_EXTERNAL_ES5){
    TimeValue timeout = TimeValue.timeValueSeconds(30);

    final org.elasticsearch.client.Client c = nodes[0].client();
    ClusterHealthResponse actionGet = c.admin().cluster()
            .health(Requests.clusterHealthRequest()
                .timeout(timeout)
                .waitForGreenStatus()
                .waitForEvents(Priority.LANGUID)
                .waitForRelocatingShards(0)).actionGet();

    if (actionGet.isTimedOut()) {
      logger.info("--> timed out waiting for cluster green state.\n{}\n{}",
              c.admin().cluster().prepareState().get().getState().prettyPrint(),
              c.admin().cluster().preparePendingClusterTasks().get().prettyPrint());
      fail("timed out waiting for cluster green state");
    }

    Assert.assertTrue(actionGet.getStatus().compareTo(ClusterHealthStatus.GREEN) == 0);

    NodesInfoResponse actionInfoGet = c.admin().cluster().nodesInfo(Requests.nodesInfoRequest().all()).actionGet();
    for (NodeInfo node : actionInfoGet) {
      Version nodeVersion = node.getVersion();
      if (version == null) {
        version = nodeVersion;
      } else {
        if (!nodeVersion.equals(version)) {
          logger.debug("Nodes in elasticsearch cluster have inconsistent versions.");
        }
      }
      if (nodeVersion.before(version)) {
        version = nodeVersion;
      }
    }
  }

}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:43,代码来源:ElasticsearchCluster.java

示例4: readFromProperties

import org.elasticsearch.Version; //导入方法依赖的package包/类
/** reads (and validates) plugin metadata descriptor file */
public static PluginInfo readFromProperties(Path dir) throws IOException {
    Path descriptor = dir.resolve(ES_PLUGIN_PROPERTIES);
    Properties props = new Properties();
    try (InputStream stream = Files.newInputStream(descriptor)) {
        props.load(stream);
    }
    String name = props.getProperty("name");
    if (name == null || name.isEmpty()) {
        throw new IllegalArgumentException("Property [name] is missing in [" + descriptor + "]");
    }
    String description = props.getProperty("description");
    if (description == null) {
        throw new IllegalArgumentException("Property [description] is missing for plugin [" + name + "]");
    }
    String version = props.getProperty("version");
    if (version == null) {
        throw new IllegalArgumentException("Property [version] is missing for plugin [" + name + "]");
    }

    String esVersionString = props.getProperty("elasticsearch.version");
    if (esVersionString == null) {
        throw new IllegalArgumentException("Property [elasticsearch.version] is missing for plugin [" + name + "]");
    }
    Version esVersion = Version.fromString(esVersionString);
    if (esVersion.equals(Version.CURRENT) == false) {
        throw new IllegalArgumentException("Plugin [" + name + "] is incompatible with Elasticsearch [" + Version.CURRENT.toString() +
                "]. Was designed for version [" + esVersionString + "]");
    }
    String javaVersionString = props.getProperty("java.version");
    if (javaVersionString == null) {
        throw new IllegalArgumentException("Property [java.version] is missing for plugin [" + name + "]");
    }
    JarHell.checkVersionFormat(javaVersionString);
    JarHell.checkJavaVersion(name, javaVersionString);
    String classname = props.getProperty("classname");
    if (classname == null) {
        throw new IllegalArgumentException("Property [classname] is missing for plugin [" + name + "]");
    }

    return new PluginInfo(name, description, version, classname);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:PluginInfo.java

示例5: readFromProperties

import org.elasticsearch.Version; //导入方法依赖的package包/类
/** reads (and validates) plugin metadata descriptor file */
public static PluginInfo readFromProperties(Path dir) throws IOException {
    Path descriptor = dir.resolve(ES_PLUGIN_PROPERTIES);
    Properties props = new Properties();
    try (InputStream stream = Files.newInputStream(descriptor)) {
        props.load(stream);
    }
    String name = props.getProperty("name");
    if (name == null || name.isEmpty()) {
        throw new IllegalArgumentException("Property [name] is missing in [" + descriptor + "]");
    }
    PluginManager.checkForForbiddenName(name);
    String description = props.getProperty("description");
    if (description == null) {
        throw new IllegalArgumentException("Property [description] is missing for plugin [" + name + "]");
    }
    String version = props.getProperty("version");
    if (version == null) {
        throw new IllegalArgumentException("Property [version] is missing for plugin [" + name + "]");
    }

    boolean jvm = Boolean.parseBoolean(props.getProperty("jvm"));
    boolean site = Boolean.parseBoolean(props.getProperty("site"));
    if (jvm == false && site == false) {
        throw new IllegalArgumentException("Plugin [" + name + "] must be at least a jvm or site plugin");
    }
    boolean isolated = true;
    String classname = "NA";
    if (jvm) {
        String esVersionString = props.getProperty("elasticsearch.version");
        if (esVersionString == null) {
            throw new IllegalArgumentException("Property [elasticsearch.version] is missing for jvm plugin [" + name + "]");
        }
        Version esVersion = Version.fromString(esVersionString);
        if (esVersion.equals(Version.CURRENT) == false) {
            throw new IllegalArgumentException("Plugin [" + name + "] is incompatible with Elasticsearch [" + Version.CURRENT.toString() +
                    "]. Was designed for version [" + esVersionString + "]");
        }
        String javaVersionString = props.getProperty("java.version");
        if (javaVersionString == null) {
            throw new IllegalArgumentException("Property [java.version] is missing for jvm plugin [" + name + "]");
        }
        JarHell.checkVersionFormat(javaVersionString);
        JarHell.checkJavaVersion(name, javaVersionString);
        isolated = Boolean.parseBoolean(props.getProperty("isolated", "true"));
        classname = props.getProperty("classname");
        if (classname == null) {
            throw new IllegalArgumentException("Property [classname] is missing for jvm plugin [" + name + "]");
        }
    }

    if (site) {
        if (!Files.exists(dir.resolve("_site"))) {
            throw new IllegalArgumentException("Plugin [" + name + "] is a site plugin but has no '_site/' directory");
        }
    }

    return new PluginInfo(name, description, site, version, jvm, classname, isolated);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:60,代码来源:PluginInfo.java


注:本文中的org.elasticsearch.Version.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。