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.domain;
40 import static org.junit.Assert.assertEquals;
41 import static org.junit.Assert.assertFalse;
42 import static org.junit.Assert.assertNotNull;
43 import static org.junit.Assert.assertTrue;
45 import org.junit.Test;
46 import org.onap.portalapp.portal.domain.EPApp;
48 public class EPAppTest {
50 private static final String TEST="test";
52 public EPApp mockEPApp(EPApp epApp){
54 epApp.setImageUrl(TEST);
55 epApp.setAppDescription(TEST);
56 epApp.setAppNotes(TEST);
57 epApp.setLandingPage(TEST);
58 epApp.setAlternateLandingPage(TEST);
59 epApp.setAppRestEndpoint(TEST);
60 epApp.setMlAppName(TEST);
61 epApp.setMlAppAdminId(TEST);
62 epApp.setMotsId((long)1);
63 epApp.setAppBasicAuthUsername(TEST);
64 epApp.setAppBasicAuthPassword(TEST);
66 epApp.setEnabled(false);
67 epApp.setUebTopicName(TEST);
68 epApp.setUebSecret(TEST);
69 epApp.setAppType(EpAppType.GUI);
70 epApp.setRolesInAAF(false);
71 epApp.setNameSpace(TEST);
73 epApp.setThumbnail(TEST.getBytes());
74 epApp.setUebKey(TEST);
80 public void epAppTest(){
81 EPApp epApp1 = new EPApp();
82 epApp1 = mockEPApp(epApp1);
83 EPApp epApp=new EPApp();
85 epApp.setName(epApp1.getName());
86 epApp.setImageUrl(epApp1.getImageUrl());
87 epApp.setAppDescription(epApp1.getAppDescription());
88 epApp.setAppNotes(epApp1.getAppNotes());
89 epApp.setLandingPage(epApp1.getLandingPage());
90 epApp.setAlternateLandingPage(epApp1.getAlternateLandingPage());
91 epApp.setAppRestEndpoint(epApp1.getAppRestEndpoint());
92 epApp.setMlAppName(epApp1.getMlAppName());
93 epApp.setMlAppAdminId(epApp1.getMlAppAdminId());
94 epApp.setMotsId(epApp1.getMotsId());
95 epApp.setAppBasicAuthUsername(epApp1.getAppBasicAuthUsername());
96 epApp.setAppBasicAuthPassword(epApp1.getAppBasicAuthPassword());
97 epApp.setOpen(epApp1.getOpen());
98 epApp.setEnabled(epApp1.getEnabled());
99 epApp.setUebTopicName(epApp1.getUebTopicName());
100 epApp.setUebSecret(epApp1.getUebSecret());
101 epApp.setAppType(epApp1.getAppType());
102 epApp.setRolesInAAF(epApp1.getRolesInAAF());
103 epApp.setNameSpace(epApp1.getNameSpace());
105 epApp.setAppType(epApp1.getAppType());
107 epApp.setThumbnail(epApp1.getThumbnail());
108 epApp.setUebKey(epApp1.getUebKey());
109 assertEquals(epApp.hashCode(), epApp1.hashCode());
110 assertFalse(epApp.equals(null));
113 assertEquals(epApp.getName(), TEST);
114 assertEquals(epApp.getImageUrl(), TEST);
115 assertEquals(epApp.getAppDescription(), TEST);
116 assertEquals(epApp.getAppNotes(), TEST);
117 assertEquals(epApp.getLandingPage(), TEST);
118 assertEquals(epApp.getAlternateLandingPage(), TEST);
119 assertEquals(epApp.getAppRestEndpoint(), TEST);
120 assertEquals(epApp.getMlAppName(), TEST);
121 assertEquals(epApp.getMlAppAdminId(), TEST);
122 assertEquals(epApp.getMotsId(), new Long(1));
123 assertEquals(epApp.getAppBasicAuthUsername(), TEST);
124 assertEquals(epApp.getAppBasicAuthPassword(), TEST);
125 assertEquals(epApp.getOpen(), false);
126 assertEquals(epApp.getEnabled(), false);
127 assertEquals(epApp.getUebTopicName(), TEST);
128 assertEquals(epApp.getUebSecret(), TEST);
129 assertEquals(epApp.getAppType(), Integer.valueOf(1));
130 assertEquals(epApp.getRolesInAAF(), false);
131 assertEquals(epApp.getNameSpace(), TEST);
132 assertEquals(epApp.getUebKey(), TEST);
134 assertEquals(epApp.getOpen(), false);
135 assertEquals(epApp.isRestrictedApp(), false);
136 assertEquals(epApp.hashCode(), epApp1.hashCode());
137 assertNotNull(epApp.toString());
138 epApp.setContactUs(new AppContactUs());
139 assertNotNull(epApp.getContactUs());