summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/test/java/org/onap
diff options
context:
space:
mode:
authorShiwei Tian <tian.shiwei@zte.com.cn>2017-10-09 16:28:07 +0800
committerShiwei Tian <tian.shiwei@zte.com.cn>2017-10-09 16:28:07 +0800
commite5e0b7b09226751d4986b1080c2bdb76cde5df4d (patch)
tree949d0c46b89b0c981c24dba9af6500b8d7eb481e /rulemgt/src/test/java/org/onap
parent6fc2b33efaacc5cf64795d2d349fe0180cd8c1be (diff)
modify dace polling and loopControlName
Issue-ID: HOLMES-67 Change-Id: If538c63d4ab173bd4ea0aa0bb3af8afcce24a177 Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'rulemgt/src/test/java/org/onap')
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java (renamed from rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DaceConfigurationPollingTest.java)32
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java1
2 files changed, 9 insertions, 24 deletions
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DaceConfigurationPollingTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java
index b9d9abb..25e211a 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DaceConfigurationPollingTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java
@@ -21,10 +21,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.powermock.api.mockito.PowerMockito.when;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import java.util.ArrayList;
-import java.util.List;
import javax.ws.rs.ProcessingException;
import org.junit.Before;
import org.junit.Test;
@@ -36,26 +33,24 @@ import org.onap.holmes.common.dcae.entity.Rule;
import org.onap.holmes.common.dcae.utils.DcaeConfigurationParser;
import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
-import org.onap.holmes.rulemgt.bean.response.RuleQueryListResponse;
-import org.onap.holmes.rulemgt.bean.response.RuleResult4API;
import org.powermock.api.easymock.PowerMock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
-@PrepareForTest({DaceConfigurationPolling.class, MicroServiceConfig.class, ObjectMapper.class})
+@PrepareForTest({DcaeConfigurationPolling.class, MicroServiceConfig.class, ObjectMapper.class})
@RunWith(PowerMockRunner.class)
-public class DaceConfigurationPollingTest {
+public class DcaeConfigurationPollingTest {
@org.junit.Rule
public ExpectedException thrown = ExpectedException.none();
- private DaceConfigurationPolling daceConfigurationPolling;
+ private DcaeConfigurationPolling daceConfigurationPolling;
@Before
public void setUp() {
- daceConfigurationPolling = new DaceConfigurationPolling("holmes-rule-mgmt");
+ daceConfigurationPolling = new DcaeConfigurationPolling("holmes-rule-mgmt");
}
@Test
@@ -100,7 +95,7 @@ public class DaceConfigurationPollingTest {
PowerMock.resetAll();
thrown.expect(ProcessingException.class);
DcaeConfigurations dcaeConfigurations = new DcaeConfigurations();
- Rule rule = new Rule("test", "test", 1);
+ Rule rule = new Rule("test", "test", "tset",1);
dcaeConfigurations.getDefaultRules().add(rule);
PowerMock.replayAll();
@@ -112,27 +107,16 @@ public class DaceConfigurationPollingTest {
@Test
public void testDaceConfigurationPolling_getRuleCreateRequest() throws Exception {
PowerMock.resetAll();
- Rule rule = new Rule("test", "test1", 1);
+ Rule rule = new Rule("test", "test1", "stest",1);
PowerMock.replayAll();
RuleCreateRequest actual = Whitebox
.invokeMethod(daceConfigurationPolling, "getRuleCreateRequest", rule);
PowerMock.verifyAll();
assertThat(actual.getRuleName(), equalTo("test"));
- assertThat(actual.getContent(), equalTo("test1"));
+ assertThat(actual.getLoopControlName(), equalTo("test1"));
+ assertThat(actual.getContent(), equalTo("stest"));
assertThat(actual.getDescription(), equalTo(""));
assertThat(actual.getEnabled(), equalTo(1));
}
-
- @Test
- public void testDaceConfigurationPolling_run_null_exception() throws Exception {
- PowerMock.replayAll();
- PowerMockito.mockStatic(MicroServiceConfig.class);
- when(MicroServiceConfig.getServiceAddrInfoFromCBS("holmes-rule-mgmt"))
- .thenReturn("host");
- PowerMock.replayAll();
- Whitebox.invokeMethod(daceConfigurationPolling, "run");
- PowerMock.verifyAll();
- }
-
} \ No newline at end of file
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
index 1697bf4..9837fc5 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapperTest.java
@@ -159,6 +159,7 @@ public class RuleMgtWrapperTest {
RuleCreateRequest ruleCreateRequest = createRuleCreateRequest(ruleName, "This is a rule for testing.",
"Mocked contents.", 1);
+ ruleCreateRequest.setLoopControlName("loopName");
CorrelationRule correlationRuleRet = new CorrelationRule();
correlationRuleRet.setRid("rule_" + System.currentTimeMillis());