/** * Create a {@link CassandraKeyspace} test rule to provide a running Cassandra instance on {@code localhost:9042} with * a keyspace {@code example}. Reuses a running Cassandra instance if available or starts an embedded instance. * * @return the {@link CassandraKeyspace} rule. */ public static CassandraKeyspace onLocalhost() { return new CassandraKeyspace("localhost", ProtocolOptions.DEFAULT_PORT, "example", Cassandra.embeddedIfNotRunning("localhost", ProtocolOptions.DEFAULT_PORT), new Version(0, 0, 0)); }
/** * Parses the given string representation of a version into a {@link Version} object. * * @param version must not be {@literal null} or empty. * @return */ public static Version parse(String version) { Assert.hasText(version, "Version must not be null o empty!"); String[] parts = version.trim().split("\\."); int[] intParts = new int[parts.length]; for (int i = 0; i < parts.length; i++) { String input = i == parts.length - 1 ? parts[i].replaceAll("\\D.*", "") : parts[i]; if (StringUtils.hasText(input)) { try { intParts[i] = Integer.parseInt(input); } catch (IllegalArgumentException o_O) { throw new IllegalArgumentException(String.format(VERSION_PARSE_ERROR, input, version), o_O); } } } return new Version(intParts); }