diff options
Diffstat (limited to 'models-sim/policy-models-simulators/src')
16 files changed, 77 insertions, 573 deletions
diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java index a501d5253..b1ee73942 100644 --- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java +++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java @@ -24,21 +24,13 @@ package org.onap.policy.models.simulators; import java.io.FileNotFoundException; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.Properties; import java.util.concurrent.atomic.AtomicReference; import lombok.AccessLevel; import lombok.Getter; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; -import org.onap.policy.common.endpoints.parameters.TopicParameters; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.parameters.BeanValidationResult; @@ -49,12 +41,7 @@ import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.common.utils.services.Registry; 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.CambriaMessageBodyHandler; -import org.onap.policy.models.sim.dmaap.rest.TextMessageBodyHandler; import org.onap.policy.simulators.CdsSimulator; -import org.onap.policy.simulators.TopicServer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,21 +66,7 @@ public class Main extends ServiceManagerContainer { super(Main.class.getPackage().getName()); SimulatorParameters params = readParameters(paramFile); - BeanValidationResult result = params.validate("simulators"); - if (!result.isValid()) { - logger.error("invalid parameters:\n{}", result.getResult()); - throw new IllegalArgumentException("invalid simulator parameters"); - } - - DmaapSimParameterGroup dmaapProv = params.getDmaapProvider(); - String dmaapName = (dmaapProv != null ? dmaapProv.getName() : null); - - // dmaap provider - if (dmaapProv != null) { - String provName = dmaapName.replace("simulator", "provider"); - AtomicReference<DmaapSimProvider> provRef = new AtomicReference<>(); - addAction(provName, () -> provRef.set(buildDmaapProvider(dmaapProv)), () -> provRef.get().shutdown()); - } + String messageBroker = "models-sim"; CdsServerParameters cdsServer = params.getGrpcServer(); @@ -114,35 +87,7 @@ public class Main extends ServiceManagerContainer { () -> Registry.unregister(resourceLocationId)); } addAction(restsim.getName(), - () -> ref.set(buildRestServer(dmaapName, restsim)), - () -> ref.get().shutdown()); - } - - // NOTE: topics must be started AFTER the (dmaap) rest servers - - // topic sinks - Map<String, TopicSink> sinks = new HashMap<>(); - for (TopicParameters topicParams : params.getTopicSinks()) { - String topic = topicParams.getTopic(); - addAction("Sink " + topic, - () -> sinks.put(topic, startSink(topicParams)), - () -> sinks.get(topic).shutdown()); - } - - // topic sources - Map<String, TopicSource> sources = new HashMap<>(); - for (TopicParameters topicParams : params.getTopicSources()) { - String topic = topicParams.getTopic(); - addAction("Source " + topic, - () -> sources.put(topic, startSource(topicParams)), - () -> sources.get(topic).shutdown()); - } - - // topic server simulators - for (TopicServerParameters topicsim : params.getTopicServers()) { - AtomicReference<TopicServer<?>> ref = new AtomicReference<>(); - addAction(topicsim.getName(), - () -> ref.set(buildTopicServer(topicsim, sinks, sources)), + () -> ref.set(buildRestServer(messageBroker, restsim)), () -> ref.get().shutdown()); } // @formatter:on @@ -191,13 +136,6 @@ public class Main extends ServiceManagerContainer { } } - private DmaapSimProvider buildDmaapProvider(DmaapSimParameterGroup params) { - var prov = new DmaapSimProvider(params); - DmaapSimProvider.setInstance(prov); - prov.start(); - return prov; - } - private CdsSimulator buildCdsSimulator(CdsServerParameters params) throws IOException { var cdsSimulator = new CdsSimulator(params.getHost(), params.getPort(), params.getResourceLocation(), params.getSuccessRepeatCount(), params.getRequestedResponseDelayMs()); @@ -206,21 +144,9 @@ public class Main extends ServiceManagerContainer { } - private TopicSink startSink(TopicParameters params) { - TopicSink sink = TopicEndpointManager.getManager().addTopicSinks(List.of(params)).get(0); - sink.start(); - return sink; - } - - private TopicSource startSource(TopicParameters params) { - TopicSource source = TopicEndpointManager.getManager().addTopicSources(List.of(params)).get(0); - source.start(); - return source; - } - - private HttpServletServer buildRestServer(String dmaapName, ClassRestServerParameters params) { + private HttpServletServer buildRestServer(String messageBroker, ClassRestServerParameters params) { try { - var props = getServerProperties(dmaapName, params); + var props = getServerProperties(messageBroker, params); HttpServletServer testServer = makeServer(props); testServer.waitedStart(5000); @@ -239,30 +165,6 @@ public class Main extends ServiceManagerContainer { } } - private TopicServer<?> buildTopicServer(TopicServerParameters params, Map<String, TopicSink> sinks, - Map<String, TopicSource> sources) { - try { - // find the desired sink - TopicSink sink = sinks.get(params.getSink()); - if (sink == null) { - throw new IllegalArgumentException("invalid sink topic " + params.getSink()); - } - - // find the desired source - TopicSource source = sources.get(params.getSource()); - if (source == null) { - throw new IllegalArgumentException("invalid source topic " + params.getSource()); - } - - // create the topic server - return (TopicServer<?>) Class.forName(params.getProviderClass()) - .getDeclaredConstructor(TopicSink.class, TopicSource.class).newInstance(sink, source); - - } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException - | SecurityException | ClassNotFoundException e) { - throw new IllegalArgumentException("cannot create TopicServer: " + params.getName(), e); - } - } /** * Creates a set of properties, suitable for building a REST server, from the @@ -271,7 +173,7 @@ public class Main extends ServiceManagerContainer { * @param params parameters from which to build the properties * @return a Map of properties representing the given parameters */ - private static Properties getServerProperties(String dmaapName, ClassRestServerParameters params) { + private static Properties getServerProperties(String messageBroker, ClassRestServerParameters params) { final var props = new Properties(); props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, params.getName()); @@ -290,15 +192,9 @@ public class Main extends ServiceManagerContainer { props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SNI_HOST_CHECK_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true"); - if (dmaapName != null && dmaapName.equals(params.getName())) { - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, - String.join(",", CambriaMessageBodyHandler.class.getName(), - GsonMessageBodyHandler.class.getName(), - TextMessageBodyHandler.class.getName())); - } else { - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, String.join(",", + props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, String.join(",", GsonMessageBodyHandler.class.getName(), TextMessageBodyHandler.class.getName())); - } + return props; } diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java index 28c4f42d2..0ae3a17e7 100644 --- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java +++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/SimulatorParameters.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +25,7 @@ package org.onap.policy.models.simulators; import java.util.LinkedList; import java.util.List; import lombok.Getter; -import org.onap.policy.common.endpoints.parameters.TopicParameters; -import org.onap.policy.common.parameters.BeanValidationResult; -import org.onap.policy.common.parameters.BeanValidator; -import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.common.parameters.annotations.Valid; -import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup; /** * Simulator parameters. @@ -37,14 +33,6 @@ import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup; @Getter public class SimulatorParameters { - /** - * Note: this is only used to capture the provider's parameters; the rest server - * parameters that it contains are ignored. Instead, the parameters for the rest - * server are contained within the {@link #restServers} entry having the same name as - * the provider parameters. - */ - private DmaapSimParameterGroup dmaapProvider; - private @Valid CdsServerParameters grpcServer; /** @@ -52,43 +40,5 @@ public class SimulatorParameters { */ private List<@Valid ClassRestServerParameters> restServers = new LinkedList<>(); - /** - * Topic sinks that are used by {@link #topicServers}. - */ - private List<@Valid TopicParameters> topicSinks = new LinkedList<>(); - - /** - * Topic sources that are used by {@link #topicServers}. - */ - private List<@Valid TopicParameters> topicSources = new LinkedList<>(); - - /** - * Parameters for the TOPIC server simulators that are to be started. - */ - private List<@Valid TopicServerParameters> topicServers = new LinkedList<>(); - - - /** - * Validates the parameters. - * - * @param containerName name of the parameter container - * @return the validation result - */ - public BeanValidationResult validate(String containerName) { - BeanValidationResult result = new BeanValidator().validateTop(containerName, this); - - if (dmaapProvider != null) { - // do not want full validation of the provider, so validate the relevant - // fields ourselves - var subResult = new BeanValidationResult("dmaapProvider", dmaapProvider); - subResult.validateNotNull("name", dmaapProvider.getName()); - if (dmaapProvider.getTopicSweepSec() < 1) { - subResult.addResult("topicSweepSec", dmaapProvider.getTopicSweepSec(), - ValidationStatus.INVALID, "is below the minimum value: 1"); - } - result.addResult(subResult); - } - return result; - } } diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TextMessageBodyHandler.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TextMessageBodyHandler.java new file mode 100644 index 000000000..a99a9383d --- /dev/null +++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TextMessageBodyHandler.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Models + * ================================================================================ + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023-2024 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.models.simulators; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.ext.MessageBodyReader; +import jakarta.ws.rs.ext.Provider; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.util.LinkedList; +import java.util.List; + +/** + * Provider that decodes "text/plain" messages. + */ +@Provider +@Consumes(TextMessageBodyHandler.MEDIA_TYPE_TEXT_PLAIN) +public class TextMessageBodyHandler implements MessageBodyReader<Object> { + public static final String MEDIA_TYPE_TEXT_PLAIN = "text/plain"; + + @Override + public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return (mediaType != null && MEDIA_TYPE_TEXT_PLAIN.equals(mediaType.toString())); + } + + @Override + public List<Object> readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { + + try (var bufferedReader = new BufferedReader(new InputStreamReader(entityStream, StandardCharsets.UTF_8))) { + List<Object> messages = new LinkedList<>(); + String msg; + while ((msg = bufferedReader.readLine()) != null) { + messages.add(msg); + } + + return messages; + } + } +} diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TopicServerParameters.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TopicServerParameters.java deleted file mode 100644 index 8a477b232..000000000 --- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/TopicServerParameters.java +++ /dev/null @@ -1,48 +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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.models.simulators; - -import lombok.Getter; -import org.onap.policy.common.parameters.BeanValidationResult; -import org.onap.policy.common.parameters.BeanValidator; -import org.onap.policy.common.parameters.annotations.NotBlank; -import org.onap.policy.common.parameters.annotations.NotNull; - -@Getter -@NotNull -@NotBlank -public class TopicServerParameters { - private String name; - private String providerClass; - private String sink; - private String source; - - - /** - * Validates the parameters. - * - * @param containerName name of the parameter container - * @return the validation result - */ - public BeanValidationResult validate(String containerName) { - return new BeanValidator().validateTop(containerName, this); - } -} diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java index 73eb69f7a..09064f472 100644 --- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java +++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java @@ -113,12 +113,6 @@ public class MainTest { } } - @Test - public void testConstructor() throws Exception { - assertThatIllegalArgumentException().isThrownBy(() -> new Main("invalidDmaapProvider.json")) - .withMessage("invalid simulator parameters"); - } - /** * Verifies that all the simulators are brought up and that HTTPS works with at * least one of them. @@ -243,30 +237,5 @@ public class MainTest { assertThat(ex.getCause()).hasMessageStartingWith("interrupted while building"); } - /** - * Tests buildTopicServer() when the provider class is invalid. - */ - @Test - public void testBuildTopicServerInvalidProvider() { - assertThatThrownBy(() -> new Main("invalidTopicServer.json").start()) - .hasCauseInstanceOf(IllegalArgumentException.class); - } - - /** - * Tests buildTopicServer() when the sink is missing. - */ - @Test - public void testBuildTopicServerNoSink() { - assertThatThrownBy(() -> new Main("missingSink.json").start()) - .hasCauseInstanceOf(IllegalArgumentException.class); - } - /** - * Tests buildTopicServer() when the sink is missing. - */ - @Test - public void testBuildTopicServerNoSource() { - assertThatThrownBy(() -> new Main("missingSource.json").start()) - .hasCauseInstanceOf(IllegalArgumentException.class); - } } diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java deleted file mode 100644 index 8094ca419..000000000 --- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/SimulatorParametersTest.java +++ /dev/null @@ -1,85 +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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.models.simulators; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.File; -import org.junit.Test; -import org.onap.policy.common.parameters.BeanValidationResult; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.common.utils.coder.StandardCoder; - -public class SimulatorParametersTest { - - @Test - public void testValidate() throws CoderException { - SimulatorParameters params = new StandardCoder().decode(new File("src/test/resources/simParameters.json"), - SimulatorParameters.class); - assertNull(params.validate("ValidParams").getResult()); - } - - @Test - public void testValidateEmptyRestServer() throws CoderException { - SimulatorParameters params = new StandardCoder() - .decode(new File("src/test/resources/emptyRestServer.json"), SimulatorParameters.class); - assertNull(params.validate("ValidParams").getResult()); - } - - @Test - public void testValidateInvalidDmaapProvider() throws CoderException { - SimulatorParameters params = new StandardCoder() - .decode(new File("src/test/resources/invalidDmaapProvider.json"), SimulatorParameters.class); - BeanValidationResult result = params.validate("InvalidDmaapParams"); - assertFalse(result.isValid()); - assertNotNull(result.getResult()); - } - - @Test - public void testValidateInvalidDmaapName() throws CoderException { - SimulatorParameters params = new StandardCoder().decode( - new File("src/test/resources/invalidDmaapName.json"), SimulatorParameters.class); - BeanValidationResult result = params.validate("InvalidDmaapParams"); - assertFalse(result.isValid()); - assertThat(result.getResult()).contains("item \"name\" value \"null\""); - } - - @Test - public void testValidateInvalidTopicSweep() throws CoderException { - SimulatorParameters params = new StandardCoder().decode( - new File("src/test/resources/invalidTopicSweep.json"), SimulatorParameters.class); - BeanValidationResult result = params.validate("InvalidDmaapParams"); - assertFalse(result.isValid()); - assertThat(result.getResult()).contains("topicSweepSec"); - } - - @Test - public void testValidateInvalidGrpcServer() throws CoderException { - SimulatorParameters params = new StandardCoder() - .decode(new File("src/test/resources/invalidGrpcServer.json"), SimulatorParameters.class); - BeanValidationResult result = params.validate("InvalidGrpcParams"); - assertFalse(result.isValid()); - assertNotNull(result.getResult()); - } -} diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java deleted file mode 100644 index 2d182d8fb..000000000 --- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/TopicServerParametersTest.java +++ /dev/null @@ -1,48 +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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.models.simulators; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.File; -import org.junit.Test; -import org.onap.policy.common.parameters.ValidationResult; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.common.utils.coder.StandardCoder; - -public class TopicServerParametersTest { - - @Test - public void testValidateString() throws CoderException { - // some fields missing - ValidationResult result = new TopicServerParameters().validate("InvalidParams"); - assertFalse(result.isValid()); - assertNotNull(result.getResult()); - - // everything populated - SimulatorParameters simParams = new StandardCoder() - .decode(new File("src/test/resources/simParameters.json"), SimulatorParameters.class); - TopicServerParameters params = simParams.getTopicServers().get(0); - assertNull(params.validate("ValidParams").getResult()); - } -} diff --git a/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json index 4a86253da..ca4841eca 100644 --- a/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json +++ b/models-sim/policy-models-simulators/src/test/resources/emptyRestServer.json @@ -1,11 +1,3 @@ { - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": {} - }, - "restServers": [], - "topicSinks": [], - "topicSources": [], - "topicServers": [] + "restServers": [] } diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json deleted file mode 100644 index 889c4c844..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapName.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dmaapProvider": { - "name": null, - "topicSweepSec":300 - }, - "restServers": [], - "topicSinks": [], - "topicSources": [], - "topicServers": [] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json b/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json deleted file mode 100644 index ff6790144..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/invalidDmaapProvider.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dmaapProvider": {}, - "restServers": [], - "topicSinks": [], - "topicSources": [], - "topicServers": [] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json b/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json deleted file mode 100644 index b3d31f6b4..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/invalidTopicServer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": { - - } - }, - "topicSinks": [ - { - "topic": "APPC-LCM-READ", - "servers": ["localhost"], - "port": 3905, - "topicCommInfrastructure": "DMAAP", - "https": true - } - ], - "topicSources": [ - { - "topic": "APPC-LCM-WRITE", - "servers": ["localhost"], - "port": 3905, - "topicCommInfrastructure": "DMAAP", - "https": true - } - ], - "topicServers": [ - { - "name": "Invalid Topic simulator", - "providerClass": "org.onap.policy.simulators.InvalidTopicServer", - "sink": "APPC-LCM-READ", - "source": "APPC-LCM-WRITE" - } - ] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json b/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json deleted file mode 100644 index 11a37d5c4..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/invalidTopicSweep.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec":0 - }, - "restServers": [], - "topicSinks": [], - "topicSources": [], - "topicServers": [] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/logback-test.xml b/models-sim/policy-models-simulators/src/test/resources/logback-test.xml index e599a94a8..05a097bef 100644 --- a/models-sim/policy-models-simulators/src/test/resources/logback-test.xml +++ b/models-sim/policy-models-simulators/src/test/resources/logback-test.xml @@ -1,6 +1,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2024 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -41,9 +42,4 @@ <appender-ref ref="STDOUT" /> </logger> - <logger name="org.onap.policy.models.sim.dmaap" level="debug" - additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - </configuration> diff --git a/models-sim/policy-models-simulators/src/test/resources/missingSink.json b/models-sim/policy-models-simulators/src/test/resources/missingSink.json deleted file mode 100644 index e7d63e04f..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/missingSink.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": { - - } - }, - "topicSources": [ - { - "topic": "APPC-LCM-WRITE", - "servers": ["localhost"], - "port": 3905, - "topicCommInfrastructure": "DMAAP", - "https": true - } - ], - "topicServers": [ - { - "name": "APPC-LCM simulator", - "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer", - "sink": "APPC-LCM-READ", - "source": "APPC-LCM-WRITE" - } - ] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/missingSource.json b/models-sim/policy-models-simulators/src/test/resources/missingSource.json deleted file mode 100644 index 0f02e4095..000000000 --- a/models-sim/policy-models-simulators/src/test/resources/missingSource.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 300, - "restServerParameters": { - - } - }, - "topicSinks": [ - { - "topic": "APPC-LCM-READ", - "servers": ["localhost"], - "port": 3905, - "topicCommInfrastructure": "DMAAP", - "https": true - } - ], - "topicServers": [ - { - "name": "APPC-LCM simulator", - "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer", - "sink": "APPC-LCM-READ", - "source": "APPC-LCM-WRITE" - } - ] -} diff --git a/models-sim/policy-models-simulators/src/test/resources/simParameters.json b/models-sim/policy-models-simulators/src/test/resources/simParameters.json index 325998fef..6d3ae3acd 100644 --- a/models-sim/policy-models-simulators/src/test/resources/simParameters.json +++ b/models-sim/policy-models-simulators/src/test/resources/simParameters.json @@ -1,17 +1,6 @@ { - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 300 - }, "restServers": [ { - "name": "DMaaP simulator", - "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", - "host": "localhost", - "port": 3905, - "https": true - }, - { "name": "A&AI simulator", "providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs", "host": "localhost", @@ -47,66 +36,7 @@ "https": true } ], - "topicSinks": [ - { - "topic": "appc-cl", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - }, - { - "topic": "appc-lcm-write", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - }, - { - "topic": "sdnr-cl", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - } - ], - "topicSources": [ - { - "topic": "appc-cl", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - }, - { - "topic": "appc-lcm-read", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - }, - { - "topic": "sdnr-cl-rsp", - "servers": ["localhost"], - "topicCommInfrastructure": "DMAAP", - "useHttps": true - } - ], - "topicServers": [ - { - "name": "APPC Legacy simulator", - "providerClass": "org.onap.policy.simulators.AppcLegacyTopicServer", - "sink": "appc-cl", - "source": "appc-cl" - }, - { - "name": "APPC-LCM simulator", - "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer", - "sink": "appc-lcm-write", - "source": "appc-lcm-read" - }, - { - "name": "SDNR simulator", - "providerClass": "org.onap.policy.simulators.SdnrTopicServer", - "sink": "sdnr-cl", - "source": "sdnr-cl-rsp" - } - ], + "grpcServer": { "name": "CDS simulator", "providerClass": "org.onap.policy.simulators.CdsSimulator", |