summaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2019-02-19 17:09:50 +0000
committermark.j.leonard <mark.j.leonard@gmail.com>2019-03-12 12:20:57 +0000
commit6b74f2a06df4fd3bfb9f1b368f46db28f1e95ecb (patch)
tree010fa6e7fc90b69b879a65953c03f5b40642fcc4 /src/test/java/org
parente6a097ef27b0a6438b51915a8821fc0da3787036 (diff)
Simplify JSON auth policy loading code
If the JSON filename or path cannot be located then attempt to resolve the file location relative to firstly CONFIG_HOME and then CONFIG_HOME/auth Change-Id: Ic8d6c7d6e129b09ac7fa72d733768d941826185b Issue-ID: AAI-2057 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java b/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java
index 1b1a5bb..b81d9ed 100644
--- a/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java
+++ b/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java
@@ -53,11 +53,10 @@ public class MicroServiceAuthTest {
}
private static final String VALID_ADMIN_USER = "cn=common-name, ou=org-unit, o=org, l=location, st=state, c=us";
- private static final String authPolicyFile = "auth_policy.json";
+ private static final String authPolicyFile = "auth/auth_policy.json";
/**
- * Temporarily invalidate the default policy file and then try to initialise the authorisation class using the name
- * of a policy file that does not exist.
+ * Initialize the authorization class using the name of a policy file that does not exist.
*
* @throws AAIAuthException
* if the authorization policy file cannot be loaded
@@ -70,6 +69,19 @@ public class MicroServiceAuthTest {
}
/**
+ * Initialize the authorization class using a null policy file name.
+ *
+ * @throws AAIAuthException
+ * if the authorization policy file cannot be loaded
+ */
+ @Test(expected = AAIAuthException.class)
+ public void testNullPolicyFile() throws AAIAuthException {
+ ValidationServiceAuthConfig authConfig = new ValidationServiceAuthConfig();
+ authConfig.setAuthPolicyFile(null);
+ new AAIMicroServiceAuth(authConfig);
+ }
+
+ /**
* Test loading of a temporary file created with the specified roles.
*
* @throws IOException