2 * Copyright 2017 ZTE Corporation.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onap.holmes.common.api.entity;
20 import org.junit.After;
21 import org.junit.Before;
22 import org.junit.Test;
24 import java.util.ArrayList;
25 import java.util.List;
27 import static org.hamcrest.core.IsEqual.equalTo;
28 import static org.junit.Assert.assertThat;
30 public class ServiceEntityTest {
31 private ServiceEntity serviceEntity;
34 public void before() throws Exception{
35 serviceEntity = new ServiceEntity();
38 public void after() throws Exception{};
41 public void getterAndSetter4ServiceName() throws Exception{
42 final String serviceName = "serviceName";
43 serviceEntity.setServiceName(serviceName);
44 assertThat(serviceEntity.getServiceName(), equalTo(serviceName));
48 public void getterAndSetter4Version() throws Exception{
49 final String version = "version";
50 serviceEntity.setVersion(version);
51 assertThat(serviceEntity.getVersion(), equalTo(version));
55 public void getterAndSetter4Url() throws Exception{
56 final String url = "url";
57 serviceEntity.setUrl(url);
58 assertThat(serviceEntity.getUrl(), equalTo(url));
62 public void getterAndSetter4Protocol() throws Exception{
63 final String protocol = "protocol";
64 serviceEntity.setProtocol(protocol);
65 assertThat(serviceEntity.getProtocol(), equalTo(protocol));
69 public void getterAndSetter4VisualRange() throws Exception{
70 final String visualRange = "visualRange";
71 serviceEntity.setVisualRange(visualRange);
72 assertThat(serviceEntity.getVisualRange(), equalTo(visualRange));
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));
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));
93 public void getterAndSetter4Namespace() throws Exception{
94 final String namespace = "namespace";
95 serviceEntity.setNamespace(namespace);
96 assertThat(serviceEntity.getNamespace(), equalTo(namespace));
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));
107 public void getterAndSetter4Host() throws Exception{
108 final String host = "host";
109 serviceEntity.setHost(host);
110 assertThat(serviceEntity.getHost(), equalTo(host));
114 public void getterAndSetter4Path() throws Exception{
115 final String path = "path";
116 serviceEntity.setPath(path);
117 assertThat(serviceEntity.getPath(), equalTo(path));
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));
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));
137 public void getterAndSetter4Labels() throws Exception{
138 final List lables = new ArrayList();
140 serviceEntity.setLabels(lables);
141 assertThat(serviceEntity.getLabels(), equalTo(lables));
145 public void getterAndSetter4Status() throws Exception{
146 final String status = "status";
147 serviceEntity.setStatus(status);
148 assertThat(serviceEntity.getStatus(), equalTo(status));
153 public void getterAndSetter4Is_manual() throws Exception{
154 final Boolean status = true;
155 serviceEntity.setIs_manual(status);
156 assertThat(serviceEntity.getIs_manual(), equalTo(status));