Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/506#discussion_r24323604
--- Diff: core/src/test/java/brooklyn/BrooklynVersionTest.java ---
@@ -19,18 +19,63 @@
package brooklyn;
import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
import org.testng.annotations.Test;
+import brooklyn.util.text.Strings;
+
public class BrooklynVersionTest {
+ private static final Logger log =
LoggerFactory.getLogger(BrooklynVersionTest.class);
+
@Test
public void testGetVersion() {
- assertEquals(BrooklynVersion.get(),
BrooklynVersion.INSTANCE.getVersionFromStatic());
+ assertEquals(BrooklynVersion.get(),
BrooklynVersion.INSTANCE.getVersion());
}
@Test
public void testGetHardcodedClasspathVersion() {
- assertEquals(BrooklynVersion.INSTANCE.getVersionFromClasspath(),
"0.0.0-SNAPSHOT");
+ @SuppressWarnings("deprecation")
+ String v = BrooklynVersion.INSTANCE.getVersionFromClasspath();
+ Assert.assertTrue(BrooklynVersion.get().equals(v) ||
"0.0.0-SNAPSHOT".equals(v), v);
+ }
+
+ @Test
+ public void testGetFromMaven() {
+ String v = BrooklynVersion.INSTANCE.getVersionFromMavenProperties();
+ Assert.assertTrue(v==null || BrooklynVersion.get().equals(v), v);
+ }
+
+ @Test
+ public void testGetFromOsgi() {
+ String v = BrooklynVersion.INSTANCE.getVersionFromOsgiManifest();
+ Assert.assertTrue(v==null || BrooklynVersion.get().equals(v), v);
+ }
+
+ @Test
+ public void testGetOsgiSha1() {
+ String sha1 = BrooklynVersion.INSTANCE.getSha1FromOsgiManifest();
+ log.info("sha1: "+sha1);
+ if (Strings.isNonBlank(sha1) ||
BrooklynVersion.isDevelopmentEnvironment())
+ return;
+ // we might not have a SHA1 if it's a standalone source build; just
log warn in that case
--- End diff --
the warning is useful if you're running the test interactive
yes it would be cleaner to have a group skipped on non-git source builds,
or a flag indicating that status, but not really worth the effort now
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---