diff options
author | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-08 17:44:56 +0800 |
---|---|---|
committer | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-09 10:40:20 +0800 |
commit | 51e4c57db505195b9f4f1b4c45f6f68977986331 (patch) | |
tree | f578e181b7cdb9c7f0b53e502432c1de90de9d87 /rulemgt/src/test/java | |
parent | 00fb528d6e90ccecc898db11ff1a1b485771ffcb (diff) |
Add msb register code
Issue-ID:HOLMES-50
Change-Id: I854c07b552dddba14b317b41b16d6e198b23e32d
Signed-off-by: youbowu <wu.youbo@zte.com.cn>
Diffstat (limited to 'rulemgt/src/test/java')
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);
|