Extract the Common Tool 99/18899/1
authorGuangrong Fu <fu.guangrong@zte.com.cn>
Sat, 14 Oct 2017 09:35:16 +0000 (17:35 +0800)
committerGuangrong Fu <fu.guangrong@zte.com.cn>
Sat, 14 Oct 2017 09:35:16 +0000 (17:35 +0800)
Change-Id: I5d356acd7c8747072acc74bfa5e3560cde7a8724
Issue-ID: HOLMES-75
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java
rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java [deleted file]
rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java [deleted file]

index 98553c9..a94c1db 100644 (file)
@@ -18,7 +18,7 @@ package org.onap.holmes.rulemgt.db;
 import java.util.List;\r
 import org.onap.holmes.common.api.entity.CorrelationRule;\r
 import org.onap.holmes.common.exception.CorrelationException;\r
-import org.onap.holmes.rulemgt.db.mapper.CorrelationRuleMapper;\r
+import org.onap.holmes.common.utils.CorrelationRuleMapper;\r
 import org.skife.jdbi.v2.sqlobject.Bind;\r
 import org.skife.jdbi.v2.sqlobject.BindBean;\r
 import org.skife.jdbi.v2.sqlobject.GetGeneratedKeys;\r
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java
deleted file mode 100644 (file)
index 98d7d01..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**\r
- * Copyright 2017 ZTE Corporation.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.onap.holmes.rulemgt.db.mapper;\r
-\r
-import org.onap.holmes.common.api.entity.CorrelationRule;\r
-import org.skife.jdbi.v2.StatementContext;\r
-import org.skife.jdbi.v2.tweak.ResultSetMapper;\r
-\r
-import java.sql.ResultSet;\r
-import java.sql.SQLException;\r
-import java.util.Properties;\r
-\r
-public class CorrelationRuleMapper implements ResultSetMapper<CorrelationRule> {\r
-    @Override\r
-    public CorrelationRule map(int i, ResultSet resultSet, StatementContext statementContext) throws SQLException {\r
-        CorrelationRule correlationRule = new CorrelationRule();\r
-        correlationRule.setName(resultSet.getString("name"));\r
-        correlationRule.setRid(resultSet.getString("rid"));\r
-        correlationRule.setDescription(resultSet.getString("description"));\r
-        correlationRule.setEnabled(resultSet.getInt("enable"));\r
-        correlationRule.setTemplateID(resultSet.getInt("templateID"));\r
-        correlationRule.setEngineID(resultSet.getString("engineID"));\r
-        correlationRule.setEngineType(resultSet.getString("engineType"));\r
-        correlationRule.setCreator(resultSet.getString("creator"));\r
-        correlationRule.setCreateTime(resultSet.getDate("createTime"));\r
-        correlationRule.setModifier(resultSet.getString("updator"));\r
-        correlationRule.setUpdateTime(resultSet.getDate("updateTime"));\r
-        correlationRule.setParams((Properties)resultSet.getObject("params"));\r
-        correlationRule.setContent(resultSet.getString("content"));\r
-        correlationRule.setVendor(resultSet.getString("vendor"));\r
-        correlationRule.setPackageName(resultSet.getString("package"));\r
-        correlationRule.setClosedControlLoopName(resultSet.getString("ctrlloop"));\r
-        return correlationRule;\r
-    }\r
-\r
-}\r
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java
deleted file mode 100644 (file)
index 3939994..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/**\r
- * Copyright 2017 ZTE Corporation.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.holmes.rulemgt.db.mapper;\r
-\r
-import static org.easymock.EasyMock.expect;\r
-\r
-import java.sql.Date;\r
-import java.sql.ResultSet;\r
-import java.util.Properties;\r
-import org.junit.Test;\r
-import org.powermock.api.easymock.PowerMock;\r
-\r
-public class CorrelationRuleMapperTest {\r
-\r
-    @Test\r
-    public void map() throws Exception {\r
-        CorrelationRuleMapper mapper = new CorrelationRuleMapper();\r
-        ResultSet resultSet = PowerMock.createMock(ResultSet.class);\r
-        expect(resultSet.getString("name")).andReturn("");\r
-        expect(resultSet.getString("rid")).andReturn("");\r
-        expect(resultSet.getString("description")).andReturn("");\r
-        expect(resultSet.getInt("enable")).andReturn(0);\r
-        expect(resultSet.getInt("templateID")).andReturn(1);\r
-        expect(resultSet.getString("engineID")).andReturn("");\r
-        expect(resultSet.getString("engineType")).andReturn("");\r
-        expect(resultSet.getString("creator")).andReturn("");\r
-        expect(resultSet.getDate("createTime")).andReturn(new Date(System.currentTimeMillis()));\r
-        expect(resultSet.getString("updator")).andReturn("");\r
-        expect(resultSet.getDate("updateTime")).andReturn(new Date(System.currentTimeMillis()));\r
-        expect(resultSet.getObject("params")).andReturn(new Properties());\r
-        expect(resultSet.getString("content")).andReturn("");\r
-        expect(resultSet.getString("vendor")).andReturn("");\r
-        expect(resultSet.getString("package")).andReturn("");\r
-        expect(resultSet.getString("ctrlloop")).andReturn("");\r
-        PowerMock.replay(resultSet);\r
-        mapper.map(0, resultSet, null);\r
-        PowerMock.verify(resultSet);\r
-    }\r
-}
\ No newline at end of file