From 20a1514bf93035472d4f940f00a357106d4bec1f Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Mon, 7 Aug 2017 12:30:35 +0800 Subject: [PATCH] Change the groupid from openo to onap Change the groupid and package paths to onap. Change-Id: I8432e9ac2c979bbc36e10e6a702c6f04fc41446a Issue-ID: HOLMES-7 Signed-off-by: Guangrong Fu --- pom.xml | 26 +++------- rulemgt-standalone/pom.xml | 10 ++-- .../src/main/assembly/bin/initDB.bat | 2 +- rulemgt-standalone/src/main/assembly/bin/initDB.sh | 4 +- rulemgt-standalone/src/main/assembly/bin/run.bat | 2 +- rulemgt-standalone/src/main/assembly/bin/run.sh | 2 +- rulemgt-standalone/src/main/assembly/bin/stop.bat | 2 +- rulemgt-standalone/src/main/assembly/bin/stop.sh | 2 +- .../src/main/assembly/conf/rulemgt.yml | 2 +- rulemgt/pom.xml | 18 ++----- .../holmes/rulemgt/RuleActiveApp.java | 14 ++--- .../holmes/rulemgt/RuleAppConfig.java | 2 +- .../bean/request/CorrelationCheckRule4Engine.java | 2 +- .../bean/request/CorrelationDeployRule4Engine.java | 2 +- .../bean/request/CorrelationRestRequest.java | 2 +- .../rulemgt/bean/request/RuleCreateRequest.java | 2 +- .../rulemgt/bean/request/RuleDeleteRequest.java | 2 +- .../rulemgt/bean/request/RuleQueryCondition.java | 2 +- .../rulemgt/bean/request/RuleUpdateRequest.java | 2 +- .../bean/response/RuleAddAndUpdateResponse.java | 2 +- .../bean/response/RuleQueryListResponse.java | 2 +- .../rulemgt/bean/response/RuleResult4API.java | 2 +- .../rulemgt/bolt/enginebolt/EngineService.java | 10 ++-- .../rulemgt/bolt/enginebolt/EngineWrapper.java | 33 ++++++------ .../holmes/rulemgt/constant/RuleMgtConstant.java | 4 +- .../holmes/rulemgt/db/CorrelationRuleDao.java | 19 ++++--- .../holmes/rulemgt/db/CorrelationRuleQueryDao.java | 19 ++++--- .../rulemgt/db/mapper/CorrelationRuleMapper.java | 4 +- .../holmes/rulemgt/resources/RuleMgtResources.java | 51 ++++++++----------- .../holmes/rulemgt/wrapper/RuleMgtWrapper.java | 53 ++++++++++--------- .../holmes/rulemgt/RuleActiveAppTest.java | 2 +- .../holmes/rulemgt/RuleAppConfigTest.java | 2 +- .../request/CorrelationCheckRule4EngineTest.java | 2 +- .../request/CorrelationDeployRule4EngineTest.java | 2 +- .../bean/request/CorrelationRestRequestTest.java | 2 +- .../bean/request/RuleCreateRequestTest.java | 2 +- .../bean/request/RuleDeleteRequestTest.java | 2 +- .../bean/request/RuleQueryConditionTest.java | 2 +- .../bean/request/RuleUpdateRequestTest.java | 2 +- .../response/RuleAddAndUpdateResponseTest.java | 2 +- .../bean/response/RuleQueryListResponseTest.java | 2 +- .../rulemgt/bean/response/RuleResult4APITest.java | 2 +- .../rulemgt/bolt/enginebolt/EngineServiceTest.java | 4 +- .../rulemgt/bolt/enginebolt/EngineWrapperTest.java | 21 ++++---- .../rulemgt/db/CorrelationRuleQueryDaoTest.java | 15 +++--- .../db/mapper/CorrelationRuleMapperTest.java | 2 +- .../rulemgt/resources/RuleMgtResourcesTest.java | 18 +++---- .../holmes/rulemgt/wrapper/RuleMgtWrapperTest.java | 59 +++++++++++----------- 48 files changed, 204 insertions(+), 238 deletions(-) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/RuleActiveApp.java (81%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/RuleAppConfig.java (98%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java (90%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java (92%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationRestRequest.java (90%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleCreateRequest.java (92%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleDeleteRequest.java (91%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleQueryCondition.java (92%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleUpdateRequest.java (92%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java (92%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleQueryListResponse.java (93%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleResult4API.java (93%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bolt/enginebolt/EngineService.java (87%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java (61%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/constant/RuleMgtConstant.java (85%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/db/CorrelationRuleDao.java (80%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/db/CorrelationRuleQueryDao.java (86%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java (93%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/resources/RuleMgtResources.java (77%) rename rulemgt/src/main/java/org/{openo => onap}/holmes/rulemgt/wrapper/RuleMgtWrapper.java (82%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/RuleActiveAppTest.java (97%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/RuleAppConfigTest.java (95%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java (93%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java (94%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java (93%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleCreateRequestTest.java (94%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java (92%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleQueryConditionTest.java (95%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java (94%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java (93%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java (94%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bean/response/RuleResult4APITest.java (95%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java (92%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java (85%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java (89%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java (95%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/resources/RuleMgtResourcesTest.java (91%) rename rulemgt/src/test/java/org/{openo => onap}/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java (85%) diff --git a/pom.xml b/pom.xml index aadc429..a1d0353 100644 --- a/pom.xml +++ b/pom.xml @@ -18,13 +18,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.openo.oparent - oparent - 1.1.0-SNAPSHOT - ../oparent + org.onap.oparent + version + 1.0.0-SNAPSHOT + ../../oparent - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt-parent pom holmes-rulemgt-parent @@ -58,7 +58,7 @@ 2.2.1 - openo-holmes-rulemgt + onap-holmes-rulemgt linux64 win64 target/assembly/${linux64id} @@ -73,7 +73,7 @@ 3.0 - org.openo.holmes.actions + org.onap.holmes.common holmes-actions ${project.version} @@ -119,12 +119,6 @@ ${stringtemplate.version} - - org.openo.common-services.common-utilities - dropwizard-ioc-container - ${project.version} - - org.quartz-scheduler quartz @@ -151,12 +145,6 @@ 1.6.5 test - - - org.openo.client.cli - swagger-sdk - 1.1.0-SNAPSHOT - diff --git a/rulemgt-standalone/pom.xml b/rulemgt-standalone/pom.xml index ea4b985..2327c11 100644 --- a/rulemgt-standalone/pom.xml +++ b/rulemgt-standalone/pom.xml @@ -20,9 +20,9 @@ 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"> - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt-parent - 1.1.0-SNAPSHOT + 1.0.0-SNAPSHOT holmes-rulemgt-standalone @@ -96,7 +96,7 @@ - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt jar true @@ -115,7 +115,7 @@ - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt jar true @@ -166,7 +166,7 @@ - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt ${project.version} diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.bat b/rulemgt-standalone/src/main/assembly/bin/initDB.bat index f6d83af..fd60aed 100644 --- a/rulemgt-standalone/src/main/assembly/bin/initDB.bat +++ b/rulemgt-standalone/src/main/assembly/bin/initDB.bat @@ -24,7 +24,7 @@ echo start init holmes rulemgt db 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 diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.sh b/rulemgt-standalone/src/main/assembly/bin/initDB.sh index 905ad1b..a602bf9 100644 --- a/rulemgt-standalone/src/main/assembly/bin/initDB.sh +++ b/rulemgt-standalone/src/main/assembly/bin/initDB.sh @@ -23,12 +23,12 @@ port=$3 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 diff --git a/rulemgt-standalone/src/main/assembly/bin/run.bat b/rulemgt-standalone/src/main/assembly/bin/run.bat index 6553c82..1ea81ab 100644 --- a/rulemgt-standalone/src/main/assembly/bin/run.bat +++ b/rulemgt-standalone/src/main/assembly/bin/run.bat @@ -30,7 +30,7 @@ set class_path=%main_path%;%main_path%holmes-rulemgt.jar echo ### jvm_opts: %jvm_opts% echo ### class_path: %class_path% -%JAVA% -classpath %class_path% %jvm_opts% org.openo.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml +%JAVA% -classpath %class_path% %jvm_opts% org.onap.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml IF ERRORLEVEL 1 goto showerror exit diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh index 0519cc2..b6ab959 100644 --- a/rulemgt-standalone/src/main/assembly/bin/run.sh +++ b/rulemgt-standalone/src/main/assembly/bin/run.sh @@ -31,5 +31,5 @@ echo @JAVA_OPTS@ $JAVA_OPTS 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" diff --git a/rulemgt-standalone/src/main/assembly/bin/stop.bat b/rulemgt-standalone/src/main/assembly/bin/stop.bat index ca7b4ff..bfde362 100644 --- a/rulemgt-standalone/src/main/assembly/bin/stop.bat +++ b/rulemgt-standalone/src/main/assembly/bin/stop.bat @@ -18,7 +18,7 @@ title stopping engine-d-service set HOME=%~dp0 -set Main_Class="org.openo.holmes.rulemgt.RuleActiveApp" +set Main_Class="org.onap.holmes.rulemgt.RuleActiveApp" echo ================== engine-d-service info ============================================= echo HOME=$HOME diff --git a/rulemgt-standalone/src/main/assembly/bin/stop.sh b/rulemgt-standalone/src/main/assembly/bin/stop.sh index f9e07a4..2f98e77 100644 --- a/rulemgt-standalone/src/main/assembly/bin/stop.sh +++ b/rulemgt-standalone/src/main/assembly/bin/stop.sh @@ -17,7 +17,7 @@ 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 diff --git a/rulemgt-standalone/src/main/assembly/conf/rulemgt.yml b/rulemgt-standalone/src/main/assembly/conf/rulemgt.yml index 8ad1f9a..fe2e18e 100644 --- a/rulemgt-standalone/src/main/assembly/conf/rulemgt.yml +++ b/rulemgt-standalone/src/main/assembly/conf/rulemgt.yml @@ -9,7 +9,7 @@ apidescription: ZTE Holmes rule Management rest API server: type: simple - rootPath: '/openoapi/holmes-rule-mgmt/v1/*' + rootPath: '/onapapi/holmes-rule-mgmt/v1/*' applicationContextPath: / adminContextPath: /admin connector: diff --git a/rulemgt/pom.xml b/rulemgt/pom.xml index e4af4c6..a4e1388 100644 --- a/rulemgt/pom.xml +++ b/rulemgt/pom.xml @@ -19,9 +19,9 @@ 4.0.0 - org.openo.holmes.rule-management + org.onap.holmes.rule-management holmes-rulemgt-parent - 1.1.0-SNAPSHOT + 1.0.0-SNAPSHOT holmes-rulemgt @@ -31,8 +31,9 @@ - org.openo.holmes.actions + org.onap.holmes.common holmes-actions + 1.0.0-SNAPSHOT org.glassfish.jersey.containers @@ -44,11 +45,6 @@ - - org.glassfish.jersey.containers - jersey-container-servlet-core - 2.22.2 - org.easymock easymock @@ -103,10 +99,6 @@ org.slf4j slf4j-api - - org.openo.client.cli - swagger-sdk - io.swagger swagger-jersey2-jaxrs @@ -241,7 +233,7 @@ implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> - org.openo.holmes.rulemgt.RuleActiveApp + org.onap.holmes.rulemgt.RuleActiveApp diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java similarity index 81% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java index 96a1f00..8dc697c 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleActiveApp.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java @@ -14,18 +14,18 @@ * 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 ); @@ -53,7 +53,7 @@ public class RuleActiveApp extends IOCApplication < RuleAppConfig > { 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; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java similarity index 98% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java index 4fcb486..20f96c2 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/RuleAppConfig.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleAppConfig.java @@ -13,7 +13,7 @@ * 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; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java similarity index 90% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java index 1475ce9..c36fce7 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4Engine.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import lombok.Getter; import lombok.Setter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java similarity index 92% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java index 3ed4c4d..7c94395 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4Engine.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java similarity index 90% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java index 463eb2a..e79cc62 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequest.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import lombok.Getter; import lombok.Setter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java similarity index 92% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java index 9407b99..f090c3b 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequest.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java similarity index 91% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java index ac9d795..7cc4fff 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequest.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java similarity index 92% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java index c68b40d..f3b9b91 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleQueryCondition.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleQueryCondition.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java similarity index 92% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java index 6ce265a..e2811e3 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequest.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java similarity index 92% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java index e5597b8..7fe432e 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponse.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java similarity index 93% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java index a720eca..17903ab 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponse.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponse.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java similarity index 93% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java index ee948d0..c444b22 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bean/response/RuleResult4API.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bean/response/RuleResult4API.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java similarity index 87% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java index e792fbf..f3e8d5c 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bolt.enginebolt; +package org.onap.holmes.rulemgt.bolt.enginebolt; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; @@ -26,10 +26,10 @@ import javax.ws.rs.core.Response; import lombok.extern.slf4j.Slf4j; import org.glassfish.jersey.client.ClientConfig; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.config.MicroServiceConfig; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.common.config.MicroServiceConfig; @Slf4j @Service diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java similarity index 61% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java index 8e9055b..733cae0 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java @@ -13,18 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bolt.enginebolt; +package org.onap.holmes.rulemgt.bolt.enginebolt; import javax.inject.Inject; import javax.ws.rs.core.Response; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.common.exception.CorrelationException; @Service @Slf4j @@ -38,18 +37,18 @@ public class EngineWrapper { try { response = engineService.deploy(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule deployment RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call deploy rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule deployment RESTful API from the engine management service."); try { JSONObject json = JSONObject.fromObject(response.readEntity(String.class)); return json.get(RuleMgtConstant.PACKAGE).toString(); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR, e); + throw new CorrelationException("Failed to parse the value returned by the engine management service.", e); } } else { - throw new CorrelationException(I18nProxy.ENGINE_DEPLOY_RULE_FAILED); + throw new CorrelationException("Failed to deploy the rule!"); } } @@ -58,31 +57,31 @@ public class EngineWrapper { try { response = engineService.delete(packageName); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule deleting RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call delete rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule deleting RESTful API from the engine management service."); return true; } else { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED); + throw new CorrelationException("Failed to delete the rule!"); } } public boolean checkRuleFromEngine(CorrelationCheckRule4Engine correlationCheckRule4Engine) throws CorrelationException { - log.info("content:" + correlationCheckRule4Engine.getContent()); + log.info("Rule Contents: " + correlationCheckRule4Engine.getContent()); Response response; try { response = engineService.check(correlationCheckRule4Engine); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule verification RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call check rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule verification RESTful API from the engine management service."); return true; } else { log.info(response.getStatus() + " " + response.getStatusInfo() + " " + response.getEntity()); - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS); + throw new CorrelationException("Failed to verify the rule. The contents of the rule are invalid."); } } } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java similarity index 85% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java index a9b891a..debfb05 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/constant/RuleMgtConstant.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/constant/RuleMgtConstant.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.constant; +package org.onap.holmes.rulemgt.constant; public class RuleMgtConstant { @@ -24,6 +24,6 @@ public class RuleMgtConstant { public static final int STATUS_RULE_CLOSE = 0; public static final int STATUS_RULE_ALL = 2; public static final String PACKAGE = "package"; - public static final String ENGINE_PATH = "/openoapi/holmes-engine-mgmt/v1/rule"; + public static final String ENGINE_PATH = "/onapapi/holmes-engine-mgmt/v1/rule"; public static final int RESPONSE_STATUS_OK = 200; } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java similarity index 80% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java index 3a7f300..2a422c4 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleDao.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleDao.java @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.db; +package org.onap.holmes.rulemgt.db; import java.util.List; -import org.openo.holmes.common.api.entity.CorrelationRule; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.db.mapper.CorrelationRuleMapper; +import org.onap.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.rulemgt.db.mapper.CorrelationRuleMapper; import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.BindBean; import org.skife.jdbi.v2.sqlobject.GetGeneratedKeys; @@ -67,7 +66,7 @@ public abstract class CorrelationRuleDao { addRule(correlationRule); return correlationRule; } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); + throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e); } } @@ -75,7 +74,7 @@ public abstract class CorrelationRuleDao { try { updateRuleByRid(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); + throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e); } } @@ -83,7 +82,7 @@ public abstract class CorrelationRuleDao { try { deleteRule2DbInner(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); + throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e); } } @@ -92,7 +91,7 @@ public abstract class CorrelationRuleDao { try { return queryRuleById(rid); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); + throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e); } } @@ -100,7 +99,7 @@ public abstract class CorrelationRuleDao { try { return queryRuleByName(name); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR,e); + throw new CorrelationException("Can not access the database. Please contact the administrator for help.", e); } } } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java similarity index 86% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java index 487684e..322006d 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDao.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDao.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.db; +package org.onap.holmes.rulemgt.db; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; @@ -26,12 +26,11 @@ import java.util.Properties; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.api.entity.CorrelationRule; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.DbDaoUtil; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.DbDaoUtil; import org.skife.jdbi.v2.Handle; import org.skife.jdbi.v2.Query; @@ -57,8 +56,8 @@ public class CorrelationRuleQueryDao { } return correlationRules; } catch (Exception e) { - log.warn("Query rule: rule id =" + ruleQueryCondition.getRid() + " failed"); - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED, e); + log.warn("Failed to query the rule: id =" + ruleQueryCondition.getRid() + "."); + throw new CorrelationException("Failed to query the rule.", e); } finally { dbDaoUtil.close(handle); } @@ -123,7 +122,7 @@ public class CorrelationRuleQueryDao { } return ""; } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED, e); + throw new CorrelationException("An error occurred while building the query SQL.", e); } } } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java similarity index 93% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java index 437e0dd..d40253f 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapper.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.db.mapper; +package org.onap.holmes.rulemgt.db.mapper; -import org.openo.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.api.entity.CorrelationRule; import org.skife.jdbi.v2.StatementContext; import org.skife.jdbi.v2.tweak.ResultSetMapper; diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java similarity index 77% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java index f3256b2..04578f7 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/resources/RuleMgtResources.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.resources; +package org.onap.holmes.rulemgt.resources; import com.codahale.metrics.annotation.Timed; import io.swagger.annotations.Api; @@ -22,7 +22,6 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.SwaggerDefinition; import java.io.IOException; import java.util.Locale; -import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.DELETE; @@ -37,23 +36,22 @@ import javax.ws.rs.core.MediaType; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.api.entity.ServiceRegisterEntity; -import org.openo.holmes.common.config.MicroServiceConfig; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.ExceptionUtil; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.common.utils.JacksonUtil; -import org.openo.holmes.common.utils.LanguageUtil; -import org.openo.holmes.common.utils.MSBRegisterUtil; -import org.openo.holmes.common.utils.UserUtil; -import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest; -import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; -import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest; -import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; -import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; -import org.openo.holmes.rulemgt.wrapper.RuleMgtWrapper; +import org.onap.holmes.common.api.entity.ServiceRegisterEntity; +import org.onap.holmes.common.config.MicroServiceConfig; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.ExceptionUtil; +import org.onap.holmes.common.utils.JacksonUtil; +import org.onap.holmes.common.utils.LanguageUtil; +import org.onap.holmes.common.utils.MSBRegisterUtil; +import org.onap.holmes.common.utils.UserUtil; +import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest; +import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest; +import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; +import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper; @Service @SwaggerDefinition @@ -81,8 +79,7 @@ public class RuleMgtResources { return ruleChangeResponse; } catch (CorrelationException e) { log.error("create rule:" + ruleCreateRequest.getRuleName() + " failed", e); - throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale, - e.getMessage())); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); } } @@ -100,8 +97,7 @@ public class RuleMgtResources { return ruleChangeResponse; } catch (CorrelationException e) { log.error("update rule:" + ruleUpdateRequest.getContent() + " failed", e); - throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale, - e.getMessage())); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); } } @@ -118,8 +114,7 @@ public class RuleMgtResources { return true; } catch (CorrelationException e) { log.error("delete rule:" + ruleDeleteRequest.getRuleId() + " failed", e); - throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale, - e.getMessage())); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); } } @@ -142,8 +137,7 @@ public class RuleMgtResources { return ruleQueryListResponse; } catch (CorrelationException e) { log.error("query rule failed,cause query condition conversion failure", e); - throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale, - e.getMessage())); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); } } @@ -161,8 +155,7 @@ public class RuleMgtResources { return ruleQueryCondition; } catch (IOException e) { log.warn("queryRequest convert to json failed", e); - throw ExceptionUtil.buildExceptionResponse(I18nProxy.getInstance().getValue(locale, - I18nProxy.RULE_MANAGEMENT_DATA_FORMAT_ERROR)); + throw ExceptionUtil.buildExceptionResponse("The request format is invalid!"); } } } diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java similarity index 82% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java index 58d461f..beffa56 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.wrapper; +package org.onap.holmes.rulemgt.wrapper; import java.util.ArrayList; import java.util.Date; @@ -23,23 +23,22 @@ import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.api.entity.CorrelationRule; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.DbDaoUtil; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; -import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest; -import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; -import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest; -import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; -import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse; -import org.openo.holmes.rulemgt.bean.response.RuleResult4API; -import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; -import org.openo.holmes.rulemgt.db.CorrelationRuleDao; -import org.openo.holmes.rulemgt.db.CorrelationRuleQueryDao; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.bean.response.RuleResult4API; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.db.CorrelationRuleDao; +import org.onap.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.DbDaoUtil; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest; +import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest; +import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; +import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse; +import org.onap.holmes.rulemgt.bolt.enginebolt.EngineWrapper; +import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao; @Service @@ -64,14 +63,14 @@ public class RuleMgtWrapper { public RuleAddAndUpdateResponse addCorrelationRule(String creator, RuleCreateRequest ruleCreateRequest) throws CorrelationException { if (ruleCreateRequest == null) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY); + throw new CorrelationException("The request object can not be empty!"); } CorrelationRule correlationRule = convertCreateRequest2Rule(creator, ruleCreateRequest); checkCorrelation(correlationRule); CorrelationRule ruleTemp = correlationRuleDao.queryRuleByRuleName(correlationRule.getName()); if (ruleTemp != null) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME); + throw new CorrelationException("A rule with the same name already exists."); } correlationRule.setPackageName(deployRule2Engine(correlationRule)); CorrelationRule result = correlationRuleDao.saveRule(correlationRule); @@ -83,11 +82,11 @@ public class RuleMgtWrapper { public RuleAddAndUpdateResponse updateCorrelationRule(String modifier, RuleUpdateRequest ruleUpdateRequest) throws CorrelationException { if (ruleUpdateRequest == null) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY); + throw new CorrelationException("The request object can not be empty!"); } CorrelationRule oldCorrelationRule = correlationRuleDao.queryRuleByRid(ruleUpdateRequest.getRuleId()); if (oldCorrelationRule == null) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE); + throw new CorrelationException("You're trying to update a rule which does not exist in the system."); } CorrelationRule newCorrelationRule = convertRuleUpdateRequest2CorrelationRule(modifier, ruleUpdateRequest, oldCorrelationRule.getName()); @@ -110,14 +109,14 @@ public class RuleMgtWrapper { String ruleName = correlationRule.getName() == null ? "" : correlationRule.getName().trim(); String content = correlationRule.getContent() == null ? "" : correlationRule.getContent().trim(); if ("".equals(content)) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY); + throw new CorrelationException("The contents of the rule can not be empty!"); } if (enabled != RuleMgtConstant.STATUS_RULE_CLOSE && enabled != RuleMgtConstant.STATUS_RULE_OPEN) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR); + throw new CorrelationException("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed."); } if ("".equals(ruleName)) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY); + throw new CorrelationException("The name of the rule can not be empty."); } } @@ -137,12 +136,12 @@ public class RuleMgtWrapper { public void deleteCorrelationRule(RuleDeleteRequest ruleDeleteRequest) throws CorrelationException { if (ruleDeleteRequest == null) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY); + throw new CorrelationException("The request object can not be empty!"); } CorrelationRule correlationRule = correlationRuleDao.queryRuleByRid(ruleDeleteRequest.getRuleId()); if (correlationRule == null) { log.warn("the rule:rule id=" + ruleDeleteRequest.getRuleId() + " does not exist the database."); - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE); + throw new CorrelationException("You're trying to delete a rule which does not exist in the system."); } if (correlationRule.getEnabled() == RuleMgtConstant.STATUS_RULE_OPEN) { engineWarpper.deleteRuleFromEngine(correlationRule.getPackageName()); diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleActiveAppTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java similarity index 97% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleActiveAppTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java index 4f35b94..cd79ae8 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleActiveAppTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleActiveAppTest.java @@ -14,7 +14,7 @@ * 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; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleAppConfigTest.java similarity index 95% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleAppConfigTest.java index d14e55e..d411603 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/RuleAppConfigTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt; +package org.onap.holmes.rulemgt; import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsNull.notNullValue; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java similarity index 93% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java index 59e020c..e292e16 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationCheckRule4EngineTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java similarity index 94% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java index 8a9b8ec..418ff41 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationDeployRule4EngineTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.junit.Assert.*; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java similarity index 93% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java index 5f3c5c1..e616a71 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/CorrelationRestRequestTest.java @@ -15,7 +15,7 @@ */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequestTest.java similarity index 94% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequestTest.java index 3f5469d..54fa132 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleCreateRequestTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleCreateRequestTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java similarity index 92% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java index f9a09ff..3d49b2f 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleDeleteRequestTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleQueryConditionTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleQueryConditionTest.java similarity index 95% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleQueryConditionTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleQueryConditionTest.java index 8bb5b8b..36d5024 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleQueryConditionTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleQueryConditionTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java similarity index 94% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java index 4cd4744..9f24c0c 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/request/RuleUpdateRequestTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.request; +package org.onap.holmes.rulemgt.bean.request; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java similarity index 93% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java index 82731d6..a7db0fe 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleAddAndUpdateResponseTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import static org.junit.Assert.*; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java similarity index 94% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java index c6e0a7e..fa423db 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleQueryListResponseTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleResult4APITest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleResult4APITest.java similarity index 95% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleResult4APITest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleResult4APITest.java index 3af245e..2c006ab 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bean/response/RuleResult4APITest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bean/response/RuleResult4APITest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bean.response; +package org.onap.holmes.rulemgt.bean.response; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java similarity index 92% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java index f4275eb..b3cb93d 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java @@ -15,7 +15,7 @@ */ -package org.openo.holmes.rulemgt.bolt.enginebolt; +package org.onap.holmes.rulemgt.bolt.enginebolt; import org.apache.http.HttpResponse; @@ -25,7 +25,7 @@ import org.apache.http.impl.client.HttpClients; import org.junit.Before; import org.junit.Rule; import org.junit.rules.ExpectedException; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; import org.powermock.api.easymock.PowerMock; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.rule.PowerMockRule; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java similarity index 85% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java index 38afa47..b63b106 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.bolt.enginebolt; +package org.onap.holmes.rulemgt.bolt.enginebolt; import static org.hamcrest.MatcherAssert.assertThat; @@ -27,10 +27,9 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.common.exception.CorrelationException; import org.powermock.api.easymock.PowerMock; import org.powermock.reflect.Whitebox; @@ -54,7 +53,7 @@ public class EngineWrapperTest { @Test public void deployEngine_invoke_rule_deploy_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED); + thrown.expectMessage("Failed to call the rule deployment RESTful API."); EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class))).andThrow( new RuntimeException("")); @@ -68,7 +67,7 @@ public class EngineWrapperTest { @Test public void deployEngine_http_status_not_ok() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.ENGINE_DEPLOY_RULE_FAILED); + thrown.expectMessage("Failed to deploy the rule!"); EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class))) .andReturn(response); @@ -85,7 +84,7 @@ public class EngineWrapperTest { String content = ""; thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR); + thrown.expectMessage("Failed to parse the value returned by the engine management service."); EasyMock.expect(engineServiceMock.deploy(EasyMock.anyObject(CorrelationDeployRule4Engine.class))) .andReturn(response); EasyMock.expect(response.getStatus()).andReturn(200); @@ -115,7 +114,7 @@ public class EngineWrapperTest { @Test public void deleteRuleFromEngine_invoke_rule_delete_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED); + thrown.expectMessage("Failed to call the rule deleting RESTful API."); EasyMock.expect(engineServiceMock.delete(EasyMock.anyObject(String.class))).andThrow( new RuntimeException("")); @@ -129,7 +128,7 @@ public class EngineWrapperTest { @Test public void deleteRuleFromEngine_http_status_not_ok() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED); + thrown.expectMessage("Failed to delete the rule!"); EasyMock.expect(engineServiceMock.delete(EasyMock.anyObject(String.class))) .andReturn(response); @@ -158,7 +157,7 @@ public class EngineWrapperTest { @Test public void checkRuleFromEngine_rule_delete_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED); + thrown.expectMessage("Failed to call the rule verification RESTful API."); EasyMock.expect(engineServiceMock.check(EasyMock.anyObject(CorrelationCheckRule4Engine.class))).andThrow( new RuntimeException("")); diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java similarity index 89% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java index f241484..3854cdc 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/CorrelationRuleQueryDaoTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.db; +package org.onap.holmes.rulemgt.db; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @@ -30,11 +30,10 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.openo.holmes.common.api.entity.CorrelationRule; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.DbDaoUtil; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.DbDaoUtil; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; import org.powermock.api.easymock.PowerMock; import org.powermock.modules.junit4.rule.PowerMockRule; import org.powermock.reflect.Whitebox; @@ -76,7 +75,7 @@ public class CorrelationRuleQueryDaoTest { public void getCorrelationRulesByCondition_db_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED); + thrown.expectMessage("Failed to query the rule."); EasyMock.expect(dbDaoUtil.getHandle()).andReturn(handle); EasyMock.expect(handle.createQuery(EasyMock.anyObject(String.class))).andReturn(query); @@ -110,7 +109,7 @@ public class CorrelationRuleQueryDaoTest { @Test public void getCorrelationRulesByCondition_get_where_sql_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED); + thrown.expectMessage("An error occurred while building the query SQL."); EasyMock.expect(dbDaoUtil.getHandle()).andReturn(handle); EasyMock.expect(handle.createQuery(EasyMock.anyObject(String.class))).andReturn(query); diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java similarity index 95% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java index 65a53dd..bcf56ca 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/db/mapper/CorrelationRuleMapperTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.db.mapper; +package org.onap.holmes.rulemgt.db.mapper; import static org.easymock.EasyMock.expect; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/resources/RuleMgtResourcesTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java similarity index 91% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/resources/RuleMgtResourcesTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java index 16a547b..dd68ad8 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/resources/RuleMgtResourcesTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.resources; +package org.onap.holmes.rulemgt.resources; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.WebApplicationException; @@ -24,14 +24,14 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest; -import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; -import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest; -import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; -import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse; -import org.openo.holmes.rulemgt.wrapper.RuleMgtWrapper; +import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest; +import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest; +import org.onap.holmes.rulemgt.wrapper.RuleMgtWrapper; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest; +import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; +import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse; import org.powermock.api.easymock.PowerMock; import org.powermock.reflect.Whitebox; diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java similarity index 85% rename from rulemgt/src/test/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java rename to rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java index f6d0544..0c81b98 100644 --- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.openo.holmes.rulemgt.wrapper; +package org.onap.holmes.rulemgt.wrapper; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -29,21 +29,20 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.openo.holmes.common.api.entity.CorrelationRule; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.DbDaoUtil; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; -import org.openo.holmes.rulemgt.bean.request.RuleCreateRequest; -import org.openo.holmes.rulemgt.bean.request.RuleDeleteRequest; -import org.openo.holmes.rulemgt.bean.request.RuleQueryCondition; -import org.openo.holmes.rulemgt.bean.request.RuleUpdateRequest; -import org.openo.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; -import org.openo.holmes.rulemgt.bean.response.RuleQueryListResponse; -import org.openo.holmes.rulemgt.bolt.enginebolt.EngineWrapper; -import org.openo.holmes.rulemgt.db.CorrelationRuleDao; -import org.openo.holmes.rulemgt.db.CorrelationRuleQueryDao; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.db.CorrelationRuleDao; +import org.onap.holmes.common.api.entity.CorrelationRule; +import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.DbDaoUtil; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest; +import org.onap.holmes.rulemgt.bean.request.RuleDeleteRequest; +import org.onap.holmes.rulemgt.bean.request.RuleQueryCondition; +import org.onap.holmes.rulemgt.bean.request.RuleUpdateRequest; +import org.onap.holmes.rulemgt.bean.response.RuleAddAndUpdateResponse; +import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse; +import org.onap.holmes.rulemgt.bolt.enginebolt.EngineWrapper; +import org.onap.holmes.rulemgt.db.CorrelationRuleQueryDao; import org.powermock.api.easymock.PowerMock; import org.powermock.modules.junit4.rule.PowerMockRule; import org.powermock.reflect.Whitebox; @@ -93,7 +92,7 @@ public class RuleMgtWrapperTest { @Test public void addCorrelationRule_name_is_null() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY); + thrown.expectMessage("The name of the rule can not be empty."); ruleMgtWrapper.addCorrelationRule(USER_NAME, createRuleCreateRequest(null, "This is a rule for testing.", "Mocked contents.", 0)); @@ -102,7 +101,7 @@ public class RuleMgtWrapperTest { @Test public void addCorrelationRule_request_null() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY)); + thrown.expectMessage("The request object can not be empty!"); ruleMgtWrapper.addCorrelationRule(USER_NAME, null); } @@ -110,7 +109,7 @@ public class RuleMgtWrapperTest { @Test public void addCorrelationRule_name_is_empty() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NAME_CANNOT_BE_EMPTY); + thrown.expectMessage("The name of the rule can not be empty."); ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("", "This is a rule for testing.", "Mocked contents.", 0)); @@ -119,7 +118,7 @@ public class RuleMgtWrapperTest { @Test public void addCorrelationRule_content_is_empty() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CONTENT_CANNOT_BE_EMPTY); + thrown.expectMessage("The contents of the rule can not be empty!"); ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("test", "This is a rule for testing.", "", 0)); @@ -128,7 +127,7 @@ public class RuleMgtWrapperTest { @Test public void addCorrelationRule_enabled_is_off_limit() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR); + thrown.expectMessage("Invalid rule status. Only 0 (disabled) and 1 (enabled) are allowed."); ruleMgtWrapper.addCorrelationRule("admin", createRuleCreateRequest("test", "This is a rule for testing.", "Mocked contents.", 3)); @@ -144,7 +143,7 @@ public class RuleMgtWrapperTest { CorrelationRule correlationRule = convertCreateRequest2CorrelationRule(ruleCreateRequest); thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_REPEAT_RULE_NAME); + thrown.expectMessage("A rule with the same name already exists."); EasyMock.expect(correlationRuleDaoMock.queryRuleByRuleName(ruleName)).andReturn(correlationRule); PowerMock.replayAll(); @@ -183,7 +182,7 @@ public class RuleMgtWrapperTest { @Test public void updateCorrelationRule_param_null() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY); + thrown.expectMessage("The request object can not be empty!"); ruleMgtWrapper.updateCorrelationRule(USER_NAME, null); } @@ -241,7 +240,7 @@ public class RuleMgtWrapperTest { @Test public void updateCorrelationRule_rule_not_exist() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE); + thrown.expectMessage("You're trying to update a rule which does not exist in the system."); EasyMock.expect(correlationRuleDaoMock.queryRuleByRid(EasyMock.anyObject(String.class))).andReturn(null); @@ -255,7 +254,7 @@ public class RuleMgtWrapperTest { @Test public void deleteCorrelationRule_request_null() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_REQUEST_OBJECT_IS_EMPTY)); + thrown.expectMessage("The request object can not be empty!"); ruleMgtWrapper.deleteCorrelationRule(null); } @@ -263,7 +262,7 @@ public class RuleMgtWrapperTest { @Test public void deleteCorrelationRule_rule_not_exit() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_RULE_NOT_EXIST_DATABASE)); + thrown.expectMessage("You're trying to delete a rule which does not exist in the system."); RuleDeleteRequest ruleDeleteRequest = createRuleDeleteRequest("rule_" + System.currentTimeMillis()); @@ -299,11 +298,11 @@ public class RuleMgtWrapperTest { @Test public void getCorrelationRuleByCondition_data_format_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED)); + thrown.expectMessage("An error occurred while building the query SQL."); EasyMock.expect(correlationRuleQueryDaoMock.getCorrelationRulesByCondition(EasyMock.anyObject( RuleQueryCondition.class))) - .andThrow(new CorrelationException(I18nProxy.RULE_MANAGEMENT_CREATE_QUERY_SQL_FAILED)); + .andThrow(new CorrelationException("An error occurred while building the query SQL.")); PowerMock.replay(correlationRuleQueryDaoMock, CorrelationRuleQueryDao.class); @@ -315,11 +314,11 @@ public class RuleMgtWrapperTest { @Test public void getCorrelationRuleByCondition_db_exception() throws Exception { thrown.expect(CorrelationException.class); - thrown.expectMessage((I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED)); + thrown.expectMessage("Failed to query the rule."); EasyMock.expect(correlationRuleQueryDaoMock.getCorrelationRulesByCondition(EasyMock.anyObject( RuleQueryCondition.class))) - .andThrow(new CorrelationException(I18nProxy.RULE_MANAGEMENT_QUERY_RULE_FAILED)); + .andThrow(new CorrelationException("Failed to query the rule.")); PowerMock.replay(correlationRuleQueryDaoMock, CorrelationRuleQueryDao.class); -- 2.16.6