1 package org.opendaylight.openflowplugin.impl.statistics.ofpspecific;
3 import junit.framework.TestCase;
5 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
9 import static org.junit.Assert.assertTrue;
12 public class MessageIntelligenceAgencyImplTest {
15 public void testMessageIntelligenceAgency() {
16 final MessageIntelligenceAgencyImpl messageIntelligenceAgency = new MessageIntelligenceAgencyImpl();
17 messageIntelligenceAgency.spyMessage(String.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH);
18 messageIntelligenceAgency.spyMessage(Integer.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENTERED);
19 final List<String> intelligence = messageIntelligenceAgency.provideIntelligence();
20 findExpectedStatistics(intelligence, "FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1");
23 private void findExpectedStatistics(final List<String> statisticsInfo, String ... expectedValues) {
24 for (String expectedValue : expectedValues) {
25 assertTrue("Expected value " + expectedValue + "wasn't found.", findValueInStatistics(statisticsInfo, expectedValue));
29 private boolean findValueInStatistics(List<String> statisticsInfo, String expectedValue) {
30 for (String pieceOfInfo : statisticsInfo) {
31 if (pieceOfInfo.equals(expectedValue)) {