Change the groupid and package paths to onap.
Change-Id: I8432e9ac2c979bbc36e10e6a702c6f04fc41446a
Issue-ID: HOLMES-7
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
<modelVersion>4.0.0</modelVersion>\r
<parent>\r
- <groupId>org.openo.oparent</groupId>\r
- <artifactId>oparent</artifactId>\r
- <version>1.1.0-SNAPSHOT</version>\r
- <relativePath>../oparent</relativePath>\r
+ <groupId>org.onap.oparent</groupId>\r
+ <artifactId>version</artifactId>\r
+ <version>1.0.0-SNAPSHOT</version>\r
+ <relativePath>../../oparent</relativePath>\r
</parent>\r
\r
- <groupId>org.openo.holmes.rule-management</groupId>\r
+ <groupId>org.onap.holmes.rule-management</groupId>\r
<artifactId>holmes-rulemgt-parent</artifactId>\r
<packaging>pom</packaging>\r
<name>holmes-rulemgt-parent</name>\r
<quartz.version>2.2.1</quartz.version>\r
\r
\r
- <packagename>openo-holmes-rulemgt</packagename>\r
+ <packagename>onap-holmes-rulemgt</packagename>\r
<linux64id>linux64</linux64id>\r
<win64id>win64</win64id>\r
<linux64outputdir>target/assembly/${linux64id}</linux64outputdir>\r
<version>3.0</version>\r
</dependency>\r
<dependency>\r
- <groupId>org.openo.holmes.actions</groupId>\r
+ <groupId>org.onap.holmes.common</groupId>\r
<artifactId>holmes-actions</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
<version>${stringtemplate.version}</version>\r
</dependency>\r
\r
- <dependency>\r
- <groupId>org.openo.common-services.common-utilities</groupId>\r
- <artifactId>dropwizard-ioc-container</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
-\r
<dependency>\r
<groupId>org.quartz-scheduler</groupId>\r
<artifactId>quartz</artifactId>\r
<version>1.6.5</version>\r
<scope>test</scope>\r
</dependency>\r
-\r
- <dependency>\r
- <groupId>org.openo.client.cli</groupId>\r
- <artifactId>swagger-sdk</artifactId>\r
- <version>1.1.0-SNAPSHOT</version>\r
- </dependency>\r
</dependencies>\r
</dependencyManagement>\r
\r
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <groupId>org.openo.holmes.rule-management</groupId>
+ <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>holmes-rulemgt-standalone</artifactId>
<configuration>
<artifactItems>
<artifactItem>
- <groupId>org.openo.holmes.rule-management</groupId>
+ <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
<configuration>
<artifactItems>
<artifactItem>
- <groupId>org.openo.holmes.rule-management</groupId>
+ <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
<dependencies>
<dependency>
- <groupId>org.openo.holmes.rule-management</groupId>
+ <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt</artifactId>
<version>${project.version}</version>
</dependency>
echo HOME=%HOME%
set main_path=%HOME%..\
cd /d %main_path%
-mysql -u%user% -p%password% -P%port% -h%host% < %main_path%\dbscripts\mysql\openo-holmes_rulemgt-createobj.sql
+mysql -u%user% -p%password% -P%port% -h%host% < %main_path%\dbscripts\mysql\onap-holmes_rulemgt-createobj.sql
set "err=%errorlevel%"
if "%err%"=="0" (
echo init rulemgt db success
host=$4
echo "start init holmes rulemgt db"
main_path=$HOME/../
-cat $main_path/dbscripts/mysql/openo-holmes_rulemgt-createobj.sql
+cat $main_path/dbscripts/mysql/onap-holmes_rulemgt-createobj.sql
echo "user="$user
echo "password"$password
echo "port="$port
echo "host="$host
-mysql -u$user -p$password -P$port -h$host <$main_path/dbscripts/mysql/openo-holmes_rulemgt-createobj.sql
+mysql -u$user -p$password -P$port -h$host <$main_path/dbscripts/mysql/onap-holmes_rulemgt-createobj.sql
sql_result=$?
cat "sql_result="$sql_result
if [ $sql_result != 0 ] ; then
echo ### jvm_opts: %jvm_opts%\r
echo ### class_path: %class_path%\r
\r
-%JAVA% -classpath %class_path% %jvm_opts% org.openo.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml\r
+%JAVA% -classpath %class_path% %jvm_opts% org.onap.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml\r
\r
IF ERRORLEVEL 1 goto showerror\r
exit\r
class_path="$main_path/:$main_path/holmes-rulemgt.jar"
echo @class_path@ $class_path
-"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.holmes.rulemgt.RuleActiveApp server "$main_path/conf/rulemgt.yml"
+"$JAVA" $JAVA_OPTS -classpath "$class_path" org.onap.holmes.rulemgt.RuleActiveApp server "$main_path/conf/rulemgt.yml"
title stopping engine-d-service\r
\r
set HOME=%~dp0\r
-set Main_Class="org.openo.holmes.rulemgt.RuleActiveApp"\r
+set Main_Class="org.onap.holmes.rulemgt.RuleActiveApp"\r
\r
echo ================== engine-d-service info =============================================\r
echo HOME=$HOME\r
DIRNAME=`dirname $0`
HOME=`cd $DIRNAME/; pwd`
-Main_Class="org.openo.holmes.rulemgt.RuleActiveApp"
+Main_Class="org.onap.holmes.rulemgt.RuleActiveApp"
echo ================== engine-d-service info =============================================
echo HOME=$HOME
server:
type: simple
- rootPath: '/openoapi/holmes-rule-mgmt/v1/*'
+ rootPath: '/onapapi/holmes-rule-mgmt/v1/*'
applicationContextPath: /
adminContextPath: /admin
connector:
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.openo.holmes.rule-management</groupId>
+ <groupId>org.onap.holmes.rule-management</groupId>
<artifactId>holmes-rulemgt-parent</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>holmes-rulemgt</artifactId>
<dependencies>
<dependency>
- <groupId>org.openo.holmes.actions</groupId>
+ <groupId>org.onap.holmes.common</groupId>
<artifactId>holmes-actions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.jersey.containers</groupId>
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet-core</artifactId>
- <version>2.22.2</version>
- </dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.openo.client.cli</groupId>
- <artifactId>swagger-sdk</artifactId>
- </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>org.openo.holmes.rulemgt.RuleActiveApp</mainClass>
+ <mainClass>org.onap.holmes.rulemgt.RuleActiveApp</mainClass>
</transformer>
</transformers>
</configuration>
* limitations under the License.
*/
-package org.openo.holmes.rulemgt;
+package org.onap.holmes.rulemgt;
import io.dropwizard.setup.Environment;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
-import org.openo.dropwizard.ioc.bundle.IOCApplication;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.utils.MSBRegisterUtil;
+import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
+import org.onap.holmes.common.utils.MSBRegisterUtil;
@Slf4j
-public class RuleActiveApp extends IOCApplication < RuleAppConfig > {
+public class RuleActiveApp extends IOCApplication< RuleAppConfig > {
public static void main( String[] args ) throws Exception {
new RuleActiveApp().run( args );
serviceRegisterEntity.setServiceName("holmes-rule-mgmt");
serviceRegisterEntity.setProtocol("REST");
serviceRegisterEntity.setVersion("v1");
- serviceRegisterEntity.setUrl("/openoapi/holmes-rule-mgmt/v1");
+ serviceRegisterEntity.setUrl("/onapapi/holmes-rule-mgmt/v1");
serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9101", 0);
serviceRegisterEntity.setVisualRange("1|0");
return serviceRegisterEntity;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.rulemgt;
+package org.onap.holmes.rulemgt;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import lombok.Getter;\r
import lombok.Setter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
import lombok.Getter;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import lombok.Getter;\r
import lombok.Setter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
import lombok.Getter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
import lombok.Getter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
import lombok.Getter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
import lombok.Getter;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import com.fasterxml.jackson.annotation.JsonInclude;\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import com.fasterxml.jackson.annotation.JsonInclude;\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import com.fasterxml.jackson.annotation.JsonInclude;\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bolt.enginebolt;\r
+package org.onap.holmes.rulemgt.bolt.enginebolt;\r
\r
import com.fasterxml.jackson.databind.ObjectMapper;\r
import java.io.IOException;\r
import lombok.extern.slf4j.Slf4j;\r
import org.glassfish.jersey.client.ClientConfig;\r
import org.jvnet.hk2.annotations.Service;\r
-import org.openo.holmes.common.config.MicroServiceConfig;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.common.config.MicroServiceConfig;\r
\r
@Slf4j\r
@Service\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.bolt.enginebolt;\r
+package org.onap.holmes.rulemgt.bolt.enginebolt;\r
\r
import javax.inject.Inject;\r
import javax.ws.rs.core.Response;\r
import lombok.extern.slf4j.Slf4j;\r
import net.sf.json.JSONObject;\r
import org.jvnet.hk2.annotations.Service;\r
-import org.openo.holmes.common.exception.CorrelationException;\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.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
\r
@Service\r
@Slf4j\r
try {\r
response = engineService.deploy(correlationRule);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED, e);\r
+ throw new CorrelationException("Failed to call the rule deployment RESTful API.", e);\r
}\r
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
- log.info("Call deploy rule rest interface in engine successfully.");\r
+ log.info("Succeeded in calling the rule deployment RESTful API from the engine management service.");\r
try {\r
JSONObject json = JSONObject.fromObject(response.readEntity(String.class));\r
return json.get(RuleMgtConstant.PACKAGE).toString();\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR, e);\r
+ throw new CorrelationException("Failed to parse the value returned by the engine management service.", e);\r
}\r
} else {\r
- throw new CorrelationException(I18nProxy.ENGINE_DEPLOY_RULE_FAILED);\r
+ throw new CorrelationException("Failed to deploy the rule!");\r
}\r
}\r
\r
try {\r
response = engineService.delete(packageName);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED, e);\r
+ throw new CorrelationException("Failed to call the rule deleting RESTful API.", e);\r
}\r
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
- log.info("Call delete rule rest interface in engine successfully.");\r
+ log.info("Succeeded in calling the rule deleting RESTful API from the engine management service.");\r
return true;\r
} else {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED);\r
+ throw new CorrelationException("Failed to delete the rule!");\r
}\r
}\r
\r
public boolean checkRuleFromEngine(CorrelationCheckRule4Engine correlationCheckRule4Engine)\r
throws CorrelationException {\r
- log.info("content:" + correlationCheckRule4Engine.getContent());\r
+ log.info("Rule Contents: " + correlationCheckRule4Engine.getContent());\r
Response response;\r
try {\r
response = engineService.check(correlationCheckRule4Engine);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED, e);\r
+ throw new CorrelationException("Failed to call the rule verification RESTful API.", e);\r
}\r
if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
- log.info("Call check rule rest interface in engine successfully.");\r
+ log.info("Succeeded in calling the rule verification RESTful API from the engine management service.");\r
return true;\r
} else {\r
log.info(response.getStatus() + " " + response.getStatusInfo() + " " + response.getEntity());\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS);\r
+ throw new CorrelationException("Failed to verify the rule. The contents of the rule are invalid.");\r
}\r
}\r
}\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.constant;\r
+package org.onap.holmes.rulemgt.constant;\r
\r
public class RuleMgtConstant {\r
\r
public static final int STATUS_RULE_CLOSE = 0;\r
public static final int STATUS_RULE_ALL = 2;\r
public static final String PACKAGE = "package";\r
- public static final String ENGINE_PATH = "/openoapi/holmes-engine-mgmt/v1/rule";\r
+ public static final String ENGINE_PATH = "/onapapi/holmes-engine-mgmt/v1/rule";\r
public static final int RESPONSE_STATUS_OK = 200;\r
}\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.db;\r
+package org.onap.holmes.rulemgt.db;\r
\r
import java.util.List;\r
-import org.openo.holmes.common.api.entity.CorrelationRule;\r
-import org.openo.holmes.common.exception.CorrelationException;\r
-import org.openo.holmes.common.utils.I18nProxy;\r
-import org.openo.holmes.rulemgt.db.mapper.CorrelationRuleMapper;\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.skife.jdbi.v2.sqlobject.Bind;\r
import org.skife.jdbi.v2.sqlobject.BindBean;\r
import org.skife.jdbi.v2.sqlobject.GetGeneratedKeys;\r
addRule(correlationRule);\r
return correlationRule;\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);\r
}\r
}\r
\r
try {\r
updateRuleByRid(correlationRule);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);\r
}\r
}\r
\r
try {\r
deleteRule2DbInner(correlationRule);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);\r
}\r
}\r
\r
try {\r
return queryRuleById(rid);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);\r
}\r
}\r
\r
try {\r
return queryRuleByName(name);\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e);\r
+ throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e);\r
}\r
}\r
}\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.db;\r
+package org.onap.holmes.rulemgt.db;\r
\r
import java.beans.PropertyDescriptor;\r
import java.lang.reflect.Field;\r
import javax.inject.Inject;\r
import lombok.extern.slf4j.Slf4j;\r
import org.jvnet.hk2.annotations.Service;\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.openo.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\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.skife.jdbi.v2.Handle;\r
import org.skife.jdbi.v2.Query;\r
\r
}\r
return correlationRules;\r
} catch (Exception e) {\r
- log.warn("Query rule: rule id =" + ruleQueryCondition.getRid() + " failed");\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED, e);\r
+ log.warn("Failed to query the rule: id =" + ruleQueryCondition.getRid() + ".");\r
+ throw new CorrelationException("Failed to query the rule.", e);\r
} finally {\r
dbDaoUtil.close(handle);\r
}\r
}\r
return "";\r
} catch (Exception e) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED, e);\r
+ throw new CorrelationException("An error occurred while building the query SQL.", e);\r
}\r
}\r
}\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.db.mapper;\r
+package org.onap.holmes.rulemgt.db.mapper;\r
\r
-import org.openo.holmes.common.api.entity.CorrelationRule;\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
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.resources;\r
+package org.onap.holmes.rulemgt.resources;\r
\r
import com.codahale.metrics.annotation.Timed;\r
import io.swagger.annotations.Api;\r
import io.swagger.annotations.SwaggerDefinition;\r
import java.io.IOException;\r
import java.util.Locale;\r
-import javax.annotation.PostConstruct;\r
import javax.inject.Inject;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.ws.rs.DELETE;\r
import lombok.extern.slf4j.Slf4j;\r
import net.sf.json.JSONObject;\r
import org.jvnet.hk2.annotations.Service;\r
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;\r
-import org.openo.holmes.common.config.MicroServiceConfig;\r
-import org.openo.holmes.common.exception.CorrelationException;\r
-import org.openo.holmes.common.utils.ExceptionUtil;\r
-import org.openo.holmes.common.utils.I18nProxy;\r
-import org.openo.holmes.common.utils.JacksonUtil;\r
-import org.openo.holmes.common.utils.LanguageUtil;\r
-import org.openo.holmes.common.utils.MSBRegisterUtil;\r
-import org.openo.holmes.common.utils.UserUtil;\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.constant.RuleMgtConstant;\r
-import org.openo.holmes.rulemgt.wrapper.RuleMgtWrapper;\r
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;\r
+import org.onap.holmes.common.config.MicroServiceConfig;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
+import org.onap.holmes.common.utils.ExceptionUtil;\r
+import org.onap.holmes.common.utils.JacksonUtil;\r
+import org.onap.holmes.common.utils.LanguageUtil;\r
+import org.onap.holmes.common.utils.MSBRegisterUtil;\r
+import org.onap.holmes.common.utils.UserUtil;\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.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper;\r
\r
@Service\r
@SwaggerDefinition\r
return ruleChangeResponse;\r
} catch (CorrelationException e) {\r
log.error("create rule:" + ruleCreateRequest.getRuleName() + " failed", e);\r
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,\r
- e.getMessage()));\r
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());\r
}\r
}\r
\r
return ruleChangeResponse;\r
} catch (CorrelationException e) {\r
log.error("update rule:" + ruleUpdateRequest.getContent() + " failed", e);\r
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,\r
- e.getMessage()));\r
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());\r
}\r
}\r
\r
return true;\r
} catch (CorrelationException e) {\r
log.error("delete rule:" + ruleDeleteRequest.getRuleId() + " failed", e);\r
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,\r
- e.getMessage()));\r
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());\r
}\r
}\r
\r
return ruleQueryListResponse;\r
} catch (CorrelationException e) {\r
log.error("query rule failed,cause query condition conversion failure", e);\r
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,\r
- e.getMessage()));\r
+ throw ExceptionUtil.buildExceptionResponse(e.getMessage());\r
}\r
}\r
\r
return ruleQueryCondition;\r
} catch (IOException e) {\r
log.warn("queryRequest convert to json failed", e);\r
- throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale,\r
- I18nProxy.RULE_MANAGEMENT_DATA_FORMAT_ERROR));\r
+ throw ExceptionUtil.buildExceptionResponse("The request format is invalid!");\r
}\r
}\r
}\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
-package org.openo.holmes.rulemgt.wrapper;\r
+package org.onap.holmes.rulemgt.wrapper;\r
\r
import java.util.ArrayList;\r
import java.util.Date;\r
import javax.inject.Singleton;\r
import lombok.extern.slf4j.Slf4j;\r
import org.jvnet.hk2.annotations.Service;\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.bean.response.RuleResult4API;\r
-import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper;\r
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;\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.bean.response.RuleResult4API;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\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
\r
\r
@Service\r
public RuleAddAndUpdateResponse addCorrelationRule(String creator, RuleCreateRequest ruleCreateRequest)\r
throws CorrelationException {\r
if (ruleCreateRequest == null) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+ throw new CorrelationException("The request object can not be empty!");\r
}\r
CorrelationRule correlationRule = convertCreateRequest2Rule(creator,\r
ruleCreateRequest);\r
checkCorrelation(correlationRule);\r
CorrelationRule ruleTemp = correlationRuleDao.queryRuleByRuleName(correlationRule.getName());\r
if (ruleTemp != null) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME);\r
+ throw new CorrelationException("A rule with the same name already exists.");\r
}\r
correlationRule.setPackageName(deployRule2Engine(correlationRule));\r
CorrelationRule result = correlationRuleDao.saveRule(correlationRule);\r
public RuleAddAndUpdateResponse updateCorrelationRule(String modifier, RuleUpdateRequest ruleUpdateRequest)\r
throws CorrelationException {\r
if (ruleUpdateRequest == null) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+ throw new CorrelationException("The request object can not be empty!");\r
}\r
CorrelationRule oldCorrelationRule = correlationRuleDao.queryRuleByRid(ruleUpdateRequest.getRuleId());\r
if (oldCorrelationRule == null) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);\r
+ throw new CorrelationException("You're trying to update a rule which does not exist in the system.");\r
}\r
CorrelationRule newCorrelationRule = convertRuleUpdateRequest2CorrelationRule(modifier,\r
ruleUpdateRequest, oldCorrelationRule.getName());\r
String ruleName = correlationRule.getName() == null ? "" : correlationRule.getName().trim();\r
String content = correlationRule.getContent() == null ? "" : correlationRule.getContent().trim();\r
if ("".equals(content)) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY);\r
+ throw new CorrelationException("The contents of the rule can not be empty!");\r
}\r
if (enabled != RuleMgtConstant.STATUS_RULE_CLOSE\r
&& enabled != RuleMgtConstant.STATUS_RULE_OPEN) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR);\r
+ throw new CorrelationException("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed.");\r
}\r
if ("".equals(ruleName)) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY);\r
+ throw new CorrelationException("The name of the rule can not be empty.");\r
}\r
}\r
\r
public void deleteCorrelationRule(RuleDeleteRequest ruleDeleteRequest)\r
throws CorrelationException {\r
if (ruleDeleteRequest == null) {\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY);\r
+ throw new CorrelationException("The request object can not be empty!");\r
}\r
CorrelationRule correlationRule = correlationRuleDao.queryRuleByRid(ruleDeleteRequest.getRuleId());\r
if (correlationRule == null) {\r
log.warn("the rule:rule id=" + ruleDeleteRequest.getRuleId() + " does not exist the database.");\r
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE);\r
+ throw new CorrelationException("You're trying to delete a rule which does not exist in the system.");\r
}\r
if (correlationRule.getEnabled() == RuleMgtConstant.STATUS_RULE_OPEN) {\r
engineWarpper.deleteRuleFromEngine(correlationRule.getPackageName());\r
* limitations under the License.
*/
-package org.openo.holmes.rulemgt;
+package org.onap.holmes.rulemgt;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt;\r
+package org.onap.holmes.rulemgt;\r
\r
import static org.hamcrest.core.IsEqual.equalTo;\r
import static org.hamcrest.core.IsNull.notNullValue;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.IsEqual.equalTo;\r
import static org.junit.Assert.*;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.junit.Assert.*;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
*/\r
\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.IsEqual.equalTo;\r
import static org.junit.Assert.assertThat;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.Is.is;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.IsEqual.equalTo;\r
import static org.junit.Assert.*;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.Is.is;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.request;\r
+package org.onap.holmes.rulemgt.bean.request;\r
\r
import static org.hamcrest.core.Is.is;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import static org.junit.Assert.*;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import static org.hamcrest.core.Is.is;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bean.response;\r
+package org.onap.holmes.rulemgt.bean.response;\r
\r
import static org.hamcrest.core.Is.is;\r
import static org.hamcrest.core.IsEqual.equalTo;\r
*/\r
\r
\r
-package org.openo.holmes.rulemgt.bolt.enginebolt;\r
+package org.onap.holmes.rulemgt.bolt.enginebolt;\r
\r
\r
import org.apache.http.HttpResponse;\r
import org.junit.Before;\r
import org.junit.Rule;\r
import org.junit.rules.ExpectedException;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
import org.powermock.api.easymock.PowerMock;\r
import org.powermock.core.classloader.annotations.PrepareForTest;\r
import org.powermock.modules.junit4.rule.PowerMockRule;\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.bolt.enginebolt;\r
+package org.onap.holmes.rulemgt.bolt.enginebolt;\r
\r
\r
import static org.hamcrest.MatcherAssert.assertThat;\r
import org.junit.Rule;\r
import org.junit.Test;\r
import org.junit.rules.ExpectedException;\r
-import org.openo.holmes.common.exception.CorrelationException;\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.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
import org.powermock.api.easymock.PowerMock;\r
import org.powermock.reflect.Whitebox;\r
\r
@Test\r
public void deployEngine_invoke_rule_deploy_exception() throws Exception {\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED);\r
+ thrown.expectMessage("Failed to call the rule deployment RESTful API.");\r
\r
EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class))).andThrow(\r
new RuntimeException(""));\r
@Test\r
public void deployEngine_http_status_not_ok() throws Exception {\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.ENGINE_DEPLOY_RULE_FAILED);\r
+ thrown.expectMessage("Failed to deploy the rule!");\r
\r
EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class)))\r
.andReturn(response);\r
String content = "";\r
\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR);\r
+ thrown.expectMessage("Failed to parse the value returned by the engine management service.");\r
EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class)))\r
.andReturn(response);\r
EasyMock.expect(response.getStatus()).andReturn(200);\r
@Test\r
public void deleteRuleFromEngine_invoke_rule_delete_exception() throws Exception {\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED);\r
+ thrown.expectMessage("Failed to call the rule deleting RESTful API.");\r
\r
EasyMock.expect(engineServiceMock.delete(EasyMock.anyObject(String.class))).andThrow(\r
new RuntimeException(""));\r
@Test\r
public void deleteRuleFromEngine_http_status_not_ok() throws Exception {\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED);\r
+ thrown.expectMessage("Failed to delete the rule!");\r
\r
EasyMock.expect(engineServiceMock.delete(EasyMock.anyObject(String.class)))\r
.andReturn(response);\r
@Test\r
public void checkRuleFromEngine_rule_delete_exception() throws Exception {\r
thrown.expect(CorrelationException.class);\r
- thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED);\r
+ thrown.expectMessage("Failed to call the rule verification RESTful API.");\r
\r
EasyMock.expect(engineServiceMock.check(EasyMock.anyObject(CorrelationCheckRule4Engine.class))).andThrow(\r
new RuntimeException(""));\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.db;\r
+package org.onap.holmes.rulemgt.db;\r
\r
import static org.hamcrest.MatcherAssert.assertThat;\r
import static org.hamcrest.Matchers.is;\r
import org.junit.Rule;\r
import org.junit.Test;\r
import org.junit.rules.ExpectedException;\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.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.RuleQueryCondition;\r
import org.powermock.api.easymock.PowerMock;\r
import org.powermock.modules.junit4.rule.PowerMockRule;\r
import org.powermock.reflect.Whitebox;\r
public void getCorrelationRulesByCondition_db_exception() throws Exception {\r
\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(dbDaoUtil.getHandle()).andReturn(handle);\r
EasyMock.expect(handle.createQuery(EasyMock.anyObject(String.class))).andReturn(query);\r
@Test\r
public void getCorrelationRulesByCondition_get_where_sql_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(dbDaoUtil.getHandle()).andReturn(handle);\r
EasyMock.expect(handle.createQuery(EasyMock.anyObject(String.class))).andReturn(query);\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.db.mapper;\r
+package org.onap.holmes.rulemgt.db.mapper;\r
\r
import static org.easymock.EasyMock.expect;\r
\r
* limitations under the License.\r
*/\r
\r
-package org.openo.holmes.rulemgt.resources;\r
+package org.onap.holmes.rulemgt.resources;\r
\r
import javax.servlet.http.HttpServletRequest;\r
import javax.ws.rs.WebApplicationException;\r
import org.junit.Rule;\r
import org.junit.Test;\r
import org.junit.rules.ExpectedException;\r
-import org.openo.holmes.common.exception.CorrelationException;\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.wrapper.RuleMgtWrapper;\r
+import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;\r
+import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest;\r
+import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper;\r
+import org.onap.holmes.common.exception.CorrelationException;\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.powermock.api.easymock.PowerMock;\r
import org.powermock.reflect.Whitebox;\r
\r
* 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
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
@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
@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
@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
@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
@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
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
@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
@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
@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
@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
@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
@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