ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject incubator-ranger git commit: RANGER-841 Remove deprecated junit.framework dependencies
Date Thu, 11 Feb 2016 19:06:54 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master e7fe42f6b -> 0966bbccb


RANGER-841 Remove deprecated junit.framework dependencies

Signed-off-by: Alok Lal <alok@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0966bbcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0966bbcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0966bbcc

Branch: refs/heads/master
Commit: 0966bbccbf8e1781219a3933a0ab17a0a06051ba
Parents: e7fe42f
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Feb 11 10:53:31 2016 -0800
Committer: Alok Lal <alok@apache.org>
Committed: Thu Feb 11 10:54:13 2016 -0800

----------------------------------------------------------------------
 .../plugin/errors/TestValidationErrorCode.java  | 15 +++++----
 .../ranger/policyengine/PerfTesterTest.java     | 35 ++++----------------
 2 files changed, 16 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0966bbcc/agents-common/src/test/java/org/apache/ranger/plugin/errors/TestValidationErrorCode.java
----------------------------------------------------------------------
diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/errors/TestValidationErrorCode.java
b/agents-common/src/test/java/org/apache/ranger/plugin/errors/TestValidationErrorCode.java
index 46b1966..9336377 100644
--- a/agents-common/src/test/java/org/apache/ranger/plugin/errors/TestValidationErrorCode.java
+++ b/agents-common/src/test/java/org/apache/ranger/plugin/errors/TestValidationErrorCode.java
@@ -20,8 +20,9 @@
 package org.apache.ranger.plugin.errors;
 
 import com.google.common.collect.ImmutableSet;
-import junit.framework.TestCase;
 import org.apache.ranger.plugin.model.validation.ValidationFailureDetails;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -29,14 +30,14 @@ import java.util.Set;
 /**
  * Created by alal on 7/30/15.
  */
-public class TestValidationErrorCode extends TestCase {
-
+public class TestValidationErrorCode {
 
+    @Test
     public void testUserMessage() throws Exception {
         ValidationErrorCode errorCode = ValidationErrorCode.SERVICE_VALIDATION_ERR_UNSUPPORTED_ACTION;
         String aParameter = "FOO";
         String expected = errorCode._template.replace("{0}", aParameter);
-        assertEquals(expected, errorCode.getMessage(aParameter));
+        Assert.assertEquals(expected, errorCode.getMessage(aParameter));
     }
 
     /**
@@ -46,6 +47,7 @@ public class TestValidationErrorCode extends TestCase {
      * This check is far from perfect.  It may give false alarms if the message itself contains
strings of the form {1}
      * which have been escaped using single quotes.  If that happens we would have to make
this test smarter.
      */
+    @Test
     public void testTemplates() {
 
         // we check up to 5 substitution variables.  If there are more than 5 then you probably
have a different set of problems
@@ -65,7 +67,7 @@ public class TestValidationErrorCode extends TestCase {
             }
             // check for incorrectly numbers substition variable placeholders
             for (ValidationErrorCode anEnum : mustNot) {
-                assertFalse(anEnum.toString() + ": contains " + token + ". Check for wongly
numberd substition variable placeholders.",
+                Assert.assertFalse(anEnum.toString() + ": contains " + token + ". Check for
wongly numberd substition variable placeholders.",
                         anEnum._template.contains(token));
             }
         }
@@ -74,12 +76,13 @@ public class TestValidationErrorCode extends TestCase {
     /**
      * Test if the values assigned to the validation error code are unique or not.
      */
+    @Test
     public void testValidationErrorCodesUnique() {
         Set<Integer> errorCodes = new HashSet<>();
         for (ValidationErrorCode anEnum : ValidationErrorCode.values()) {
             int errorCode = anEnum.getErrorCode();
             // errorCode that we see must not have been seen so far.
-            assertFalse("ValidationErrorCode: error code [" + errorCode + "] used multiple
times!", errorCodes.contains(errorCode));
+            Assert.assertFalse("ValidationErrorCode: error code [" + errorCode + "] used
multiple times!", errorCodes.contains(errorCode));
             errorCodes.add(errorCode);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0966bbcc/ranger-tools/src/test/java/org/apache/ranger/policyengine/PerfTesterTest.java
----------------------------------------------------------------------
diff --git a/ranger-tools/src/test/java/org/apache/ranger/policyengine/PerfTesterTest.java
b/ranger-tools/src/test/java/org/apache/ranger/policyengine/PerfTesterTest.java
index 2d7c52e..7837e5a 100644
--- a/ranger-tools/src/test/java/org/apache/ranger/policyengine/PerfTesterTest.java
+++ b/ranger-tools/src/test/java/org/apache/ranger/policyengine/PerfTesterTest.java
@@ -19,45 +19,24 @@
 
 package org.apache.ranger.policyengine;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.nio.charset.Charset;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 /**
  * Unit test for simple App.
  */
-public class PerfTesterTest
-    extends TestCase
-
-{
-    /**
-     * Create the test case
-     *
-     * @param testName name of the test case
-     */
-    public PerfTesterTest( String testName )
-    {
-        super( testName );
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite( PerfTesterTest.class );
-    }
+public class PerfTesterTest {
 
     /**
      * Rigourous Test :-)
      */
-
+    @Test
     public void testMain() {
 
         String[] args = readCommandLine();
@@ -67,14 +46,14 @@ public class PerfTesterTest
         }
     }
 
-
+    @Test
     public void testArgParsing() {
         String[] args = readCommandLine();
 
         if (args != null) {
             CommandLineParser commandLineParser = new CommandLineParser();
             PerfTestOptions parseResult = commandLineParser.parse(args);
-            assertNotNull(parseResult);
+            Assert.assertNotNull(parseResult);
         }
     }
 


Mime
View raw message