Repository: incubator-ranger
Updated Branches:
  refs/heads/master 5f29db871 -> ab44b6508


RANGER-234: added debug code for JUNIT background processes on win env


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

Branch: refs/heads/master
Commit: ab44b6508ecb1e9c286aedef59e3a9add23d6677
Parents: 5f29db8
Author: sneethiraj <[email protected]>
Authored: Wed Feb 25 18:09:13 2015 -0800
Committer: sneethiraj <[email protected]>
Committed: Wed Feb 25 18:09:13 2015 -0800

----------------------------------------------------------------------
 .../utils/RangerCredentialProviderTest.java     | 33 +++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ab44b650/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
----------------------------------------------------------------------
diff --git 
a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
 
b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
index 65e5cf6..7923154 100644
--- 
a/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
+++ 
b/agents-cred/src/test/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProviderTest.java
@@ -52,11 +52,20 @@ public class RangerCredentialProviderTest {
                try {
                        if (ksFile != null) {
                                if (ksFile.exists()) {
+                                       System.out.println("Keystore File [" + 
ksFile.getAbsolutePath() + "] is available - and deleting") ;
                                        ksFile.delete() ;
+                                       System.out.println("Keystore File [" + 
ksFile.getAbsolutePath() + "] is deleted.") ;
                                }
+                               else {
+                                       System.out.println("Keystore File [" + 
ksFile.getAbsolutePath() + "] is not available") ;
+                               }
+                       }
+                       else {
+                               System.out.println("Keystore File is NULL") ;
                        }
                }
                catch(Throwable t) {
+                       t.printStackTrace();
                }
                
                Configuration conf = new Configuration();
@@ -67,8 +76,12 @@ public class RangerCredentialProviderTest {
                } catch (Exception e) {
                        throw e;
                }
+               finally {
+               }
                assertEquals(0,ret);
-       }
+               System.out.println("(1) Number of active Threads : " + 
Thread.activeCount() ) ;
+               listThreads() ;
+       } 
        
        @Test
        public void testCredentialProvider() {
@@ -78,6 +91,8 @@ public class RangerCredentialProviderTest {
                if (providers != null) {
                        assertTrue(url.equals(providers.get(0).toString()));
                }
+               System.out.println("(2) Number of active Threads : " + 
Thread.activeCount() ) ;
+               listThreads() ;
        }
        
        @Test
@@ -88,11 +103,14 @@ public class RangerCredentialProviderTest {
                if (providers != null) {
                        assertTrue("PassworD123".equals(new 
String(cp.getCredentialString(url,"TestCredential001"))));
                }
+               System.out.println("(3) Number of active Threads : " + 
Thread.activeCount() ) ;
+               listThreads() ;
        }
 
        
        @After
        public void teardown() throws Exception {
+               System.out.println("In teardown : Number of active Threads : " 
+ Thread.activeCount() ) ;
                int ret;
                Configuration conf = new Configuration();
                CredentialShell cs = new CredentialShell();
@@ -103,6 +121,19 @@ public class RangerCredentialProviderTest {
                        throw e;
                }
                assertEquals(0,ret);    
+               listThreads() ;
        }
+       
+       private static void             listThreads() {
+               int ac = Thread.activeCount() ;
+               if (ac > 0) {
+                       Thread[] tlist = new Thread[ac] ;
+                       Thread.enumerate(tlist) ;
+                       for(Thread t : tlist) {
+                               System.out.println("Thread [" + t + "] => {" + 
t.getClass().getName() + "}") ;
+                       }
+               }
+       }
+
 }
 

Reply via email to