Change the groupid from openo to onap
[holmes/rule-management.git] / rulemgt / src / test / java / org / onap / holmes / rulemgt / wrapper / RuleMgtWrapperTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.\r
  */\r
 \r
-package org.openo.holmes.rulemgt.wrapper;\r
+package org.onap.holmes.rulemgt.wrapper;\r
 \r
 import static org.hamcrest.MatcherAssert.assertThat;\r
 import static org.hamcrest.Matchers.equalTo;\r
@@ -29,21 +29,20 @@ import org.junit.Rule;
 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.CorrelationCheckRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest;\r
-import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest;\r
-import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition;\r
-import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest;\r
-import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;\r
-import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse;\r
-import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper;\r
-import org.openo.holmes.rulemgt.db.CorrelationRuleDao;\r
-import org.openo.holmes.rulemgt.db.CorrelationRuleQueryDao;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.db.CorrelationRuleDao;\r
+import org.onap.holmes.common.api.entity.CorrelationRule;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
+import org.onap.holmes.common.utils.DbDaoUtil;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;\r
+import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;\r
+import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;\r
+import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest;\r
+import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse;\r
+import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse;\r
+import org.onap.holmes.rulemgt.bolt.enginebolt.EngineWrapper;\r
+import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao;\r
 import org.powermock.api.easymock.PowerMock;\r
 import org.powermock.modules.junit4.rule.PowerMockRule;\r
 import org.powermock.reflect.Whitebox;\r
@@ -93,7 +92,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void addCorrelationRule_name_is_null() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY);\r
+        thrown.expectMessage("The name of the rule can not be empty.");\r
 \r
         ruleMgtWrapper.addCorrelationRule(USER_NAME, createRuleCreateRequest(null, "This is a rule for testing.",\r
                 "Mocked contents.", 0));\r
@@ -102,7 +101,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void addCorrelationRule_request_null() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY));\r
+        thrown.expectMessage("The request object can not be empty!");\r
 \r
         ruleMgtWrapper.addCorrelationRule(USER_NAME, null);\r
     }\r
@@ -110,7 +109,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void addCorrelationRule_name_is_empty() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY);\r
+        thrown.expectMessage("The name of the rule can not be empty.");\r
 \r
         ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("", "This is a rule for testing.",\r
                 "Mocked contents.", 0));\r
@@ -119,7 +118,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void addCorrelationRule_content_is_empty() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY);\r
+        thrown.expectMessage("The contents of the rule can not be empty!");\r
 \r
         ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("test", "This is a rule for testing.",\r
                 "", 0));\r
@@ -128,7 +127,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void addCorrelationRule_enabled_is_off_limit() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR);\r
+        thrown.expectMessage("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed.");\r
 \r
         ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("test", "This is a rule for testing.",\r
                 "Mocked contents.", 3));\r
@@ -144,7 +143,7 @@ public class RuleMgtWrapperTest {
         CorrelationRule correlationRule = convertCreateRequest2CorrelationRule(ruleCreateRequest);\r
 \r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME);\r
+        thrown.expectMessage("A rule with the same name already exists.");\r
 \r
         EasyMock.expect(correlationRuleDaoMock.queryRuleByRuleName(ruleName)).andReturn(correlationRule);\r
         PowerMock.replayAll();\r
@@ -183,7 +182,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void updateCorrelationRule_param_null() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+        thrown.expectMessage("The request object can not be empty!");\r
 \r
         ruleMgtWrapper.updateCorrelationRule(USER_NAME, null);\r
     }\r
@@ -241,7 +240,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void updateCorrelationRule_rule_not_exist() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);\r
+        thrown.expectMessage("You're trying to update a rule which does not exist in the system.");\r
 \r
         EasyMock.expect(correlationRuleDaoMock.queryRuleByRid(EasyMock.anyObject(String.class))).andReturn(null);\r
 \r
@@ -255,7 +254,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void deleteCorrelationRule_request_null() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY));\r
+        thrown.expectMessage("The request object can not be empty!");\r
 \r
         ruleMgtWrapper.deleteCorrelationRule(null);\r
     }\r
@@ -263,7 +262,7 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void deleteCorrelationRule_rule_not_exit() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE));\r
+        thrown.expectMessage("You're trying to delete a rule which does not exist in the system.");\r
 \r
         RuleDeleteRequest ruleDeleteRequest = createRuleDeleteRequest("rule_" + System.currentTimeMillis());\r
 \r
@@ -299,11 +298,11 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void getCorrelationRuleByCondition_data_format_exception() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED));\r
+        thrown.expectMessage("An error occurred while building the query SQL.");\r
 \r
         EasyMock.expect(correlationRuleQueryDaoMock.getCorrelationRulesByCondition(EasyMock.anyObject(\r
                 RuleQueryCondition.class)))\r
-                .andThrow(new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED));\r
+                .andThrow(new CorrelationException("An error occurred while building the query SQL."));\r
 \r
         PowerMock.replay(correlationRuleQueryDaoMock, CorrelationRuleQueryDao.class);\r
 \r
@@ -315,11 +314,11 @@ public class RuleMgtWrapperTest {
     @Test\r
     public void getCorrelationRuleByCondition_db_exception() throws Exception {\r
         thrown.expect(CorrelationException.class);\r
-        thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED));\r
+        thrown.expectMessage("Failed to query the rule.");\r
 \r
         EasyMock.expect(correlationRuleQueryDaoMock.getCorrelationRulesByCondition(EasyMock.anyObject(\r
                 RuleQueryCondition.class)))\r
-                .andThrow(new CorrelationException(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED));\r
+                .andThrow(new CorrelationException("Failed to query the rule."));\r
 \r
         PowerMock.replay(correlationRuleQueryDaoMock, CorrelationRuleQueryDao.class);\r
 \r