diff options
Diffstat (limited to 'engine-d/src/test')
4 files changed, 18 insertions, 15 deletions
diff --git a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java index 85e3083..3b46fed 100644 --- a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java +++ b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java @@ -15,14 +15,12 @@ */ package org.onap.holmes.dsa.dmaappolling; -import com.alibaba.fastjson.JSONException; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.holmes.common.api.stat.AlarmAdditionalField; import org.onap.holmes.common.api.stat.VesAlarm; -import org.onap.holmes.dsa.dmaappolling.DMaaPResponseUtil; import org.powermock.core.classloader.annotations.PrepareForTest; import java.io.IOException; @@ -164,7 +162,7 @@ public class DMaaPResponseUtilTest { @Test public void testDMaaPResponseUtil_input_illegal() throws Exception { String json = "***"; - thrown.expect(JSONException.class); + thrown.expect(Exception.class); dMaaPResponseUtil.convertJsonToVesAlarm(json); } @@ -302,6 +300,10 @@ public class DMaaPResponseUtilTest { List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); AlarmAdditionalField alarmAdditionalField = new AlarmAdditionalField(); + alarmAdditionalField.setName(null); + alarmAdditionalField.setValue("1111"); + alarmAdditionalFields.add(alarmAdditionalField); + alarmAdditionalField = new AlarmAdditionalField(); alarmAdditionalField.setName("tian"); alarmAdditionalField.setValue("22222"); alarmAdditionalFields.add(alarmAdditionalField); diff --git a/engine-d/src/test/java/org/onap/holmes/engine/manager/DroolsEngineTest.java b/engine-d/src/test/java/org/onap/holmes/engine/manager/DroolsEngineTest.java index 8da4910..f7b7fbd 100644 --- a/engine-d/src/test/java/org/onap/holmes/engine/manager/DroolsEngineTest.java +++ b/engine-d/src/test/java/org/onap/holmes/engine/manager/DroolsEngineTest.java @@ -23,6 +23,7 @@ import org.junit.rules.ExpectedException; import org.onap.holmes.common.api.entity.AlarmInfo;
import org.onap.holmes.common.api.entity.CorrelationRule;
import org.onap.holmes.common.api.stat.VesAlarm;
+import org.onap.holmes.common.dmaap.store.ClosedLoopControlNameCache;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.utils.DbDaoUtil;
import org.onap.holmes.engine.db.AlarmInfoDao;
@@ -47,18 +48,21 @@ public class DroolsEngineTest { private RuleMgtWrapper ruleMgtWrapper;
- private AlarmInfoDao alarmInfoDaoMock;
-
private DroolsEngine droolsEngine;
private DbDaoUtil dbDaoUtilStub;
+ private ClosedLoopControlNameCache closedLoopControlNameCache;
+
public DroolsEngineTest() throws Exception {
droolsEngine = new DroolsEngine();
ruleMgtWrapper = new RuleMgtWrapperStub();
dbDaoUtilStub = new DbDaoUtilStub();
- Whitebox.setInternalState(droolsEngine, "daoUtil", dbDaoUtilStub);
- Whitebox.setInternalState(droolsEngine, "ruleMgtWrapper", ruleMgtWrapper);
+ closedLoopControlNameCache = new ClosedLoopControlNameCache();
+ droolsEngine.setClosedLoopControlNameCache(closedLoopControlNameCache);
+ droolsEngine.setDaoUtil(dbDaoUtilStub);
+ droolsEngine.setRuleMgtWrapper(ruleMgtWrapper);
+
Whitebox.invokeMethod(droolsEngine, "init");
}
diff --git a/engine-d/src/test/java/org/onap/holmes/engine/resources/EngineResourcesTest.java b/engine-d/src/test/java/org/onap/holmes/engine/resources/EngineResourcesTest.java index a09eb3a..aa2052d 100644 --- a/engine-d/src/test/java/org/onap/holmes/engine/resources/EngineResourcesTest.java +++ b/engine-d/src/test/java/org/onap/holmes/engine/resources/EngineResourcesTest.java @@ -20,6 +20,7 @@ import org.junit.Before; import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onap.holmes.common.dmaap.store.ClosedLoopControlNameCache;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.engine.manager.DroolsEngine;
import org.onap.holmes.engine.request.CompileRuleRequest;
@@ -36,13 +37,16 @@ import static org.easymock.EasyMock.*; public class EngineResourcesTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- DroolsEngine droolsEngine;
+ private DroolsEngine droolsEngine;
private EngineResources engineResources;
+ private ClosedLoopControlNameCache closedLoopControlNameCache;
@Before
public void setUp() {
droolsEngine = PowerMock.createMock(DroolsEngine.class);
+ closedLoopControlNameCache = new ClosedLoopControlNameCache();
engineResources = new EngineResources();
+ engineResources.setClosedLoopControlNameCache(closedLoopControlNameCache);
Whitebox.setInternalState(engineResources,"droolsEngine", droolsEngine);
PowerMock.resetAll();
diff --git a/engine-d/src/test/java/org/onap/holmes/engine/utils/AlarmUtilTest.java b/engine-d/src/test/java/org/onap/holmes/engine/utils/AlarmUtilTest.java index 97330a7..080ad2b 100644 --- a/engine-d/src/test/java/org/onap/holmes/engine/utils/AlarmUtilTest.java +++ b/engine-d/src/test/java/org/onap/holmes/engine/utils/AlarmUtilTest.java @@ -22,7 +22,6 @@ import org.junit.Assert; import org.junit.Before;
import org.junit.Test;
import org.onap.holmes.common.api.stat.Alarm;
-import org.onap.holmes.common.producer.MQProducer;
import org.powermock.api.easymock.PowerMock;
import org.powermock.reflect.Whitebox;
@@ -127,10 +126,4 @@ public class AlarmUtilTest { Integer priority = alarmUtil.getPriority(ruleId, probableCauseStr, rootAlarmFeatureStr, equipTypeStr, alarm);
Assert.assertThat(priority,IsEqual.equalTo(1));
}
-
- @Test
- public void getMqProducer() {
- MQProducer mqProducer = alarmUtil.getMqProducer();
- Assert.assertThat(mqProducer, IsNull.<MQProducer>notNullValue());
- }
}
|