aboutsummaryrefslogtreecommitdiffstats
path: root/models-sim
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-07-12 15:25:53 -0400
committerJim Hahn <jrh3@att.com>2021-07-12 17:04:14 -0400
commit6be3c1abaf5c3eea0b353675835b6d2ce4584fe7 (patch)
treead5376e94d48eb518670939823702d18c49b3f11 /models-sim
parent886406e003934b83da7a2b538a0574a76fd5dd4d (diff)
Delete extra simulator docker images
The policy-models-simulator docker image, built from models-sim/packages, subsumes the functionality of the other simulator images. Deleted the other images. This simulator still needs some of the code from the dmaap-sim modules, so only deleted the code from the latter that is not needed by this simulator. Also modified the simulator launch script to use sh instead of bash. Issue-ID: POLICY-3474 Change-Id: Ie7f69b327a18c3e07f154124ae38975d5e6924f0 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-sim')
-rw-r--r--models-sim/models-sim-dmaap/pom.xml45
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimException.java56
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimRuntimeException.java56
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java85
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java36
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java82
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java49
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimCommandLineArguments.java55
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java142
-rw-r--r--models-sim/models-sim-dmaap/src/main/package/docker/Dockerfile57
-rw-r--r--models-sim/models-sim-dmaap/src/main/package/docker/dmaap-sim.sh55
-rwxr-xr-xmodels-sim/models-sim-dmaap/src/main/package/docker/docker_build.sh66
-rw-r--r--models-sim/models-sim-dmaap/src/main/package/tarball/assembly.xml69
-rw-r--r--models-sim/models-sim-dmaap/src/main/resources/etc/DefaultConfig.json8
-rw-r--r--models-sim/models-sim-dmaap/src/main/resources/etc/ssl/policy-truststorebin124180 -> 0 bytes
-rw-r--r--models-sim/models-sim-dmaap/src/main/resources/startDmaap.sh32
-rw-r--r--models-sim/models-sim-dmaap/src/main/resources/version.txt4
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/DmaapSimXxxExceptionTest.java37
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CommonRestServer.java114
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/e2e/EndToEndTest.java273
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/CommonTestData.java89
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java71
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/DmaapSimActivatorTest.java98
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java115
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameterFile.json0
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameters.json1
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/InvalidParameters.json3
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/MinimumParameters.json8
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/NoParameters.json2
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/Parameters_InvalidName.json10
-rw-r--r--models-sim/models-sim-dmaap/src/test/resources/parameters/TopicParameters.json36
-rw-r--r--models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile4
-rw-r--r--models-sim/packages/models-simulator-docker/src/main/docker/simulators.sh4
-rw-r--r--models-sim/policy-models-simulators/pom.xml45
-rw-r--r--models-sim/policy-models-simulators/src/main/package/docker/Dockerfile59
-rw-r--r--models-sim/policy-models-simulators/src/main/package/docker/docker_build.sh67
-rw-r--r--models-sim/policy-models-simulators/src/main/package/docker/simulators.sh43
-rw-r--r--models-sim/policy-models-simulators/src/main/package/tarball/assembly.xml50
38 files changed, 41 insertions, 1985 deletions
diff --git a/models-sim/models-sim-dmaap/pom.xml b/models-sim/models-sim-dmaap/pom.xml
index bcbca3b26..eca148e82 100644
--- a/models-sim/models-sim-dmaap/pom.xml
+++ b/models-sim/models-sim-dmaap/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
- Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. 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.
@@ -69,47 +69,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <build>
- <resources>
- <!-- Output the version of the DMaaP simulator service -->
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/version.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/version.txt</exclude>
- </excludes>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-complete-tar</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/package/tarball/assembly.xml</descriptor>
- </descriptors>
- <finalName>${project.artifactId}-${project.version}</finalName>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
</project>
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimException.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimException.java
deleted file mode 100644
index aaf8980f8..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.sim.dmaap;
-
-/**
- * This exception will be called if an error occurs in the DMaaP simulator.
- */
-public class DmaapSimException extends Exception {
- private static final long serialVersionUID = -8507246953751956974L;
-
- /**
- * Instantiates a new exception with a message.
- *
- * @param message the message
- */
- public DmaapSimException(final String message) {
- super(message);
- }
-
- /**
- * Instantiates a new exception with a caused by exception.
- *
- * @param exp the exception that caused this exception to be thrown
- */
- public DmaapSimException(final Exception exp) {
- super(exp);
- }
-
- /**
- * Instantiates a new exception with a message and a caused by exception.
- *
- * @param message the message
- * @param exp the exception that caused this exception to be thrown
- */
- public DmaapSimException(final String message, final Exception exp) {
- super(message, exp);
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimRuntimeException.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimRuntimeException.java
deleted file mode 100644
index fe8b7e21b..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/DmaapSimRuntimeException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.sim.dmaap;
-
-/**
- * This runtime exception will be called if a runtime error occurs when using the DMaaP simulator.
- */
-public class DmaapSimRuntimeException extends RuntimeException {
- private static final long serialVersionUID = -8507246953751956974L;
-
- /**
- * Instantiates a new policy pap runtime exception with a message.
- *
- * @param message the message
- */
- public DmaapSimRuntimeException(final String message) {
- super(message);
- }
-
- /**
- * Instantiates a new runtime exception with a caused by exception.
- *
- * @param exp the exception that caused this exception to be thrown
- */
- public DmaapSimRuntimeException(final Exception exp) {
- super(exp);
- }
-
- /**
- * Instantiates a new runtime exception with a message and a caused by exception.
- *
- * @param message the message
- * @param exp the exception that caused this exception to be thrown
- */
- public DmaapSimRuntimeException(final String message, final Exception exp) {
- super(message, exp);
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java
deleted file mode 100644
index 7c9f79b77..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/DmaapSimParameterHandler.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. 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.models.sim.dmaap.parameters;
-
-import java.io.File;
-import org.onap.policy.common.parameters.ValidationResult;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.sim.dmaap.DmaapSimException;
-import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class handles reading, parsing and validating of DMaaP simulator parameters from JSON files.
- */
-public class DmaapSimParameterHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DmaapSimParameterHandler.class);
-
- private final Coder coder = new StandardCoder();
-
- /**
- * Read the parameters from the parameter file.
- *
- * @param arguments the arguments passed to DMaaP simulator
- * @return the parameters read from the configuration file
- * @throws DmaapSimException on parameter exceptions
- */
- public DmaapSimParameterGroup getParameters(final DmaapSimCommandLineArguments arguments) throws DmaapSimException {
- DmaapSimParameterGroup dmaapSimParameterGroup = null;
-
- // Read the parameters
- try {
- // Read the parameters from JSON
- var file = new File(arguments.getFullConfigurationFilePath());
- dmaapSimParameterGroup = coder.decode(file, DmaapSimParameterGroup.class);
- } catch (final CoderException e) {
- final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath()
- + "\"\n" + "(" + e.getClass().getSimpleName() + "):" + e.getMessage();
- LOGGER.error(errorMessage);
- throw new DmaapSimException(errorMessage, e);
- }
-
- // The JSON processing returns null if there is an empty file
- if (dmaapSimParameterGroup == null) {
- final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\"";
- LOGGER.error(errorMessage);
- throw new DmaapSimException(errorMessage);
- }
-
- // validate the parameters
- final ValidationResult validationResult = dmaapSimParameterGroup.validate();
- if (!validationResult.isValid()) {
- String returnMessage =
- "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n";
- returnMessage += validationResult.getResult();
-
- LOGGER.error(returnMessage);
- throw new DmaapSimException(returnMessage);
- }
-
- return dmaapSimParameterGroup;
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java
index 41451eb2f..8414d0718 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. 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.
@@ -21,11 +21,17 @@
package org.onap.policy.models.sim.dmaap.parameters;
+import java.util.Properties;
import lombok.Getter;
+import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.models.sim.dmaap.rest.CambriaMessageBodyHandler;
+import org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1;
+import org.onap.policy.models.sim.dmaap.rest.TextMessageBodyHandler;
/**
* Class to hold all parameters needed for rest server.
@@ -42,4 +48,32 @@ public class RestServerParameters extends ParameterGroupImpl {
public RestServerParameters() {
super(RestServerParameters.class.getSimpleName());
}
+
+ /**
+ * Creates a set of properties, suitable for building a REST server, from the
+ * parameters.
+ *
+ * @return a set of properties representing the given parameters
+ */
+ public Properties getServerProperties() {
+ final var props = new Properties();
+ props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, getName());
+
+ final String svcpfx =
+ PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + getName();
+
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, getHost());
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
+ Integer.toString(getPort()));
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
+ DmaapSimRestControllerV1.class.getName());
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false");
+
+ props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
+ String.join(",", CambriaMessageBodyHandler.class.getName(),
+ GsonMessageBodyHandler.class.getName(),
+ TextMessageBodyHandler.class.getName()));
+ return props;
+ }
}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java
deleted file mode 100644
index acac1439b..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/rest/DmaapSimRestServer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. 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.models.sim.dmaap.rest;
-
-import java.util.List;
-import java.util.Properties;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
-import org.onap.policy.common.gson.GsonMessageBodyHandler;
-import org.onap.policy.common.utils.services.ServiceManagerContainer;
-import org.onap.policy.models.sim.dmaap.parameters.RestServerParameters;
-
-/**
- * Class to manage life cycle of DMaaP Simulator rest server.
- */
-public class DmaapSimRestServer extends ServiceManagerContainer {
-
- private final List<HttpServletServer> servers;
-
- /**
- * Constructor for instantiating DmaapSimRestServer.
- *
- * @param restServerParameters the rest server parameters
- */
- public DmaapSimRestServer(final RestServerParameters restServerParameters) {
- this.servers = HttpServletServerFactoryInstance.getServerFactory()
- .build(getServerProperties(restServerParameters));
-
- for (HttpServletServer server : this.servers) {
- addAction("REST " + server.getName(), server::start, server::stop);
- }
- }
-
- /**
- * Creates a set of properties, suitable for building a REST server, from the
- * parameters.
- *
- * @param restServerParameters parameters from which to build the properties
- * @return a set of properties representing the given parameters
- */
- public static Properties getServerProperties(RestServerParameters restServerParameters) {
- final var props = new Properties();
- props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, restServerParameters.getName());
-
- final String svcpfx =
- PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + restServerParameters.getName();
-
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, restServerParameters.getHost());
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
- Integer.toString(restServerParameters.getPort()));
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
- DmaapSimRestControllerV1.class.getName());
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false");
-
- props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- String.join(",", CambriaMessageBodyHandler.class.getName(),
- GsonMessageBodyHandler.class.getName(),
- TextMessageBodyHandler.class.getName()));
- return props;
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java
deleted file mode 100644
index 3d4e1c66c..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimActivator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. 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.models.sim.dmaap.startstop;
-
-import org.onap.policy.common.utils.services.ServiceManagerContainer;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
-import org.onap.policy.models.sim.dmaap.provider.DmaapSimProvider;
-import org.onap.policy.models.sim.dmaap.rest.DmaapSimRestServer;
-
-/**
- * This class activates the DMaaP simulator as a complete service.
- */
-public class DmaapSimActivator extends ServiceManagerContainer {
-
- /**
- * Instantiate the activator for the DMaaP simulator as a complete service.
- *
- * @param dmaapSimParameterGroup the parameters for the DMaaP simulator service
- */
- public DmaapSimActivator(final DmaapSimParameterGroup dmaapSimParameterGroup) {
- super("DMaaP Simulator");
-
- var provider = new DmaapSimProvider(dmaapSimParameterGroup);
- DmaapSimProvider.setInstance(provider);
- addAction("Sim Provider", provider::start, provider::stop);
-
- var restServer = new DmaapSimRestServer(dmaapSimParameterGroup.getRestServerParameters());
- addAction("REST server", restServer::start, restServer::stop);
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimCommandLineArguments.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimCommandLineArguments.java
deleted file mode 100644
index 8968a2a8e..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/DmaapSimCommandLineArguments.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. 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.models.sim.dmaap.startstop;
-
-import org.onap.policy.common.utils.cmd.CommandLineArgumentsHandler;
-import org.onap.policy.common.utils.cmd.CommandLineException;
-import org.onap.policy.models.sim.dmaap.DmaapSimRuntimeException;
-
-/**
- * This class reads and handles command line parameters for the DMaaP simulator service.
- */
-public class DmaapSimCommandLineArguments extends CommandLineArgumentsHandler {
- private static final String DMAAP_SIM = "DMaaP simulator";
-
- /**
- * Construct the options for the CLI editor.
- */
- public DmaapSimCommandLineArguments() {
- super(Main.class.getName(), DMAAP_SIM);
- }
-
- /**
- * Construct the options for the CLI editor and parse in the given arguments.
- *
- * @param args The command line arguments
- */
- public DmaapSimCommandLineArguments(final String[] args) {
- this();
-
- try {
- parse(args);
- } catch (final CommandLineException e) {
- throw new DmaapSimRuntimeException("parse error on DMaaP simulator parameters", e);
- }
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
deleted file mode 100644
index 9c368e044..000000000
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. 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.models.sim.dmaap.startstop;
-
-import java.util.Arrays;
-import lombok.Getter;
-import org.onap.policy.common.utils.cmd.CommandLineException;
-import org.onap.policy.models.sim.dmaap.DmaapSimException;
-import org.onap.policy.models.sim.dmaap.DmaapSimRuntimeException;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class initiates the DMaaP simulator component.
- */
-public class Main {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
-
- private DmaapSimActivator activator;
- @Getter
- private DmaapSimParameterGroup parameters;
-
- /**
- * Instantiates the DMaap Simulator service.
- *
- * @param args the command line arguments
- */
- public Main(final String[] args) {
- final var argumentString = Arrays.toString(args);
- LOGGER.info("Starting DMaaP simulator service with arguments - {}", argumentString);
-
- // Check the arguments
- final var arguments = new DmaapSimCommandLineArguments();
- try {
- // The arguments return a string if there is a message to print and we should exit
- final String argumentMessage = arguments.parse(args);
- if (argumentMessage != null) {
- LOGGER.info(argumentMessage);
- return;
- }
- // Validate that the arguments are sane
- arguments.validate();
- } catch (final DmaapSimRuntimeException | CommandLineException e) {
- LOGGER.error("start of DMaaP simulator service failed", e);
- return;
- }
-
- // Read the parameters
- try {
- parameters = new DmaapSimParameterHandler().getParameters(arguments);
- } catch (final Exception e) {
- LOGGER.error("start of DMaaP simulator service failed", e);
- return;
- }
-
- // Now, create the activator for the DMaaP Simulator service
- activator = new DmaapSimActivator(parameters);
-
- // Start the activator
- try {
- activator.start();
- } catch (final RuntimeException e) {
- LOGGER.error("start of DMaaP simulator service failed, used parameters are {}", Arrays.toString(args), e);
- return;
- }
-
- // Add a shutdown hook to shut everything down in an orderly manner
- Runtime.getRuntime().addShutdownHook(new DmaapSimShutdownHookClass());
- LOGGER.info("Started DMaaP simulator service");
- }
-
- /**
- * Shut down Execution.
- *
- * @throws DmaapSimException on shutdown errors
- */
- public void shutdown() throws DmaapSimException {
- // clear the parameterGroup variable
- parameters = null;
-
- // clear the DMaaP simulator activator
- if (activator != null && activator.isAlive()) {
- activator.stop();
- }
- }
-
- /**
- * The Class DmaapSimShutdownHookClass terminates the DMaaP simulator service when its run method is called.
- */
- private class DmaapSimShutdownHookClass extends Thread {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- try {
- // Shutdown the DMaaP simulator service and wait for everything to stop
- shutdown();
-
- } catch (final RuntimeException | DmaapSimException e) {
- LOGGER.warn("error occured during shut down of the DMaaP simulator service", e);
- }
- }
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(final String[] args) { // NOSONAR
- /*
- * The arguments are validated by the constructor, thus sonar is disabled.
- */
-
- new Main(args);
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/package/docker/Dockerfile b/models-sim/models-sim-dmaap/src/main/package/docker/Dockerfile
deleted file mode 100644
index 495924d5b..000000000
--- a/models-sim/models-sim-dmaap/src/main/package/docker/Dockerfile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Nordix Foundation.
-# Modifications Copyright (C) 2019 AT&T Intellectual Property.
-# ================================================================================
-# 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=========================================================
-#
-
-#
-# Docker file to build an image that runs the DMaaP simulator on Java 8 in alpine
-#
-
-FROM onap/policy-jre-alpine
-
-LABEL maintainer="Policy Team"
-
-ARG POLICY_LOGS=/var/log/onap/policy/dmaap-sim
-
-ENV POLICY_HOME=/opt/app/policy
-ENV POLICY_LOGS=${POLICY_LOGS}
-
-# Create DMaaP simulator user and group
-# Add simulator-specific directories and set ownership as the simulator user
-RUN mkdir -p ${POLICY_HOME}/dmaap-sim \
- && mkdir -p ${POLICY_HOME}/dmaap-sim/bin \
- && mkdir -p ${POLICY_LOGS} \
- && chown -R policy:policy ${POLICY_LOGS} \
- && mkdir /packages
-
-# Unpack the tarball
-COPY policy-models-sim-dmaap-tarball.tar.gz /packages
-RUN tar xvfz /packages/policy-models-sim-dmaap-tarball.tar.gz --directory ${POLICY_HOME}/dmaap-sim \
- && rm /packages/policy-models-sim-dmaap-tarball.tar.gz
-
-# Ensure everything has the correct permissions
-# Copy examples to DMaaP simulator user area
-COPY dmaap-sim.sh ${POLICY_HOME}/dmaap-sim/bin
-RUN find /opt/app -type d -perm 755 \
- && find /opt/app -type f -perm 644 \
- && chmod 755 ${POLICY_HOME}/dmaap-sim/bin/*
-
-USER policy
-ENV PATH ${POLICY_HOME}/dmaap-sim/bin:$PATH
-ENTRYPOINT [ "bash", "dmaap-sim.sh" ]
diff --git a/models-sim/models-sim-dmaap/src/main/package/docker/dmaap-sim.sh b/models-sim/models-sim-dmaap/src/main/package/docker/dmaap-sim.sh
deleted file mode 100644
index deb168f5d..000000000
--- a/models-sim/models-sim-dmaap/src/main/package/docker/dmaap-sim.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Nordix Foundation.
-# Modifications copyright (C) 2020 Bell Canada. 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=========================================================
-#
-
-if [ -z "$DMAAP_SIM_HOME" ]
-then
- DMAAP_SIM_HOME=/opt/app/policy/dmaap-sim
-fi
-
-JAVA_HOME=/usr/lib/jvm/java-11-openjdk
-KEYSTORE="${DMAAP_SIM_HOME}/etc/ssl/policy-keystore"
-KEYSTORE_PASSWD="Pol1cy_0nap"
-TRUSTSTORE="${DMAAP_SIM_HOME}/etc/ssl/policy-truststore"
-TRUSTSTORE_PASSWD="Pol1cy_0nap"
-
-if [ "$#" -eq 1 ]
-then
- CONFIG_FILE=$1
-else
- CONFIG_FILE=${CONFIG_FILE}
-fi
-
-if [ -z "$CONFIG_FILE" ]
-then
- CONFIG_FILE="$DMAAP_SIM_HOME/etc/DefaultConfig.json"
-fi
-
-echo "DMaaP simulation configuration file: $CONFIG_FILE"
-
-$JAVA_HOME/bin/java \
- -cp "$DMAAP_SIM_HOME/etc:$DMAAP_SIM_HOME/lib/*" \
- -Djavax.net.ssl.keyStore="$KEYSTORE" \
- -Djavax.net.ssl.keyStorePassword="$KEYSTORE_PASSWD" \
- -Djavax.net.ssl.trustStore="$TRUSTSTORE" \
- -Djavax.net.ssl.trustStorePassword="$TRUSTSTORE_PASSWD" \
- org.onap.policy.models.sim.dmaap.startstop.Main \
- -c $CONFIG_FILE
diff --git a/models-sim/models-sim-dmaap/src/main/package/docker/docker_build.sh b/models-sim/models-sim-dmaap/src/main/package/docker/docker_build.sh
deleted file mode 100755
index 3ec907b8e..000000000
--- a/models-sim/models-sim-dmaap/src/main/package/docker/docker_build.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-#
-
-#
-# Script to build a Docker file for the DMaaP simulator. The docker image
-# generated by this script should NOT be placed in the ONAP nexus, it is
-# only for testing purposes.
-#
-
-if [ -z "$DMAAP_SIM_HOME" ]
-then
- DMAAP_SIM_HOME=`pwd`
-fi
-
-# Check for the dockerfile
-if [ ! -f "$DMAAP_SIM_HOME/src/main/package/docker/Dockerfile" ]
-then
- echo docker file "$DMAAP_SIM_HOME/src/main/package/docker/Dockerfile" not found
- exit 1
-fi
-
-# Check for the start script
-if [ ! -f "$DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh" ]
-then
- echo start script "$DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh" not found
- exit 1
-fi
-
-# Check for the tarball
-tarball_count=`ls $DMAAP_SIM_HOME/target/policy-models-sim-dmaap-*tarball.tar.gz 2> /dev/null | wc | awk '{print $1}'`
-if [ "$tarball_count" -ne "1" ]
-then
- echo one and only one tarball should exist in the target directory
- exit 2
-fi
-
-# Set up the docker build
-rm -fr $DMAAP_SIM_HOME/target/docker
-mkdir $DMAAP_SIM_HOME/target/docker
-cp $DMAAP_SIM_HOME/src/main/package/docker/Dockerfile $DMAAP_SIM_HOME/target/docker
-cp $DMAAP_SIM_HOME/src/main/package/docker/dmaap-sim.sh $DMAAP_SIM_HOME/target/docker
-cp $DMAAP_SIM_HOME/target/policy-models-sim-dmaap-*tarball.tar.gz $DMAAP_SIM_HOME/target/docker/policy-models-sim-dmaap-tarball.tar.gz
-
-# Run the docker build
-cd $DMAAP_SIM_HOME/target
-docker build -t dmaap/simulator docker
-
-
diff --git a/models-sim/models-sim-dmaap/src/main/package/tarball/assembly.xml b/models-sim/models-sim-dmaap/src/main/package/tarball/assembly.xml
deleted file mode 100644
index 08e202938..000000000
--- a/models-sim/models-sim-dmaap/src/main/package/tarball/assembly.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Nordix Foundation.
- Modifications copyright (C) 2020 Bell Canada. 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=========================================================
--->
-
-<assembly>
- <id>tarball</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>true</useProjectArtifact>
- <outputDirectory>/lib</outputDirectory>
- <unpack>false</unpack>
- <scope>runtime</scope>
- <includes>
- <include>*:jar</include>
- </includes>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/src/main/resources
- </directory>
- <includes>
- <include>startDmaap.sh</include>
- </includes>
- <outputDirectory>bin</outputDirectory>
- <lineEnding>unix</lineEnding>
- <fileMode>755</fileMode>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/src/main/resources/etc
- </directory>
- <includes>
- <include>DefaultConfig.json</include>
- </includes>
- <outputDirectory>etc</outputDirectory>
- <lineEnding>unix</lineEnding>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/src/main/resources/etc/ssl
- </directory>
- <includes>
- <include>policy*</include>
- </includes>
- <outputDirectory>etc/ssl</outputDirectory>
- <lineEnding>keep</lineEnding>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/models-sim/models-sim-dmaap/src/main/resources/etc/DefaultConfig.json b/models-sim/models-sim-dmaap/src/main/resources/etc/DefaultConfig.json
deleted file mode 100644
index e936eb034..000000000
--- a/models-sim/models-sim-dmaap/src/main/resources/etc/DefaultConfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name": "DMaapSim",
- "topicSweepSec": 900,
- "restServerParameters": {
- "host": "0.0.0.0",
- "port": 3904
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/main/resources/etc/ssl/policy-truststore b/models-sim/models-sim-dmaap/src/main/resources/etc/ssl/policy-truststore
deleted file mode 100644
index 8834ac257..000000000
--- a/models-sim/models-sim-dmaap/src/main/resources/etc/ssl/policy-truststore
+++ /dev/null
Binary files differ
diff --git a/models-sim/models-sim-dmaap/src/main/resources/startDmaap.sh b/models-sim/models-sim-dmaap/src/main/resources/startDmaap.sh
deleted file mode 100644
index 1d04e7cb4..000000000
--- a/models-sim/models-sim-dmaap/src/main/resources/startDmaap.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-#
-# ============LICENSE_START=======================================================
-# ONAP Policy Models
-# ================================================================================
-# Copyright (C) 2019 AT&T Intellectual Property. 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.
-# ============LICENSE_END=========================================================
-#
-
-#
-# Starts the DMaaP simulator using the default configuration.
-#
-
-trap 'exit 1' ERR
-
-cd ${0%/*}/..
-
-java -cp "lib/*" \
- org.onap.policy.models.sim.dmaap.startstop.Main -c etc/DefaultConfig.json
diff --git a/models-sim/models-sim-dmaap/src/main/resources/version.txt b/models-sim/models-sim-dmaap/src/main/resources/version.txt
deleted file mode 100644
index d629db844..000000000
--- a/models-sim/models-sim-dmaap/src/main/resources/version.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-ONAP DMaaP simulator Service
-Version: ${project.version}
-Built (UTC): ${maven.build.timestamp}
-ONAP https://wiki.onap.org \ No newline at end of file
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/DmaapSimXxxExceptionTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/DmaapSimXxxExceptionTest.java
deleted file mode 100644
index ac72e5ee8..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/DmaapSimXxxExceptionTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.sim.dmaap;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.common.utils.test.ExceptionsTester;
-
-public class DmaapSimXxxExceptionTest {
-
- @Test
- public void testDmaapSimException() {
- assertEquals(3, new ExceptionsTester().test(DmaapSimException.class));
- }
-
- @Test
- public void testDmaapSimRuntimeException() {
- assertEquals(3, new ExceptionsTester().test(DmaapSimRuntimeException.class));
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CommonRestServer.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CommonRestServer.java
deleted file mode 100644
index 7b72e9250..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/rest/CommonRestServer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
- * ================================================================================
- * 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.models.sim.dmaap.rest;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.nio.charset.StandardCharsets;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import lombok.Getter;
-import org.glassfish.jersey.client.ClientProperties;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.common.gson.GsonMessageBodyHandler;
-import org.onap.policy.common.utils.network.NetworkUtil;
-import org.onap.policy.sim.dmaap.parameters.CommonTestData;
-
-/**
- * Common base class for rest server tests.
- */
-public class CommonRestServer {
- public static final String NOT_ALIVE = "not alive";
- public static final String ALIVE = "alive";
- public static final String SELF = "self";
- public static final String NAME = "DMaaP Simulator";
- public static final String ENDPOINT_PREFIX = "events/";
-
- protected static final String CONFIG_FILE = "src/test/resources/parameters/TestConfigParams.json";
-
- @Getter
- private static int port;
-
- protected static String httpPrefix;
-
- /**
- * Allocates a port for the server, writes a config file.
- *
- * @throws Exception if an error occurs
- */
- public static void reconfigure() throws Exception {
- port = NetworkUtil.allocPort();
-
- httpPrefix = "http://localhost:" + port + "/";
-
- String json = new CommonTestData().getParameterGroupAsString(port);
- makeConfigFile(CONFIG_FILE, json);
-
- HttpServletServerFactoryInstance.getServerFactory().destroy();
- }
-
- /**
- * Makes a parameter configuration file.
- * @param fileName name of the config file to be created
- * @param json json to be written to the file
- *
- * @throws Exception if an error occurs
- */
- protected static void makeConfigFile(String fileName, String json) throws Exception {
- File file = new File(fileName);
- file.deleteOnExit();
-
- try (FileOutputStream output = new FileOutputStream(file)) {
- output.write(json.getBytes(StandardCharsets.UTF_8));
- }
- }
-
- /**
- * Sends a request to an endpoint.
- *
- * @param endpoint the target endpoint
- * @return a request builder
- * @throws Exception if an error occurs
- */
- protected Invocation.Builder sendRequest(final String endpoint) throws Exception {
- return sendFqeRequest(httpPrefix + ENDPOINT_PREFIX + endpoint);
- }
-
- /**
- * Sends a request to a fully qualified endpoint.
- *
- * @param fullyQualifiedEndpoint the fully qualified target endpoint
- * @return a request builder
- */
- protected Invocation.Builder sendFqeRequest(final String fullyQualifiedEndpoint) {
- final Client client = ClientBuilder.newBuilder().build();
-
- client.property(ClientProperties.METAINF_SERVICES_LOOKUP_DISABLE, "true");
- client.register(GsonMessageBodyHandler.class);
-
- final WebTarget webTarget = client.target(fullyQualifiedEndpoint);
-
- return webTarget.request(MediaType.APPLICATION_JSON);
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/e2e/EndToEndTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/e2e/EndToEndTest.java
deleted file mode 100644
index 5a83b4693..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/e2e/EndToEndTest.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.sim.dmaap.e2e;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.att.nsa.cambria.client.CambriaClientBuilders;
-import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder;
-import com.att.nsa.cambria.client.CambriaConsumer;
-import java.io.File;
-import java.io.PrintWriter;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.security.GeneralSecurityException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiConsumer;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.network.NetworkUtil;
-import org.onap.policy.common.utils.services.Registry;
-import org.onap.policy.models.sim.dmaap.DmaapSimException;
-import org.onap.policy.models.sim.dmaap.rest.CommonRestServer;
-import org.onap.policy.models.sim.dmaap.startstop.Main;
-
-/**
- * This tests the simulator using dmaap endpoints to verify that it works from publisher
- * to subscriber.
- */
-public class EndToEndTest extends CommonRestServer {
- private static final int MAX_WAIT_SEC = 5;
- private static final String TOPIC = "MY-TOPIC";
- private static final String TOPIC2 = "MY-TOPIC-B";
- private static final String TOPIC3 = "MY-TOPIC-C";
- private static final int MAX_MSG = 200;
-
- private static Main main;
-
- /**
- * Messages from the topic are placed here by the endpoint.
- */
- private static BlockingQueue<String> queue;
-
- /**
- * Messages from topic 2 are placed here by the endpoint.
- */
- private static BlockingQueue<String> queue2;
-
- /**
- * Topic configuration parameters.
- */
- private static TopicParameterGroup topicConfig;
-
- /**
- * The "host:port", extracted from <i>httpPrefix</i>.
- */
- private static String hostPort;
-
- /**
- * Unique consumer name used by a single test case.
- */
- private int consumerName;
-
- /**
- * Starts the rest server.
- *
- * @throws Exception if an error occurs
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- TopicEndpointManager.getManager().shutdown();
-
- CommonRestServer.reconfigure();
-
- startMain();
-
- queue = new LinkedBlockingQueue<>();
- queue2 = new LinkedBlockingQueue<>();
-
- String json = new String(
- Files.readAllBytes(new File("src/test/resources/parameters/TopicParameters.json").toPath()),
- StandardCharsets.UTF_8);
- json = json.replace("${port}", String.valueOf(getPort()));
-
- topicConfig = new StandardCoder().decode(json, TopicParameterGroup.class);
-
- TopicEndpointManager.getManager().addTopics(topicConfig);
- TopicEndpointManager.getManager().start();
-
- TopicEndpointManager.getManager().getDmaapTopicSource(TOPIC)
- .register((infra, topic, event) -> queue.add(event));
- TopicEndpointManager.getManager().getDmaapTopicSource(TOPIC2)
- .register((infra, topic, event) -> queue2.add(event));
-
- hostPort = httpPrefix.substring(httpPrefix.indexOf("http://"), httpPrefix.length() - 1);
- }
-
- /**
- * Stops the topics and clears the queues.
- */
- @AfterClass
- public static void tearDownAfterClass() throws DmaapSimException {
- TopicEndpointManager.getManager().shutdown();
-
- queue = null;
- queue2 = null;
-
- main.shutdown();
- }
-
- /**
- * Starts the topics.
- *
- * @throws CoderException if the parameters cannot be decoded
- */
- @Before
- public void setUp() {
- ++consumerName;
-
- queue.clear();
- queue2.clear();
- }
-
- @Test
- public void testWithTopicEndpointAtEachEnd() throws InterruptedException {
- // publish events
- TopicSink sink = TopicEndpointManager.getManager().getDmaapTopicSink(TOPIC);
- TopicSink sink2 = TopicEndpointManager.getManager().getDmaapTopicSink(TOPIC2);
- for (int x = 0; x < MAX_MSG; ++x) {
- sink.send("hello-" + x);
- sink2.send("world-" + x);
- }
-
- // verify events where received
- for (int x = 0; x < MAX_MSG; ++x) {
- assertEquals("message " + x, "hello-" + x, queue.poll(MAX_WAIT_SEC, TimeUnit.SECONDS));
- assertEquals("message " + x, "world-" + x, queue2.poll(MAX_WAIT_SEC, TimeUnit.SECONDS));
- }
- }
-
- @Test
- public void testCambriaFormat() throws Exception {
- // @formatter:off
- test("testCambriaFormat", "application/cambria",
- (wtr, messages) -> messages.forEach(msg -> wtr.write("0." + msg.length() + "." + msg + "\n")));
- // @formatter:on
- }
-
- @Test
- public void testJson() throws Exception {
- test("testJson", "application/json", (wtr, messages) -> wtr.write("[" + String.join(", ", messages) + "]"));
- }
-
- @Test
- public void testText() throws Exception {
- test("testText", "text/plain", (wtr, messages) -> messages.forEach(wtr::println));
- }
-
- /**
- * Uses a raw URL connection to ensure the server can process messages of the given
- * media type.
- *
- * @param testName name of the test
- * @param mediaType media type
- * @param writeMessages function that writes messages to a PrintWriter
- * @throws Exception if an error occurs
- */
- private void test(String testName, String mediaType, BiConsumer<PrintWriter, List<String>> writeMessages)
- throws Exception {
-
- /*
- * Force consumer name to be registered with the server by attempting to fetch a message.
- */
- buildConsumer(0).fetch();
-
- String msg1 = "{'abc':10.0}".replace('\'', '"');
- String msg2 = "{'def':20.0}".replace('\'', '"');
-
- URL url = new URL(httpPrefix + "events/" + TOPIC3);
-
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-type", mediaType);
- conn.setDoOutput(true);
- conn.connect();
-
- try (PrintWriter wtr = new PrintWriter(conn.getOutputStream())) {
- writeMessages.accept(wtr, Arrays.asList(msg1, msg2));
- }
-
- assertEquals(testName + " response code", HttpURLConnection.HTTP_OK, conn.getResponseCode());
-
- // fetch the messages
- Iterator<String> iter = buildConsumer(1000).fetch().iterator();
-
- assertTrue(testName + " have message 1", iter.hasNext());
- assertEquals(testName + " message 1", msg1, iter.next());
-
- assertTrue(testName + " have message 2", iter.hasNext());
- assertEquals(testName + " message 2", msg2, iter.next());
-
- // no more messages
- assertFalse(testName + " extra message", iter.hasNext());
- }
-
- private CambriaConsumer buildConsumer(int timeoutMs) throws MalformedURLException, GeneralSecurityException {
- ConsumerBuilder builder = new CambriaClientBuilders.ConsumerBuilder();
-
- builder.knownAs(String.valueOf(consumerName), "my-consumer-id")
- .usingHosts(hostPort).onTopic(TOPIC3)
- .waitAtServer(timeoutMs).receivingAtMost(5);
-
- builder.withSocketTimeout(timeoutMs + 2000);
-
- return builder.build();
- }
-
- /**
- * Starts the "Main".
- *
- * @throws Exception if an error occurs
- */
- private static void startMain() throws Exception {
- Registry.newRegistry();
-
- int port = CommonRestServer.getPort();
-
- // make sure port is available
- if (NetworkUtil.isTcpPortOpen("localhost", port, 1, 1L)) {
- throw new IllegalStateException("port " + port + " is still in use");
- }
-
- final String[] simConfigParameters = {"-c", "src/test/resources/parameters/TestConfigParams.json"};
-
- main = new Main(simConfigParameters);
-
- if (!NetworkUtil.isTcpPortOpen("localhost", port, 300, 200L)) {
- throw new IllegalStateException("server is not listening on port " + port);
- }
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/CommonTestData.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/CommonTestData.java
deleted file mode 100644
index 21d9ed604..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/CommonTestData.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
- * ================================================================================
- * 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.sim.dmaap.parameters;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.sim.dmaap.DmaapSimRuntimeException;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
-
-/**
- * Class to hold/create all parameters for test cases.
- */
-public class CommonTestData {
- public static final String SIM_GROUP_NAME = "DMaapSim";
-
- private static final Coder coder = new StandardCoder();
-
- /**
- * Gets the standard simulator parameters.
- *
- * @param port port to be inserted into the parameters
- * @return the standard simulator parameters
- */
- public DmaapSimParameterGroup getParameterGroup(int port) {
- try {
- return coder.decode(getParameterGroupAsString(port), DmaapSimParameterGroup.class);
-
- } catch (CoderException e) {
- throw new DmaapSimRuntimeException("cannot read simulator parameters", e);
- }
- }
-
- /**
- * Gets the standard simulator parameters, as a String.
- *
- * @param port port to be inserted into the parameters
- * @return the standard simulator parameters
- */
- public String getParameterGroupAsString(int port) {
-
- try {
- File file = new File("src/test/resources/parameters/NormalParameters.json");
- String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
-
- json = json.replace("6845", String.valueOf(port));
-
- return json;
-
- } catch (IOException e) {
- throw new DmaapSimRuntimeException("cannot read simulator parameters", e);
- }
- }
-
- /**
- * Nulls out a field within a JSON string. It does it by adding a field with the same
- * name, having a null value, and then prefixing the original field name with "Xxx",
- * thus causing the original field and value to be ignored.
- *
- * @param json JSON string
- * @param field field to be nulled out
- * @return a new JSON string with the field nulled out
- */
- public String nullifyField(String json, String field) {
- return json.replace(field + "\"", field + "\":null, \"" + field + "Xxx\"");
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java
deleted file mode 100644
index ca6712388..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.sim.dmaap.parameters;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.common.utils.cmd.CommandLineException;
-import org.onap.policy.models.sim.dmaap.DmaapSimException;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterHandler;
-import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments;
-
-public class DmaapSimParameterHandlerTest {
-
- private static final String RESOURCE_DIR = "src/test/resources/parameters/";
-
- private DmaapSimParameterHandler handler;
-
- @Before
- public void setUp() {
- handler = new DmaapSimParameterHandler();
- }
-
- @Test
- public void testGetParameters() throws DmaapSimException, CommandLineException {
- final DmaapSimCommandLineArguments args = new DmaapSimCommandLineArguments();
-
- args.parse(new String[] {"-c", RESOURCE_DIR + "NormalParameters.json"});
- DmaapSimParameterGroup params = handler.getParameters(args);
- assertNotNull(params);
- assertEquals("DMaapSim", params.getName());
- assertEquals(300L, params.getTopicSweepSec());
- assertEquals(6845, params.getRestServerParameters().getPort());
-
-
- args.parse(new String[] {"-c", "FileNotFound.json"});
- assertThatThrownBy(() -> handler.getParameters(args)).isInstanceOf(DmaapSimException.class)
- .hasMessageStartingWith("error reading parameters");
-
-
- args.parse(new String[] {"-c", RESOURCE_DIR + "EmptyParameterFile.json"});
- assertThatThrownBy(() -> handler.getParameters(args)).isInstanceOf(DmaapSimException.class)
- .hasMessageStartingWith("no parameters found");
-
-
- args.parse(new String[] {"-c", RESOURCE_DIR + "Parameters_InvalidName.json"});
- assertThatThrownBy(() -> handler.getParameters(args)).isInstanceOf(DmaapSimException.class)
- .hasMessageContaining("validation error");
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/DmaapSimActivatorTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/DmaapSimActivatorTest.java
deleted file mode 100644
index 810c16bc6..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/DmaapSimActivatorTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property.
- * ================================================================================
- * 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.sim.dmaap.startstop;
-
-import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.common.utils.services.Registry;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
-import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterHandler;
-import org.onap.policy.models.sim.dmaap.rest.CommonRestServer;
-import org.onap.policy.models.sim.dmaap.startstop.DmaapSimActivator;
-import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments;
-
-
-/**
- * Class to perform unit test of {@link DmaapSimActivator}}.
- */
-public class DmaapSimActivatorTest extends CommonRestServer {
-
- private DmaapSimActivator activator;
-
- /**
- * Initializes an activator.
- *
- * @throws Exception if an error occurs
- */
- @Before
- public void setUp() throws Exception {
- Registry.newRegistry();
- HttpServletServerFactoryInstance.getServerFactory().destroy();
-
- CommonRestServer.reconfigure();
-
- final String[] papConfigParameters = {"-c", CONFIG_FILE};
- final DmaapSimCommandLineArguments arguments = new DmaapSimCommandLineArguments(papConfigParameters);
- final DmaapSimParameterGroup parGroup = new DmaapSimParameterHandler().getParameters(arguments);
-
- activator = new DmaapSimActivator(parGroup);
- }
-
- /**
- * Method for cleanup after each test.
- *
- * @throws Exception if an error occurs
- */
- @After
- public void teardown() throws Exception {
- if (activator != null && activator.isAlive()) {
- activator.stop();
- }
- }
-
- @Test
- public void testDmaapSimActivator() {
- assertFalse(activator.isAlive());
- activator.start();
- assertTrue(activator.isAlive());
-
- // repeat - should throw an exception
- assertThatIllegalStateException().isThrownBy(() -> activator.start());
- assertTrue(activator.isAlive());
- }
-
- @Test
- public void testTerminate() {
- activator.start();
- activator.stop();
- assertFalse(activator.isAlive());
-
- // repeat - should throw an exception
- assertThatIllegalStateException().isThrownBy(() -> activator.stop());
- assertFalse(activator.isAlive());
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
deleted file mode 100644
index 1d6c68a49..000000000
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
- * 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.
- * 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.sim.dmaap.startstop;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
-import org.onap.policy.models.sim.dmaap.rest.CommonRestServer;
-import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments;
-import org.onap.policy.models.sim.dmaap.startstop.Main;
-import org.onap.policy.sim.dmaap.parameters.CommonTestData;
-
-/**
- * Class to perform unit test of {@link Main}}.
- *
- * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
- */
-public class MainTest extends CommonRestServer {
- private Main main;
-
- /**
- * Sets up.
- */
- @Before
- public void setUp() {
- main = null;
- HttpServletServerFactoryInstance.getServerFactory().destroy();
- }
-
- /**
- * Shuts "main" down.
- *
- * @throws Exception if an error occurs
- */
- @After
- public void tearDown() throws Exception {
- if (main != null) {
- main.shutdown();
- }
- }
-
- @Test
- public void testMain() throws Exception {
- CommonRestServer.reconfigure();
- final String[] NormalParameters = {"-c", CONFIG_FILE};
- main = new Main(NormalParameters);
- assertTrue(main.getParameters().isValid());
- assertEquals(CommonTestData.SIM_GROUP_NAME, main.getParameters().getName());
-
- main.shutdown();
- }
-
- @Test
- public void testMain_NoArguments() {
- final String[] NormalParameters = {};
- main = new Main(NormalParameters);
- assertNull(main.getParameters());
- }
-
- @Test
- public void testMain_InvalidArguments() throws Exception {
- CommonRestServer.reconfigure();
-
- // note: this is missing the "-c" argument, thus the ARGUMENTS are invalid
- final String[] NormalParameters = {CONFIG_FILE};
- main = new Main(NormalParameters);
- assertNull(main.getParameters());
- }
-
- @Test
- public void testMain_Help() {
- final String[] NormalParameters = {"-h"};
- assertThatCode(() -> Main.main(NormalParameters)).doesNotThrowAnyException();
- }
-
- @Test
- public void testMain_InvalidParameters() {
- final String[] NormalParameters = {"-c", "parameters/InvalidParameters.json"};
- main = new Main(NormalParameters);
- assertNull(main.getParameters());
- }
-
- @Test
- public void testDmaapSimVersion() {
- String[] testArgs = {"-v"};
- DmaapSimCommandLineArguments sutArgs = new DmaapSimCommandLineArguments(testArgs);
- assertThat(sutArgs.version()).startsWith("ONAP DMaaP simulator Service");
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameterFile.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameterFile.json
deleted file mode 100644
index e69de29bb..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameterFile.json
+++ /dev/null
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameters.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameters.json
deleted file mode 100644
index 0637a088a..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/EmptyParameters.json
+++ /dev/null
@@ -1 +0,0 @@
-[] \ No newline at end of file
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/InvalidParameters.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/InvalidParameters.json
deleted file mode 100644
index de2040cc8..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/InvalidParameters.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name" : []
-} \ No newline at end of file
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/MinimumParameters.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/MinimumParameters.json
deleted file mode 100644
index a1c98a5b1..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/MinimumParameters.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "name":"DMaapSim",
- "topicSweepSec": 1,
- "restServerParameters":{
- "host":"0.0.0.0",
- "port":6845
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/NoParameters.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/NoParameters.json
deleted file mode 100644
index 7a73a41bf..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/NoParameters.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-} \ No newline at end of file
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/Parameters_InvalidName.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/Parameters_InvalidName.json
deleted file mode 100644
index 51e9458b0..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/Parameters_InvalidName.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "name":" ",
- "topicSweepSec": 1,
- "restServerParameters":{
- "host":"0.0.0.0",
- "port":6969,
- "userName":"dmaapsim",
- "password":"zb!XztG34"
- }
-}
diff --git a/models-sim/models-sim-dmaap/src/test/resources/parameters/TopicParameters.json b/models-sim/models-sim-dmaap/src/test/resources/parameters/TopicParameters.json
deleted file mode 100644
index 77a320f6d..000000000
--- a/models-sim/models-sim-dmaap/src/test/resources/parameters/TopicParameters.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "topicSources": [
- {
- "topic": "MY-TOPIC",
- "servers": [
- "localhost:${port}"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 100
- },
- {
- "topic": "MY-TOPIC-B",
- "servers": [
- "localhost:${port}"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 100
- }
- ],
- "topicSinks": [
- {
- "topic": "MY-TOPIC",
- "servers": [
- "localhost:${port}"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "MY-TOPIC-B",
- "servers": [
- "localhost:${port}"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
-} \ No newline at end of file
diff --git a/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile b/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile
index a4420b343..746f8f117 100644
--- a/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile
+++ b/models-sim/packages/models-simulator-docker/src/main/docker/Dockerfile
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# ONAP
# ================================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
# Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -57,4 +57,4 @@ RUN find /opt/app -type d -perm 755 \
USER policy:policy
ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
-ENTRYPOINT [ "bash", "simulators.sh" ]
+ENTRYPOINT [ "simulators.sh" ]
diff --git a/models-sim/packages/models-simulator-docker/src/main/docker/simulators.sh b/models-sim/packages/models-simulator-docker/src/main/docker/simulators.sh
index 1cec646de..a2c2ec5f6 100644
--- a/models-sim/packages/models-simulator-docker/src/main/docker/simulators.sh
+++ b/models-sim/packages/models-simulator-docker/src/main/docker/simulators.sh
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# ONAP
# ================================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
# Modifications copyright (C) 2020 Bell Canada. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/models-sim/policy-models-simulators/pom.xml b/models-sim/policy-models-simulators/pom.xml
index 798d7faaf..8fa986e3c 100644
--- a/models-sim/policy-models-simulators/pom.xml
+++ b/models-sim/policy-models-simulators/pom.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
ONAP
================================================================================
- Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -52,47 +52,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <build>
- <resources>
- <!-- Output the version of the service -->
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/version.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/version.txt</exclude>
- </excludes>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-complete-tar</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/package/tarball/assembly.xml</descriptor>
- </descriptors>
- <finalName>${project.artifactId}-${project.version}</finalName>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
</project>
diff --git a/models-sim/policy-models-simulators/src/main/package/docker/Dockerfile b/models-sim/policy-models-simulators/src/main/package/docker/Dockerfile
deleted file mode 100644
index e9ed6db27..000000000
--- a/models-sim/policy-models-simulators/src/main/package/docker/Dockerfile
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ============LICENSE_START=======================================================
-# ONAP
-# ================================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. 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=========================================================
-#
-
-#
-# Docker file to build an image that runs the simulators
-#
-
-FROM onap/policy-jre-alpine
-
-LABEL maintainer="Policy Team"
-
-ARG POLICY_LOGS=/var/log/onap/policy/simulators
-
-ENV POLICY_HOME /opt/app/policy
-ENV POLICY_LOGS ${POLICY_LOGS}
-
-# Create DMaaP simulator user and group
-# Add simulator-specific directories and set ownership as the simulator user
-RUN mkdir -p ${POLICY_HOME}/simulators \
- && mkdir -p ${POLICY_HOME}/simulators/bin \
- && mkdir -p ${POLICY_LOGS} \
- && mkdir /packages
-
-# Unpack the tarball
-COPY policy-models-simulators-tarball.tar.gz /packages
-RUN tar xvfz /packages/policy-models-simulators-tarball.tar.gz --directory ${POLICY_HOME}/simulators \
- && rm /packages/policy-models-simulators-tarball.tar.gz
-
-# Ensure everything has the correct permissions
-# Copy scripts simulator user area
-COPY simulators.sh ${POLICY_HOME}/simulators/bin
-RUN find /opt/app -type d -perm 755 \
- && find /opt/app -type f -perm 644 \
- && chmod 755 ${POLICY_HOME}/simulators/bin/* \
- && chown -R policy:policy $POLICY_HOME $POLICY_LOGS
-
-USER policy:policy
-
-ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
-ENTRYPOINT [ "bash", "simulators.sh" ]
diff --git a/models-sim/policy-models-simulators/src/main/package/docker/docker_build.sh b/models-sim/policy-models-simulators/src/main/package/docker/docker_build.sh
deleted file mode 100644
index efbb1dc0f..000000000
--- a/models-sim/policy-models-simulators/src/main/package/docker/docker_build.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# ONAP
-# ================================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. 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=========================================================
-#
-
-#
-# Script to build a Docker file for the simulators. The docker image
-# generated by this script should NOT be placed in the ONAP nexus, it is
-# only for testing purposes.
-#
-
-if [ -z "$SIMULATOR_HOME" ]
-then
- SIMULATOR_HOME=$PWD
-fi
-
-# Check for the dockerfile
-if [ ! -f "$SIMULATOR_HOME/src/main/package/docker/Dockerfile" ]
-then
- echo docker file "$SIMULATOR_HOME/src/main/package/docker/Dockerfile" not found
- exit 1
-fi
-
-# Check for the start script
-if [ ! -f "$SIMULATOR_HOME/src/main/package/docker/simulators.sh" ]
-then
- echo start script "$SIMULATOR_HOME/src/main/package/docker/simulators.sh" not found
- exit 1
-fi
-
-# Check for the tarball
-tarball_count=`ls $SIMULATOR_HOME/target/policy-models-simulators-*tarball.tar.gz 2> /dev/null | wc | awk '{print $1}'`
-if [ "$tarball_count" -ne "1" ]
-then
- echo one and only one tarball should exist in the target directory
- exit 2
-fi
-
-# Set up the docker build
-rm -fr $SIMULATOR_HOME/target/docker
-mkdir $SIMULATOR_HOME/target/docker
-cp $SIMULATOR_HOME/src/main/package/docker/Dockerfile $SIMULATOR_HOME/target/docker
-cp $SIMULATOR_HOME/src/main/package/docker/simulators.sh $SIMULATOR_HOME/target/docker
-cp $SIMULATOR_HOME/target/policy-models-simulators-*tarball.tar.gz \
- $SIMULATOR_HOME/target/docker/policy-models-simulators-tarball.tar.gz
-
-# Run the docker build
-cd $SIMULATOR_HOME/target
-docker build -t policy/simulators docker
diff --git a/models-sim/policy-models-simulators/src/main/package/docker/simulators.sh b/models-sim/policy-models-simulators/src/main/package/docker/simulators.sh
deleted file mode 100644
index 7e38f374c..000000000
--- a/models-sim/policy-models-simulators/src/main/package/docker/simulators.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# ONAP
-# ================================================================================
-# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
-# Modifications copyright (C) 2020 Bell Canada. 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=========================================================
-#
-
-if [ -z "$SIMULATOR_HOME" ]
-then
- SIMULATOR_HOME=${POLICY_HOME}/simulators
-fi
-
-JAVA_HOME=/usr/lib/jvm/java-11-openjdk
-KEYSTORE="${SIMULATOR_HOME}/etc/ssl/policy-keystore"
-KEYSTORE_PASSWD="Pol1cy_0nap"
-TRUSTSTORE="${SIMULATOR_HOME}/etc/ssl/policy-truststore"
-TRUSTSTORE_PASSWD="Pol1cy_0nap"
-
-${JAVA_HOME}/bin/java \
- -cp "${SIMULATOR_HOME}/etc:${SIMULATOR_HOME}/lib/*" \
- -Djavax.net.ssl.keyStore="${KEYSTORE}" \
- -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
- -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
- -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
- org.onap.policy.models.simulators.Main \
- ${SIMULATOR_HOME}/etc/parameters/simParameters.json
diff --git a/models-sim/policy-models-simulators/src/main/package/tarball/assembly.xml b/models-sim/policy-models-simulators/src/main/package/tarball/assembly.xml
deleted file mode 100644
index 9a2fd65df..000000000
--- a/models-sim/policy-models-simulators/src/main/package/tarball/assembly.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- Modifications copyright (C) 2020 Bell Canada. 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=========================================================
--->
-
-<assembly>
- <id>tarball</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>true</useProjectArtifact>
- <outputDirectory>/lib</outputDirectory>
- <unpack>false</unpack>
- <scope>runtime</scope>
- <includes>
- <include>*:jar</include>
- </includes>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/src/main/resources/ssl
- </directory>
- <includes>
- <include>policy*</include>
- </includes>
- <outputDirectory>etc${file.separator}ssl</outputDirectory>
- <lineEnding>keep</lineEnding>
- </fileSet>
- </fileSets>
-</assembly>