incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1084435 - /incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java
Date Wed, 23 Mar 2011 01:06:25 GMT
Author: marrs
Date: Wed Mar 23 01:06:25 2011
New Revision: 1084435

URL: http://svn.apache.org/viewvc?rev=1084435&view=rev
Log:
Worked around the old version of TestNG that's in the surefire plugin, which does not have
the same assert capabilities the latest TestNG release has.

Modified:
    incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java

Modified: incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java?rev=1084435&r1=1084434&r2=1084435&view=diff
==============================================================================
--- incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java
(original)
+++ incubator/ace/trunk/ace-nodelauncher-amazon/src/test/java/org/apache/ace/nodelauncher/amazon/PortParseTest.java
Wed Mar 23 01:06:25 2011
@@ -8,18 +8,36 @@ public class PortParseTest {
     @Test(groups = { UNIT })
     public void testParsePortsFromString() throws Exception {
         AmazonNodeLauncher instance = new AmazonNodeLauncher();
-        Assert.assertEquals(instance.parseExtraPorts("1,2,3"), new int[] {1, 2, 3});
-        Assert.assertEquals(instance.parseExtraPorts(""), new int[] {});
-        Assert.assertEquals(instance.parseExtraPorts("1 ,2 , 3 "), new int[] {1, 2, 3});
-        Assert.assertEquals(instance.parseExtraPorts("800,900"), new int[] {800, 900});
+        Assert.assertTrue(assertEquals(instance.parseExtraPorts("1,2,3"), new int[] {1, 2,
3}));
+        Assert.assertTrue(assertEquals(instance.parseExtraPorts(""), new int[] {}));
+        Assert.assertTrue(assertEquals(instance.parseExtraPorts("1 ,2 , 3 "), new int[] {1,
2, 3}));
+        Assert.assertTrue(assertEquals(instance.parseExtraPorts("800,900"), new int[] {800,
900}));
     }
     
     @Test(groups = { UNIT })
     public void testMergePorts() throws Exception {
         AmazonNodeLauncher instance = new AmazonNodeLauncher();
-        Assert.assertEquals(instance.mergePorts(new int[] {1, 2}, new int[] {3, 4, 5}), new
int[] {1, 2, 3, 4, 5});
-        Assert.assertEquals(instance.mergePorts(new int[] {1}, new int[] {}), new int[] {1});
-        Assert.assertEquals(instance.mergePorts(new int[] {}, new int[] {}), new int[] {});
-        Assert.assertEquals(instance.mergePorts(new int[] {}, new int[] {1, 2, 3}), new int[]
{1, 2, 3});
+        Assert.assertTrue(assertEquals(instance.mergePorts(new int[] {1, 2}, new int[] {3,
4, 5}), new int[] {1, 2, 3, 4, 5}));
+        Assert.assertTrue(assertEquals(instance.mergePorts(new int[] {1}, new int[] {}),
new int[] {1}));
+        Assert.assertTrue(assertEquals(instance.mergePorts(new int[] {}, new int[] {}), new
int[] {}));
+        Assert.assertTrue(assertEquals(instance.mergePorts(new int[] {}, new int[] {1, 2,
3}), new int[] {1, 2, 3}));
+    }
+    
+    private boolean assertEquals(int[] a, int[] b) {
+        if (a == null && b == null) {
+            return true;
+        }
+        if (a == null) {
+            return false;
+        }
+        if (a.length != b.length) {
+            return false;
+        }
+        for (int i = 0; i < a.length; i++) {
+            if (a[i] != b[i]) {
+                return false;
+            }
+        }
+        return true;
     }
 }



Mime
View raw message