08d78daaf34b083bee985b97c08f299cb29a74c2
[policy/apex-pdp.git] / testsuites / integration / integration-uservice-test / src / test / java / org / onap / policy / apex / testsuites / integration / uservice / executionproperties / DummyCarrierTechnologyParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.testsuites.integration.uservice.executionproperties;
22
23 import lombok.Data;
24 import lombok.EqualsAndHashCode;
25
26 import org.apache.commons.lang3.StringUtils;
27 import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
28 import org.onap.policy.common.parameters.GroupValidationResult;
29 import org.onap.policy.common.parameters.ValidationStatus;
30
31 /**
32  * Dummy carrier technology parameters.
33  *
34  * <p>The parameters for this plugin are:
35  * <ol>
36  * <li>testToRun: The name of the test to run.
37  * </ol>
38  */
39 @Data
40 @EqualsAndHashCode(callSuper = false)
41 public class DummyCarrierTechnologyParameters extends CarrierTechnologyParameters {
42
43     /** The label of this carrier technology. */
44     public static final String DUMMY_CARRIER_TECHNOLOGY_LABEL = "DUMMY";
45
46     /** The producer plugin class for the dummy carrier technology. */
47     public static final String DUMMY_EVENT_PRODUCER_PLUGIN_CLASS = DummyApexEventProducer.class.getName();
48
49     /** The consumer plugin class for the dummy carrier technology. */
50     public static final String DUMMY_EVENT_CONSUMER_PLUGIN_CLASS = DummyApexEventConsumer.class.getName();
51
52     private String testToRun = null;
53     private String propertyFileName = null;
54
55     /**
56      * Constructor to create a dummy carrier technology parameters instance and register the instance with the parameter
57      * service.
58      */
59     public DummyCarrierTechnologyParameters() {
60         super();
61
62         // Set the carrier technology properties for the web socket carrier technology
63         this.setLabel(DUMMY_CARRIER_TECHNOLOGY_LABEL);
64         this.setEventProducerPluginClass(DUMMY_EVENT_PRODUCER_PLUGIN_CLASS);
65         this.setEventConsumerPluginClass(DUMMY_EVENT_CONSUMER_PLUGIN_CLASS);
66
67     }
68
69     /**
70      * {@inheritDoc}.
71      */
72     @Override
73     public GroupValidationResult validate() {
74         final GroupValidationResult result = super.validate();
75
76         if (StringUtils.isEmpty(testToRun)) {
77             result.setResult("testToRun", ValidationStatus.INVALID,
78                     "no test has been specified on the dummy carrier technology plugin");
79         }
80
81         if (StringUtils.isEmpty(propertyFileName)) {
82             result.setResult("propertyFileName", ValidationStatus.INVALID,
83                     "no propertyFileName has been specified on the dummy carrier technology plugin");
84         }
85
86         return result;
87     }
88 }