From cb768ce12516415276ee370112a837014cb8c37c Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Thu, 12 Jul 2018 12:47:09 +0100 Subject: Adding Benchmark module Change-Id: I4817580bf53bbf46b6890b70d49c8a2edabca749 Issue-ID: POLICY-865 Signed-off-by: waqas.ikram --- .../test/common/model/EvalDomainModelFactory.java | 2 +- .../test/common/model/java/EvalTask_Logic.java | 7 +- .../test/common/model/jython/EvalTask_Logic.jython | 6 +- .../integration-context-metrics/pom.xml | 71 --- .../context/metrics/ConcurrentContextMetrics.java | 525 ----------------- .../metrics/ConcurrentContextMetricsJVM.java | 212 ------- .../metrics/ConcurrentContextMetricsJVMThread.java | 187 ------ .../metrics/ConcurrentContextMetricsThread.java | 170 ------ .../apex/plugins/context/metrics/package-info.java | 27 - .../apex/plugins/context/metrics/TestMetrics.java | 57 -- .../src/test/resources/hazelcast/hazelcast.xml | 643 --------------------- .../src/test/resources/infinispan/infinispan.xml | 42 -- .../integration/integration-executor-test/pom.xml | 2 +- testsuites/integration/pom.xml | 26 +- 14 files changed, 11 insertions(+), 1966 deletions(-) delete mode 100644 testsuites/integration/integration-context-metrics/pom.xml delete mode 100644 testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java delete mode 100644 testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVM.java delete mode 100644 testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVMThread.java delete mode 100644 testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsThread.java delete mode 100644 testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java delete mode 100644 testsuites/integration/integration-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java delete mode 100644 testsuites/integration/integration-context-metrics/src/test/resources/hazelcast/hazelcast.xml delete mode 100644 testsuites/integration/integration-context-metrics/src/test/resources/infinispan/infinispan.xml (limited to 'testsuites/integration') diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java index 65d49f026..83a4ccc76 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java @@ -354,7 +354,7 @@ public class EvalDomainModelFactory { final AxTask eTask = new AxTask(new AxArtifactKey("Task_Event_0", "0.0.1")); eTask.duplicateInputFields(event0000.getParameterMap()); eTask.duplicateOutputFields(event0001.getParameterMap()); - final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), "TaskLogic", (justOneLang == null ? "JRUBY" : justOneLang), logicReader); + final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), "TaskLogic", (justOneLang == null ? "JYTHON" : justOneLang), logicReader); eAxLogic.setLogic( eAxLogic.getLogic().replaceAll("", "Event").replaceAll("", eTask.getKey().getName()).replaceAll("", "1")); eTask.setTaskLogic(eAxLogic); diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java index f86107186..f4fa533f8 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java @@ -28,10 +28,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; /** * The Class EvalTask_Logic is default evaluation task logic in Java. */ -//CHECKSTYLE:OFF: checkstyle:typeNames public class EvalTask_Logic { - // CHECKSTYLE:ON: checkstyle:typeNames - private static int stateNo = 0; /** * Gets the event. @@ -43,13 +40,11 @@ public class EvalTask_Logic { public boolean getEvent(final TaskExecutionContext executor) throws ApexException { executor.logger.debug(executor.subject.getId()); executor.logger.debug(executor.inFields.toString()); - System.err.println(executor.inFields); executor.outFields.putAll(executor.inFields); final Date timeNow = new Date(); - executor.outFields.put("State" + (stateNo + 1) + "Timestamp", timeNow.getTime()); + executor.outFields.put("State3Timestamp", timeNow.getTime()); executor.logger.debug(executor.outFields.toString()); - stateNo++; return true; } } diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython index bc803ebf2..aa6525673 100644 --- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython +++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython @@ -19,18 +19,14 @@ #------------------------------------------------------------------------------- from java.lang import Boolean -from java.lang import Byte from java.lang import Long from java.util import Date executor.logger.debug('id: ' + executor.subject.id) executor.logger.debug('inFields: ' + executor.inFields.toString()) - -executor.outFields = executor.createOutgoingEvent(outEvent) executor.outFields.putAll(executor.inFields) -timeValue = Long(Date().getTime()); -executor.outFields["StateTimestamp"] = timeValue +executor.outFields["StateTimestamp"] = Long(Date().getTime()) executor.logger.debug('outFields: ' + executor.outFields.toString()) returnValue = Boolean.TRUE diff --git a/testsuites/integration/integration-context-metrics/pom.xml b/testsuites/integration/integration-context-metrics/pom.xml deleted file mode 100644 index 47a1083c6..000000000 --- a/testsuites/integration/integration-context-metrics/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.onap.policy.apex-pdp.testsuites.integration - integration - 2.0.0-SNAPSHOT - - integration-context-metrics - ${project.artifactId} - [${project.parent.artifactId}] module to calculate metrics using various plugins - - - - org.onap.policy.apex-pdp.core - core-infrastructure - ${project.version} - - - org.onap.policy.apex-pdp.context - context-test-utils - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.context-distribution - context-distribution-hazelcast - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.context-distribution - context-distribution-infinispan - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.context-locking - context-locking-curator - ${project.version} - - - org.onap.policy.apex-pdp.plugins.plugins-context.context-locking - context-locking-hazelcast - ${project.version} - - - org.apache.curator - curator-test - 3.2.0 - test - - - \ No newline at end of file diff --git a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java b/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java deleted file mode 100644 index cbe06ed57..000000000 --- a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java +++ /dev/null @@ -1,525 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.policy.apex.plugins.context.metrics; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.onap.policy.apex.context.ContextAlbum; -import org.onap.policy.apex.context.ContextException; -import org.onap.policy.apex.context.Distributor; -import org.onap.policy.apex.context.impl.distribution.DistributorFactory; -import org.onap.policy.apex.context.parameters.ContextParameters; -import org.onap.policy.apex.context.parameters.DistributorParameters; -import org.onap.policy.apex.context.parameters.LockManagerParameters; -import org.onap.policy.apex.context.test.concepts.TestContextLongItem; -import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; -import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters; -import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManagerParameters; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class concurrentContextMetrics tests concurrent use of context. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ConcurrentContextMetrics { - private static final int NUM_ARGS = 8; - private static final int ARG_LABEL = 0; - private static final int ARG_JVM_COUNT = 1; - private static final int ARG_THREAD_COUNT = 2; - private static final int ARG_ITERATIONS = 3; - private static final int ARG_ARRAY_SIZE = 4; - private static final int ARG_LOCK_TYPE = 5; - private static final int ARG_ZOOKEEPER_ADDRESS = 6; - private static final int ARG_INTERACTIVE = 7; - - private static final int TIME_10_MS = 10; - - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextMetrics.class); - - // Test parameters - private String testLabel = null; - private int jvmCount = -1; - private int threadCount = -1; - private int threadLoops = -1; - private int longArraySize = -1; - private int lockType = -1; - private String zookeeperAddress = null; - private long total = -1; - private boolean interactive = false; - - // The context distributor and map used by each test - private Distributor contextDistributor = null; - private ContextAlbum lTypeAlbum = null; - - private final DateFormat dateFormat = new SimpleDateFormat("yyyy,MM,dd,HH,mm,ss,S"); - - /** - * The main method. - * - * @param args the args - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - public static void main(final String[] args) throws ApexModelException, IOException, ApexException { - if (args.length != NUM_ARGS) { - System.err.println( - "usage: ConcurrentContextMetrics testLabel jvmCount threadCount threadLoops longArraySize lockType zookeeperAddress interactive"); - return; - } - // @formatter:off - final ConcurrentContextMetrics concurrentContextMetrics = new ConcurrentContextMetrics( - args[ARG_LABEL], - Integer.valueOf(args[ARG_JVM_COUNT]), - Integer.valueOf(args[ARG_THREAD_COUNT]), - Integer.valueOf(args[ARG_ITERATIONS]), - Integer.valueOf(args[ARG_ARRAY_SIZE]), - Integer.valueOf(args[ARG_LOCK_TYPE]), - args[ARG_ZOOKEEPER_ADDRESS], - Boolean.valueOf(args[ARG_INTERACTIVE])); - // @formatter:on - - concurrentContextMetrics.concurrentContextMetricsJVMLocal(); - concurrentContextMetrics.concurrentContextMetricsCurator(); - concurrentContextMetrics.concurrentContextMetricsHazelcast(); - concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJVMHazelcastLock(); - concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJVMHazelcastlock(); - concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJVMCuratorLock(); - concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJVMCuratorLock(); - } - - /** - * The Constructor. - * - * @param testLabel the test label - * @param jvmCount the jvm count - * @param threadCount the thread count - * @param threadLoops the thread loops - * @param longArraySize the long array size - * @param lockType the lock type - * @param zookeeperAddress the zookeeper address - * @param interactive the interactive - */ - // CHECKSTYLE:OFF: checkstyle:parameterNumber - public ConcurrentContextMetrics(final String testLabel, final int jvmCount, final int threadCount, - final int threadLoops, final int longArraySize, final int lockType, final String zookeeperAddress, - final boolean interactive) { - // CHECKSTYLE:ON: checkstyle:parameterNumber - super(); - this.testLabel = testLabel; - this.jvmCount = jvmCount; - this.threadCount = threadCount; - this.threadLoops = threadLoops; - this.longArraySize = longArraySize; - this.lockType = lockType; - this.zookeeperAddress = zookeeperAddress; - this.interactive = interactive; - } - - /** - * Concurrent context metrics JVM local. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsJVMLocal() throws ApexModelException, IOException, ApexException { - if (jvmCount != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsJVMLocalVarSet metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters() - .setPluginClass(DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - contextParameters.getLockManagerParameters() - .setPluginClass(LockManagerParameters.DEFAULT_LOCK_MANAGER_PLUGIN_CLASS); - runConcurrentContextMetrics("JVMLocal"); - - LOGGER.debug("Ran concurrentContextMetricsJVMLocalVarSet metrics"); - } - - /** - * Concurrent context metrics hazelcast. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsHazelcast() throws ApexModelException, IOException, ApexException { - if (jvmCount != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsHazelcast metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters() - .setPluginClass(DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - contextParameters.getLockManagerParameters() - .setPluginClass("org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager"); - runConcurrentContextMetrics("Hazelcast"); - - LOGGER.debug("Ran concurrentContextMetricsHazelcast metrics"); - } - - /** - * Concurrent context metrics curator. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsCurator() throws ApexModelException, IOException, ApexException { - if (jvmCount != 1) { - return; - } - - LOGGER.debug("Running concurrentContextMetricsCurator metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters() - .setPluginClass(DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass("org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager"); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - runConcurrentContextMetrics("Curator"); - - LOGGER.debug("Ran concurrentContextMetricsCurator metrics"); - } - - /** - * Concurrent context metrics hazelcast multi JVM hazelcast lock. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsHazelcastMultiJVMHazelcastLock() - throws ApexModelException, IOException, ApexException { - LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass( - "org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor"); - contextParameters.getLockManagerParameters() - .setPluginClass("org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager"); - runConcurrentContextMetrics("HazelcastMultiJVMHazelcastLock"); - - LOGGER.debug("Ran concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics"); - } - - /** - * Concurrent context metrics infinispan multi JVM hazelcastlock. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsInfinispanMultiJVMHazelcastlock() - throws ApexModelException, IOException, ApexException { - LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass( - "org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor"); - contextParameters.getLockManagerParameters() - .setPluginClass("org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager"); - - final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - contextParameters.setDistributorParameters(infinispanParameters); - - runConcurrentContextMetrics("InfinispanMultiJVMHazelcastlock"); - - LOGGER.debug("Ran concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics"); - } - - /** - * Concurrent context metrics infinispan multi JVM curator lock. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsInfinispanMultiJVMCuratorLock() - throws ApexModelException, IOException, ApexException { - LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass( - "org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor"); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass("org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager"); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - contextParameters.setDistributorParameters(infinispanParameters); - - runConcurrentContextMetrics("InfinispanMultiJVMCuratorLock"); - - LOGGER.debug("Ran concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics"); - } - - /** - * Concurrent context metrics hazelcast multi JVM curator lock. - * - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void concurrentContextMetricsHazelcastMultiJVMCuratorLock() - throws ApexModelException, IOException, ApexException { - LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics . . ."); - - final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass( - "org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor"); - - final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass("org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager"); - contextParameters.setLockManagerParameters(curatorParameters); - curatorParameters.setZookeeperAddress(zookeeperAddress); - - runConcurrentContextMetrics("HazelcastMultiJVMCuratorLock"); - - LOGGER.debug("Ran concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics"); - } - - /** - * Run concurrent context metrics. - * - * @param testName the test name - * @throws ApexModelException the apex model exception - * @throws IOException the IO exception - * @throws ApexException the apex exception - */ - private void runConcurrentContextMetrics(final String testName) - throws ApexModelException, IOException, ApexException { - total = -1; - outMetricLine(testName, "Init"); - - try { - setupContext(); - } catch (final Exception e) { - e.printStackTrace(); - throw e; - } - - outMetricLine(testName, "Start"); - - Thread[] threadArray; - - // Check if we have a single JVM or multiple JVMs - int runningThreadCount = -1; - if (jvmCount == 1) { - threadArray = new Thread[threadCount]; - - // Run everything in this JVM - for (int t = 0; t < threadCount; t++) { - threadArray[t] = - new Thread(new ConcurrentContextMetricsThread(0, t, threadLoops, longArraySize, lockType)); - threadArray[t].setName(testLabel + "_" + testName + ":concurrentContextMetricsThread_0_" + t); - threadArray[t].start(); - } - - outMetricLine(testName, "Running"); - runningThreadCount = threadCount; - } else { - threadArray = new Thread[jvmCount]; - - final ConcurrentContextMetricsJVMThread[] jvmArray = new ConcurrentContextMetricsJVMThread[jvmCount]; - // Spawn JVMs to run the tests - for (int j = 0; j < jvmCount; j++) { - jvmArray[j] = new ConcurrentContextMetricsJVMThread(testLabel + "_" + testName, j, threadCount, - threadLoops, longArraySize, lockType); - threadArray[j] = new Thread(jvmArray[j]); - threadArray[j].setName(testLabel + "_" + testName + ":concurrentContextMetricsJVMThread_" + j); - threadArray[j].start(); - } - - boolean allReadyToGo; - do { - ThreadUtilities.sleep(TIME_10_MS); - allReadyToGo = true; - for (int j = 0; j < jvmCount; j++) { - if (!jvmArray[j].isReadyToGo()) { - allReadyToGo = false; - break; - } - } - } while (!allReadyToGo); - - outMetricLine(testName, "Ready"); - if (interactive) { - System.in.read(); - } - outMetricLine(testName, "Running"); - - for (int j = 0; j < jvmCount; j++) { - jvmArray[j].offYouGo(); - } - - boolean allFinished; - do { - ThreadUtilities.sleep(TIME_10_MS); - allFinished = true; - for (int j = 0; j < jvmCount; j++) { - if (!jvmArray[j].isAllFinished()) { - allFinished = false; - break; - } - } - } while (!allFinished); - - outMetricLine(testName, "Completed"); - - verifyContext(testName); - - for (int j = 0; j < jvmCount; j++) { - jvmArray[j].finishItOut(); - } - - runningThreadCount = jvmCount; - } - - boolean allFinished; - do { - ThreadUtilities.sleep(TIME_10_MS); - allFinished = true; - for (int i = 0; i < runningThreadCount; i++) { - if (threadArray[i].isAlive()) { - allFinished = false; - break; - } - } - } while (!allFinished); - - if (jvmCount == 1) { - outMetricLine(testName, "Completed"); - verifyContext(testName); - } - - clearContext(testName); - } - - /** - * Setup context. - * - * @throws ContextException the context exception - */ - private void setupContext() throws ContextException { - final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1"); - contextDistributor = new DistributorFactory().getDistributor(distributorKey); - - final AxArtifactKey[] usedArtifactStackArray = {new AxArtifactKey("testC-top", "0.0.1"), - new AxArtifactKey("testC-next", "0.0.1"), new AxArtifactKey("testC-bot", "0.0.1")}; - - final AxContextModel albumsModel = TestContextAlbumFactory.createMultiAlbumsContextModel(); - contextDistributor.registerModel(albumsModel); - - lTypeAlbum = contextDistributor.createContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1")); - assert (lTypeAlbum != null); - lTypeAlbum.setUserArtifactStack(usedArtifactStackArray); - - for (int i = 0; i < longArraySize; i++) { - final String longKey = Integer.toString(i); - final TestContextLongItem longItem = new TestContextLongItem(); - longItem.setLongValue(0); - lTypeAlbum.put(longKey, longItem); - } - } - - /** - * Verify context. - * - * @param testName the test name - * @throws ContextException the context exception - */ - private void verifyContext(final String testName) throws ContextException { - total = 0; - - try { - for (int i = 0; i < longArraySize; i++) { - total += ((TestContextLongItem) lTypeAlbum.get(Integer.toString(i))).getLongValue(); - } - - outMetricLine(testName, "Totaled"); - } catch (final Exception e) { - e.printStackTrace(); - } - - if (lockType == 2) { - if (total == jvmCount * threadCount * threadLoops) { - outMetricLine(testName, "VerifiedOK"); - } else { - outMetricLine(testName, "VerifiedFail"); - } - } else { - if (total == 0) { - outMetricLine(testName, "VerifiedOK"); - } else { - outMetricLine(testName, "VerifiedFail"); - } - } - } - - /** - * Clear context. - * - * @param testName the test name - * @throws ContextException the context exception - */ - private void clearContext(final String testName) throws ContextException { - contextDistributor.clear(); - contextDistributor = null; - - outMetricLine(testName, "Cleared"); - } - - /** - * Out metric line. - * - * @param testName the test name - * @param testPhase the test phase - */ - public void outMetricLine(final String testName, final String testPhase) { - System.out.println("ContextMetrics," + dateFormat.format(new Date()) + "," + System.currentTimeMillis() + "," - + testLabel + "," + testName + "," + testPhase + "," + jvmCount + "," + threadCount + "," + threadLoops - + "," + longArraySize + "," + lockType + "," + total); - } -} diff --git a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVM.java b/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVM.java deleted file mode 100644 index ed81e39a1..000000000 --- a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVM.java +++ /dev/null @@ -1,212 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.policy.apex.plugins.context.metrics; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Arrays; - -import org.onap.policy.apex.context.ContextAlbum; -import org.onap.policy.apex.context.Distributor; -import org.onap.policy.apex.context.impl.distribution.DistributorFactory; -import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.service.AbstractParameters; -import org.onap.policy.apex.model.basicmodel.service.ParameterService; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; -import org.onap.policy.apex.model.utilities.Assertions; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; - -/** - * The Class ConcurrentContextMetricsJVM rins in its own JVM to test concurrent context updates and - * lockings across JVMs. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public final class ConcurrentContextMetricsJVM { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextMetricsJVM.class); - - private static final int NUM_ARGS = 6; - private static final int ARG_JVM_NO = 1; - private static final int ARG_THREAD_COUNT = 2; - private static final int ARG_ITERATIONS = 3; - private static final int ARG_ARRAY_SIZE = 4; - private static final int ARG_LOCK_TYPE = 5; - - private static final int WAIT_10_MS = 10; - - /** - * The Constructor for this class. - * - * @param testType the test type - * @param jvmNo the jvm no - * @param threadCount the thread count - * @param threadLoops the thread loops - * @param longArraySize the long array size - * @param lockType the lock type - * @throws ApexException the apex exception - * @throws IOException the IO exception - */ - private ConcurrentContextMetricsJVM(final String testType, final int jvmNo, final int threadCount, - final int threadLoops, final int longArraySize, final int lockType) throws ApexException, IOException { - LOGGER.debug("starting JVMs and threads . . ."); - - final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); - - // Set up the distributor for this JVM - final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor", "0.0.1"); - final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey); - - final AxArtifactKey[] usedArtifactStackArray = {new AxArtifactKey("testC-top_" + jvmNo, "0.0.1"), - new AxArtifactKey("testC-next_" + jvmNo, "0.0.1"), new AxArtifactKey("testC-bot_" + jvmNo, "0.0.1")}; - - final AxContextModel testAxContextModel = TestContextAlbumFactory.createLongContextModel(); - contextDistributor.registerModel(testAxContextModel); - final ContextAlbum testContextAlbum = - contextDistributor.createContextAlbum(new AxArtifactKey("LongSameTypeContextAlbum", "0.0.1")); - Assertions.argumentNotNull(testContextAlbum, "testContextAlbum may not be null"); - testContextAlbum.setUserArtifactStack(usedArtifactStackArray); - - final Thread[] threadArray = new Thread[threadCount]; - - for (int t = 0; t < threadCount; t++) { - threadArray[t] = - new Thread(new ConcurrentContextMetricsThread(jvmNo, t, threadLoops, longArraySize, lockType)); - threadArray[t].setName(testType + ":ConcurrentContextMetricsThread_" + jvmNo + "_" + t); - threadArray[t].start(); - LOGGER.debug("started thread " + threadArray[t].getName()); - } - - System.out.println("ReadyToGo"); - while (true) { - final String goLine = bufferedReader.readLine(); - if (!goLine.trim().equals("OffYouGo")) { - throw new IOException("Expected OffYouGo"); - } - break; - } - - boolean allFinished; - do { - allFinished = true; - for (int t = 0; t < threadCount; t++) { - if (threadArray[t].isAlive()) { - allFinished = false; - ThreadUtilities.sleep(WAIT_10_MS); - break; - } - } - } while (!allFinished); - - System.out.println("AllFinished"); - while (true) { - final String goLine = bufferedReader.readLine(); - if (!goLine.trim().equals("FinishItOut")) { - throw new IOException("Expected FinishItOut"); - } - break; - } - - LOGGER.debug("threads finished"); - contextDistributor.clear(); - } - - /** - * The main method. - * - * @param args the args - * @throws JsonSyntaxException the json syntax exception - * @throws ClassNotFoundException the class not found exception - */ - @SuppressWarnings("unchecked") - public static void main(final String[] args) throws JsonSyntaxException, ClassNotFoundException { - if (args.length < NUM_ARGS || (args.length % 2 != 0)) { - LOGGER.error("invalid arguments: " + Arrays.toString(args)); - LOGGER.error( - "usage: ConcurrentContextMetricsJVM testLabel jvmNo threadCount threadLoops longArraySize lockType [parameterKey parameterJson].... "); - return; - } - - int jvmNo = -1; - int threadCount = -1; - int threadLoops = -1; - int longArraySize = -1; - int lockType = -1; - - try { - jvmNo = Integer.parseInt(args[ARG_JVM_NO]); - } catch (final Exception e) { - LOGGER.error("invalid argument jvmNo", e); - return; - } - - try { - threadCount = Integer.parseInt(args[ARG_THREAD_COUNT]); - } catch (final Exception e) { - LOGGER.error("invalid argument threadCount", e); - return; - } - - try { - threadLoops = Integer.parseInt(args[ARG_ITERATIONS]); - } catch (final Exception e) { - LOGGER.error("invalid argument threadLoops", e); - return; - } - - try { - longArraySize = Integer.parseInt(args[ARG_ARRAY_SIZE]); - } catch (final Exception e) { - LOGGER.error("invalid argument longArraySize", e); - return; - } - - try { - lockType = Integer.parseInt(args[ARG_LOCK_TYPE]); - } catch (final Exception e) { - LOGGER.error("invalid argument lockType", e); - return; - } - - for (int p = NUM_ARGS; p < args.length - 1; p += 2) { - @SuppressWarnings("rawtypes") - final Class parametersClass = Class.forName(args[p]); - final AbstractParameters parameters = - (AbstractParameters) new Gson().fromJson(args[p + 1], parametersClass); - ParameterService.registerParameters(parametersClass, parameters); - } - - try { - new ConcurrentContextMetricsJVM(args[0], jvmNo, threadCount, threadLoops, longArraySize, lockType); - } catch (final Exception e) { - LOGGER.error("error running test in JVM", e); - return; - } - } -} diff --git a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVMThread.java b/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVMThread.java deleted file mode 100644 index 64bc0cab6..000000000 --- a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsJVMThread.java +++ /dev/null @@ -1,187 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.policy.apex.plugins.context.metrics; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; - -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.service.AbstractParameters; -import org.onap.policy.apex.model.basicmodel.service.ParameterService; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -import com.google.gson.Gson; - -/** - * The Class ConcurrentContextMetricsJVMThread gets metrics for concurrent use of context. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ConcurrentContextMetricsJVMThread implements Runnable { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextMetricsJVMThread.class); - - private final String testType; - private final int jvm; - private final int threadCount; - private final int threadLoops; - private final int longArraySize; - private final int lockType; - - private boolean readyToGo = false; - private boolean allFinished = false; - - private PrintWriter processWriter; - - /** - * The Constructor. - * - * @param testType the test type - * @param jvm the jvm - * @param threadCount the thread count - * @param threadLoops the thread loops - * @param longArraySize the long array size - * @param lockType the lock type - * @throws ApexException the apex exception - */ - public ConcurrentContextMetricsJVMThread(final String testType, final int jvm, final int threadCount, - final int threadLoops, final int longArraySize, final int lockType) throws ApexException { - this.testType = testType; - this.jvm = jvm; - this.threadCount = threadCount; - this.threadLoops = threadLoops; - this.longArraySize = longArraySize; - this.lockType = lockType; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - final List commandList = new ArrayList<>(); - commandList.add(System.getProperty("java.home") + System.getProperty("file.separator") + "bin" - + System.getProperty("file.separator") + "java"); - commandList.add("-cp"); - commandList.add(System.getProperty("java.class.path")); - for (final Entry property : System.getProperties().entrySet()) { - if (property.getKey().toString().startsWith("APEX") - || property.getKey().toString().equals("java.net.preferIPv4Stack") - || property.getKey().toString().equals("jgroups.bind_addr")) { - commandList.add("-D" + property.getKey().toString() + "=" + property.getValue().toString()); - } - } - commandList.add("org.onap.policy.apex.plugins.context.metrics.ConcurrentContextMetricsJVM"); - commandList.add(testType); - commandList.add(new Integer(jvm).toString()); - commandList.add(new Integer(threadCount).toString()); - commandList.add(new Integer(threadLoops).toString()); - commandList.add(new Integer(longArraySize).toString()); - commandList.add(new Integer(lockType).toString()); - - for (final Entry, AbstractParameters> parameterServiceEntry : ParameterService.getAll()) { - commandList.add(parameterServiceEntry.getKey().getCanonicalName()); - commandList.add(new Gson().toJson(parameterServiceEntry.getValue())); - } - - LOGGER.info("starting JVM " + jvm); - - // Run the JVM - final ProcessBuilder processBuilder = new ProcessBuilder(commandList); - processBuilder.redirectErrorStream(true); - Process process; - - try { - process = processBuilder.start(); - - final InputStream is = process.getInputStream(); - processWriter = new PrintWriter(process.getOutputStream()); - final InputStreamReader isr = new InputStreamReader(is); - final BufferedReader br = new BufferedReader(isr); - - String line; - - LOGGER.info("JVM Output for command " + commandList + "\n"); - while ((line = br.readLine()) != null) { - LOGGER.info(line); - - if (line.trim().equals("ReadyToGo")) { - readyToGo = true; - } else if (line.trim().equals("AllFinished")) { - allFinished = true; - } - } - - // Wait to get exit value - try { - final int exitValue = process.waitFor(); - LOGGER.info("\n\nJVM " + jvm + " finished, exit value is " + exitValue); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } catch (final IOException e1) { - e1.printStackTrace(); - } - } - - /** - * Checks if is ready to go. - * - * @return true, if checks if is ready to go - */ - public boolean isReadyToGo() { - return readyToGo; - } - - /** - * Checks if is all finished. - * - * @return true, if checks if is all finished - */ - public boolean isAllFinished() { - return allFinished; - } - - /** - * Off you go. - */ - public void offYouGo() { - processWriter.println("OffYouGo"); - processWriter.flush(); - } - - /** - * Finish it out. - */ - public void finishItOut() { - processWriter.println("FinishItOut"); - processWriter.flush(); - } -} diff --git a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsThread.java b/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsThread.java deleted file mode 100644 index e207832c1..000000000 --- a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetricsThread.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.policy.apex.plugins.context.metrics; - -import java.util.Random; - -import org.onap.policy.apex.context.ContextAlbum; -import org.onap.policy.apex.context.ContextException; -import org.onap.policy.apex.context.Distributor; -import org.onap.policy.apex.context.impl.distribution.DistributorFactory; -import org.onap.policy.apex.context.test.concepts.TestContextLongItem; -import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class ConcurrentContextMetricsThread gets metrics for concurrent use of context. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ConcurrentContextMetricsThread implements Runnable { - // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextMetricsThread.class); - private final Distributor contextDistributor; - private final int jvm; - private final int instance; - private final int threadLoops; - private final int longArraySize; - private final int lockType; - - /** - * The Constructor. - * - * @param jvm the jvm - * @param instance the instance - * @param threadLoops the thread loops - * @param longArraySize the long array size - * @param lockType the lock type - * @throws ApexException the apex exception - */ - public ConcurrentContextMetricsThread(final int jvm, final int instance, final int threadLoops, - final int longArraySize, final int lockType) throws ApexException { - this.jvm = jvm; - this.instance = instance; - this.threadLoops = threadLoops; - this.longArraySize = longArraySize; - this.lockType = lockType; - - final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributor_" + jvm + "_" + instance, "0.0.1"); - contextDistributor = new DistributorFactory().getDistributor(distributorKey); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - LOGGER.info("running ConcurrentContextMetricsThread_" + jvm + "_" + instance + " . . ."); - - ContextAlbum lTypeAlbum = null; - try { - final AxContextModel axTestContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel(); - contextDistributor.registerModel(axTestContextModel); - lTypeAlbum = contextDistributor.createContextAlbum(new AxArtifactKey("LTypeContextAlbum", "0.0.1")); - } catch (final Exception e) { - LOGGER.error("could not get the test context album", e); - LOGGER.error("failed ConcurrentContextMetricsThread_" + jvm + "_" + instance); - return; - } - - if (lTypeAlbum == null) { - LOGGER.error("could not find the test context album"); - LOGGER.error("failed ConcurrentContextMetricsThread_" + jvm + "_" + instance); - return; - } - - final AxArtifactKey[] usedArtifactStackArray = - {new AxArtifactKey("testCC-top", "0.0.1"), new AxArtifactKey("testCC-" + instance, "0.0.1")}; - - lTypeAlbum.setUserArtifactStack(usedArtifactStackArray); - - final Random rand = new Random(); - - for (int i = 0; i < threadLoops; i++) { - // Get the next random entry to use - final String nextLongKey = Integer.toString(rand.nextInt(longArraySize)); - - if (lockType == 0) { - final TestContextLongItem item = (TestContextLongItem) lTypeAlbum.get(nextLongKey); - final long value = item.getLongValue(); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("lock type=" + lockType + ", value=" + value); - } - continue; - } - - if (lockType == 1) { - try { - lTypeAlbum.lockForReading(nextLongKey); - } catch (final ContextException e) { - LOGGER.error("could not acquire read lock on context album, key=" + nextLongKey, e); - continue; - } - - final TestContextLongItem item = (TestContextLongItem) lTypeAlbum.get(nextLongKey); - final long value = item.getLongValue(); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("lock type=" + lockType + ", value=" + value); - } - - try { - lTypeAlbum.unlockForReading(nextLongKey); - } catch (final ContextException e) { - LOGGER.error("could not release read lock on context album, key=" + nextLongKey, e); - } - - continue; - } - - if (lockType == 2) { - try { - lTypeAlbum.lockForWriting(nextLongKey); - } catch (final ContextException e) { - LOGGER.error("could not acquire write lock on context album, key=" + nextLongKey, e); - continue; - } - - final TestContextLongItem item = (TestContextLongItem) lTypeAlbum.get(nextLongKey); - long value = item.getLongValue(); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("lock type=" + lockType + ", value=" + value); - } - item.setLongValue(++value); - lTypeAlbum.put(nextLongKey, item); - - try { - lTypeAlbum.unlockForWriting(nextLongKey); - } catch (final ContextException e) { - LOGGER.error("could not release write lock on context album, key=" + nextLongKey, e); - } - continue; - } - } - - LOGGER.info("completed ConcurrentContextMetricsThread_" + jvm + "_" + instance); - } -} diff --git a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java b/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java deleted file mode 100644 index 5e916b6db..000000000 --- a/testsuites/integration/integration-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============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========================================================= - */ - -/** - * Used to get metrics on the performance of Context Album performance for various types of - * distribution and locking mechanisms in APEX. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -package org.onap.policy.apex.plugins.context.metrics; diff --git a/testsuites/integration/integration-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java b/testsuites/integration/integration-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java deleted file mode 100644 index 5607f8711..000000000 --- a/testsuites/integration/integration-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.policy.apex.plugins.context.metrics; - -import static org.junit.Assert.fail; - -import java.io.IOException; - -import org.apache.curator.test.TestingServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class TestMetrics { - // Zookeeper test server - TestingServer zkTestServer; - - @Before - public void beforeTest() throws Exception { - zkTestServer = new TestingServer(62181); - } - - @After - public void afterTest() throws IOException { - zkTestServer.stop(); - } - - @Test - public void getSingleJVMMetrics() { - final String[] args = {"singleJVMTestNL", "1", "32", "1000", "65536", "0", "localhost:62181", "false"}; - - try { - ConcurrentContextMetrics.main(args); - } catch (final Exception e) { - fail("Metrics test failed"); - e.printStackTrace(); - } - } -} diff --git a/testsuites/integration/integration-context-metrics/src/test/resources/hazelcast/hazelcast.xml b/testsuites/integration/integration-context-metrics/src/test/resources/hazelcast/hazelcast.xml deleted file mode 100644 index 84da4951e..000000000 --- a/testsuites/integration/integration-context-metrics/src/test/resources/hazelcast/hazelcast.xml +++ /dev/null @@ -1,643 +0,0 @@ - - - - - - HazelcastGroup3.0EVAL - password3.0EVAL - - - 5706 - - - 224.2.2.10 - 54327 - - - 10.0.0.0 - - - - - - 127.0.0.* - - - - true - slf4j - - false - 60 - - - 16 - - - - 100000 - - - - - 1 - - NONE - - 0 - - 25 - - - - 1 - - LRU - - 1000000 - - 5 - - - 0 - - - - - - - - 1 - - LRU - - 1000000 - - 5 - - - 7200 - - - - - - - 1 - - LRU - - 1000000 - - 5 - - - 3600 - - - - - - - - - 1 - - LRU - - 1000000 - - 5 - - - 7200 - - - - - - - - - - 1 - - - true - - LRU - - 3000000 - - 5 - - - 7200 - - - - - - - - - - - 2 - - NONE - - 10000000 - - 0 - - - - 0 - - - - - - - - - - 0 - - - 0 - - - NONE - - - 2000 - - - true - - - - - - - - - - 1 - - NONE - - 10000000 - - 0 - - - - 60 - - - - - - - 2 - - 0 - - - - NONE - - 1000 - - - - 0 - - - - - 2 - - 0 - - - - NONE - - 10000 - - - 0 - - - - - - - 2 - - NONE - - 10000000 - - 0 - - - - 0 - - - - - - - - - - 2 - - NONE - - 10000000 - - 0 - - - - 0 - - - - - - - - - - - 1 - - - true - - LRU - - 3000000 - - 5 - - - 7200 - - - - - - - - - - 100000 - - - - - 0 - - - - - 2 - NONE - 50 - 0 - 0 - - - - - 0 - 100000 - - - - - 3 - - true - - NONE - - 1000 - - 0 - - - - - 0 - - - - 3 - - true - - NONE - - 1000 - - 0 - - - - - 0 - - - - 100000 - - - - - 1 - NONE - 0 - - - diff --git a/testsuites/integration/integration-context-metrics/src/test/resources/infinispan/infinispan.xml b/testsuites/integration/integration-context-metrics/src/test/resources/infinispan/infinispan.xml deleted file mode 100644 index a8541333e..000000000 --- a/testsuites/integration/integration-context-metrics/src/test/resources/infinispan/infinispan.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index d064f6373..82f847fbf 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -79,7 +79,7 @@ ${project.version} test - + org.apache.derby derby ${version.derby} diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml index 9fcfd324e..0e82d2493 100644 --- a/testsuites/integration/pom.xml +++ b/testsuites/integration/pom.xml @@ -31,18 +31,13 @@ integration pom + + integration-common + integration-executor-test + integration-uservice-test + + - - apexDefault - - true - - - integration-common - integration-executor-test - integration-uservice-test - - apexMetrics @@ -51,10 +46,7 @@ - integration-common - integration-executor-test - integration-uservice-test - integration-context-metrics + integration-context-test @@ -65,11 +57,7 @@ - integration-common - integration-executor-test - integration-uservice-test integration-context-test - integration-context-metrics -- cgit 1.2.3-korg