summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/test
diff options
context:
space:
mode:
authoryoubowu <wu.youbo@zte.com.cn>2017-02-27 16:37:17 +0800
committer6092002067 <wu.youbo@zte.com.cn>2017-02-27 16:37:17 +0800
commitb89572c4c6963ca3d6707e4a21e436bd2309f8ee (patch)
tree4d0fc553037329f245cdf02133e74047d7b4f302 /rulemgt/src/test
parent3e1081668fbff463553e7b742f120954ac60210b (diff)
Fix the sonar detected error
Issue-ID:HOLMES-50 Change-Id: Ia43c44cf70f6a0ac99592e4e302fda5f123cfc4f Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'rulemgt/src/test')
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java37
1 files changed, 31 insertions, 6 deletions
diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java
index d911f9c..596a408 100644
--- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java
+++ b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java
@@ -18,15 +18,15 @@
package org.openo.holmes.rulemgt.bolt.enginebolt;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.openo.holmes.rulemgt.RuleAppConfig;
+import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
+import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
import org.powermock.api.easymock.PowerMock;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.powermock.reflect.Whitebox;
@@ -38,18 +38,18 @@ public class EngineServiceTest {
@Rule
public PowerMockRule powerMockRule = new PowerMockRule();
private EngineService engineService;
- private HttpEntity httpEntityMock;
private HttpResponse httpResponseMock;
- private HttpClient httpClient;
private RuleAppConfig ruleAppConfig = new RuleAppConfig();
+ private CorrelationDeployRule4Engine correlationDeployRule4Engine;
@Before
public void setUp() {
engineService = new EngineService();
- httpEntityMock = PowerMock.createMock(HttpEntity.class);
httpResponseMock = PowerMock.createMock(HttpResponse.class);
- httpClient = PowerMock.createMock(HttpClient.class);
Whitebox.setInternalState(engineService, "ruleAppConfig", ruleAppConfig);
+ correlationDeployRule4Engine = new CorrelationDeployRule4Engine();
+ correlationDeployRule4Engine.setContent("{\"package\":\"test\"}");
+ correlationDeployRule4Engine.setEngineId("engine_id");
}
@Test
@@ -61,4 +61,29 @@ public class EngineServiceTest {
PowerMock.verifyAll();
}
+
+ @Test
+ public void delete_exception() throws Exception {
+ thrown.expect(Exception.class);
+
+ engineService.delete("test");
+
+ }
+
+ @Test
+ public void deploy_exception() throws Exception {
+
+ thrown.expect(Exception.class);
+
+ engineService.deploy(correlationDeployRule4Engine);
+
+ }
+
+ @Test
+ public void check_normal() throws Exception {
+ thrown.expect(Exception.class);
+
+ engineService.check(new CorrelationCheckRule4Engine());
+
+ }
} \ No newline at end of file