66217d1848b144d2df0e2b2add294b245b903c49
[policy/distribution.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. All rights reserved.
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.distribution.main.testclasses;
22
23 import org.onap.policy.common.parameters.GroupValidationResult;
24 import org.onap.policy.distribution.main.parameters.PolicyForwarderConfigurationParameterGroup;
25
26 /**
27  * Dummy policy forwarder parameter group.
28  */
29 public class DummyPolicyForwarderParameterGroup extends PolicyForwarderConfigurationParameterGroup {
30
31     private boolean useHttps;
32     private String hostname;
33     private int port;
34     private String userName;
35     private String password;
36     private boolean isManaged;
37
38     public boolean isUseHttps() {
39         return useHttps;
40     }
41
42     public String getHostname() {
43         return hostname;
44     }
45
46     public int getPort() {
47         return port;
48     }
49
50     public String getUserName() {
51         return userName;
52     }
53
54     public String getPassword() {
55         return password;
56     }
57
58     public boolean isManaged() {
59         return isManaged;
60     }
61
62     /**
63      * Builder for DummyPolicyForwarderParameterGroup.
64      */
65     public static class DummyPolicyForwarderParameterGroupBuilder {
66         private boolean useHttps;
67         private String hostname;
68         private int port;
69         private String userName;
70         private String password;
71         private boolean isManaged;
72
73         public DummyPolicyForwarderParameterGroupBuilder setUseHttps(final boolean useHttps) {
74             this.useHttps = useHttps;
75             return this;
76         }
77
78         public DummyPolicyForwarderParameterGroupBuilder setHostname(final String hostname) {
79             this.hostname = hostname;
80             return this;
81         }
82
83         public DummyPolicyForwarderParameterGroupBuilder setPort(final int port) {
84             this.port = port;
85             return this;
86         }
87
88         public DummyPolicyForwarderParameterGroupBuilder setUserName(final String userName) {
89             this.userName = userName;
90             return this;
91         }
92
93         public DummyPolicyForwarderParameterGroupBuilder setPassword(final String password) {
94             this.password = password;
95             return this;
96         }
97
98         public DummyPolicyForwarderParameterGroupBuilder setIsManaged(final boolean isManaged) {
99             this.isManaged = isManaged;
100             return this;
101         }
102
103         /**
104          * Creates a new DummyPolicyForwarderParameterGroup instance.
105          */
106         public DummyPolicyForwarderParameterGroup build() {
107             return new DummyPolicyForwarderParameterGroup(this);
108         }
109     }
110
111     /**
112      * Construct an instance.
113      *
114      * @param builder the builder create the instance from
115      */
116     private DummyPolicyForwarderParameterGroup(final DummyPolicyForwarderParameterGroupBuilder builder) {
117         this.useHttps = builder.useHttps;
118         this.hostname = builder.hostname;
119         this.port = builder.port;
120         this.userName = builder.userName;
121         this.password = builder.password;
122         this.isManaged = builder.isManaged;
123     }
124
125     @Override
126     public GroupValidationResult validate() {
127         final GroupValidationResult validationResult = new GroupValidationResult(this);
128         return validationResult;
129     }
130
131 }