starts threads each for every supported collector
[dcaegen2/services/mapper.git] / UniversalVesAdapter / src / test / java / org / onap / dcaegen2 / ves / domain / CommonEventHeaderTest.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.mockito.Mock;
29 import org.springframework.beans.factory.annotation.Autowired;
30
31 public class CommonEventHeaderTest {
32
33     @Autowired
34     CommonEventHeader commonEventHeader = new CommonEventHeader();
35     Object value =new Object();
36     private Map<String, Object> map = new HashMap<String, Object>();
37     @Mock
38     InternalHeaderFields internalHeaderFields = new InternalHeaderFields();
39     
40     @Test
41     public void test() {
42         
43         commonEventHeader.setDomain("Domain");
44         commonEventHeader.setEventId("EventID");
45         commonEventHeader.setEventName("EventName");
46         commonEventHeader.setEventType("EventType");
47         commonEventHeader.setLastEpochMicrosec(11.25);
48         commonEventHeader.setAdditionalProperty("name", value);
49         commonEventHeader.setInternalHeaderFields(internalHeaderFields);
50         commonEventHeader.setNfcNamingCode("nfcNamingCode");
51         commonEventHeader.setNfNamingCode("nfNamingCode");
52         commonEventHeader.setPriority("priority");
53         commonEventHeader.setReportingEntityId("reportingEntityId");
54         commonEventHeader.setReportingEntityName("reportingEntityName");
55         commonEventHeader.setSequence(1L);
56         commonEventHeader.setSourceId("sourceId");
57         commonEventHeader.setSourceName("sourceName");
58         commonEventHeader.setStartEpochMicrosec(11.1);
59         commonEventHeader.setVersion(1.2);
60         map.put("name", value);
61         
62         assertEquals (commonEventHeader.getDomain(),"Domain");
63         assertEquals (commonEventHeader.getEventId(),"EventID");
64         assertEquals (commonEventHeader.getEventName(),"EventName");
65         assertEquals (commonEventHeader.getEventType(),"EventType");
66         assertEquals(commonEventHeader.getLastEpochMicrosec(), new Double(11.25));
67        
68         assertEquals (commonEventHeader.getAdditionalProperties(),map);
69         assertEquals (commonEventHeader.getInternalHeaderFields(),internalHeaderFields);
70         assertEquals (commonEventHeader.getNfcNamingCode(),"nfcNamingCode");
71         assertEquals (commonEventHeader.getNfNamingCode(),"nfNamingCode");
72         assertEquals (commonEventHeader.getPriority(),"priority");
73         assertEquals (commonEventHeader.getReportingEntityId(),"reportingEntityId");
74         assertEquals (commonEventHeader.getReportingEntityName(),"reportingEntityName");
75         assertEquals (commonEventHeader.getSequence(),new Long(1L));
76         assertEquals (commonEventHeader.getSourceId(),"sourceId");
77         assertEquals (commonEventHeader.getSourceName(),"sourceName");
78         assertEquals (commonEventHeader.getStartEpochMicrosec(),new Double(11.1));
79         assertEquals (commonEventHeader.getVersion(),new Double(1.2));
80         
81         assert (commonEventHeader.toString() != null);
82         assert (commonEventHeader.hashCode() != 0);
83         
84         
85         
86         
87     }
88
89 }