2 * Copyright 2023 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.msb.entity;
19 import org.junit.Test;
21 import java.util.HashSet;
22 import java.util.List;
25 import static org.junit.Assert.*;
27 public class ServiceTest {
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);
40 Set<Integer> nodes = new HashSet<>();
43 service.setNodes(nodes);
45 List<KeyValuePair> metadata = List.of(new KeyValuePair("key1", "value1"), new KeyValuePair("key2", "value2"));
46 service.setMetadata(metadata);
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());