summaryrefslogtreecommitdiffstats
path: root/aai-core/src
diff options
context:
space:
mode:
authorKeong Lim <keong.lim@huawei.com>2018-11-01 17:01:25 +1100
committerKeong Lim <keong.lim@huawei.com>2018-11-22 11:06:14 +1100
commite2022e79c4d7e23d699bfff3fa904fb48f7d29e2 (patch)
tree80ca7b3bc08a427a63b3d209cf24ef691ab45bae /aai-core/src
parent49c37cdfbb9378cbc4531b8731c68c33c7cf1d18 (diff)
AAI-1523 checkstyle warnings for aai-core auth
Issue-ID: AAI-1523 re-indent code with spaces to clean up some checkstyle warnings for aai-core test auth (part of 24k lines of output) Change-Id: I634a49d499f5a6605510633ec2ab6069a04cccba Signed-off-by: Keong Lim <keong.lim@huawei.com>
Diffstat (limited to 'aai-core/src')
-rw-r--r--aai-core/src/test/java/org/onap/aai/auth/AAIAuthCoreTest.java352
-rw-r--r--aai-core/src/test/java/org/onap/aai/auth/AAIUserTest.java46
2 files changed, 199 insertions, 199 deletions
diff --git a/aai-core/src/test/java/org/onap/aai/auth/AAIAuthCoreTest.java b/aai-core/src/test/java/org/onap/aai/auth/AAIAuthCoreTest.java
index 97d00c8b..2c299869 100644
--- a/aai-core/src/test/java/org/onap/aai/auth/AAIAuthCoreTest.java
+++ b/aai-core/src/test/java/org/onap/aai/auth/AAIAuthCoreTest.java
@@ -28,181 +28,181 @@ import static org.junit.Assert.*;
public class AAIAuthCoreTest extends AAISetup {
- private AAIAuthCore authCore;
-
- @Before
- public void setup(){
- authCore = new AAIAuthCore("/aai");
- }
-
- @Test
- public void getAuthPolicyFunctionNameTest() {
-
- String uri = "/aai/v3/search/edge-tag-query";
- assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/v10/search/edge-tag-query";
- assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/search/model";
- assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/somecloudregion/some-cloud-owner";
- assertEquals("Get aai function name from " + uri, "cloud-infrastructure", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/v8/network/pnfs/pnf/ff4ca01orc/p-interfaces";
- assertEquals("Get aai function name from " + uri, "network", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/util/echo";
- assertEquals("Get aai function name from " + uri, "util", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/tools";
- assertEquals("Get aai function name from " + uri, "tools", authCore.getAuthPolicyFunctName(uri));
-
- uri = "/aai/v12/bulk/single-transaction";
- assertEquals("Get aai function name from " + uri, "bulk", authCore.getAuthPolicyFunctName(uri));
-
- }
-
- @Test
- public void validUsernameAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("testUser".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void validUsernameInvalidHttpMethodAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("testUser".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", ""));
- }
-
- @Test(expected = AAIUnrecognizedFunctionException.class)
- public void validUsernameInvalidFunctionInURIAuthTest() throws AAIUnrecognizedFunctionException {
- authCore.authorize("testUser".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "");
- }
-
- @Test
- public void invalidUsernameAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("invlaidTestUser".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void validUsernameIsTheExactWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("testWildcardId".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void validUsernameContainsTheWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("cn=blah, testWildcardId, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "", "aafWildCardIssuer"));
- }
-
- @Test
- public void validUsernameContainsTheWildcardIdInvalidIssuerAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, testWildcardId, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "", "invalidIssuer"));
- }
-
- @Test
- public void invalidUsernameContainsRegularUsernameAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, testUser, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void haProxyUsernameAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/util/echo", "GET", ""));
- }
-
- @Test
- public void haProxyUsernameInvalidFunctionAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void validUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testUser".toLowerCase()));
- }
-
- @Test
- public void validUsernameInvalidHttpMethodViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", "testUser".toLowerCase()));
- }
-
- @Test(expected = AAIUnrecognizedFunctionException.class)
- public void validUsernameInvalidFunctionInURIViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "testUser".toLowerCase());
- }
-
- @Test
- public void invalidUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "invlaidTestUser".toLowerCase()));
- }
-
- @Test
- public void validUsernameIsTheExactWildcardIdViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testWildcardId".toLowerCase()));
- }
-
- @Test
- public void validUsernameContainsTheWildcardIdViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "aafWildCardIssuer"));
- }
-
- @Test
- public void invalidUsernameContainsRegularUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testUser, O=".toLowerCase()));
- }
-
- @Test
- public void haProxyUsernameTwiceAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "ha-proxy-user".toLowerCase()));
- }
-
-
- @Test
- public void haProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/util/echo", "GET", "", "aafWildCardIssuer"));
- }
-
- @Test
- public void haProxyWildcardIdInvalidFunctionAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
- }
-
- @Test
- public void validUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testUser".toLowerCase(), "aafWildCardIssuer"));
- }
-
- @Test
- public void validUsernameInvalidHttpMethodViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", "testUser".toLowerCase()));
- }
-
- @Test(expected = AAIUnrecognizedFunctionException.class)
- public void validUsernameInvalidFunctionInURIViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "testUser".toLowerCase());
- }
-
- @Test
- public void invalidUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "invlaidTestUser".toLowerCase()));
- }
-
- @Test
- public void validUsernameIsTheExactWildcardIdViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testWildcardId".toLowerCase(), "aafWildCardIssuer"));
- }
-
- @Test
- public void validUsernameContainsTheWildcardIdViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "aafWildCardIssuer"));
- }
-
- @Test
- public void validUsernameContainsTheWildcardIdViaHaProxyWildcardIdInvalidIssuerAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "invalidIssuer"));
- }
-
- @Test
- public void invalidUsernameContainsRegularUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
- assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testUser, O=".toLowerCase()));
- }
+ private AAIAuthCore authCore;
+
+ @Before
+ public void setup(){
+ authCore = new AAIAuthCore("/aai");
+ }
+
+ @Test
+ public void getAuthPolicyFunctionNameTest() {
+
+ String uri = "/aai/v3/search/edge-tag-query";
+ assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/v10/search/edge-tag-query";
+ assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/search/model";
+ assertEquals("Get aai function name from " + uri, "search", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/somecloudregion/some-cloud-owner";
+ assertEquals("Get aai function name from " + uri, "cloud-infrastructure", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/v8/network/pnfs/pnf/ff4ca01orc/p-interfaces";
+ assertEquals("Get aai function name from " + uri, "network", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/util/echo";
+ assertEquals("Get aai function name from " + uri, "util", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/tools";
+ assertEquals("Get aai function name from " + uri, "tools", authCore.getAuthPolicyFunctName(uri));
+
+ uri = "/aai/v12/bulk/single-transaction";
+ assertEquals("Get aai function name from " + uri, "bulk", authCore.getAuthPolicyFunctName(uri));
+
+ }
+
+ @Test
+ public void validUsernameAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("testUser".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void validUsernameInvalidHttpMethodAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("testUser".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", ""));
+ }
+
+ @Test(expected = AAIUnrecognizedFunctionException.class)
+ public void validUsernameInvalidFunctionInURIAuthTest() throws AAIUnrecognizedFunctionException {
+ authCore.authorize("testUser".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "");
+ }
+
+ @Test
+ public void invalidUsernameAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("invlaidTestUser".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void validUsernameIsTheExactWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("testWildcardId".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void validUsernameContainsTheWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("cn=blah, testWildcardId, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "", "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void validUsernameContainsTheWildcardIdInvalidIssuerAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, testWildcardId, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "", "invalidIssuer"));
+ }
+
+ @Test
+ public void invalidUsernameContainsRegularUsernameAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, testUser, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void haProxyUsernameAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/util/echo", "GET", ""));
+ }
+
+ @Test
+ public void haProxyUsernameInvalidFunctionAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void validUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testUser".toLowerCase()));
+ }
+
+ @Test
+ public void validUsernameInvalidHttpMethodViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", "testUser".toLowerCase()));
+ }
+
+ @Test(expected = AAIUnrecognizedFunctionException.class)
+ public void validUsernameInvalidFunctionInURIViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "testUser".toLowerCase());
+ }
+
+ @Test
+ public void invalidUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "invlaidTestUser".toLowerCase()));
+ }
+
+ @Test
+ public void validUsernameIsTheExactWildcardIdViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testWildcardId".toLowerCase()));
+ }
+
+ @Test
+ public void validUsernameContainsTheWildcardIdViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void invalidUsernameContainsRegularUsernameViaHaProxyAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testUser, O=".toLowerCase()));
+ }
+
+ @Test
+ public void haProxyUsernameTwiceAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("ha-proxy-user".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "ha-proxy-user".toLowerCase()));
+ }
+
+
+ @Test
+ public void haProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/util/echo", "GET", "", "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void haProxyWildcardIdInvalidFunctionAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", ""));
+ }
+
+ @Test
+ public void validUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testUser".toLowerCase(), "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void validUsernameInvalidHttpMethodViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "POST", "testUser".toLowerCase()));
+ }
+
+ @Test(expected = AAIUnrecognizedFunctionException.class)
+ public void validUsernameInvalidFunctionInURIViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/badFunction/someUri", "PUT", "testUser".toLowerCase());
+ }
+
+ @Test
+ public void invalidUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "invlaidTestUser".toLowerCase()));
+ }
+
+ @Test
+ public void validUsernameIsTheExactWildcardIdViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "testWildcardId".toLowerCase(), "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void validUsernameContainsTheWildcardIdViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertTrue(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "aafWildCardIssuer"));
+ }
+
+ @Test
+ public void validUsernameContainsTheWildcardIdViaHaProxyWildcardIdInvalidIssuerAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testWildcardId, O=".toLowerCase(), "invalidIssuer"));
+ }
+
+ @Test
+ public void invalidUsernameContainsRegularUsernameViaHaProxyWildcardIdAuthTest() throws AAIUnrecognizedFunctionException {
+ assertFalse(authCore.authorize("cn=blah, ha-proxy-wildcard-id, O=".toLowerCase(), "/aai/v0/testFunction/someUri", "PUT", "cn=blah, testUser, O=".toLowerCase()));
+ }
}
diff --git a/aai-core/src/test/java/org/onap/aai/auth/AAIUserTest.java b/aai-core/src/test/java/org/onap/aai/auth/AAIUserTest.java
index 4d0e65a6..a90c7feb 100644
--- a/aai-core/src/test/java/org/onap/aai/auth/AAIUserTest.java
+++ b/aai-core/src/test/java/org/onap/aai/auth/AAIUserTest.java
@@ -26,28 +26,28 @@ import static org.junit.Assert.assertEquals;
public class AAIUserTest extends AAISetup {
- @Test
- public void testIsAuth() {
- AAIUser usr = new AAIUser("testUser");
- usr.addRole("testRole");
- usr.setUserAccess("auth", "GET");
- usr.setUserAccess("auth", "PUT");
- usr.setUserAccess("authentication", "PUT", "GET", "POST");
-
- assertEquals(true, usr.hasAccess("auth", "GET"));
- assertEquals(true, usr.hasAccess("auth", "PUT"));
- assertEquals(true, usr.hasAccess("authentication", "POST"));
- }
-
- @Test
- public void testIsNotAuth() {
- AAIUser usr = new AAIUser("testUser");
- usr.addRole("testRole");
-
- assertEquals(false, usr.hasAccess("auth", "GET"));
-
- usr.setUserAccess("auth", "GET");
- assertEquals(false, usr.hasAccess("auth", "PUT"));
- }
+ @Test
+ public void testIsAuth() {
+ AAIUser usr = new AAIUser("testUser");
+ usr.addRole("testRole");
+ usr.setUserAccess("auth", "GET");
+ usr.setUserAccess("auth", "PUT");
+ usr.setUserAccess("authentication", "PUT", "GET", "POST");
+
+ assertEquals(true, usr.hasAccess("auth", "GET"));
+ assertEquals(true, usr.hasAccess("auth", "PUT"));
+ assertEquals(true, usr.hasAccess("authentication", "POST"));
+ }
+
+ @Test
+ public void testIsNotAuth() {
+ AAIUser usr = new AAIUser("testUser");
+ usr.addRole("testRole");
+
+ assertEquals(false, usr.hasAccess("auth", "GET"));
+
+ usr.setUserAccess("auth", "GET");
+ assertEquals(false, usr.hasAccess("auth", "PUT"));
+ }
}