summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-07-06 16:37:36 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-07-09 14:07:58 +0100
commitdba5999ebf16a85a996f1f5502c2c154ac3f38b2 (patch)
tree189c48972b92213ae7b853ce6c100f52a196635b /testsuites
parentdcf8f703fdd07161c86231ecc4af0f25872a45f4 (diff)
Fixing Multi JVM Tests and sonar bugs
Change-Id: I02df58695b44d5768410a0eaccb090cda7eb85ba Issue-ID: POLICY-865 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java11
-rw-r--r--testsuites/integration/integration-context-test/src/test/resources/hazelcast/hazelcast.xml13
-rw-r--r--testsuites/integration/integration-context-test/src/test/resources/logback-test.xml76
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java12
4 files changed, 29 insertions, 83 deletions
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
index 7a3a29cc1..e2c2de97a 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
@@ -48,6 +48,7 @@ import org.onap.policy.apex.context.test.locking.ConcurrentContext;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
+import org.onap.policy.apex.model.utilities.ResourceUtils;
import org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters;
@@ -65,6 +66,11 @@ import com.hazelcast.config.Config;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestConcurrentContext {
+ private static final String HAZELCAST_CONFIG = "hazelcast.config";
+
+ private static final String JAVA_NET_PREFER_IPV4_STACK = "java.net.preferIPv4Stack";
+ private static final String HAZELCAST_XML_FILE = "src/test/resources/hazelcast/hazelcast.xml";
+
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(TestConcurrentContext.class);
@@ -89,8 +95,9 @@ public class TestConcurrentContext {
@BeforeClass
public static void configure() throws Exception {
- System.setProperty("java.net.preferIPv4Stack", "true");
- System.setProperty("hazelcast.config", "src/test/resources/hazelcast/hazelcast.xml");
+ System.setProperty(JAVA_NET_PREFER_IPV4_STACK, "true");
+ final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE);
+ System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation);
// The JGroups IP address must be set to a real (not loopback) IP address for Infinispan to
// work. IN order to ensure that all
diff --git a/testsuites/integration/integration-context-test/src/test/resources/hazelcast/hazelcast.xml b/testsuites/integration/integration-context-test/src/test/resources/hazelcast/hazelcast.xml
index d69f24b90..2918909c3 100644
--- a/testsuites/integration/integration-context-test/src/test/resources/hazelcast/hazelcast.xml
+++ b/testsuites/integration/integration-context-test/src/test/resources/hazelcast/hazelcast.xml
@@ -41,14 +41,23 @@
</interfaces>
</network>
<properties>
- <property name="hazelcast.icmp.enabled">true</property>
+ <property name="hazelcast.icmp.enabled">false</property>
<property name="hazelcast.logging.type">slf4j</property>
<!-- disable the hazelcast shutdown hook - prefer to control the shutdown
in code -->
<property name="hazelcast.shutdownhook.enabled">false</property>
<property name="hazelcast.graceful.shutdown.max.wait">60</property>
+ <property name="hazelcast.operation.generic.thread.count">1</property>
+ <property name="hazelcast.operation.thread.count">1</property>
+ <property name="hazelcast.clientengine.thread.count">1</property>
+ <property name="hazelcast.client.event.thread.count">1</property>
+ <property name="hazelcast.event.thread.count">1</property>
+ <property name="hazelcast.io.output.thread.count">1</property>
+ <property name="hazelcast.io.thread.count">1</property>
+ <property name="hazelcast.executor.client.thread.count">1</property>
+ <property name="hazelcast.clientengine.thread.count">1</property>
</properties>
<executor-service>
- <pool-size>16</pool-size>
+ <pool-size>2</pool-size>
</executor-service>
</hazelcast>
diff --git a/testsuites/integration/integration-context-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-context-test/src/test/resources/logback-test.xml
deleted file mode 100644
index 7fd818d4b..000000000
--- a/testsuites/integration/integration-context-test/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. 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.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
--->
-
-<configuration>
- <contextName>Apex</contextName>
- <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
- <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
-
- <!-- USE FOR STD OUT ONLY -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
- </encoder>
- </appender>
-
- <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <appender name="FILE"
- class="ch.qos.logback.core.FileAppender">
- <file>${LOG_DIR}/apex.log</file>
- <encoder>
- <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
- %logger{26} - %msg %n %ex{full}</pattern>
- </encoder>
- </appender>
-
- <appender name="CTXT_FILE"
- class="ch.qos.logback.core.FileAppender">
- <file>${LOG_DIR}/apex_ctxt.log</file>
- <encoder>
- <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
- %logger{26} - %msg %n %ex{full}</pattern>
- </encoder>
- </appender>
-
- <logger name="org.infinispan" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.ericsson.apex.context.monitoring" level="TRACE" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.ericsson.apex.context.monitoring" level="TRACE" additivity="false">
- <appender-ref ref="CTXT_FILE" />
- </logger>
-
- <logger name="org.jgroups" level="off" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <root level="info">
- <appender-ref ref="STDOUT" />
- </root>
-
-</configuration>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
index 0874d9827..8468b6d7f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
@@ -91,9 +91,15 @@ public class TestKafka2Kafka {
@AfterClass
public static void shutdownDummyKafkaServer() throws IOException {
- kafkaServer.shutdown();
- zkClient.close();
- zkServer.shutdown();
+ if (kafkaServer != null) {
+ kafkaServer.shutdown();
+ }
+ if (zkClient != null) {
+ zkClient.close();
+ }
+ if (zkServer != null) {
+ zkServer.shutdown();
+ }
}
@Test