summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt/src/test/java')
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java7
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java14
-rw-r--r--rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java4
3 files changed, 12 insertions, 13 deletions
diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java b/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java
index e451410..d14e55e 100644
--- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java
+++ b/rulemgt/src/test/java/org/openo/holmes/rulemgt/RuleAppConfigTest.java
@@ -56,11 +56,4 @@ public class RuleAppConfigTest {
ruleAppConfig.setApidescription(value);
assertThat(ruleAppConfig.getApidescription(), equalTo(value));
}
-
- @Test
- public void getterAndSetter4MsbServerAddr() throws Exception {
- final String value = "msbServerAddr";
- ruleAppConfig.setMsbServerAddr(value);
- assertThat(ruleAppConfig.getMsbServerAddr(), equalTo(value));
- }
} \ No newline at end of file
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 596a408..3b1c9bd 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
@@ -19,18 +19,22 @@ package org.openo.holmes.rulemgt.bolt.enginebolt;
import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
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.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
-import org.powermock.reflect.Whitebox;
+@PrepareForTest({HttpClients.class, CloseableHttpClient.class})
public class EngineServiceTest {
@Rule
@@ -39,14 +43,16 @@ public class EngineServiceTest {
public PowerMockRule powerMockRule = new PowerMockRule();
private EngineService engineService;
private HttpResponse httpResponseMock;
- private RuleAppConfig ruleAppConfig = new RuleAppConfig();
+ private CloseableHttpClient closeableHttpClient;
private CorrelationDeployRule4Engine correlationDeployRule4Engine;
+ private CloseableHttpResponse closeableHttpResponseMock;
@Before
public void setUp() {
engineService = new EngineService();
+ closeableHttpClient = PowerMock.createMock(CloseableHttpClient.class);
httpResponseMock = PowerMock.createMock(HttpResponse.class);
- Whitebox.setInternalState(engineService, "ruleAppConfig", ruleAppConfig);
+ closeableHttpResponseMock = PowerMock.createMock(CloseableHttpResponse.class);
correlationDeployRule4Engine = new CorrelationDeployRule4Engine();
correlationDeployRule4Engine.setContent("{\"package\":\"test\"}");
correlationDeployRule4Engine.setEngineId("engine_id");
diff --git a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java
index f672415..8d25d6a 100644
--- a/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java
+++ b/rulemgt/src/test/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java
@@ -165,7 +165,7 @@ public class EngineWrapperTest {
}
@Test
- public void checkRuleFromEngine_invoke_rule_delete_exception() throws Exception {
+ public void checkRuleFromEngine_rule_delete_exception() throws Exception {
thrown.expect(CorrelationException.class);
thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED);
@@ -179,7 +179,7 @@ public class EngineWrapperTest {
}
@Test
- public void checkRuleFromEngine_http_status_not_ok() throws Exception {
+ public void checkRuleFromEngine_http_status_not_200() throws Exception {
thrown.expect(CorrelationException.class);
thrown.expectMessage(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS);