/** * Get the version number of the build. * @return the version number of the build. */ public static String getVersion() { return OUR_FULL_VERSION.getVersion(); }
/** * Get the SCM branch of the build. * @return the SCM branch of the build. */ public static String getBranch() { return OUR_FULL_VERSION.getBranch(); }
/** * Get the date/time the build happened. * @return the date/time of the build. */ public static String getDate() { return OUR_FULL_VERSION.getDate(); }
private static Map<String, String> toJsonStruct(IVersionInfo info) { Map<String, String> ret = new HashMap<>(); ret.put("version", info.getVersion()); ret.put("revision", info.getRevision()); ret.put("branch", info.getBranch()); ret.put("date", info.getDate()); ret.put("user", info.getUser()); ret.put("url", info.getUrl()); ret.put("srcChecksum", info.getSrcChecksum()); return ret; }
/** * Get the name of the user that did the build. * @return the name of the user that did the build. */ public static String getUser() { return OUR_FULL_VERSION.getUser(); }
/** * Get the full SCM URL for the build. * @return the SCM URL of the build. */ public static String getUrl() { return OUR_FULL_VERSION.getUrl(); }
/** * Get the SCM revision number of the build. * @return the SCM revision number of the build. */ public static String getRevision() { return OUR_FULL_VERSION.getRevision(); }
/** * Get the checksum of the source. * @return the checksum of the source. */ public static String getSrcChecksum() { return OUR_FULL_VERSION.getSrcChecksum(); }
/** * Get a descriptive representation of the build meant for human consumption. * @return a descriptive representation of the build. */ public static String getBuildVersion() { return OUR_FULL_VERSION.getBuildVersion(); }
@Test public void checkVersionInfo() { Map<String, String> versions = new HashMap<>(); String key = VersionInfo.getVersion(); assertNotEquals("Unknown", key, "Looks like we don't know what version of storm we are"); versions.put(key, System.getProperty("java.class.path")); Map<String, Object> conf = new HashMap<>(); conf.put(Config.SUPERVISOR_WORKER_VERSION_CLASSPATH_MAP, versions); NavigableMap<String, IVersionInfo> alternativeVersions = Utils.getAlternativeVersionsMap(conf); assertEquals(1, alternativeVersions.size()); IVersionInfo found = alternativeVersions.get(key); assertNotNull(found); assertEquals(key, found.getVersion()); } }