2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.simulators;
23 import java.util.LinkedList;
24 import java.util.List;
26 import org.onap.policy.common.endpoints.parameters.TopicParameters;
27 import org.onap.policy.common.parameters.BeanValidationResult;
28 import org.onap.policy.common.parameters.BeanValidator;
29 import org.onap.policy.common.parameters.annotations.NotNull;
30 import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup;
33 * Simulator parameters.
37 public class SimulatorParameters {
40 * Note: this is only used to capture the provider's parameters; the rest server
41 * parameters that it contains are ignored. Instead, the parameters for the rest
42 * server are contained within the {@link #restServers} entry having the same name as
43 * the provider parameters.
45 private DmaapSimParameterGroup dmaapProvider;
48 * Parameters for the REST server simulators that are to be started.
50 private List<ClassRestServerParameters> restServers = new LinkedList<>();
53 * Topic sinks that are used by {@link #topicServers}.
55 private List<TopicParameters> topicSinks = new LinkedList<>();
58 * Topic sources that are used by {@link #topicServers}.
60 private List<TopicParameters> topicSources = new LinkedList<>();
63 * Parameters for the TOPIC server simulators that are to be started.
65 private List<TopicServerParameters> topicServers = new LinkedList<>();
69 * Validates the parameters.
71 * @param containerName name of the parameter container
72 * @return the validation result
74 public BeanValidationResult validate(String containerName) {
75 BeanValidationResult result = new BeanValidator().validateTop(containerName, this);
77 result.validateList("restServers", restServers, params -> params.validate("restServers"));
78 result.validateList("topicServers", topicServers, params -> params.validate("topicServers"));