summaryrefslogtreecommitdiffstats
path: root/engine-d/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'engine-d/src/test/java')
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/EngineDActiveAppTest.java2
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/EnginedAppConfigTest.java9
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/db/CorrelationRuleDaoTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapperTest.java10
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java161
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/request/CompileRuleRequestTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/request/DeployRuleRequestTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/resources/EngineResourcesTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/response/CorrelationRuleResponseTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/utils/AlarmUtilTest.java4
-rw-r--r--engine-d/src/test/java/org/openo/holmes/engine/wrapper/RuleMgtWrapperTest.java7
11 files changed, 102 insertions, 111 deletions
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/EngineDActiveAppTest.java b/engine-d/src/test/java/org/openo/holmes/engine/EngineDActiveAppTest.java
index af79cc6..b69f9db 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/EngineDActiveAppTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/EngineDActiveAppTest.java
@@ -21,7 +21,7 @@ package org.openo.holmes.engine;
public class EngineDActiveAppTest {
public static void main(String[] args) throws Exception {
- String filePath = "C:\\Users\\Administrator\\AppData\\Roaming\\IM\\6092002109\\RecvFiles\\correlation-engine.yml";
+ String filePath = "C:\\correlation-engine.yml";
new EngineDActiveApp().run(new String[]{"server", filePath});
}
}
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/EnginedAppConfigTest.java b/engine-d/src/test/java/org/openo/holmes/engine/EnginedAppConfigTest.java
index c24894c..b7bcf34 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/EnginedAppConfigTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/EnginedAppConfigTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine;
import io.dropwizard.db.DataSourceFactory;
@@ -24,10 +25,8 @@ import org.junit.Test;
import org.openo.holmes.common.config.MQConfig;
import org.powermock.api.easymock.PowerMock;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class EnginedAppConfigTest {
+
private EngineDAppConfig engineAppConfig;
@Before
@@ -64,13 +63,13 @@ public class EnginedAppConfigTest {
@Test
public void getApidescription() {
final String apidescription = "Holmes rule management rest API";
- Assert.assertThat(engineAppConfig.getApidescription(),IsEqual.equalTo(apidescription));
+ Assert.assertThat(engineAppConfig.getApidescription(), IsEqual.equalTo(apidescription));
}
@Test
public void setApidescription() {
final String apidescription = "set api description";
engineAppConfig.setApidescription(apidescription);
- Assert.assertThat(engineAppConfig.getApidescription(),IsEqual.equalTo(apidescription));
+ Assert.assertThat(engineAppConfig.getApidescription(), IsEqual.equalTo(apidescription));
}
}
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/db/CorrelationRuleDaoTest.java b/engine-d/src/test/java/org/openo/holmes/engine/db/CorrelationRuleDaoTest.java
index 3352b08..073f590 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/db/CorrelationRuleDaoTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/db/CorrelationRuleDaoTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.db;
import org.easymock.EasyMock;
@@ -26,9 +27,6 @@ import org.powermock.api.easymock.PowerMock;
import java.util.ArrayList;
import java.util.List;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class CorrelationRuleDaoTest {
private CorrelationRuleDao correlationRuleDao;
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapperTest.java b/engine-d/src/test/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapperTest.java
index ce8f9bf..e5eccf8 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapperTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapperTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.db.mapper;
import org.junit.Test;
@@ -24,15 +25,13 @@ import java.util.Properties;
import static org.easymock.EasyMock.expect;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class CorrelationRuleMapperTest {
@Test
public void map() throws Exception {
CorrelationRuleMapper mapper = new CorrelationRuleMapper();
ResultSet resultSet = PowerMock.createMock(ResultSet.class);
+
expect(resultSet.getString("name")).andReturn("");
expect(resultSet.getString("rid")).andReturn("");
expect(resultSet.getString("description")).andReturn("");
@@ -44,8 +43,7 @@ public class CorrelationRuleMapperTest {
expect(resultSet.getDate("createTime")).andReturn(new Date(System.currentTimeMillis()));
expect(resultSet.getString("updator")).andReturn("");
expect(resultSet.getDate("updateTime")).andReturn(new Date(System.currentTimeMillis()));
- Properties propMock = PowerMock.createMock(Properties.class);
- expect(resultSet.getObject("params")).andReturn(propMock);
+ expect(resultSet.getObject("params")).andReturn(new Properties());
expect(resultSet.getString("domain")).andReturn("");
expect(resultSet.getString("content")).andReturn("");
expect(resultSet.getInt("isManual")).andReturn(0);
@@ -53,7 +51,9 @@ public class CorrelationRuleMapperTest {
expect(resultSet.getString("package")).andReturn("");
PowerMock.replayAll();
+
mapper.map(0, resultSet, null);
+
PowerMock.verify();
}
}
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java b/engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java
index 3877e3f..1740d62 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java
@@ -13,8 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.manager;
+import static org.easymock.EasyMock.anyBoolean;
+import static org.easymock.EasyMock.anyInt;
+import static org.easymock.EasyMock.anyLong;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.Topic;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.builder.KnowledgeBuilder;
@@ -32,34 +53,24 @@ import org.junit.Before;
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.api.stat.Alarm;
import org.openo.holmes.common.config.MQConfig;
import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.exception.EngineException;
import org.openo.holmes.engine.request.DeployRuleRequest;
import org.openo.holmes.engine.wrapper.RuleMgtWrapper;
import org.powermock.api.easymock.PowerMock;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.junit4.rule.PowerMockRule;
import org.powermock.reflect.Whitebox;
-import javax.jms.*;
-import java.lang.reflect.Method;
-import java.util.*;
-
-import static org.easymock.EasyMock.*;
-
-/**
- * Created by Administrator on 2017/2/20.
- */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(DroolsEngine.class)
public class DroolsEngineTest {
+
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public PowerMockRule powerMockRule = new PowerMockRule();
+
private RuleMgtWrapper ruleMgtWrapper;
private KnowledgeBase kbase;
@@ -78,7 +89,7 @@ public class DroolsEngineTest {
@Before
public void setUp() {
- droolsEngine = new DroolsEngine();
+ droolsEngine = new DroolsEngine();
ruleMgtWrapper = PowerMock.createMock(RuleMgtWrapper.class);
kbase = PowerMock.createMock(KnowledgeBase.class);
@@ -88,13 +99,13 @@ public class DroolsEngineTest {
mqConfigProvider = PowerMock.createMock(IterableProvider.class);
connectionFactory = PowerMock.createMock(ConnectionFactory.class);
- Whitebox.setInternalState(droolsEngine,"ruleMgtWrapper",ruleMgtWrapper);
- Whitebox.setInternalState(droolsEngine,"kbase",kbase);
- Whitebox.setInternalState(droolsEngine,"kconf",kconf);
- Whitebox.setInternalState(droolsEngine,"ksession",ksession);
- Whitebox.setInternalState(droolsEngine,"kbuilder",kbuilder);
- Whitebox.setInternalState(droolsEngine,"mqConfigProvider",mqConfigProvider);
- Whitebox.setInternalState(droolsEngine,"connectionFactory",connectionFactory);
+ Whitebox.setInternalState(droolsEngine, "ruleMgtWrapper", ruleMgtWrapper);
+ Whitebox.setInternalState(droolsEngine, "kbase", kbase);
+ Whitebox.setInternalState(droolsEngine, "kconf", kconf);
+ Whitebox.setInternalState(droolsEngine, "ksession", ksession);
+ Whitebox.setInternalState(droolsEngine, "kbuilder", kbuilder);
+ Whitebox.setInternalState(droolsEngine, "mqConfigProvider", mqConfigProvider);
+ Whitebox.setInternalState(droolsEngine, "connectionFactory", connectionFactory);
PowerMock.resetAll();
}
@@ -106,52 +117,16 @@ public class DroolsEngineTest {
mqConfig.brokerPort = 4567;
mqConfig.brokerUsername = "admin";
mqConfig.brokerPassword = "admin";
- expect(mqConfigProvider.get()).andReturn(mqConfig).anyTimes();
- PowerMock.replayAll();
-
- Method method = DroolsEngine.class.getDeclaredMethod("init");
- method.setAccessible(true);
- method.invoke(droolsEngine);
-
- PowerMock.verifyAll();
- }
-
- @Test
- public void initDeployRule_exception() throws Exception {
- thrown.expect(EngineException.class);
-
List<CorrelationRule> rules = new ArrayList<CorrelationRule>();
CorrelationRule rule = new CorrelationRule();
rule.setContent("content");
rules.add(rule);
- expect(ruleMgtWrapper.queryRuleByEnable(anyInt())).andReturn(rules);
- kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
- expect(kbuilder.getKnowledgePackages()).andReturn(new ArrayList<KnowledgePackage>());
- kbase.addKnowledgePackages(anyObject(Collection.class));
- expectLastCall().andThrow(new RuntimeException(""));
- PowerMock.replayAll();
-
- Method method = DroolsEngine.class.getDeclaredMethod("initDeployRule");
- method.setAccessible(true);
- method.invoke(droolsEngine);
-
- PowerMock.verifyAll();
- }
- @Test
- public void initDeployRule_normal() throws Exception {
- List<CorrelationRule> rules = new ArrayList<CorrelationRule>();
- CorrelationRule rule = new CorrelationRule();
- rule.setContent("content");
- rules.add(rule);
+ expect(mqConfigProvider.get()).andReturn(mqConfig).anyTimes();
expect(ruleMgtWrapper.queryRuleByEnable(anyInt())).andReturn(rules);
- kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
- expect(kbuilder.getKnowledgePackages()).andReturn(new ArrayList<KnowledgePackage>());
- kbase.addKnowledgePackages(anyObject(Collection.class));
- expect(ksession.fireAllRules()).andReturn(1);
PowerMock.replayAll();
- Method method = DroolsEngine.class.getDeclaredMethod("initDeployRule");
+ Method method = DroolsEngine.class.getDeclaredMethod("init");
method.setAccessible(true);
method.invoke(droolsEngine);
@@ -159,7 +134,7 @@ public class DroolsEngineTest {
}
@Test
- public void deployRule_rull_is_null() throws CorrelationException {
+ public void deployRule_rule_is_null() throws CorrelationException {
Locale locale = PowerMock.createMock(Locale.class);
thrown.expect(NullPointerException.class);
@@ -179,8 +154,11 @@ public class DroolsEngineTest {
kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
expect(kbuilder.hasErrors()).andReturn(true);
expect(kbuilder.getErrors()).andReturn(errors);
+
PowerMock.replayAll();
+
droolsEngine.deployRule(rule, locale);
+
PowerMock.verifyAll();
}
@@ -203,8 +181,11 @@ public class DroolsEngineTest {
expect(builderColl.iterator()).andReturn(iterator);
expect(iterator.next()).andReturn(kPackage);
expect(kbase.getKnowledgePackages()).andReturn(baseColl);
+
PowerMock.replayAll();
+
droolsEngine.deployRule(rule, locale);
+
PowerMock.verifyAll();
}
@@ -228,8 +209,11 @@ public class DroolsEngineTest {
expect(kbase.getKnowledgePackages()).andReturn(baseColl);
kbase.addKnowledgePackages(anyObject(Collection.class));
EasyMock.expectLastCall().andThrow(new RuntimeException(""));
+
PowerMock.replayAll();
+
droolsEngine.deployRule(rule, locale);
+
PowerMock.verifyAll();
}
@@ -255,9 +239,12 @@ public class DroolsEngineTest {
expect(kPackage.getName()).andReturn(pkgName);
PowerMock.replayAll();
+
String resultPkgName = droolsEngine.deployRule(rule, locale);
- PowerMock.verifyAll();
Assert.assertThat(resultPkgName, IsEqual.equalTo(pkgName));
+
+ PowerMock.verifyAll();
+
}
@Test
@@ -268,8 +255,11 @@ public class DroolsEngineTest {
thrown.expect(CorrelationException.class);
expect(kbase.getKnowledgePackage(anyObject(String.class))).andReturn(null);
+
PowerMock.replayAll();
- droolsEngine.undeployRule(packageName,locale);
+
+ droolsEngine.undeployRule(packageName, locale);
+
PowerMock.verifyAll();
}
@@ -285,8 +275,11 @@ public class DroolsEngineTest {
expect(pkg.getName()).andReturn("");
kbase.removeKnowledgePackage(anyObject(String.class));
EasyMock.expectLastCall().andThrow(new RuntimeException(""));
+
PowerMock.replayAll();
- droolsEngine.undeployRule(packageName,locale);
+
+ droolsEngine.undeployRule(packageName, locale);
+
PowerMock.verifyAll();
}
@@ -299,8 +292,11 @@ public class DroolsEngineTest {
expect(kbase.getKnowledgePackage(anyObject(String.class))).andReturn(pkg);
expect(pkg.getName()).andReturn("");
kbase.removeKnowledgePackage(anyObject(String.class));
+
PowerMock.replayAll();
- droolsEngine.undeployRule(packageName,locale);
+
+ droolsEngine.undeployRule(packageName, locale);
+
PowerMock.verifyAll();
}
@@ -315,8 +311,11 @@ public class DroolsEngineTest {
kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
expect(kbuilder.hasErrors()).andReturn(true);
expect(kbuilder.getErrors()).andReturn(errors);
+
PowerMock.replayAll();
- droolsEngine.compileRule(content,locale);
+
+ droolsEngine.compileRule(content, locale);
+
PowerMock.verifyAll();
}
@@ -327,33 +326,39 @@ public class DroolsEngineTest {
kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
expect(kbuilder.hasErrors()).andReturn(false);
+
PowerMock.replayAll();
- droolsEngine.compileRule(content,locale);
+
+ droolsEngine.compileRule(content, locale);
+
PowerMock.verifyAll();
}
@Test
public void putRaisedIntoStream_facthandle_is_null() {
- Alarm raiseAlarm = new Alarm();
-
expect(ksession.getFactHandle(anyObject(Alarm.class))).andReturn(null);
expect(ksession.insert(anyObject(Alarm.class))).andReturn(null);
expect(ksession.fireAllRules()).andReturn(0);
+
PowerMock.replayAll();
- droolsEngine.putRaisedIntoStream(raiseAlarm);
+
+ droolsEngine.putRaisedIntoStream(new Alarm());
+
PowerMock.verifyAll();
}
@Test
public void putRaisedIntoStream_factHandle_is_not_null() {
- Alarm raiseAlarm = new Alarm();
FactHandle factHandle = PowerMock.createMock(FactHandle.class);
expect(ksession.getFactHandle(anyObject(Alarm.class))).andReturn(factHandle);
ksession.retract(anyObject(FactHandle.class));
expect(ksession.insert(anyObject(Alarm.class))).andReturn(null);
expect(ksession.fireAllRules()).andReturn(0);
+
PowerMock.replayAll();
- droolsEngine.putRaisedIntoStream(raiseAlarm);
+
+ droolsEngine.putRaisedIntoStream(new Alarm());
+
PowerMock.verifyAll();
}
@@ -374,7 +379,9 @@ public class DroolsEngineTest {
expect(messageConsumer.receive(anyLong())).andReturn(null);
PowerMock.replayAll();
+
listener.run();
+
PowerMock.verifyAll();
}
@@ -387,7 +394,6 @@ public class DroolsEngineTest {
Destination destination = PowerMock.createMock(Topic.class);
MessageConsumer messageConsumer = PowerMock.createMock(MessageConsumer.class);
ObjectMessage objMessage = PowerMock.createMock(ObjectMessage.class);
- Alarm raiseAlarm = new Alarm();
FactHandle factHandle = PowerMock.createMock(FactHandle.class);
@@ -397,7 +403,7 @@ public class DroolsEngineTest {
expect(session.createTopic(anyObject(String.class))).andReturn((Topic) destination);
expect(session.createConsumer(anyObject(Destination.class))).andReturn(messageConsumer);
expect(messageConsumer.receive(anyLong())).andReturn(objMessage);
- expect(objMessage.getObject()).andReturn(raiseAlarm);
+ expect(objMessage.getObject()).andReturn(new Alarm());
expect(ksession.getFactHandle(anyObject(Alarm.class))).andReturn(factHandle);
ksession.retract(anyObject(FactHandle.class));
@@ -407,15 +413,14 @@ public class DroolsEngineTest {
expect(messageConsumer.receive(anyLong())).andReturn(null);
PowerMock.replayAll();
+
listener.run();
+
PowerMock.verifyAll();
}
@Test
public void stop() throws Exception {
- ksession.dispose();
- PowerMock.replayAll();
droolsEngine.stop();
- PowerMock.verifyAll();
}
}
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/request/CompileRuleRequestTest.java b/engine-d/src/test/java/org/openo/holmes/engine/request/CompileRuleRequestTest.java
index dfb49b9..e1baae7 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/request/CompileRuleRequestTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/request/CompileRuleRequestTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.request;
import org.junit.Test;
@@ -20,9 +21,6 @@ import org.junit.Test;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class CompileRuleRequestTest {
@Test
public void getterAndSetter4Content(){
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/request/DeployRuleRequestTest.java b/engine-d/src/test/java/org/openo/holmes/engine/request/DeployRuleRequestTest.java
index 131330e..1f9b12f 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/request/DeployRuleRequestTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/request/DeployRuleRequestTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.request;
import org.junit.Test;
@@ -20,9 +21,6 @@ import org.junit.Test;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class DeployRuleRequestTest {
@Test
public void getterAndSetter4Content(){
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/resources/EngineResourcesTest.java b/engine-d/src/test/java/org/openo/holmes/engine/resources/EngineResourcesTest.java
index 2a40336..51f46a6 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/resources/EngineResourcesTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/resources/EngineResourcesTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.resources;
import org.junit.Before;
@@ -32,9 +33,6 @@ import java.util.Locale;
import static org.easymock.EasyMock.*;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class EngineResourcesTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/response/CorrelationRuleResponseTest.java b/engine-d/src/test/java/org/openo/holmes/engine/response/CorrelationRuleResponseTest.java
index 45cd19b..f8899e6 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/response/CorrelationRuleResponseTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/response/CorrelationRuleResponseTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.response;
import org.junit.Test;
@@ -21,9 +22,6 @@ import org.openo.holmes.engine.request.DeployRuleRequest;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class CorrelationRuleResponseTest {
@Test
public void getterAndSetter4RuleId(){
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/utils/AlarmUtilTest.java b/engine-d/src/test/java/org/openo/holmes/engine/utils/AlarmUtilTest.java
index d5ef771..107d6e9 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/utils/AlarmUtilTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/utils/AlarmUtilTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.utils;
import org.hamcrest.core.IsEqual;
@@ -28,9 +29,6 @@ import org.powermock.reflect.Whitebox;
import java.util.HashMap;
import java.util.Map;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class AlarmUtilTest {
private AlarmUtil alarmUtil;
private final Map<String, Map<String, Integer>> rootPriorityMap = new HashMap<String, Map<String, Integer>>();
diff --git a/engine-d/src/test/java/org/openo/holmes/engine/wrapper/RuleMgtWrapperTest.java b/engine-d/src/test/java/org/openo/holmes/engine/wrapper/RuleMgtWrapperTest.java
index e8c2e7e..75c4a20 100644
--- a/engine-d/src/test/java/org/openo/holmes/engine/wrapper/RuleMgtWrapperTest.java
+++ b/engine-d/src/test/java/org/openo/holmes/engine/wrapper/RuleMgtWrapperTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openo.holmes.engine.wrapper;
import org.junit.Before;
@@ -30,10 +31,8 @@ import java.util.ArrayList;
import static org.easymock.EasyMock.*;
-/**
- * Created by Administrator on 2017/2/20.
- */
public class RuleMgtWrapperTest {
+
@Rule
public ExpectedException thrown = ExpectedException.none();
private DbDaoUtil daoUtil;
@@ -44,7 +43,7 @@ public class RuleMgtWrapperTest {
daoUtil = PowerMock.createMock(DbDaoUtil.class);
ruleMgtWrapper = new RuleMgtWrapper();
- Whitebox.setInternalState(ruleMgtWrapper,"daoUtil",daoUtil);
+ Whitebox.setInternalState(ruleMgtWrapper, "daoUtil", daoUtil);
PowerMock.resetAll();
}