1 package org.opendaylight.openflowplugin.impl.statistics.ofpspecific;
3 import static org.junit.Assert.assertTrue;
7 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
10 public class MessageIntelligenceAgencyImplTest {
13 public void testMessageIntelligenceAgency() {
14 final MessageIntelligenceAgencyImpl messageIntelligenceAgency = new MessageIntelligenceAgencyImpl();
15 messageIntelligenceAgency.spyMessage(String.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH);
16 messageIntelligenceAgency.spyMessage(Integer.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENTERED);
17 final List<String> intelligence = messageIntelligenceAgency.provideIntelligence();
18 findExpectedStatistics(intelligence, "FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1");
21 private void findExpectedStatistics(final List<String> statisticsInfo, String ... expectedValues) {
22 for (String expectedValue : expectedValues) {
23 assertTrue("Expected value " + expectedValue + "wasn't found.", findValueInStatistics(statisticsInfo, expectedValue));
27 private boolean findValueInStatistics(List<String> statisticsInfo, String expectedValue) {
28 for (String pieceOfInfo : statisticsInfo) {
29 if (pieceOfInfo.equals(expectedValue)) {