@Test public void testVersionNumber() { Pattern versionPattern = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)(-\\w+)?"); Matcher versionMatcher = versionPattern.matcher(BigtableHBaseVersion.getVersion()); assertTrue("incorrect version format", versionMatcher.matches()); int result = ComparisonChain.start() .compare(1, Integer.parseInt(versionMatcher.group(1))) .compare(14, Integer.parseInt(versionMatcher.group(2))) .compare(1, Integer.parseInt(versionMatcher.group(3))) .result(); assertTrue("Expected BigtableHBaseVersion.getVersion() to be at least 1.14.1", result <= 0); }
public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }
BigtableHBaseVersion { public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; } }
BigtableHBaseVersion { public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }  }
BigtableHBaseVersion { public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }  static String getVersion(); }
BigtableHBaseVersion { public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }  static String getVersion();  }