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.*;
25 import java.util.List;
27 import org.junit.Test;
29 import org.onap.so.utils.CheckResults.CheckResult;
31 public class CheckResultsTest {
34 * Test method for {@link org.onap.so.utils.CheckResults#getResults()}.
37 public final void testGetResults () {
38 CheckResults cr = new CheckResults ();
39 cr.addHostCheckResult ("host1", 0, "output");
40 cr.addHostCheckResult ("host2", 2, "output2");
41 cr.addServiceCheckResult ("host1", "service1", 0, "outputServ");
42 cr.addServiceCheckResult ("host1", "service2", 2, "outputServ2");
43 cr.addServiceCheckResult ("host2", "service1", 0, "output2Serv");
44 cr.addServiceCheckResult ("host2", "service2", 2, "output2Serv2");
45 List <CheckResult> res = cr.getResults ();
46 assertEquals(res.size (), 6);
47 assertEquals(res.get (0).getHostname (), "host1");
48 assertEquals(res.get (1).getHostname (), "host2");
49 assertEquals(res.get (2).getHostname (), "host1");
50 assertEquals(res.get (3).getHostname (), "host1");
51 assertEquals(res.get (4).getHostname (), "host2");
52 assertEquals(res.get (5).getHostname (), "host2");
53 assertEquals(res.get (0).getServicename (), null);
54 assertEquals(res.get (3).getServicename (), "service2");
55 assertEquals(res.get (5).getState (), 2);