diff options
author | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-14 17:11:36 +0800 |
---|---|---|
committer | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-14 17:15:37 +0800 |
commit | e16b222eaaf94b75d669863f93ab48c509eae7ad (patch) | |
tree | 989600ed6925a8e64b25631b5d28c330fd50e5ed /engine-d/src/test/java/org/openo | |
parent | fb73c92232ed387c64b1a175504d605797a6f505 (diff) |
Fix the rule engine not reset the fault
Issue-ID: HOLMES-47
Change-Id: I24a4c78d4fbddb1e5602fde0ac13a881d9e055ac
Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'engine-d/src/test/java/org/openo')
-rw-r--r-- | engine-d/src/test/java/org/openo/holmes/engine/manager/DroolsEngineTest.java | 51 |
1 files changed, 0 insertions, 51 deletions
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 0f637c7..44de609 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 @@ -18,7 +18,6 @@ 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;
@@ -33,7 +32,6 @@ 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.apache.activemq.command.ActiveMQObjectMessage;
@@ -48,8 +46,6 @@ import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.rule.FactHandle;
import org.easymock.EasyMock;
import org.glassfish.hk2.api.IterableProvider;
-import org.hamcrest.core.IsEqual;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -219,36 +215,6 @@ public class DroolsEngineTest { }
@Test
- public void deployRule_normal() throws CorrelationException {
- DeployRuleRequest rule = PowerMock.createMock(DeployRuleRequest.class);
- Locale locale = PowerMock.createMock(Locale.class);
-
- final String pkgName = "pkgName";
- KnowledgePackage kPackage = PowerMock.createMock(KnowledgePackage.class);
- Collection<KnowledgePackage> builderColl = PowerMock.createMock(Collection.class);
- Iterator<KnowledgePackage> iterator = PowerMock.createMock(Iterator.class);
- Collection<KnowledgePackage> baseColl = new ArrayList<KnowledgePackage>();
- expect(rule.getContent()).andReturn("rule");
- expect(kbuilder.hasErrors()).andReturn(false);
- kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
- expect(kbuilder.getKnowledgePackages()).andReturn(builderColl).times(2);
- expect(builderColl.iterator()).andReturn(iterator);
- expect(iterator.next()).andReturn(kPackage);
- expect(kbase.getKnowledgePackages()).andReturn(baseColl);
- kbase.addKnowledgePackages(anyObject(Collection.class));
- expect(ksession.fireAllRules()).andReturn(1);
- expect(kPackage.getName()).andReturn(pkgName);
-
- PowerMock.replayAll();
-
- String resultPkgName = droolsEngine.deployRule(rule, locale);
- Assert.assertThat(resultPkgName, IsEqual.equalTo(pkgName));
-
- PowerMock.verifyAll();
-
- }
-
- @Test
public void undeployRule_knowledgepackage_is_null() throws CorrelationException {
String packageName = "packageName";
Locale locale = PowerMock.createMock(Locale.class);
@@ -321,21 +287,6 @@ public class DroolsEngineTest { }
@Test
- public void compileRule_normal() throws CorrelationException {
- String content = "content";
- Locale locale = PowerMock.createMock(Locale.class);
-
- kbuilder.add(anyObject(Resource.class), anyObject(ResourceType.class));
- expect(kbuilder.hasErrors()).andReturn(false);
-
- PowerMock.replayAll();
-
- droolsEngine.compileRule(content, locale);
-
- PowerMock.verifyAll();
- }
-
- @Test
public void putRaisedIntoStream_facthandle_is_null() {
expect(ksession.getFactHandle(anyObject(Alarm.class))).andReturn(null);
expect(ksession.insert(anyObject(Alarm.class))).andReturn(null);
@@ -422,7 +373,6 @@ public class DroolsEngineTest { session.close();
connection.close();
-
PowerMock.replayAll();
listener.receive();
@@ -457,7 +407,6 @@ public class DroolsEngineTest { consumer.close();
EasyMock.expectLastCall().andThrow(new JMSException(""));
-
PowerMock.replayAll();
listener.receive();
|