BrooklynVersion implements BrooklynVersionService { public static boolean isDevelopmentEnvironment() { Boolean isDevEnv = IS_DEV_ENV.get(); if (isDevEnv != null) return isDevEnv; synchronized (IS_DEV_ENV) { isDevEnv = computeIsDevelopmentEnvironment(); IS_DEV_ENV.set(isDevEnv); return isDevEnv; } } private  BrooklynVersion(); @Override void checkVersions(); @Override @Nullable String getVersionFromMavenProperties(); @Override @Nullable String getVersionFromOsgiManifest(); @Override @Nullable /** SHA1 of the last commit to brooklyn at the time this build was made. * For SNAPSHOT builds of course there may have been further non-committed changes. */ String getSha1FromOsgiManifest(); @Override String getVersion(); @Override boolean isSnapshot(); static boolean isDevelopmentEnvironment(); @Override void logSummary(); static String get(); static BrooklynVersion getInstance(); static Iterable<BrooklynFeature> getFeatures(ManagementContext mgmt); static String getOsgiVersion(); static final BrooklynVersion INSTANCE; }
@Test public void testDevEnv() { URL sp = getClass().getClassLoader().getResource("brooklyn/config/sample.properties"); if (sp == null) Assert.fail("Can't find test resources"); log.info("Test for dev env: " + "Dev env? " + BrooklynVersion.isDevelopmentEnvironment() + "; path " + sp); boolean testResourcePathInClasses = sp.getPath().endsWith("classes/brooklyn/config/sample.properties"); Assert.assertEquals(testResourcePathInClasses, BrooklynVersion.isDevelopmentEnvironment(), "Dev env? " + BrooklynVersion.isDevelopmentEnvironment() + "; but resource path: " + sp); }