aboutsummaryrefslogtreecommitdiffstats
path: root/auth/cli-editor/src/test/java
diff options
context:
space:
mode:
authorJohnKeeney <John.Keeney@est.tech>2019-07-01 14:46:49 +0000
committerJohnKeeney <John.Keeney@est.tech>2019-07-01 14:46:49 +0000
commitd83a82743070369878ffde4b9b4f9001a0884c5b (patch)
tree2840f803e197cbf00c742f9522a051d7286beca8 /auth/cli-editor/src/test/java
parentc4baac8a79b0ca6340693ae47f9c424f3612e3bd (diff)
ApexPDP: Adding support to omit the (context) albums entry in an apex
policy model if it is empty. Implemented as a pair of JAXB XMLAdaters Updated copyright, fixed somecheckstyle issues, refactored affected tests & Merge Issue-ID: POLICY-1802 Change-Id: Id68d9a524700f44c164939b7533f2d511b591e36 Signed-off-by: JohnKeeney <John.Keeney@est.tech>
Diffstat (limited to 'auth/cli-editor/src/test/java')
-rw-r--r--auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorOptionsTest.java16
-rw-r--r--auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java21
2 files changed, 22 insertions, 15 deletions
diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorOptionsTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorOptionsTest.java
index 227cb23f5..5e0501288 100644
--- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorOptionsTest.java
+++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorOptionsTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -28,7 +29,6 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
-
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.utilities.TextFileUtils;
@@ -67,7 +67,7 @@ public class CommandLineEditorOptionsTest {
final int modelCharCount = modelString.replaceAll("\\s+", "").length();
assertEquals(1204, logCharCount);
- assertEquals(2924, modelCharCount);
+ assertEquals(2561, modelCharCount);
tempLogFile.delete();
tempModelFile.delete();
@@ -164,7 +164,7 @@ public class CommandLineEditorOptionsTest {
final int modelCharCount = modelString.replaceAll("\\s+", "").length();
assertEquals(0, logCharCount);
- assertEquals(2924, modelCharCount);
+ assertEquals(2561, modelCharCount);
tempLogFile.delete();
tempModelFile.delete();
@@ -249,7 +249,7 @@ public class CommandLineEditorOptionsTest {
final int tempModelFileInCharCount = tempModelFileInString.replaceAll("\\s+", "").length();
assertEquals(1204, tempLogFileInCharCount);
- assertEquals(2924, tempModelFileInCharCount);
+ assertEquals(2561, tempModelFileInCharCount);
final String[] cliArgsOut = new String[] {"-i", tempModelFileIn.getAbsolutePath(), "-c",
"src/main/resources/examples/scripts/ShellPolicyModelAddSchema.apex", "-l",
@@ -267,7 +267,7 @@ public class CommandLineEditorOptionsTest {
final int tempModelFileOutCharCount = tempModelFileOutString.replaceAll("\\s+", "").length();
assertEquals(1154, tempLogFileOutCharCount);
- assertEquals(3356, tempModelFileOutCharCount);
+ assertEquals(2993, tempModelFileOutCharCount);
tempLogFileIn.delete();
tempModelFileIn.delete();
diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java
index 35b725f2a..c863461ef 100644
--- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java
+++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorScriptingTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -26,7 +27,6 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.net.URL;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -77,7 +77,7 @@ public class CommandLineEditorScriptingTest {
}
/**
- * Test sample Fuzzy LB policy script.
+ * Test sample FLB policy script.
*
* @throws IOException Signals that an I/O exception has occurred.
* @throws ApexModelException if there is an Apex error
@@ -94,18 +94,25 @@ public class CommandLineEditorScriptingTest {
final AxPolicyModel writtenModel = modelReader.read(writtenModelUrl.openStream());
final URL compareModelUrl =
- ResourceUtils.getLocalFile("src/test/resources/compare/FuzzyPolicyModel_Compare.json");
+ ResourceUtils.getLocalFile("src/test/resources/compare/FLBPolicyModel_Compare.json");
final AxPolicyModel compareModel = modelReader.read(compareModelUrl.openStream());
+ final URL compareModelNoAlbumsUrl =
+ ResourceUtils.getLocalFile("src/test/resources/compare/FLBPolicyModel_noAlbums_Compare.json");
+ final AxPolicyModel compareNoAlbumsModel = modelReader.read(compareModelNoAlbumsUrl.openStream());
+
// Ignore key info UUIDs
writtenModel.getKeyInformation().getKeyInfoMap().clear();
compareModel.getKeyInformation().getKeyInfoMap().clear();
+ compareNoAlbumsModel.getKeyInformation().getKeyInfoMap().clear();
assertTrue(writtenModel.equals(compareModel));
+ assertTrue(writtenModel.equals(compareNoAlbumsModel));
+ assertTrue(compareModel.equals(compareNoAlbumsModel));
}
/**
- * Test sample Fuzzy LB map policy script.
+ * Test sample FLB map policy script.
*
* @throws IOException Signals that an I/O exception has occurred.
* @throws ApexModelException if there is an Apex error