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