Null check for ClientResponse in PolicyUril.java
[portal.git] / ecomp-portal-BE-common / src / test / java / org / openecomp / portalapp / portal / transport / CentralAppTest.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
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
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
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
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
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.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.openecomp.portalapp.portal.transport;
39
40 import static org.junit.Assert.*;
41
42 import org.junit.Test;
43 import org.openecomp.portalapp.portal.transport.CentralApp;
44
45 public class CentralAppTest {
46
47         public CentralApp mockCentralApp(){
48                 CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
49                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
50         
51
52         /*      public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name,
53                                 String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint,
54                                 String mlAppName, String mlAppAdminId, String motsId, String appPassword, String open, String enabled,
55                                 byte[] thumbnail, String username, String uebKey, String uebSecret, String uebTopicName)*/
56                 
57                 centralApp.setId((long)1);
58                 centralApp.setCreatedId((long)1);
59                 centralApp.setModifiedId((long)1);
60                 centralApp.setRowNum((long)1);
61                 centralApp.setName("test");
62                 centralApp.setImageUrl("test");
63                 centralApp.setDescription("test");
64                 centralApp.setNotes("test");
65                 centralApp.setUrl("test");
66                 centralApp.setAlternateUrl("test");
67                 centralApp.setRestEndpoint("test");
68                 centralApp.setMlAppName("test");
69                 centralApp.setMlAppAdminId("test");
70                 centralApp.setMotsId("test");
71                 centralApp.setAppPassword("test");
72                 centralApp.setOpen("test");
73                 centralApp.setEnabled("test");
74                 centralApp.setUsername("test");
75                 centralApp.setUebKey("test");
76                 centralApp.setUebSecret("test");
77                 centralApp.setUebTopicName("test");
78                 
79                 return centralApp;
80         }
81         
82         @Test
83         public void centralAppTest(){
84                 CentralApp centralApp = mockCentralApp();
85                 
86                 CentralApp centralApp1 =  new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
87                                 "test", "test", "test", "test", null, "test", "test", "test", "test");
88                 
89                 /*centralApp1.setId((long)1);
90                 centralApp1.setCreatedId((long)1);
91                 centralApp1.setModifiedId((long)1);
92                 centralApp1.setRowNum((long)1);
93                 centralApp1.setName("test");
94                 centralApp1.setImageUrl("test");
95                 centralApp1.setDescription("test");
96                 centralApp1.setNotes("test");
97                 centralApp1.setUrl("test");
98                 centralApp1.setAlternateUrl("test");
99                 centralApp1.setRestEndpoint("test");
100                 centralApp1.setMlAppName("test");
101                 centralApp1.setMlAppAdminId("test");
102                 centralApp1.setMotsId("test");
103                 centralApp1.setAppPassword("test");
104                 centralApp1.setOpen("test");
105                 centralApp1.setEnabled("test");
106                 centralApp1.setUsername("test");
107                 centralApp1.setUebKey("test");
108                 centralApp1.setUebSecret("test");
109                 centralApp1.setUebTopicName("test");*/
110                 
111                 assertEquals(centralApp.getId(), new Long(1));
112                 assertEquals(centralApp.getCreatedId(), new Long(1));
113                 assertEquals(centralApp.getModifiedId(), new Long(1));
114                 assertEquals(centralApp.getRowNum(), new Long(1));
115                 assertEquals(centralApp.getName(), "test");
116                 assertEquals(centralApp.getImageUrl(), "test");
117                 assertEquals(centralApp.getDescription(), "test");
118                 assertEquals(centralApp.getNotes(), "test");
119                 assertEquals(centralApp.getUrl(), "test");
120                 assertEquals(centralApp.getAlternateUrl(), "test");
121                 assertEquals(centralApp.getRestEndpoint(), "test");
122                 assertEquals(centralApp.getMlAppName(), "test");
123                 assertEquals(centralApp.getMlAppAdminId(), "test");
124                 assertEquals(centralApp.getMotsId(), "test");
125                 assertEquals(centralApp.getAppPassword(), "test");
126                 assertEquals(centralApp.getOpen(), "test");
127                 assertEquals(centralApp.getEnabled(), "test");
128                 assertEquals(centralApp.getUsername(), "test");
129                 assertEquals(centralApp.getUebKey(), "test");
130                 assertEquals(centralApp.getUebSecret(), "test");
131                 assertEquals(centralApp.getUebTopicName(), "test");
132                 
133                 assertTrue(centralApp.equals(centralApp1));
134                 assertEquals(centralApp.hashCode(), centralApp1.hashCode());
135                 /*      assertTrue(centralApp.equals(new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", 
136                                 "test", "test", "test", "test", null, "test", "test", "test", "test")));*/
137         }
138         
139 }