starts threads each for every supported collector
[dcaegen2/services/mapper.git] / UniversalVesAdapter / src / test / java / org / onap / dcaegen2 / ves / domain / CpuUsageArrayTest.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : DCAE
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
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=========================================================
19 */
20 package org.onap.dcaegen2.ves.domain;
21
22 import static org.junit.Assert.*;
23
24 import java.util.HashMap;
25 import java.util.Map;
26
27 import org.junit.Test;
28 import org.springframework.beans.factory.annotation.Autowired;
29
30 public class CpuUsageArrayTest {
31         
32         @Autowired
33         CpuUsageArray cpuUsageArray = new CpuUsageArray();
34         Object value;
35         Map<String, Object> additionalProperties = new HashMap<String, Object>();
36         @Test
37         public void test() {
38                 
39                 cpuUsageArray.setAdditionalProperty("name", value);
40                 cpuUsageArray.setCpuIdentifier("test");
41                 cpuUsageArray.setCpuIdle(2.2);
42                 cpuUsageArray.setCpuUsageInterrupt(2.2);
43                 cpuUsageArray.setCpuUsageNice(2.2);
44                 cpuUsageArray.setCpuUsageSoftIrq(2.2);
45                 cpuUsageArray.setCpuUsageSteal(2.2);
46                 cpuUsageArray.setCpuUsageSystem(2.2);
47                 cpuUsageArray.setCpuUsageUser(2.2);
48                 cpuUsageArray.setCpuWait(2.2);
49                 cpuUsageArray.setPercentUsage(2.2);
50                 additionalProperties.put("name", value);
51                 
52                 assertEquals(additionalProperties, cpuUsageArray.getAdditionalProperties());
53                 assertEquals(new Double(2.2), cpuUsageArray.getCpuIdle());
54                 assertEquals("test", cpuUsageArray.getCpuIdentifier());
55                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageInterrupt());
56                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageNice());
57                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSoftIrq());
58                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSteal());
59                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSystem());
60                 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageUser());
61                 assertEquals(new Double(2.2), cpuUsageArray.getCpuWait());
62                 assertEquals(new Double(2.2), cpuUsageArray.getPercentUsage());
63                 assert (cpuUsageArray.toString() != null);
64         assert (cpuUsageArray.hashCode() != 0);
65         assertEquals(true, cpuUsageArray.equals(cpuUsageArray));
66                 
67         }
68
69 }