addRule(correlationRule);\r
return correlationRule;\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);\r
+ throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
}\r
}\r
\r
try {\r
updateRuleByRid(correlationRule);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);\r
+ throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
}\r
}\r
\r
try {\r
deleteRule2DbInner(correlationRule);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);\r
+ throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
}\r
}\r
\r
try {\r
return queryRuleById(rid);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);\r
+ throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
}\r
}\r
\r
try {\r
return queryRuleByName(name);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);\r
+ throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
}\r
}\r
}\r
}\r
}\r
}\r
- if (whereSql.indexOf("AND") > -1) {\r
- whereSql = whereSql.trim();\r
- return whereSql.substring(0, whereSql.length() - "AND".length());\r
- }\r
- return "";\r
+ whereSql = whereSql.trim();\r
+ return whereSql.substring(0, whereSql.length() - "AND".length());\r
} catch (Exception e) {\r
throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED, e);\r
}\r
import org.junit.Rule;\r
import org.junit.Test;\r
import org.junit.rules.ExpectedException;\r
-import org.junit.runner.RunWith;\r
import org.openo.holmes.common.api.entity.CorrelationRule;\r
import org.openo.holmes.common.exception.CorrelationException;\r
import org.openo.holmes.common.utils.DbDaoUtil;\r
import org.openo.holmes.common.utils.I18nProxy;\r
import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;\r
import org.powermock.api.easymock.PowerMock;\r
-import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;\r
-import org.powermock.modules.junit4.PowerMockRunner;\r
import org.powermock.modules.junit4.rule.PowerMockRule;\r
import org.powermock.reflect.Whitebox;\r
import org.skife.jdbi.v2.Handle;\r
import org.skife.jdbi.v2.Query;\r
\r
\r
-\r
public class CorrelationRuleQueryDaoTest {\r
\r
@Rule\r
public ExpectedException thrown = ExpectedException.none();\r
\r
- @Rule\r
+ @Rule\r
public PowerMockRule powerMockRule = new PowerMockRule();\r
private DbDaoUtil dbDaoUtil;\r
\r