Merge "Remove model-impl/vfc checkstyle suppressions"
[policy/drools-applications.git] / controlloop / common / eventmanager / src / test / java / org / onap / policy / controlloop / eventmanager / OperationsHistoryDbEntryTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * eventmanager
4  * ================================================================================
5  * Copyright (C) 2018 Ericsson. 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
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
21 package org.onap.policy.controlloop.eventmanager;
22
23 import static org.junit.Assert.assertEquals;
24
25 import java.sql.Timestamp;
26 import java.util.UUID;
27
28 import org.junit.Test;
29
30 public class OperationsHistoryDbEntryTest {
31
32     @Test
33     public void testOperationsHistoryDbEntry() {
34         OperationsHistoryDbEntry entry = new OperationsHistoryDbEntry();
35
36         String actor = "Dorothy";
37         entry.setActor(actor);
38         assertEquals(actor, entry.getActor());
39
40         String closedLoopName = "GoToOz";
41         entry.setClosedLoopName(closedLoopName);
42         assertEquals(closedLoopName, entry.getClosedLoopName());
43
44         Timestamp endtime = new Timestamp(System.currentTimeMillis());
45         entry.setEndtime(endtime);
46         assertEquals(endtime, entry.getEndtime());
47
48         String message = "I Want to go Home";
49         entry.setMessage(message);
50         assertEquals(message, entry.getMessage());
51
52         String operation = "Get Home";
53         entry.setOperation(operation);
54         assertEquals(operation, entry.getOperation());
55
56         String outcome = "Back in Kansas";
57         entry.setOutcome(outcome);
58         assertEquals(outcome, entry.getOutcome());
59
60         String requestId = UUID.randomUUID().toString();
61         entry.setRequestId(requestId);
62         assertEquals(requestId, entry.getRequestId());
63
64         long rowid = 12345;
65         entry.setRowid(rowid);
66         assertEquals(rowid, entry.getRowid());
67
68         Timestamp starttime = new Timestamp(endtime.getTime() - 100);
69         entry.setStarttime(starttime);
70         assertEquals(starttime, entry.getStarttime());
71
72         String subrequestId = "12321";
73         entry.setSubrequestId(subrequestId);
74         assertEquals(subrequestId, entry.getSubrequestId());
75
76         String target = "WizardOfOz";
77         entry.setTarget(target);
78         assertEquals(target, entry.getTarget());
79     }
80 }