2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.transport;
40 import static org.junit.Assert.*;
42 import java.util.Date;
44 import org.junit.Test;
45 import org.onap.portalapp.portal.transport.CentralApp;
47 public class CentralAppTest {
49 CentralApp centralApp=new CentralApp();
51 private static final String TEST="test";
52 public CentralApp mockCentralApp(){
53 CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, TEST, TEST, TEST, TEST, TEST, TEST, TEST, TEST, TEST,
54 TEST, TEST, TEST, TEST, null, TEST, TEST, TEST, TEST);
59 public void centralAppTest(){
60 CentralApp centralApp = mockCentralApp();
62 CentralApp centralApp1 = buildCentralApp();
64 assertEquals(centralApp.getId(), new Long(1));
65 assertEquals(centralApp.getCreatedId(), new Long(1));
66 assertEquals(centralApp.getModifiedId(), new Long(1));
67 assertEquals(centralApp.getRowNum(), new Long(1));
68 assertEquals(centralApp.getName(), TEST);
69 assertEquals(centralApp.getImageUrl(), TEST);
70 assertEquals(centralApp.getDescription(), TEST);
71 assertEquals(centralApp.getNotes(), TEST);
72 assertEquals(centralApp.getUrl(), TEST);
73 assertEquals(centralApp.getAlternateUrl(), TEST);
74 assertEquals(centralApp.getRestEndpoint(), TEST);
75 assertEquals(centralApp.getMlAppName(), TEST);
76 assertEquals(centralApp.getMlAppAdminId(), TEST);
77 assertEquals(centralApp.getMotsId(), TEST);
78 assertEquals(centralApp.getAppPassword(), TEST);
79 assertEquals(centralApp.getOpen(), TEST);
80 assertEquals(centralApp.getEnabled(), TEST);
81 assertEquals(centralApp.getUsername(), TEST);
82 assertEquals(centralApp.getUebKey(), TEST);
83 assertEquals(centralApp.getUebSecret(), TEST);
84 assertEquals(centralApp.getUebTopicName(), TEST);
86 assertTrue(centralApp.equals(centralApp1));
87 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
90 private CentralApp buildCentralApp() {
91 CentralApp centralApp = new CentralApp();
93 centralApp.setCreatedId(1l);
94 centralApp.setModifiedId(1l);
95 centralApp.setRowNum(1l);
96 centralApp.setName(TEST);
97 centralApp.setImageUrl(TEST);
98 centralApp.setDescription(TEST);
99 centralApp.setNotes(TEST);
100 centralApp.setUrl(TEST);
101 centralApp.setAlternateUrl(TEST);
102 centralApp.setRestEndpoint(TEST);
103 centralApp.setMlAppAdminId(TEST);
104 centralApp.setMlAppName(TEST);
105 centralApp.setMotsId(TEST);
106 centralApp.setAppPassword(TEST);
107 centralApp.setOpen(TEST);
108 centralApp.setEnabled(TEST);
109 centralApp.setUsername(TEST);
110 centralApp.setUebKey(TEST);
111 centralApp.setUebSecret(TEST);
112 centralApp.setUebTopicName(TEST);
127 public void unt_IdTest(){
128 Long defaultValue=123L;
129 centralApp.setId(defaultValue);
130 assertEquals(defaultValue, centralApp.getId());
134 public void unt_createdTest(){
135 Date defaultValue=new Date();
136 centralApp.setCreated(defaultValue);
137 assertEquals(defaultValue, centralApp.getCreated());
141 public void unt_modifiedTest(){
142 Date defaultValue=new Date();
143 centralApp.setCreated(defaultValue);
144 assertEquals(defaultValue, centralApp.getCreated());
148 public void unt_craetedIdTest(){
149 Long defaultValue=123L;
150 centralApp.setCreatedId(defaultValue);
151 assertEquals(defaultValue, centralApp.getCreatedId());
155 public void unt_modifiedIdTest(){
156 Long defaultValue=123L;
157 centralApp.setModifiedId(defaultValue);
158 assertEquals(defaultValue, centralApp.getModifiedId());
162 public void unt_rowNumTest(){
163 Long defaultValue=123L;
164 centralApp.setRowNum(defaultValue);
165 assertEquals(defaultValue, centralApp.getRowNum());
170 public void unt_nameTest(){
171 String defaultValue="test";
172 centralApp.setName(defaultValue);
173 assertEquals(defaultValue, centralApp.getName());
177 public void unt_ImageUrlTest(){
178 String defaultValue="test";
179 centralApp.setImageUrl(defaultValue);
180 assertEquals(defaultValue, centralApp.getImageUrl());
184 public void unt_descriptionTest(){
185 String defaultValue="test";
186 centralApp.setDescription(defaultValue);
187 assertEquals(defaultValue, centralApp.getDescription());
191 public void unt_notesTest(){
192 String defaultValue="test";
193 centralApp.setNotes(defaultValue);
194 assertEquals(defaultValue, centralApp.getNotes());
198 public void unt_urlTest(){
199 String defaultValue="testUrl";
200 centralApp.setUrl(defaultValue);
201 assertEquals(defaultValue, centralApp.getUrl());
205 public void unt_alternateUrlTest(){
206 String defaultValue="testUrl";
207 centralApp.setAlternateUrl(defaultValue);
208 assertEquals(defaultValue, centralApp.getAlternateUrl());
212 public void unt_restendpointTest(){
213 String defaultValue="testUrl";
214 centralApp.setRestEndpoint(defaultValue);
215 assertEquals(defaultValue, centralApp.getRestEndpoint());
219 public void unt_mlAppNameTest(){
220 String defaultValue="testAppName";
221 centralApp.setMlAppName(defaultValue);
222 assertEquals(defaultValue, centralApp.getMlAppName());
226 public void unt_mlAppAdminIdTest(){
227 String defaultValue="testAppAdminId";
228 centralApp.setMlAppAdminId(defaultValue);
229 assertEquals(defaultValue, centralApp.getMlAppAdminId());
233 public void unt_motsIdIdTest(){
234 String defaultValue="testmotsid";
235 centralApp.setMotsId(defaultValue);
236 assertEquals(defaultValue, centralApp.getMotsId());
240 public void unt_appPasswordTest(){
241 String defaultValue="TestAppPassword";
242 centralApp.setAppPassword(defaultValue);
243 assertEquals(defaultValue, centralApp.getAppPassword());
247 public void unt_openTest(){
248 String defaultValue="Testopen";
249 centralApp.setOpen(defaultValue);
250 assertEquals(defaultValue, centralApp.getOpen());
254 public void unt_enabledTest(){
255 String defaultValue="Testenable";
256 centralApp.setEnabled(defaultValue);
257 assertEquals(defaultValue, centralApp.getEnabled());
261 public void unt_thumbnailTest(){
262 byte[] defaultValue={1,2,3};
263 centralApp.setThumbnail(defaultValue);
264 assertEquals(defaultValue, centralApp.getThumbnail());
268 public void unt_userNameTest(){
269 String defaultValue="Testusername";
270 centralApp.setUsername(defaultValue);
271 assertEquals(defaultValue, centralApp.getUsername());
275 public void unt_uebKeyTest(){
276 String defaultValue="Testuebkey";
277 centralApp.setUebKey(defaultValue);
278 assertEquals(defaultValue, centralApp.getUebKey());
282 public void unt_uebSecreteTest(){
283 String defaultValue="Testuebscrete";
284 centralApp.setUebSecret(defaultValue);
285 assertEquals(defaultValue, centralApp.getUebSecret());
289 public void unt_uebTopicNameTest(){
290 String defaultValue="Testuebtopicname";
291 centralApp.setUebTopicName(defaultValue);
292 assertEquals(defaultValue, centralApp.getUebTopicName());
296 public void unt_hashCodeWithNullTest(){
297 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
299 CentralApp centralApp1=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
301 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
302 assertTrue(centralApp.equals(centralApp1));
307 public void unt_hashCodeTest(){
308 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
309 "test", "test", "test", "test", null, "test", "test", "test", "test");
311 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
312 "test", "test", "test", "test", null, "test", "test", "test", "test");
314 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
315 assertTrue(centralApp.equals(centralApp1));
320 public void unt_hashCodeTestWithNull(){
321 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
322 "test", "test", "test", "test", null, "test", "test", "test", "test");
323 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
324 "test", "test", "test", "test", null, "test", "test", "test", "test");
325 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
326 assertFalse(centralApp.equals(null));
331 public void unt_hashCodeTestWithNull1(){
332 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
333 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
334 "test", "test", "test", "test", null, "test", "test", "test", "test");
335 assertFalse(centralApp.equals(centralApp1));
340 public void unt_hashCodeTestWithalternateURL(){
341 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, "test1", null, null, null, null, null, null, null, null, null, null, null, null);
342 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
343 "test", "test", "test", "test", null, "test", "test", "test", "test");
344 assertFalse(centralApp.equals(centralApp1));
349 public void unt_hashCodeTestWithpassword(){
350 CentralApp centralApp=new CentralApp(null, null, null, null, null, null, null, null, null, null, null, "test", null, null, null, null, "testPass", null, null, null, null, null, null, null);
351 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
352 "test", "test", "test", "test", null, "test", "test", "test", "test");
353 assertFalse(centralApp.equals(centralApp1));
358 public void unt_hashCodeTestWithcreateId(){
359 CentralApp centralApp=new CentralApp(null, null, null, 123L, null, null, null, null, null, null, null, "test", null, null, null, null, "test", null, null, null, null, null, null, null);
360 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
361 "test", "test", "test", "test", null, "test", "test", "test", "test");
362 assertFalse(centralApp.equals(centralApp1));
367 public void unt_hashCodeTestWithcreateId1(){
368 CentralApp centralApp=new CentralApp(12L, null, null, 123L, 123L, 123L, "test1", "test1", "test1", "test1", "test1", "test", "tests1", "test1", "test1", null, "test", null, null, null, null, null, null, null);
369 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
370 "test", "test", "test", "test", null, "test", "test", "test", "test");
371 assertFalse(centralApp.equals(centralApp1));