2 * ============LICENSE_START=======================================================
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
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.policy.controlloop.eventmanager;
23 import static org.junit.Assert.assertEquals;
25 import java.sql.Timestamp;
26 import java.util.UUID;
28 import org.junit.Test;
30 public class OperationsHistoryDbEntryTest {
33 public void testOperationsHistoryDbEntry() {
34 OperationsHistoryDbEntry entry = new OperationsHistoryDbEntry();
36 String actor = "Dorothy";
37 entry.setActor(actor);
38 assertEquals(actor, entry.getActor());
40 String closedLoopName = "GoToOz";
41 entry.setClosedLoopName(closedLoopName);
42 assertEquals(closedLoopName, entry.getClosedLoopName());
44 Timestamp endtime = new Timestamp(System.currentTimeMillis());
45 entry.setEndtime(endtime);
46 assertEquals(endtime, entry.getEndtime());
48 String message = "I Want to go Home";
49 entry.setMessage(message);
50 assertEquals(message, entry.getMessage());
52 String operation = "Get Home";
53 entry.setOperation(operation);
54 assertEquals(operation, entry.getOperation());
56 String outcome = "Back in Kansas";
57 entry.setOutcome(outcome);
58 assertEquals(outcome, entry.getOutcome());
60 String requestId = UUID.randomUUID().toString();
61 entry.setRequestId(requestId);
62 assertEquals(requestId, entry.getRequestId());
65 entry.setRowid(rowid);
66 assertEquals(rowid, entry.getRowid());
68 Timestamp starttime = new Timestamp(endtime.getTime() - 100);
69 entry.setStarttime(starttime);
70 assertEquals(starttime, entry.getStarttime());
72 String subrequestId = "12321";
73 entry.setSubrequestId(subrequestId);
74 assertEquals(subrequestId, entry.getSubrequestId());
76 String target = "WizardOfOz";
77 entry.setTarget(target);
78 assertEquals(target, entry.getTarget());