summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineParser.java41
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java13
-rw-r--r--testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx14
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java3
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/TestEventBase.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/BaseEventTest.java)4
10 files changed, 42 insertions, 48 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineParser.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineParser.java
index 05066adb4..c9316cbd2 100644
--- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineParser.java
+++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CommandLineParser.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ public class CommandLineParser {
private ArrayList<String> mergeQuotes(final ArrayList<String> wordsSplitOnQuotes) {
final ArrayList<String> wordsWithQuotesMerged = new ArrayList<>();
- int loopWordIndex = 0;
+ int loopWordIndex;
for (int wordIndex = 0; wordIndex < wordsSplitOnQuotes.size(); wordIndex = loopWordIndex) {
loopWordIndex = mergeQuote(wordsSplitOnQuotes, wordsWithQuotesMerged, wordIndex);
}
@@ -140,9 +140,7 @@ public class CommandLineParser {
// Split on equals character
final ArrayList<String> splitWords = splitOnChar(word, '=');
- for (final String splitWord : splitWords) {
- wordsSplitOnEquals.add(splitWord);
- }
+ wordsSplitOnEquals.addAll(splitWords);
}
return wordsSplitOnEquals;
@@ -158,7 +156,7 @@ public class CommandLineParser {
private ArrayList<String> mergeEquals(final ArrayList<String> wordsSplitOnEquals) {
final ArrayList<String> wordsWithEqualsMerged = new ArrayList<>();
- int loopWordIndex = 0;
+ int loopWordIndex;
for (int wordIndex = 0; wordIndex < wordsSplitOnEquals.size(); wordIndex = loopWordIndex) {
loopWordIndex = wordIndex;
@@ -315,39 +313,30 @@ public class CommandLineParser {
// The first word must be alphanumeric, that is a command
if (!commandWords.get(0).matches("^[a-zA-Z0-9]*$")) {
throw new CommandLineException(
- "first command word is not alphanumeric or is not a command: " + commandWords.get(0));
+ "first command word is not alphanumeric or is not a command: " + commandWords.get(0));
}
// Now check that we have a sequence of commands at the beginning
int currentWordPos = 0;
- while (currentWordPos < commandWords.size()) {
- if (commandWords.get(currentWordPos).matches("^[a-zA-Z0-9]*$")) {
- currentWordPos++;
- } else {
+ for (; currentWordPos < commandWords.size(); currentWordPos++) {
+ if (!commandWords.get(currentWordPos).matches("^[a-zA-Z0-9]*$")) {
break;
}
}
- while (currentWordPos < commandWords.size()) {
- // From now on we should have a sequence of parameters with arguments delimited by a
- // single '=' character
- if (currentWordPos < commandWords.size() - 1 || logicBlock == null) {
- // No logic block
- if (commandWords.get(currentWordPos).matches("^[a-zA-Z0-9]+=[a-zA-Z0-9/\"].*$")) {
- currentWordPos++;
- } else {
- throw new CommandLineException(
- "command argument is not properly formed: " + commandWords.get(currentWordPos));
- }
- } else {
- // Logic block
+ for (; currentWordPos < commandWords.size(); ++currentWordPos) {
+ if (currentWordPos == commandWords.size() - 1 && logicBlock != null) {
+ // for the last command, if the command ends with = and there is a Logic block
if (commandWords.get(currentWordPos).matches("^[a-zA-Z0-9]+=")) {
commandWords.set(currentWordPos, commandWords.get(currentWordPos) + logicBlock);
- currentWordPos++;
} else {
throw new CommandLineException(
- "command argument is not properly formed: " + commandWords.get(currentWordPos));
+ "command argument is not properly formed: " + commandWords.get(currentWordPos));
}
+ } else if (!commandWords.get(currentWordPos).matches("^[a-zA-Z0-9]+=[a-zA-Z0-9/\"].*$")) {
+ // Not a last command, or the last command, but there is no logic block - wrong pattern
+ throw new CommandLineException(
+ "command argument is not properly formed: " + commandWords.get(currentWordPos));
}
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
index 5531d9704..67b7cb871 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 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=========================================================
*/
@@ -50,7 +51,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable
// Indicates that text block processing starts at the first block of text
private final boolean delimiterAtStart;
- private boolean blockEndTokenUsed = false;
+ private boolean blockEndTokenUsed;
// The thread used to read the text from the stream
private Thread textConsumputionThread;
@@ -170,9 +171,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable
*/
@Override
public void run() {
- final BufferedReader textReader = new BufferedReader(new InputStreamReader(inputStream));
-
- try {
+ try (BufferedReader textReader = new BufferedReader(new InputStreamReader(inputStream))) {
// Read the input line by line until we see end of file on the stream
String line;
while ((line = textReader.readLine()) != null) {
diff --git a/testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx b/testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx
index c958bb70d..7a8777f17 100644
--- a/testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx
+++ b/testsuites/apex-pdp-stability/src/main/resources/apexPdpStabilityTestPlan.jmx
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
ONAP Apex-PDP
================================================================================
- Copyright (C) 2020 Nordix Foundation.All rights reserved.
+ Copyright (C) 2020-2021 Nordix Foundation.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.
@@ -2391,7 +2391,7 @@
&quot;carrierTechnology&quot;: &quot;RESTCLIENT&quot;,&#xd;
&quot;parameterClassName&quot;: &quot;org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters&quot;,&#xd;
&quot;parameters&quot;: {&#xd;
- &quot;url&quot;: &quot;https://message-router:3905/events/POLICY_CL_MGT&quot;&#xd;
+ &quot;url&quot;: &quot;https://message-router:3905/events/POLICY-PDP-PAP&quot;&#xd;
}&#xd;
},&#xd;
&quot;eventProtocolParameters&quot;: {&#xd;
@@ -2524,7 +2524,7 @@
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
- <stringProp name="49586">200</stringProp>
+ <stringProp name="49588">202</stringProp>
</collectionProp>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
@@ -2660,7 +2660,7 @@ if (prev.getResponseCode() == &apos;200&apos;) {
</elementProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${DMAAP_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">http</stringProp>
+ <stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/events/unauthenticated.DCAE_CL_OUTPUT</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
@@ -2697,9 +2697,9 @@ if (prev.getResponseCode() == &apos;200&apos;) {
</elementProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${DMAAP_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">http</stringProp>
+ <stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
- <stringProp name="HTTPSampler.path">/events/POLICY_CL_MGT/cg1/c1?timeout=30000</stringProp>
+ <stringProp name="HTTPSampler.path">/events/POLICY-PDP-PAP/cg1/c1?timeout=30000</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
@@ -2803,7 +2803,7 @@ if (prev.getResponseCode() == &apos;200&apos;) {
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
- <stringProp name="49586">200</stringProp>
+ <stringProp name="49588">202</stringProp>
</collectionProp>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java
index 07b63770d..cf6efdd91 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMimoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class AsyncEventMimoTest extends BaseEventTest {
+public class AsyncEventMimoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutMulti0.json",
"target/examples/events/SampleDomain/EventsOutMulti1.json",
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java
index d7a462290..2da4f5bd9 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventMisoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class AsyncEventMisoTest extends BaseEventTest {
+public class AsyncEventMisoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutSingle.json"
};
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java
index c176b69f2..5e63b38ba 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSimoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class AsyncEventSimoTest extends BaseEventTest {
+public class AsyncEventSimoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutMulti0.json",
"target/examples/events/SampleDomain/EventsOutMulti1.json",
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java
index 64b4b3850..412d4be06 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/AsyncEventSisoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class AsyncEventSisoTest extends BaseEventTest {
+public class AsyncEventSisoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutSingle.json"
};
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java
index 95e589bf4..482656071 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventMimoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class SyncEventMimoTest extends BaseEventTest {
+public class SyncEventMimoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutMulti0.json",
"target/examples/events/SampleDomain/EventsOutMulti1.json",
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java
index 1d536cea9..596bcbc25 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/SyncEventSisoTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@ import java.io.File;
import org.junit.After;
import org.junit.Test;
-public class SyncEventSisoTest extends BaseEventTest {
+public class SyncEventSisoTest extends TestEventBase {
private final String[] outFilePaths = {
"target/examples/events/SampleDomain/EventsOutSingle.json"
};
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/BaseEventTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/TestEventBase.java
index 4e7636cde..39603c540 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/BaseEventTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/syncasync/TestEventBase.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.main.ApexMain;
import org.onap.policy.common.utils.resources.TextFileUtils;
-public class BaseEventTest {
+public class TestEventBase {
private static final long TIME_OUT_IN_MS = 10000;
private void waitForOutFiles(final String[] expectedFileNames, final long expectedFileSize) throws IOException {