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