2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.utils;
23 import static org.junit.Assert.*;
24 import java.util.List;
25 import org.junit.Test;
26 import org.onap.so.utils.CheckResults.CheckResult;
28 public class CheckResultsTest {
31 * Test method for {@link org.onap.so.utils.CheckResults#getResults()}.
34 public final void testGetResults() {
35 CheckResults cr = new CheckResults();
36 cr.addHostCheckResult("host1", 0, "output");
37 cr.addHostCheckResult("host2", 2, "output2");
38 cr.addServiceCheckResult("host1", "service1", 0, "outputServ");
39 cr.addServiceCheckResult("host1", "service2", 2, "outputServ2");
40 cr.addServiceCheckResult("host2", "service1", 0, "output2Serv");
41 cr.addServiceCheckResult("host2", "service2", 2, "output2Serv2");
42 List<CheckResult> res = cr.getResults();
43 assertEquals(res.size(), 6);
44 assertEquals(res.get(0).getHostname(), "host1");
45 assertEquals(res.get(1).getHostname(), "host2");
46 assertEquals(res.get(2).getHostname(), "host1");
47 assertEquals(res.get(3).getHostname(), "host1");
48 assertEquals(res.get(4).getHostname(), "host2");
49 assertEquals(res.get(5).getHostname(), "host2");
50 assertEquals(res.get(0).getServicename(), null);
51 assertEquals(res.get(3).getServicename(), "service2");
52 assertEquals(res.get(5).getState(), 2);