diff options
author | Liam Fallon <liam.fallon@ericsson.com> | 2018-07-10 09:49:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-10 09:49:50 +0000 |
commit | da923d791ae2e3ca67dd9711e7c3f173b500abce (patch) | |
tree | 0261a310fd26aa67619572895c7107658ccc2223 /testsuites | |
parent | 197a07f0e8b48c2710984176c8ed9d78f0b50335 (diff) | |
parent | dba5999ebf16a85a996f1f5502c2c154ac3f38b2 (diff) |
Merge "Fixing Multi JVM Tests and sonar bugs"
Diffstat (limited to 'testsuites')
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 |