aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-17 10:26:58 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-17 17:12:11 -0400
commite9b8aa0223e6f042c0533176ae8222fb061852de (patch)
treece5ac86f12a3430a688af34e5838c8be79504d12 /PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java
parent3c95fa7249cccc3d0eb3c9e89ba708a3167d41ba (diff)
Re-format source code
No longer need the onap-java-formatter.xml in the repo - just use command line to set path to it as this process is done manually anyway. Fixed missing javadoc, curly braces and variables names. One minor fix to remove redundant jump and then unnecessary lambda expression. Distance from usage - moved code. Fixed compilation error in PeCryptoUtils due to policy/common change. Fixed some test sources with consecutive capital letter in names. Updated licenses. Added some trivial code coverage. Issue-ID: POLICY-2145 Change-Id: I6c36650554e4fe31a3e71538d898535bc77e7e74 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java')
-rw-r--r--PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java46
1 files changed, 28 insertions, 18 deletions
diff --git a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java
index 2fa822a33..23060688d 100644
--- a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java
+++ b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/AAFClientTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* PolicyEngineUtils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed 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.
@@ -33,23 +33,33 @@ import org.onap.policy.utils.AAFPolicyException;
public class AAFClientTest {
AAFPolicyClient afClient;
String pass = "test";
-
+ String user = "test";
+
+ /**
+ * setUp.
+ *
+ * @throws AAFPolicyException AAFPolicyException
+ */
@Before
- public void setUp() throws AAFPolicyException{
+ public void setUp() throws AAFPolicyException {
Properties props = new Properties();
props.setProperty("ENVIRONMENT", "TEST");
props.setProperty("aafClient.impl.className", AAFPolicyClientImpl.class.getName());
- afClient = AAFPolicyClient.getInstance(props);
+ afClient = AAFPolicyClient.getInstance(props);
}
-
+
@Test
- public void invalidClientTest() throws AAFPolicyException{
- assertFalse(afClient.checkAuth("test", pass));
- assertFalse(afClient.checkPerm("test", pass, "policy-engine.config", "*", "*"));
+ public void invalidClientTest() throws AAFPolicyException {
+ assertFalse(afClient.checkPerm(null, null, null, null, null));
+ assertFalse(afClient.checkPerm(user, null, null, null, null));
+ assertFalse(afClient.checkAuth(user, pass));
+ assertFalse(afClient.checkAuth(null, pass));
+ assertFalse(afClient.checkAuth(user, null));
+ assertFalse(afClient.checkPerm(user, pass, "policy-engine.config", "*", "*"));
Properties props = new Properties();
props.setProperty("aafClient.impl.className", AAFPolicyClientImpl.class.getName());
- afClient = AAFPolicyClient.getInstance(props);
- assertFalse(afClient.checkAuth("test", pass));
+ afClient = AAFPolicyClient.getInstance(props);
+ assertFalse(afClient.checkAuth(user, pass));
props.setProperty("ENVIRONMENT", "PROD");
props.setProperty("aafClient.impl.className", AAFPolicyClientImpl.class.getName());
afClient.updateProperties(props);
@@ -63,14 +73,14 @@ public class AAFClientTest {
assertFalse(afClient.checkAuth("test", pass));
assertFalse(afClient.checkAuthPerm("test", pass, "decision", "*", "read"));
}
-
+
@Test(expected = AAFPolicyException.class)
- public void invalidAAFInstance() throws AAFPolicyException{
+ public void invalidAafInstance() throws AAFPolicyException {
Properties props = new Properties();
props.setProperty("aafClient.impl.className", "errorClass");
- afClient = AAFPolicyClient.getInstance(props);
+ afClient = AAFPolicyClient.getInstance(props);
}
-
+
@Test(expected = AAFPolicyException.class)
public void testPropNullException() throws AAFPolicyException {
afClient.updateProperties(null);
@@ -80,9 +90,9 @@ public class AAFClientTest {
public void testPropEmptyException() throws AAFPolicyException {
afClient.updateProperties(new Properties());
}
-
+
@Test(expected = AAFPolicyException.class)
- public void testAAFException() throws AAFPolicyException{
+ public void testAafException() throws AAFPolicyException {
new AAFPolicyException();
new AAFPolicyException("error", new Exception());
throw new AAFPolicyException("error", new Exception(), false, false);