From 51e4c57db505195b9f4f1b4c45f6f68977986331 Mon Sep 17 00:00:00 2001 From: 6092002067 Date: Wed, 8 Mar 2017 17:44:56 +0800 Subject: Add msb register code Issue-ID:HOLMES-50 Change-Id: I854c07b552dddba14b317b41b16d6e198b23e32d Signed-off-by: youbowu --- .../java/org/openo/holmes/rulemgt/RuleAppConfigTest.java | 7 ------- .../holmes/rulemgt/bolt/enginebolt/EngineServiceTest.java | 14 ++++++++++---- .../holmes/rulemgt/bolt/enginebolt/EngineWrapperTest.java | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'rulemgt/src/test/java/org/openo') 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); -- cgit 1.2.3-korg