Example usage for org.springframework.data.util Version parse

List of usage examples for org.springframework.data.util Version parse

Introduction

In this page you can find the example usage for org.springframework.data.util Version parse.

Prototype

public static Version parse(String version) 

Source Link

Document

Parses the given string representation of a version into a Version object.

Usage

From source file:example.springdata.cassandra.util.CassandraVersion.java

/**
 * Retrieve the Cassandra release version.
 *
 * @param session must not be {@literal null}.
 * @return the release {@link Version}./*from ww  w  . j  av a  2s . c  om*/
 */
public static Version getReleaseVersion(Session session) {

    Assert.notNull(session, "Session must not be null");

    ResultSet resultSet = session.execute("SELECT release_version FROM system.local;");
    Row row = resultSet.one();

    return Version.parse(row.getString(0));
}

From source file:example.springdata.mongodb.util.RequiresMongoDB.java

private void initCurrentVersion() {

    if (currentVersion == null) {
        try {/*w  ww . j  a  v a 2  s.  c  om*/
            DB db = new MongoClient(host, port).getDB("test");
            CommandResult result = db.command(new BasicDBObjectBuilder().add("buildInfo", 1).get());
            this.currentVersion = Version.parse(result.get("version").toString());
        } catch (com.mongodb.MongoTimeoutException | UnknownHostException e) {
            throw new AssumptionViolatedException("Seems as mongodb server is not running.", e);
        }
    }
}