Removed MSB Dependencies
[holmes/common.git] / holmes-actions / src / test / java / org / onap / holmes / common / msb / entity / ServiceTest.java
1 /**
2  * Copyright 2023 ZTE Corporation.
3  * <p>
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  * <p>
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * <p>
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.msb.entity;
18
19 import org.junit.Test;
20
21 import java.util.HashSet;
22 import java.util.List;
23 import java.util.Set;
24
25 import static org.junit.Assert.*;
26
27 public class ServiceTest {
28     @Test
29     public void testGettersAndSetters() {
30         Service<Integer> service = new Service<>();
31         service.setServiceName("my-service");
32         service.setVersion("1.0");
33         service.setUrl("http://example.com");
34         service.setProtocol("http");
35         service.setVisualRange("local");
36         service.setLb_policy("round-robin");
37         service.setPath("/api");
38         service.setEnable_ssl(true);
39
40         Set<Integer> nodes = new HashSet<>();
41         nodes.add(8080);
42         nodes.add(8081);
43         service.setNodes(nodes);
44
45         List<KeyValuePair> metadata = List.of(new KeyValuePair("key1", "value1"), new KeyValuePair("key2", "value2"));
46         service.setMetadata(metadata);
47
48         assertEquals("my-service", service.getServiceName());
49         assertEquals("1.0", service.getVersion());
50         assertEquals("http://example.com", service.getUrl());
51         assertEquals("http", service.getProtocol());
52         assertEquals("local", service.getVisualRange());
53         assertEquals("round-robin", service.getLb_policy());
54         assertEquals("/api", service.getPath());
55         assertEquals(true, service.isEnable_ssl());
56         assertEquals(nodes, service.getNodes());
57         assertEquals(metadata, service.getMetadata());
58     }
59 }