2 * Copyright 2017 ZTE Corporation.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.onap.holmes.engine.db.mapper;
\r
19 import org.junit.Test;
\r
20 import org.powermock.api.easymock.PowerMock;
\r
22 import java.sql.Date;
\r
23 import java.sql.ResultSet;
\r
24 import java.util.Properties;
\r
26 import static org.easymock.EasyMock.expect;
\r
28 public class CorrelationRuleMapperTest {
\r
31 public void map() throws Exception {
\r
32 CorrelationRuleMapper mapper = new CorrelationRuleMapper();
\r
33 ResultSet resultSet = PowerMock.createMock(ResultSet.class);
\r
35 expect(resultSet.getString("name")).andReturn("");
\r
36 expect(resultSet.getString("rid")).andReturn("");
\r
37 expect(resultSet.getString("description")).andReturn("");
\r
38 expect(resultSet.getInt("enable")).andReturn(0);
\r
39 expect(resultSet.getInt("templateID")).andReturn(0);
\r
40 expect(resultSet.getString("engineID")).andReturn("");
\r
41 expect(resultSet.getString("engineType")).andReturn("");
\r
42 expect(resultSet.getString("creator")).andReturn("");
\r
43 expect(resultSet.getDate("createTime")).andReturn(new Date(System.currentTimeMillis()));
\r
44 expect(resultSet.getString("updator")).andReturn("");
\r
45 expect(resultSet.getDate("updateTime")).andReturn(new Date(System.currentTimeMillis()));
\r
46 expect(resultSet.getObject("params")).andReturn(new Properties());
\r
47 expect(resultSet.getString("content")).andReturn("");
\r
48 expect(resultSet.getString("vendor")).andReturn("");
\r
49 expect(resultSet.getString("package")).andReturn("");
\r
51 PowerMock.replayAll();
\r
53 mapper.map(0, resultSet, null);
\r