Add service node entity class
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / api / entity / ServiceEntityTest.java
1 /**
2  * Copyright 2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.holmes.common.api.entity;
18
19
20 import org.junit.After;
21 import org.junit.Before;
22 import org.junit.Test;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import static org.hamcrest.core.IsEqual.equalTo;
28 import static org.junit.Assert.assertThat;
29
30 public class ServiceEntityTest {
31     private ServiceEntity serviceEntity;
32
33     @Before
34     public void before() throws Exception{
35         serviceEntity = new ServiceEntity();
36     }
37     @After
38     public void after() throws Exception{};
39
40     @Test
41     public void getterAndSetter4ServiceName() throws Exception{
42         final String serviceName = "serviceName";
43         serviceEntity.setServiceName(serviceName);
44         assertThat(serviceEntity.getServiceName(), equalTo(serviceName));
45     }
46
47     @Test
48     public void getterAndSetter4Version() throws Exception{
49         final String version = "version";
50         serviceEntity.setVersion(version);
51         assertThat(serviceEntity.getVersion(), equalTo(version));
52     }
53
54     @Test
55     public void getterAndSetter4Url() throws Exception{
56         final String url = "url";
57         serviceEntity.setUrl(url);
58         assertThat(serviceEntity.getUrl(), equalTo(url));
59     }
60
61     @Test
62     public void getterAndSetter4Protocol() throws Exception{
63         final String protocol = "protocol";
64         serviceEntity.setProtocol(protocol);
65         assertThat(serviceEntity.getProtocol(), equalTo(protocol));
66     }
67
68     @Test
69     public void getterAndSetter4VisualRange() throws Exception{
70         final String visualRange = "visualRange";
71         serviceEntity.setVisualRange(visualRange);
72         assertThat(serviceEntity.getVisualRange(), equalTo(visualRange));
73     }
74
75
76
77
78     @Test
79     public void getterAndSetter4Lb_policy() throws Exception{
80         final String lb_policy = "lb_policy";
81         serviceEntity.setLb_policy(lb_policy);
82         assertThat(serviceEntity.getLb_policy(), equalTo(lb_policy));
83     }
84
85     @Test
86     public void getterAndSetter4Publish_port() throws Exception{
87         final String publish_port = "publish_port";
88         serviceEntity.setPublish_port(publish_port);
89         assertThat(serviceEntity.getPublish_port(), equalTo(publish_port));
90     }
91
92     @Test
93     public void getterAndSetter4Namespace() throws Exception{
94         final String namespace = "namespace";
95         serviceEntity.setNamespace(namespace);
96         assertThat(serviceEntity.getNamespace(), equalTo(namespace));
97     }
98
99     @Test
100     public void getterAndSetter4Network_plane_type() throws Exception{
101         final String network_plane_type = "network_plane_type";
102         serviceEntity.setNetwork_plane_type(network_plane_type);
103         assertThat(serviceEntity.getNetwork_plane_type(), equalTo(network_plane_type));
104     }
105
106     @Test
107     public void getterAndSetter4Host() throws Exception{
108         final String host = "host";
109         serviceEntity.setHost(host);
110         assertThat(serviceEntity.getHost(), equalTo(host));
111     }
112
113     @Test
114     public void getterAndSetter4Path() throws Exception{
115         final String path = "path";
116         serviceEntity.setPath(path);
117         assertThat(serviceEntity.getPath(), equalTo(path));
118     }
119
120     @Test
121     public void getterAndSetterEnable_ssl() throws Exception{
122         final Boolean enable_ssl = true;
123         serviceEntity.setEnable_ssl(enable_ssl);
124         assertThat(serviceEntity.getEnable_ssl(), equalTo(enable_ssl));
125     }
126
127     @Test
128     public void getterAndSetter4Metadata() throws Exception{
129         final List metadata = new ArrayList();
130         metadata.add("hello");
131         serviceEntity.setMetadata(metadata);
132         assertThat(serviceEntity.getMetadata(), equalTo(metadata));
133     }
134
135
136     @Test
137     public void getterAndSetter4Labels() throws Exception{
138         final List lables = new ArrayList();
139         lables.add("aha");
140         serviceEntity.setLabels(lables);
141         assertThat(serviceEntity.getLabels(), equalTo(lables));
142     }
143
144     @Test
145     public void getterAndSetter4Status() throws Exception{
146         final String status = "status";
147         serviceEntity.setStatus(status);
148         assertThat(serviceEntity.getStatus(), equalTo(status));
149     }
150
151
152     @Test
153     public void getterAndSetter4Is_manual() throws Exception{
154         final Boolean status = true;
155         serviceEntity.setIs_manual(status);
156         assertThat(serviceEntity.getIs_manual(), equalTo(status));
157     }
158
159
160
161
162 }