Add unit tests to increase the sonar coverage
[aai/model-loader.git] / src / test / java / org / onap / aai / modelloader / notification / TestConfiguration.java
1 /**\r
2  * ============LICENSE_START=======================================================\r
3  * org.onap.aai\r
4  * ================================================================================\r
5  * Copyright © 2017 AT&T Intellectual Property.\r
6  * Copyright © 2017 Amdocs\r
7  * All rights reserved.\r
8  * ================================================================================\r
9  * Licensed under the Apache License, Version 2.0 (the "License");\r
10  * you may not use this file except in compliance with the License.\r
11  * You may obtain a copy of the License at\r
12  *\r
13  *     http://www.apache.org/licenses/LICENSE-2.0\r
14  *\r
15  * Unless required by applicable law or agreed to in writing, software\r
16  * distributed under the License is distributed on an "AS IS" BASIS,\r
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
18  * See the License for the specific language governing permissions and\r
19  * limitations under the License.\r
20  * ============LICENSE_END=========================================================\r
21  *\r
22  * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
23  */\r
24 package org.onap.aai.modelloader.notification;\r
25 \r
26 import org.openecomp.sdc.api.consumer.IConfiguration;\r
27 \r
28 import java.util.ArrayList;\r
29 import java.util.List;\r
30 \r
31 public class TestConfiguration implements IConfiguration{\r
32 \r
33 \r
34     private String asdcAddress;\r
35     private String user;\r
36     private String password;\r
37     private int pollingInterval = 15;\r
38     private int pollingTimeout = 15;\r
39     private List<String> relevantArtifactTypes;\r
40     private String consumerGroup;\r
41     private String environmentName;\r
42     private String comsumerID;\r
43     private String keyStorePath;\r
44     private String keyStorePassword;\r
45     private boolean activateServerTLSAuth;\r
46     private boolean isFilterInEmptyResources;\r
47     private boolean useHttpsWithDmaap;\r
48 \r
49     public TestConfiguration(IConfiguration other) {\r
50         this.asdcAddress = other.getAsdcAddress();\r
51         this.comsumerID = other.getConsumerID();\r
52         this.consumerGroup = other.getConsumerGroup();\r
53         this.environmentName = other.getEnvironmentName();\r
54         this.password = other.getPassword();\r
55         this.pollingInterval = other.getPollingInterval();\r
56         this.pollingTimeout = other.getPollingTimeout();\r
57         this.relevantArtifactTypes = other.getRelevantArtifactTypes();\r
58         this.user = other.getUser();\r
59         this.keyStorePath = other.getKeyStorePath();\r
60         this.keyStorePassword = other.getKeyStorePassword();\r
61         this.activateServerTLSAuth = other.activateServerTLSAuth();\r
62         this.isFilterInEmptyResources = other.isFilterInEmptyResources();\r
63     }\r
64 \r
65     public TestConfiguration() {\r
66         this.asdcAddress = "localhost:8443";\r
67         this.comsumerID = "mso-123456";\r
68         this.consumerGroup = "mso-group";\r
69         this.environmentName = "PROD";\r
70         this.password = "password";\r
71         this.pollingInterval = 20;\r
72         this.pollingTimeout = 20;\r
73         this.relevantArtifactTypes = new ArrayList<String>();\r
74         this.relevantArtifactTypes.add("HEAT");\r
75         this.user = "mso-user";\r
76         this.keyStorePath = "etc/asdc-client.jks";\r
77         this.keyStorePassword = "Aa123456";\r
78         this.activateServerTLSAuth = false;\r
79         this.isFilterInEmptyResources = false;\r
80     }\r
81 \r
82     @Override\r
83     public String getAsdcAddress() {\r
84         return asdcAddress;\r
85     }\r
86 \r
87     @Override\r
88     public String getUser() {\r
89         return user;\r
90     }\r
91 \r
92     @Override\r
93     public String getPassword() {\r
94         return password;\r
95     }\r
96 \r
97     @Override\r
98     public int getPollingInterval() {\r
99         return pollingInterval;\r
100     }\r
101 \r
102     @Override\r
103     public int getPollingTimeout() {\r
104         return pollingTimeout;\r
105     }\r
106 \r
107     @Override\r
108     public List<String> getRelevantArtifactTypes() {\r
109         return relevantArtifactTypes;\r
110     }\r
111 \r
112     @Override\r
113     public String getConsumerGroup() {\r
114         return consumerGroup;\r
115     }\r
116 \r
117     @Override\r
118     public String getEnvironmentName() {\r
119         return environmentName;\r
120     }\r
121 \r
122     @Override\r
123     public String getConsumerID() {\r
124         return comsumerID;\r
125     }\r
126 \r
127     @Override\r
128     public String getKeyStorePath() {\r
129         return keyStorePath;\r
130     }\r
131 \r
132     @Override\r
133     public String getKeyStorePassword() {\r
134         return keyStorePassword;\r
135     }\r
136 \r
137     public String getComsumerID() {\r
138         return comsumerID;\r
139     }\r
140 \r
141     public void setComsumerID(String comsumerID) {\r
142         this.comsumerID = comsumerID;\r
143     }\r
144 \r
145     public void setAsdcAddress(String asdcAddress) {\r
146         this.asdcAddress = asdcAddress;\r
147     }\r
148 \r
149     public void setUser(String user) {\r
150         this.user = user;\r
151     }\r
152 \r
153     public void setPassword(String password) {\r
154         this.password = password;\r
155     }\r
156 \r
157     public void setPollingInterval(int pollingInterval) {\r
158         this.pollingInterval = pollingInterval;\r
159     }\r
160 \r
161     public void setPollingTimeout(int pollingTimeout) {\r
162         this.pollingTimeout = pollingTimeout;\r
163     }\r
164 \r
165     public void setRelevantArtifactTypes(List<String> relevantArtifactTypes) {\r
166         this.relevantArtifactTypes = relevantArtifactTypes;\r
167     }\r
168 \r
169     public void setConsumerGroup(String consumerGroup) {\r
170         this.consumerGroup = consumerGroup;\r
171     }\r
172 \r
173     public void setEnvironmentName(String environmentName) {\r
174         this.environmentName = environmentName;\r
175     }\r
176 \r
177     public void setKeyStorePath(String keyStorePath) {\r
178         this.keyStorePath = keyStorePath;\r
179     }\r
180 \r
181     public void setKeyStorePassword(String keyStorePassword) {\r
182         this.keyStorePassword = keyStorePassword;\r
183     }\r
184 \r
185     @Override\r
186     public int hashCode() {\r
187         final int prime = 31;\r
188         int result = 1;\r
189         result = prime * result + ((asdcAddress == null) ? 0 : asdcAddress.hashCode());\r
190         result = prime * result + ((comsumerID == null) ? 0 : comsumerID.hashCode());\r
191         result = prime * result + ((consumerGroup == null) ? 0 : consumerGroup.hashCode());\r
192         result = prime * result + ((environmentName == null) ? 0 : environmentName.hashCode());\r
193         result = prime * result + ((password == null) ? 0 : password.hashCode());\r
194         result = prime * result + pollingInterval;\r
195         result = prime * result + pollingTimeout;\r
196         result = prime * result + ((relevantArtifactTypes == null) ? 0 : relevantArtifactTypes.hashCode());\r
197         result = prime * result + ((user == null) ? 0 : user.hashCode());\r
198         return result;\r
199     }\r
200 \r
201     @Override\r
202     public boolean activateServerTLSAuth() {\r
203 \r
204         return activateServerTLSAuth;\r
205     }\r
206 \r
207     public void setactivateServerTLSAuth(boolean activateServerTLSAuth) {\r
208         this.activateServerTLSAuth = activateServerTLSAuth;\r
209     }\r
210 \r
211     @Override\r
212     public boolean equals(Object obj) {\r
213         if (this == obj)\r
214             return true;\r
215         if (obj == null)\r
216             return false;\r
217         if (getClass() != obj.getClass())\r
218             return false;\r
219         TestConfiguration other = (TestConfiguration) obj;\r
220         if (asdcAddress == null) {\r
221             if (other.asdcAddress != null)\r
222                 return false;\r
223         } else if (!asdcAddress.equals(other.asdcAddress))\r
224             return false;\r
225         if (comsumerID == null) {\r
226             if (other.comsumerID != null)\r
227                 return false;\r
228         } else if (!comsumerID.equals(other.comsumerID))\r
229             return false;\r
230         if (consumerGroup == null) {\r
231             if (other.consumerGroup != null)\r
232                 return false;\r
233         } else if (!consumerGroup.equals(other.consumerGroup))\r
234             return false;\r
235         if (environmentName == null) {\r
236             if (other.environmentName != null)\r
237                 return false;\r
238         } else if (!environmentName.equals(other.environmentName))\r
239             return false;\r
240         if (password == null) {\r
241             if (other.password != null)\r
242                 return false;\r
243         } else if (!password.equals(other.password))\r
244             return false;\r
245         if (pollingInterval != other.pollingInterval)\r
246             return false;\r
247         if (pollingTimeout != other.pollingTimeout)\r
248             return false;\r
249         if (relevantArtifactTypes == null) {\r
250             if (other.relevantArtifactTypes != null)\r
251                 return false;\r
252         } else if (!relevantArtifactTypes.equals(other.relevantArtifactTypes))\r
253             return false;\r
254         if (user == null) {\r
255             if (other.user != null)\r
256                 return false;\r
257         } else if (!user.equals(other.user))\r
258             return false;\r
259         if (keyStorePath == null) {\r
260             if (other.keyStorePath != null)\r
261                 return false;\r
262         } else if (!keyStorePath.equals(other.keyStorePath))\r
263             return false;\r
264         if (keyStorePassword == null) {\r
265             if (other.keyStorePassword != null)\r
266                 return false;\r
267         } else if (!keyStorePassword.equals(other.keyStorePassword))\r
268             return false;\r
269 \r
270         return true;\r
271     }\r
272 \r
273     @Override\r
274     public String toString() {\r
275         return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password +\r
276                 ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout +\r
277                 ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup +\r
278                 ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";\r
279     }\r
280 \r
281     @Override\r
282     public boolean isFilterInEmptyResources() {\r
283         return isFilterInEmptyResources;\r
284     }\r
285 \r
286 \r
287     public void setFilterInEmptyResources(boolean isFilterInEmptyResources) {\r
288         this.isFilterInEmptyResources = isFilterInEmptyResources;\r
289     }\r
290 \r
291     @Override\r
292     public Boolean isUseHttpsWithDmaap() {\r
293         return this.useHttpsWithDmaap;\r
294     }\r
295 }\r