ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject git commit: ARGUS-155 misc housekeeping to streamline unit tests.
Date Thu, 06 Nov 2014 02:03:34 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 4fcbf1675 -> 3b87db6c4


ARGUS-155 misc housekeeping to streamline unit tests.

1) Refactored depedencies for unit-test-related jars to parent pom.  Added test scope to depedencies.
2) Some projects had test code in main. Fixed that.
3) Mockito-all was appropriate for ant build.  For maven mockito-core is safer.  Made that
change.
4) Added a couple of new tests.
5) By default the tests would be executed.  Earlier by default they were skipped.

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


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

Branch: refs/heads/master
Commit: 3b87db6c456b37e07c067f3e7469bd696c5100f4
Parents: 4fcbf16
Author: Alok Lal <alal@hortonworks.com>
Authored: Tue Nov 4 10:32:02 2014 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Wed Nov 5 17:57:36 2014 -0800

----------------------------------------------------------------------
 agents-impl/pom.xml                             |  9 ++-
 .../xasecure/pdp/hdfs/URLBasedAuthDBTest.java   | 61 +++++++++++++++
 .../.settings/org.eclipse.core.resources.prefs  |  1 +
 credentialbuilder/pom.xml                       |  1 -
 .../credentialapi/TestCredentialReader.java     | 52 -------------
 .../hortonworks/credentialapi/Testbuildks.java  | 78 --------------------
 .../credentialapi/TestCredentialReader.java     | 52 +++++++++++++
 .../hortonworks/credentialapi/Testbuildks.java  | 78 ++++++++++++++++++++
 .../.settings/org.eclipse.core.resources.prefs  |  1 +
 hdfs-agent/pom.xml                              |  8 ++
 .../agent/TestXaSecureFSPermissionChecker.java  | 50 +++++++++++++
 pom.xml                                         | 33 ++++++++-
 security-admin/pom.xml                          |  4 +-
 13 files changed, 289 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/agents-impl/pom.xml
----------------------------------------------------------------------
diff --git a/agents-impl/pom.xml b/agents-impl/pom.xml
index a5bded8..98a66d6 100644
--- a/agents-impl/pom.xml
+++ b/agents-impl/pom.xml
@@ -30,12 +30,19 @@
   </parent>
   <dependencies>
 
+	<dependency>
+		<groupId>junit</groupId>
+		<artifactId>junit</artifactId>
+	</dependency>
+	<dependency>
+		<groupId>org.mockito</groupId>
+		<artifactId>mockito-core</artifactId>
+	</dependency>
   <dependency>
     <groupId>org.glassfish.jersey.core</groupId>
     <artifactId>jersey-client</artifactId>
     <version>2.6</version>
   </dependency>
-
     <dependency>
 	<groupId>commons-logging</groupId>
 	<artifactId>commons-logging</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/agents-impl/src/test/java/com/xasecure/pdp/hdfs/URLBasedAuthDBTest.java
----------------------------------------------------------------------
diff --git a/agents-impl/src/test/java/com/xasecure/pdp/hdfs/URLBasedAuthDBTest.java b/agents-impl/src/test/java/com/xasecure/pdp/hdfs/URLBasedAuthDBTest.java
new file mode 100644
index 0000000..3ece386
--- /dev/null
+++ b/agents-impl/src/test/java/com/xasecure/pdp/hdfs/URLBasedAuthDBTest.java
@@ -0,0 +1,61 @@
+package com.xasecure.pdp.hdfs;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.xasecure.pdp.model.Policy;
+import com.xasecure.pdp.model.PolicyContainer;
+import com.xasecure.pdp.model.ResourcePath;
+
+public class URLBasedAuthDBTest {
+
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testIsAuditLogEnabledByACL() {
+
+		// if authdb isn't initialized then return false
+		URLBasedAuthDB authDB = URLBasedAuthDB.getInstance();
+		assertFalse(authDB.isAuditLogEnabledByACL("blah"));
+		
+		// Policy container with empty acl list is the same!
+		URLBasedAuthDB spy = spy(authDB);
+		PolicyContainer policyContainer = mock(PolicyContainer.class);
+		List<Policy> policies = new ArrayList<Policy>();
+		when(policyContainer.getAcl()).thenReturn(policies);
+		
+		when(spy.getPolicyContainer()).thenReturn(policyContainer);
+		assertFalse(spy.isAuditLogEnabledByACL("blah"));
+		
+		// or a non-empty acl with empty resource lists!
+		Policy aPolicy = mock(Policy.class);
+		when(aPolicy.getResourceList()).thenReturn(new ArrayList<ResourcePath>());
+		policies.add(aPolicy);
+		assertFalse(spy.isAuditLogEnabledByACL("blah"));
+		
+		// setup a resource non-recursive path
+		ResourcePath path = mock(ResourcePath.class);
+		when(path.getPath()).thenReturn("aPath");
+		when(path.isWildcardPath()).thenReturn(false);
+		
+		// build a resource list with this path
+		List<ResourcePath> resourcePaths = new ArrayList<ResourcePath>();
+		resourcePaths.add(path);
+		when(aPolicy.getResourceList()).thenReturn(resourcePaths);
+		// let the ACL not be recursive either
+		when(aPolicy.getRecursiveInd()).thenReturn(0);
+		when(aPolicy.getAuditInd()).thenReturn(1);
+		assertFalse(spy.isAuditLogEnabledByACL("blah"));
+		// right path matches
+		assertTrue(spy.isAuditLogEnabledByACL("aPath"));
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/credentialbuilder/.settings/org.eclipse.core.resources.prefs b/credentialbuilder/.settings/org.eclipse.core.resources.prefs
index e9441bb..f9fe345 100644
--- a/credentialbuilder/.settings/org.eclipse.core.resources.prefs
+++ b/credentialbuilder/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,4 @@
 eclipse.preferences.version=1
 encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
 encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/pom.xml
----------------------------------------------------------------------
diff --git a/credentialbuilder/pom.xml b/credentialbuilder/pom.xml
index a360bfc..33df4de 100644
--- a/credentialbuilder/pom.xml
+++ b/credentialbuilder/pom.xml
@@ -67,7 +67,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>${junit.version}</version>
         </dependency>
 	<dependency>
     		<groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/src/main/java/com/hortonworks/credentialapi/TestCredentialReader.java
----------------------------------------------------------------------
diff --git a/credentialbuilder/src/main/java/com/hortonworks/credentialapi/TestCredentialReader.java
b/credentialbuilder/src/main/java/com/hortonworks/credentialapi/TestCredentialReader.java
deleted file mode 100644
index 8becce8..0000000
--- a/credentialbuilder/src/main/java/com/hortonworks/credentialapi/TestCredentialReader.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 com.hortonworks.credentialapi;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestCredentialReader {
-  private final String keystoreFile =System.getProperty("user.home")+"/testkeystore.jceks";
 
-  @Before
-  public void setup() throws Exception {   
-	buildks buildksOBJ=new buildks();	
-    String[] argsCreateCommand = {"create", "TestCredential2", "-value", "PassworD123", "-provider",
"jceks://file" + keystoreFile};
-    int rc2=buildksOBJ.createCredential(argsCreateCommand); 
-    assertEquals( 0, rc2);
-    assertTrue(rc2==0);  
-  }
-
-  @Test
-  public void testPassword() throws Exception {  	
-    String password=CredentialReader.getDecryptedString(keystoreFile, "TestCredential2");
-    assertEquals( "PassworD123", password);
-    assertTrue(password,"PassworD123".equals(password));
-    //delete after use
-    String[] argsdeleteCommand = {"delete", "TestCredential2", "-provider", "jceks://file"
+ keystoreFile};
-	buildks buildksOBJ=new buildks();
-	buildksOBJ.deleteCredential(argsdeleteCommand);
-    
-  }
-  
-  
- 
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/src/main/java/com/hortonworks/credentialapi/Testbuildks.java
----------------------------------------------------------------------
diff --git a/credentialbuilder/src/main/java/com/hortonworks/credentialapi/Testbuildks.java
b/credentialbuilder/src/main/java/com/hortonworks/credentialapi/Testbuildks.java
deleted file mode 100644
index e4acf89..0000000
--- a/credentialbuilder/src/main/java/com/hortonworks/credentialapi/Testbuildks.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 com.hortonworks.credentialapi;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class Testbuildks {
-  private final String keystoreFile =System.getProperty("user.home")+"/testkeystore.jceks";
 
-  @Test
-  public void testBuildKSsuccess() throws Exception {   
-	buildks buildksOBJ=new buildks();
-    String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider",
"jceks://file" + keystoreFile};
-    int rc1=buildksOBJ.createCredential(argsCreateCommand); 
-    assertEquals( 0, rc1);
-    assertTrue(rc1==0);
-   
-    String[] argsListCommand = {"list", "-provider","jceks://file" + keystoreFile};
-    int rc2=buildksOBJ.listCredential(argsListCommand);
-    assertEquals(0, rc2);
-    assertTrue(rc2==0);
-    
-    String[] argsGetCommand = {"get", "TestCredential1", "-provider", "jceks://file" +keystoreFile
};
-    String pw=buildksOBJ.getCredential(argsGetCommand);
-    assertEquals("PassworD123", pw);
-    assertTrue(pw.equals("PassworD123"));
-    boolean getCredentialPassed = pw.equals("PassworD123");
-    
-    String[] argsDeleteCommand = {"delete", "TestCredential1", "-provider", "jceks://file"
+keystoreFile };
-    int rc3=buildksOBJ.deleteCredential(argsDeleteCommand);
-    assertEquals(0, rc3);
-    assertTrue(rc3==0);
-   
-    if(rc1==rc2 && rc2==rc3 && rc3==0 && getCredentialPassed){
-    	System.out.println("Test Case has been completed successfully..");    	
-    }
-  }
-
-  @Test
-  public void testInvalidProvider() throws Exception {
-	buildks buildksOBJ=new buildks(); 
-	String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider",
"jksp://file"+keystoreFile};    
-    int rc1=buildksOBJ.createCredential(argsCreateCommand);   
-    assertEquals(-1, rc1);
-    assertTrue(rc1==-1);
-  } 
-  
-  @Test
-  public void testInvalidCommand() throws Exception {
-	buildks buildksOBJ=new buildks(); 
-	String[] argsCreateCommand = {"creat", "TestCredential1", "-value", "PassworD123", "-provider",
"jksp://file"+keystoreFile};    
-    int rc1=buildksOBJ.createCredential(argsCreateCommand);   
-    assertEquals(-1, rc1);
-    assertTrue(rc1==-1);
-  } 
-  /*public static void main(String args[]) throws Exception{
-	  Testbuildks tTestbuildks=new Testbuildks();
-	  tTestbuildks.testBuildKSsuccess();
-  }*/  
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/src/test/java/com/hortonworks/credentialapi/TestCredentialReader.java
----------------------------------------------------------------------
diff --git a/credentialbuilder/src/test/java/com/hortonworks/credentialapi/TestCredentialReader.java
b/credentialbuilder/src/test/java/com/hortonworks/credentialapi/TestCredentialReader.java
new file mode 100644
index 0000000..8becce8
--- /dev/null
+++ b/credentialbuilder/src/test/java/com/hortonworks/credentialapi/TestCredentialReader.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 com.hortonworks.credentialapi;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestCredentialReader {
+  private final String keystoreFile =System.getProperty("user.home")+"/testkeystore.jceks";
 
+  @Before
+  public void setup() throws Exception {   
+	buildks buildksOBJ=new buildks();	
+    String[] argsCreateCommand = {"create", "TestCredential2", "-value", "PassworD123", "-provider",
"jceks://file" + keystoreFile};
+    int rc2=buildksOBJ.createCredential(argsCreateCommand); 
+    assertEquals( 0, rc2);
+    assertTrue(rc2==0);  
+  }
+
+  @Test
+  public void testPassword() throws Exception {  	
+    String password=CredentialReader.getDecryptedString(keystoreFile, "TestCredential2");
+    assertEquals( "PassworD123", password);
+    assertTrue(password,"PassworD123".equals(password));
+    //delete after use
+    String[] argsdeleteCommand = {"delete", "TestCredential2", "-provider", "jceks://file"
+ keystoreFile};
+	buildks buildksOBJ=new buildks();
+	buildksOBJ.deleteCredential(argsdeleteCommand);
+    
+  }
+  
+  
+ 
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/credentialbuilder/src/test/java/com/hortonworks/credentialapi/Testbuildks.java
----------------------------------------------------------------------
diff --git a/credentialbuilder/src/test/java/com/hortonworks/credentialapi/Testbuildks.java
b/credentialbuilder/src/test/java/com/hortonworks/credentialapi/Testbuildks.java
new file mode 100644
index 0000000..e4acf89
--- /dev/null
+++ b/credentialbuilder/src/test/java/com/hortonworks/credentialapi/Testbuildks.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 com.hortonworks.credentialapi;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class Testbuildks {
+  private final String keystoreFile =System.getProperty("user.home")+"/testkeystore.jceks";
 
+  @Test
+  public void testBuildKSsuccess() throws Exception {   
+	buildks buildksOBJ=new buildks();
+    String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider",
"jceks://file" + keystoreFile};
+    int rc1=buildksOBJ.createCredential(argsCreateCommand); 
+    assertEquals( 0, rc1);
+    assertTrue(rc1==0);
+   
+    String[] argsListCommand = {"list", "-provider","jceks://file" + keystoreFile};
+    int rc2=buildksOBJ.listCredential(argsListCommand);
+    assertEquals(0, rc2);
+    assertTrue(rc2==0);
+    
+    String[] argsGetCommand = {"get", "TestCredential1", "-provider", "jceks://file" +keystoreFile
};
+    String pw=buildksOBJ.getCredential(argsGetCommand);
+    assertEquals("PassworD123", pw);
+    assertTrue(pw.equals("PassworD123"));
+    boolean getCredentialPassed = pw.equals("PassworD123");
+    
+    String[] argsDeleteCommand = {"delete", "TestCredential1", "-provider", "jceks://file"
+keystoreFile };
+    int rc3=buildksOBJ.deleteCredential(argsDeleteCommand);
+    assertEquals(0, rc3);
+    assertTrue(rc3==0);
+   
+    if(rc1==rc2 && rc2==rc3 && rc3==0 && getCredentialPassed){
+    	System.out.println("Test Case has been completed successfully..");    	
+    }
+  }
+
+  @Test
+  public void testInvalidProvider() throws Exception {
+	buildks buildksOBJ=new buildks(); 
+	String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider",
"jksp://file"+keystoreFile};    
+    int rc1=buildksOBJ.createCredential(argsCreateCommand);   
+    assertEquals(-1, rc1);
+    assertTrue(rc1==-1);
+  } 
+  
+  @Test
+  public void testInvalidCommand() throws Exception {
+	buildks buildksOBJ=new buildks(); 
+	String[] argsCreateCommand = {"creat", "TestCredential1", "-value", "PassworD123", "-provider",
"jksp://file"+keystoreFile};    
+    int rc1=buildksOBJ.createCredential(argsCreateCommand);   
+    assertEquals(-1, rc1);
+    assertTrue(rc1==-1);
+  } 
+  /*public static void main(String args[]) throws Exception{
+	  Testbuildks tTestbuildks=new Testbuildks();
+	  tTestbuildks.testBuildKSsuccess();
+  }*/  
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/hdfs-agent/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/hdfs-agent/.settings/org.eclipse.core.resources.prefs b/hdfs-agent/.settings/org.eclipse.core.resources.prefs
index abdea9a..839d647 100644
--- a/hdfs-agent/.settings/org.eclipse.core.resources.prefs
+++ b/hdfs-agent/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,5 @@
 eclipse.preferences.version=1
 encoding//src/main/java=UTF-8
 encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
 encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/hdfs-agent/pom.xml
----------------------------------------------------------------------
diff --git a/hdfs-agent/pom.xml b/hdfs-agent/pom.xml
index d7d3b62..db0fbee 100644
--- a/hdfs-agent/pom.xml
+++ b/hdfs-agent/pom.xml
@@ -67,6 +67,14 @@
       <artifactId>ranger-plugins-common</artifactId>
       <version>${project.version}</version>
     </dependency>
+	<dependency>
+		<groupId>junit</groupId>
+		<artifactId>junit</artifactId>
+	</dependency>
+	<dependency>
+		<groupId>org.mockito</groupId>
+		<artifactId>mockito-core</artifactId>
+	</dependency>
   </dependencies>
   <build>
 	<!--

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/hdfs-agent/src/test/java/com/xasecure/authorization/hadoop/agent/TestXaSecureFSPermissionChecker.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/test/java/com/xasecure/authorization/hadoop/agent/TestXaSecureFSPermissionChecker.java
b/hdfs-agent/src/test/java/com/xasecure/authorization/hadoop/agent/TestXaSecureFSPermissionChecker.java
new file mode 100644
index 0000000..43f0804
--- /dev/null
+++ b/hdfs-agent/src/test/java/com/xasecure/authorization/hadoop/agent/TestXaSecureFSPermissionChecker.java
@@ -0,0 +1,50 @@
+package com.xasecure.authorization.hadoop.agent;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.util.Set;
+
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.hdfs.server.namenode.INode;
+import org.apache.hadoop.hdfs.server.namenode.XaSecureFSPermissionChecker;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.junit.Test;
+
+import com.xasecure.authorization.hadoop.exceptions.XaSecureAccessControlException;
+
+public class TestXaSecureFSPermissionChecker {
+
+	@Test
+	public void nullUgiToCheckReturnsFalse() {
+
+		UserGroupInformation ugi = null;
+		INode inode = null;
+		FsAction access = null;
+		try {
+			boolean result = XaSecureFSPermissionChecker.check(ugi, inode, access);
+			assertFalse(result);
+		} catch (XaSecureAccessControlException e) {
+			fail("Unexpected exception!");
+		} 
+	}
+	
+	@Test
+	public void authorizeAccess() {
+		String aPathName = null;
+		String aPathOwnerName = null;
+		String user = null;
+		Set<String> groups = null;
+		FsAction access = null;
+		try {
+			// null access returns false! 
+			assertFalse(XaSecureFSPermissionChecker.AuthorizeAccessForUser(aPathName, aPathOwnerName,
access, user, groups));
+			// None access type returns true!
+			access = FsAction.NONE;
+			assertFalse(XaSecureFSPermissionChecker.AuthorizeAccessForUser(aPathName, aPathOwnerName,
access, user, groups));
+		} catch (XaSecureAccessControlException e) {
+			e.printStackTrace();
+			fail("Unexpected exception!");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6a1aabe..0d74fe8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,10 +113,10 @@
 		<tomcat.commons.el.version>5.5.23</tomcat.commons.el.version>
 		<tomcat.embed.version>7.0.55</tomcat.embed.version>
 		<velocity.version>1.7</velocity.version>
+		<powermock.version>1.5.6</powermock.version>
 		<distMgmtStagingId>apache.staging.https</distMgmtStagingId>
     	<distMgmtStagingName>Apache Release Distribution Repository</distMgmtStagingName>
     	<distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>
-        <skipTests>true</skipTests>
   </properties>
   <profiles>
         <profile>
@@ -192,6 +192,34 @@
             </snapshots>
           </repository>
   </repositories>
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>junit</groupId>
+				<artifactId>junit</artifactId>
+				<version>${junit.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.mockito</groupId>
+				<artifactId>mockito-core</artifactId>
+				<version>${mockito.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.powermock</groupId>
+				<artifactId>powermock-module-junit4</artifactId>
+				<version>${powermock.version}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.powermock</groupId>
+				<artifactId>powermock-api-mockito</artifactId>
+				<version>${powermock.version}</version>
+				<scope>test</scope>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
   <build>
   	<pluginManagement>
     <plugins>
@@ -212,9 +240,6 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.17</version>
-        <configuration>
-          <skipTests>${skipTests}</skipTests>
-        </configuration>
       </plugin>
       <plugin>
          <artifactId>maven-assembly-plugin</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3b87db6c/security-admin/pom.xml
----------------------------------------------------------------------
diff --git a/security-admin/pom.xml b/security-admin/pom.xml
index a692f48..ba0e68b 100644
--- a/security-admin/pom.xml
+++ b/security-admin/pom.xml
@@ -247,12 +247,10 @@
 		<dependency>
 		    <groupId>junit</groupId>
 		    <artifactId>junit</artifactId>
-		    <version>${junit.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.mockito</groupId>
-			<artifactId>mockito-all</artifactId>
-			<version>${mockito.version}</version>
+			<artifactId>mockito-core</artifactId>
 		</dependency>
 		<dependency>
 		    <groupId>com.googlecode.log4jdbc</groupId>


Mime
View raw message