2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 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 public CentralApp mockCentralApp(){
52 CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
53 "test", "test", "test", "test", null, "test", "test", "test", "test");
58 public void centralAppTest(){
59 CentralApp centralApp = mockCentralApp();
61 CentralApp centralApp1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
62 "test", "test", "test", "test", null, "test", "test", "test", "test");
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());
92 public void unt_IdTest(){
93 Long defaultValue=123L;
94 centralApp.setId(defaultValue);
95 assertEquals(defaultValue, centralApp.getId());
99 public void unt_createdTest(){
100 Date defaultValue=new Date();
101 centralApp.setCreated(defaultValue);
102 assertEquals(defaultValue, centralApp.getCreated());
106 public void unt_modifiedTest(){
107 Date defaultValue=new Date();
108 centralApp.setCreated(defaultValue);
109 assertEquals(defaultValue, centralApp.getCreated());
113 public void unt_craetedIdTest(){
114 Long defaultValue=123L;
115 centralApp.setCreatedId(defaultValue);
116 assertEquals(defaultValue, centralApp.getCreatedId());
120 public void unt_modifiedIdTest(){
121 Long defaultValue=123L;
122 centralApp.setModifiedId(defaultValue);
123 assertEquals(defaultValue, centralApp.getModifiedId());
127 public void unt_rowNumTest(){
128 Long defaultValue=123L;
129 centralApp.setRowNum(defaultValue);
130 assertEquals(defaultValue, centralApp.getRowNum());
135 public void unt_nameTest(){
136 String defaultValue="test";
137 centralApp.setName(defaultValue);
138 assertEquals(defaultValue, centralApp.getName());
142 public void unt_ImageUrlTest(){
143 String defaultValue="test";
144 centralApp.setImageUrl(defaultValue);
145 assertEquals(defaultValue, centralApp.getImageUrl());
149 public void unt_descriptionTest(){
150 String defaultValue="test";
151 centralApp.setDescription(defaultValue);
152 assertEquals(defaultValue, centralApp.getDescription());
156 public void unt_notesTest(){
157 String defaultValue="test";
158 centralApp.setNotes(defaultValue);
159 assertEquals(defaultValue, centralApp.getNotes());
163 public void unt_urlTest(){
164 String defaultValue="testUrl";
165 centralApp.setUrl(defaultValue);
166 assertEquals(defaultValue, centralApp.getUrl());
170 public void unt_alternateUrlTest(){
171 String defaultValue="testUrl";
172 centralApp.setAlternateUrl(defaultValue);
173 assertEquals(defaultValue, centralApp.getAlternateUrl());
177 public void unt_restendpointTest(){
178 String defaultValue="testUrl";
179 centralApp.setRestEndpoint(defaultValue);
180 assertEquals(defaultValue, centralApp.getRestEndpoint());
184 public void unt_mlAppNameTest(){
185 String defaultValue="testAppName";
186 centralApp.setMlAppName(defaultValue);
187 assertEquals(defaultValue, centralApp.getMlAppName());
191 public void unt_mlAppAdminIdTest(){
192 String defaultValue="testAppAdminId";
193 centralApp.setMlAppAdminId(defaultValue);
194 assertEquals(defaultValue, centralApp.getMlAppAdminId());
198 public void unt_motsIdIdTest(){
199 String defaultValue="testmotsid";
200 centralApp.setMotsId(defaultValue);
201 assertEquals(defaultValue, centralApp.getMotsId());
205 public void unt_appPasswordTest(){
206 String defaultValue="TestAppPassword";
207 centralApp.setAppPassword(defaultValue);
208 assertEquals(defaultValue, centralApp.getAppPassword());
212 public void unt_openTest(){
213 String defaultValue="Testopen";
214 centralApp.setOpen(defaultValue);
215 assertEquals(defaultValue, centralApp.getOpen());
219 public void unt_enabledTest(){
220 String defaultValue="Testenable";
221 centralApp.setEnabled(defaultValue);
222 assertEquals(defaultValue, centralApp.getEnabled());
226 public void unt_thumbnailTest(){
227 byte[] defaultValue={1,2,3};
228 centralApp.setThumbnail(defaultValue);
229 assertEquals(defaultValue, centralApp.getThumbnail());
233 public void unt_userNameTest(){
234 String defaultValue="Testusername";
235 centralApp.setUsername(defaultValue);
236 assertEquals(defaultValue, centralApp.getUsername());
240 public void unt_uebKeyTest(){
241 String defaultValue="Testuebkey";
242 centralApp.setUebKey(defaultValue);
243 assertEquals(defaultValue, centralApp.getUebKey());
247 public void unt_uebSecreteTest(){
248 String defaultValue="Testuebscrete";
249 centralApp.setUebSecret(defaultValue);
250 assertEquals(defaultValue, centralApp.getUebSecret());
254 public void unt_uebTopicNameTest(){
255 String defaultValue="Testuebtopicname";
256 centralApp.setUebTopicName(defaultValue);
257 assertEquals(defaultValue, centralApp.getUebTopicName());
261 public void unt_hashCodeWithNullTest(){
262 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);
264 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);
266 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
267 assertTrue(centralApp.equals(centralApp1));
272 public void unt_hashCodeTest(){
273 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
274 "test", "test", "test", "test", null, "test", "test", "test", "test");
276 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
277 "test", "test", "test", "test", null, "test", "test", "test", "test");
279 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
280 assertTrue(centralApp.equals(centralApp1));
285 public void unt_hashCodeTestWithNull(){
286 CentralApp centralApp=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
287 "test", "test", "test", "test", null, "test", "test", "test", "test");
288 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
289 "test", "test", "test", "test", null, "test", "test", "test", "test");
290 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
291 assertFalse(centralApp.equals(null));
296 public void unt_hashCodeTestWithNull1(){
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);
298 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
299 "test", "test", "test", "test", null, "test", "test", "test", "test");
300 assertFalse(centralApp.equals(centralApp1));
305 public void unt_hashCodeTestWithalternateURL(){
306 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);
307 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
308 "test", "test", "test", "test", null, "test", "test", "test", "test");
309 assertFalse(centralApp.equals(centralApp1));
314 public void unt_hashCodeTestWithpassword(){
315 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);
316 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
317 "test", "test", "test", "test", null, "test", "test", "test", "test");
318 assertFalse(centralApp.equals(centralApp1));
323 public void unt_hashCodeTestWithcreateId(){
324 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);
325 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
326 "test", "test", "test", "test", null, "test", "test", "test", "test");
327 assertFalse(centralApp.equals(centralApp1));
332 public void unt_hashCodeTestWithcreateId1(){
333 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);
334 CentralApp centralApp1=new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test",
335 "test", "test", "test", "test", null, "test", "test", "test", "test");
336 assertFalse(centralApp.equals(centralApp1));