summaryrefslogtreecommitdiffstats
path: root/engine-d/src/test
diff options
context:
space:
mode:
authorGuangrongFu <fu.guangrong@zte.com.cn>2020-07-27 19:34:57 +0800
committerGuangrongFu <fu.guangrong@zte.com.cn>2020-07-27 20:17:58 +0800
commitc4dc95bc729afd91c00cab49d0a69bceb102eed9 (patch)
treee570f534ae4c4524c4398ffc705eee69e578cd26 /engine-d/src/test
parenteadc4de80148f3457e75b06270370a33dc4751a4 (diff)
Trying to fix the Jenkins Job
Issue-ID: HOLMES-332 Change-Id: I3605ac6850226dc365460911c4e523f62ea117fc Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'engine-d/src/test')
-rw-r--r--engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java8
-rw-r--r--engine-d/src/test/java/org/onap/holmes/engine/manager/DroolsEngineTest.java12
-rw-r--r--engine-d/src/test/java/org/onap/holmes/engine/resources/EngineResourcesTest.java6
-rw-r--r--engine-d/src/test/java/org/onap/holmes/engine/utils/AlarmUtilTest.java7
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());
- }
}