diff options
author | FengLiang <feng.liang1@zte.com.cn> | 2017-03-02 14:10:01 +0800 |
---|---|---|
committer | FengLiang <feng.liang1@zte.com.cn> | 2017-03-02 14:10:01 +0800 |
commit | 739c5a3717f5b134de059e6ea895f3d626cb72d7 (patch) | |
tree | 888ece7e0d8c55f701778cedce14ae87f88605ca /holmes-actions | |
parent | 23dd65b8421041947027b3b5ab87ddf3b379b5ba (diff) |
Add dsa i18n
Change-Id: I1d54f847dac127c0cc90cfc0517fc7094bcbf776
Issue-ID:HOLMES-51
Signed-off-by: FengLiang <feng.liang1@zte.com.cn>
Diffstat (limited to 'holmes-actions')
6 files changed, 84 insertions, 37 deletions
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java index 786deb3..c2248f1 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java @@ -17,15 +17,19 @@ package org.openo.holmes.common.constant; public interface AlarmConst {
- public static final String MQ_TOPIC_NAME_ALARMS_CORRELATION = "topic://voss/fm/alarms_correlation";
+ String MQ_TOPIC_NAME_ALARMS_CORRELATION = "topic://voss/fm/alarms_correlation";
- public static final String MQ_TOPIC_NAME_ALARM = "topic://voss/fm/alarm";
+ String MQ_TOPIC_NAME_ALARM = "topic://voss/fm/alarm";
- public static final String I18N_EN = "en";
+ String NFVO_PATH = "/openoapi/umc/v1/fm/curalarms/findAll";
- public static final String I18N_ZH = "zh";
+ int NFVO_STATUS_OK = 200;
- public static final String ZH_CN = "zh_CN";
+ String I18N_EN = "en";
- public static final String ADMIN = "admin";
+ String I18N_ZH = "zh";
+
+ String ZH_CN = "zh_CN";
+
+ String ADMIN = "admin";
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json index 0192d01..d366526 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json +++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json @@ -1,29 +1,33 @@ -{
- "ENGINE_CONTENT_ILLEGALITY": "The rule content have error:{0}",
- "ENGINE_DEPLOY_RULE_FAILED": "Deploy rule failed",
- "ENGINE_DELETE_RULE_NULL": "The rule do not exist :{0}",
- "ENGINE_DELETE_RULE_FAILED": "The rule remove failed :{0}",
- "ENGINE_INSERT_RULE_CACHE_FAILED": "insert rule failed in cache",
- "ENGINE_DELETE_RULE_FAILED_FROM_CACHE": "delete rule failed in cache",
- "ENGINE_CONTAINS_PACKAGE": "Is included in the package name, please amend",
- "ENGINE_QUERY_CACHE_FAILED": "Failed query cache",
- "EXCEPTION_DB_RULE_NOT_EXIST_ERROR": "This rule does not exist in the database.",
- "EXCEPTION_DB_RULE_SAVE_ERROR": "Error saving rule to database",
- "EXCEPTION_DB_RULE_GET_ERROR": "Error when get rule from database",
- "EXCEPTION_REQUEST_IS_EMPTY": "The request object is empty",
- "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED": "Delete rules from engine call interface failure ",
- "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED": "From the rules engine calls the deployment of interface failure",
- "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED": "From the rules engine calls the check of interface failure",
- "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "Create query exception",
- "RULE_MANAGEMENT_QUERY_RULE_FAILED": "Query rule failed",
- "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY": "Request object is empty",
- "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "Rule does not exist",
- "RULE_MANAGEMENT_REPEAT_RULE_NAME": "Rule name repetition",
- "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY": "Rule name cannot be empty",
- "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "Data format error",
- "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)",
- "RULE_MANAGEMENT_DB_ERROR": "db error",
- "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"Parsing call deployment rule return the result of the failure",
- "RULE_MANAGEMENT_CHECK_NO_PASS":"Content inspection not by rule",
- "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"Content cannot be empty"
-}
+{ + "ENGINE_CONTENT_ILLEGALITY": "The rule content have error:{0}", + "ENGINE_DEPLOY_RULE_FAILED": "Deploy rule failed", + "ENGINE_DELETE_RULE_NULL": "The rule do not exist :{0}", + "ENGINE_DELETE_RULE_FAILED": "The rule remove failed :{0}", + "ENGINE_INSERT_RULE_CACHE_FAILED": "insert rule failed in cache", + "ENGINE_DELETE_RULE_FAILED_FROM_CACHE": "delete rule failed in cache", + "ENGINE_CONTAINS_PACKAGE": "Is included in the package name, please amend", + "ENGINE_QUERY_CACHE_FAILED": "Failed query cache", + "DSA_QUERY_CURRENT_ALARM_FAILED":"query current alarm failed", + "DSA_REQUEST_ANALYSIS_ERROR":"request analysis error", + "DSA_REQUEST_EXECUTE_FAILED":"send request failed", + "DSA_HTTP_CLIENT_CLOSE_FAILED":"httpclient close failed" + "EXCEPTION_DB_RULE_NOT_EXIST_ERROR": "This rule does not exist in the database.", + "EXCEPTION_DB_RULE_SAVE_ERROR": "Error saving rule to database", + "EXCEPTION_DB_RULE_GET_ERROR": "Error when get rule from database", + "EXCEPTION_REQUEST_IS_EMPTY": "The request object is empty", + "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED": "Delete rules from engine call interface failure ", + "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED": "From the rules engine calls the deployment of interface failure", + "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED": "From the rules engine calls the check of interface failure", + "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED": "Create query exception", + "RULE_MANAGEMENT_QUERY_RULE_FAILED": "Query rule failed", + "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY": "Request object is empty", + "RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE": "Rule does not exist", + "RULE_MANAGEMENT_REPEAT_RULE_NAME": "Rule name repetition", + "RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY": "Rule name cannot be empty", + "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "Data format error", + "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)", + "RULE_MANAGEMENT_DB_ERROR": "db error", + "RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR":"Parsing call deployment rule return the result of the failure", + "RULE_MANAGEMENT_CHECK_NO_PASS":"Content inspection not by rule", + "RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY":"Content cannot be empty" +} diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json index 0b0d007..856e3a2 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json +++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json @@ -7,6 +7,10 @@ "ENGINE_DELETE_RULE_FAILED_FROM_CACHE": "从缓存删除数据失败",
"ENGINE_CONTAINS_PACKAGE": "package 名字已包含,请修改",
"ENGINE_QUERY_CACHE_FAILED":"查询缓存失败",
+ "DSA_QUERY_CURRENT_ALARM_FAILED":"查询当前所有告警失败",
+ "DSA_REQUEST_ANALYSIS_ERROR":"解析请求数据失败",
+ "DSA_REQUEST_EXECUTE_FAILED":"发送请求失败",
+ "DSA_HTTP_CLIENT_CLOSE_FAILED":"httpclient 关闭失败",
"RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED": "从引擎调用删除规则接口失败",
"RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED": "从引擎调用部署规则接口失败",
"RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED": "从引擎调用校验规则接口失败",
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java b/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java index 21b62f3..0de1289 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/producer/MQProducer.java @@ -32,6 +32,7 @@ import org.openo.holmes.common.api.stat.Alarm; import org.openo.holmes.common.api.stat.AplusResult;
import org.openo.holmes.common.config.MQConfig;
import org.openo.holmes.common.constant.AlarmConst;
+import org.apache.activemq.ActiveMQConnectionFactory;
@Service
@Slf4j
@@ -41,6 +42,18 @@ public class MQProducer { private IterableProvider<MQConfig> mqConfigProvider;
private ConnectionFactory connectionFactory;
+ public MQProducer() {
+
+ }
+
+ public void init() {
+
+ String brokerURL =
+ "tcp://" + mqConfigProvider.get().brokerIp + ":" + mqConfigProvider.get().brokerPort;
+ connectionFactory = new ActiveMQConnectionFactory(mqConfigProvider.get().brokerUsername,
+ mqConfigProvider.get().brokerPassword, brokerURL);
+ }
+
public void sendAlarmMQTopicMsg(Alarm alarm) {
sendMQTopicMsg(alarm);
}
diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java index c30eff1..0b3083f 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java @@ -35,10 +35,16 @@ public class I18nProxy { public static final String ENGINE_DELETE_RULE_FAILED_FROM_CACHE = "ENGINE_DELETE_RULE_FAILED_FROM_CACHE";
public static final String ENGINE_CONTAINS_PACKAGE = "ENGINE_CONTAINS_PACKAGE";
public static final String ENGINE_QUERY_CACHE_FAILED = "ENGINE_QUERY_CACHE_FAILED";
+ /*-----------------------DSA ------------------------------- */
+ public static final String DSA_QUERY_CURRENT_ALARM_FAILED = "DSA_QUERY_CURRENT_ALARM_FAILED";
+ public static final String DSA_REQUEST_ANALYSIS_FAILED = "DSA_REQUEST_ANALYSIS_ERROR";
+ public static final String DSA_REQUEST_EXECUTE_FAILED = "DSA_REQUEST_EXECUTE_FAILED";
+ public static final String DSA_HTTP_CLIENT_CLOSE_FAILED = "DSA_HTTP_CLIENT_CLOSE_FAILED";
+
/*-----------------------Rule Management------------------------------- */
public static final String RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED";
public static final String RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED";
- public static final String RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED = "RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED";
+ public static final String RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED = "RULE_MANAGEMENT__CALL_CHECK_RULE_REST_FAILED";
public static final String RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED = "RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED";
public static final String RULE_MANAGEMENT_QUERY_RULE_FAILED = "RULE_MANAGEMENT_QUERY_RULE_FAILED";
public static final String RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY = "RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY";
@@ -95,7 +101,7 @@ public class I18nProxy { log.warn("get i18n error, key is :" + key, e);
} catch (IllegalArgumentException e) {
log.warn("get i18n error IllegalArgumentException, key is :" + key + ",args is : " + Arrays.toString(args),
- e);
+ e);
}
return value;
diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java b/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java index 58ea684..1390b77 100644 --- a/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java +++ b/holmes-actions/src/test/java/org/openo/holmes/common/producer/MQProducerTest.java @@ -67,6 +67,22 @@ public class MQProducerTest { } @Test + public void init() { + MQConfig mqConfig = new MQConfig(); + mqConfig.brokerIp = "127.0.0.1"; + mqConfig.brokerPort = 61616; + mqConfig.brokerPassword = "admin"; + mqConfig.brokerUsername = "admin"; + expect(mqConfigProvider.get()).andReturn(mqConfig).anyTimes(); + + PowerMock.replayAll(); + + mqProducer.init(); + + PowerMock.verifyAll(); + } + + @Test public void sendAlarmMQTopicMsg() throws Exception { Alarm alarm = new Alarm(); Connection connection = PowerMock.createMock(Connection.class); |