brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/4] brooklyn-server git commit: Add missing tests
Date Tue, 19 Jul 2016 19:03:26 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master af1aec58a -> 8d8d5766d


Add missing tests


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d2c36916
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d2c36916
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d2c36916

Branch: refs/heads/master
Commit: d2c369166fb2ab0a04793fdf1ccc6e7ddc481102
Parents: c4d5055
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Jul 14 23:40:25 2016 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Jul 14 23:40:25 2016 +0300

----------------------------------------------------------------------
 .../brooklyn/util/osgi/OsgiUtilsTest.java       | 49 ++++++++++++++++++++
 .../util/text/VersionComparatorTest.java        |  2 +
 2 files changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d2c36916/utils/common/src/test/java/org/apache/brooklyn/util/osgi/OsgiUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/osgi/OsgiUtilsTest.java b/utils/common/src/test/java/org/apache/brooklyn/util/osgi/OsgiUtilsTest.java
new file mode 100644
index 0000000..e41b00a
--- /dev/null
+++ b/utils/common/src/test/java/org/apache/brooklyn/util/osgi/OsgiUtilsTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2016 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.brooklyn.util.osgi;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+public class OsgiUtilsTest {
+
+    @Test
+    public void testToOsgiVersion() {
+        assertVersion("0.10.0-20160713.1653", "0.10.0.20160713_1653");
+
+        assertVersion("2.1.0-SNAPSHOT", "2.1.0.SNAPSHOT");
+        assertVersion("2.1-SNAPSHOT", "2.1.0.SNAPSHOT");
+        assertVersion("0.1-SNAPSHOT", "0.1.0.SNAPSHOT");
+        assertVersion("2-SNAPSHOT", "2.0.0.SNAPSHOT");
+        assertVersion("2", "2.0.0");
+        assertVersion("2.1", "2.1.0");
+        assertVersion("2.1.3", "2.1.3");
+        assertVersion("2.1.3.4", "2.1.3.4");
+        assertVersion("4aug2000r7-dev", "0.0.0.4aug2000r7-dev");
+        assertVersion("1.1-alpha-2", "1.1.0.alpha-2");
+        assertVersion("1.0-alpha-16-20070122.203121-13", "1.0.0.alpha-16-20070122_203121-13");
+        assertVersion("1.0-20070119.021432-1", "1.0.0.20070119_021432-1");
+        assertVersion("1-20070119.021432-1", "1.0.0.20070119_021432-1");
+        assertVersion("1.4.1-20070217.082013-7", "1.4.1.20070217_082013-7");
+        assertVersion("0.0.0.4aug2000r7-dev", "0.0.0.4aug2000r7-dev");
+        assertVersion("4aug2000r7-dev", "0.0.0.4aug2000r7-dev");
+    }
+
+    private void assertVersion(String ver, String expected) {
+        assertEquals(OsgiUtils.toOsgiVersion(ver), expected);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d2c36916/utils/common/src/test/java/org/apache/brooklyn/util/text/VersionComparatorTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/text/VersionComparatorTest.java
b/utils/common/src/test/java/org/apache/brooklyn/util/text/VersionComparatorTest.java
index 5322817..3a4a71c 100644
--- a/utils/common/src/test/java/org/apache/brooklyn/util/text/VersionComparatorTest.java
+++ b/utils/common/src/test/java/org/apache/brooklyn/util/text/VersionComparatorTest.java
@@ -88,6 +88,8 @@ public class VersionComparatorTest {
             "1.2-SNAPSHOT", "1.10-SNAPSHOT",
             "qualifer",
             "0", "0.1", "1");
+
+        assertVersionOrder("0.10.0-SNAPSHOT", "0.10.0.SNAPSHOT", "0.10.0-GA", "0.10.0.GA",
"0.10.0");
     }
     
     private static void assertVersionOrder(String v1, String v2, String ...otherVersions)
{


Mime
View raw message