// Path: src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java
// public class FloodlightModuleContext implements IFloodlightModuleContext {
//     protected Map<Class<? extends IFloodlightService>, IFloodlightService> serviceMap;
//     protected Map<Class<? extends IFloodlightModule>, Map<String, String>> configParams;
//     protected Collection<IFloodlightModule> moduleSet;
//     
//     /**
//      * Creates the ModuleContext for use with this IFloodlightProvider.
//      * This will be used as a module registry for all IFloodlightModule(s).
//      */
//     public FloodlightModuleContext() {
//         serviceMap = 
//                 new HashMap<Class<? extends IFloodlightService>,
//                                       IFloodlightService>();
//         configParams =
//                 new HashMap<Class<? extends IFloodlightModule>,
//                                 Map<String, String>>();
//     }
//     
//     /**
//      * Adds a IFloodlightModule for this Context.
//      * @param clazz the service class
//      * @param service The IFloodlightService to add to the registry
//      */
//     public void addService(Class<? extends IFloodlightService> clazz, 
//                            IFloodlightService service) {
//         serviceMap.put(clazz, service);
//     }
//     
//     @SuppressWarnings("unchecked")
//     @Override
//     public <T extends IFloodlightService> T getServiceImpl(Class<T> service) {
//         IFloodlightService s = serviceMap.get(service);
//         return (T)s;
//     }
//     
//     @Override
//     public Collection<Class<? extends IFloodlightService>> getAllServices() {
//         return serviceMap.keySet();
//     }
//     
//     @Override
//     public Collection<IFloodlightModule> getAllModules() {
//         return moduleSet;
//     }
//     
//     public void setModuleSet(Collection<IFloodlightModule> modSet) {
//         this.moduleSet = modSet;
//     }
// 
//     @Override
//     public Map<String, String> getConfigParams(IFloodlightModule module) {
//         Class<? extends IFloodlightModule> clazz = module.getClass();
//         return getConfigParams(clazz);
//     }
// 
//     @Override
//     public Map<String, String> getConfigParams(Class<? extends IFloodlightModule> clazz) {
//         Map<String, String> retMap = configParams.get(clazz);
//         if (retMap == null) {
//             // Return an empty map if none exists so the module does not
//             // need to null check the map
//             retMap = new HashMap<String, String>();
//             configParams.put(clazz, retMap);
//         }
// 
//         // also add any configuration parameters for superclasses, but
//         // only if more specific configuration does not override it
//         for (Class<? extends IFloodlightModule> c : configParams.keySet()) {
//             if (c.isAssignableFrom(clazz)) {
//                 for (Map.Entry<String, String> ent : configParams.get(c).entrySet()) {
//                     if (!retMap.containsKey(ent.getKey())) {
//                         retMap.put(ent.getKey(), ent.getValue());
//                     }
//                 }
//             }
//         }
// 
//         return retMap;
//     }
//     
//     /**
//      * Adds a configuration parameter for a module
//      * @param mod The fully qualified module name to add the parameter to
//      * @param key The configuration parameter key
//      * @param value The configuration parameter value
//      */
//     public void addConfigParam(IFloodlightModule mod, String key, String value) {
//         Map<String, String> moduleParams = configParams.get(mod.getClass());
//         if (moduleParams == null) {
//             moduleParams = new HashMap<String, String>();
//             configParams.put(mod.getClass(), moduleParams);
//         }
//         moduleParams.put(key, value);
//     }
//  }


import static org.easymock.EasyMock.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.ListIterator;
import net.floodlightcontroller.core.IListener.Command;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.counter.SimpleCounter;
import net.floodlightcontroller.counter.CounterValue.CounterType;
import net.floodlightcontroller.flowcache.IFlowReconcileListener;
import net.floodlightcontroller.flowcache.OFMatchReconcile;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import org.easymock.EasyMock;
import org.easymock.IAnswer;
import org.junit.Before;
import org.junit.Test;
import org.openflow.protocol.OFStatisticsRequest;
import org.openflow.protocol.OFType;
/**
 *    Copyright 2013, Big Switch Networks, Inc.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may
 *    not use this file except in compliance with the License. You may obtain
 *    a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *    License for the specific language governing permissions and limitations
 *    under the License.
 **/

package net.floodlightcontroller.flowcache;





public class FlowReconcileMgrTest extends FloodlightTestCase {

    protected FlowReconcileManager flowReconcileMgr;
    protected MockThreadPoolService threadPool;
    protected ICounterStoreService counterStore;
    protected FloodlightModuleContext fmc;
    
    OFStatisticsRequest ofStatsRequest;

    protected int NUM_FLOWS_PER_THREAD = 100;
    protected int NUM_THREADS = 20;
    
    @Before
    public void setUp() throws Exception {
        super.setUp();

// Path: src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java
// public class FloodlightModuleContext implements IFloodlightModuleContext {
//     protected Map<Class<? extends IFloodlightService>, IFloodlightService> serviceMap;
//     protected Map<Class<? extends IFloodlightModule>, Map<String, String>> configParams;
//     protected Collection<IFloodlightModule> moduleSet;
//     
//     /**
//      * Creates the ModuleContext for use with this IFloodlightProvider.
//      * This will be used as a module registry for all IFloodlightModule(s).
//      */
//     public FloodlightModuleContext() {
//         serviceMap = 
//                 new HashMap<Class<? extends IFloodlightService>,
//                                       IFloodlightService>();
//         configParams =
//                 new HashMap<Class<? extends IFloodlightModule>,
//                                 Map<String, String>>();
//     }
//     
//     /**
//      * Adds a IFloodlightModule for this Context.
//      * @param clazz the service class
//      * @param service The IFloodlightService to add to the registry
//      */
//     public void addService(Class<? extends IFloodlightService> clazz, 
//                            IFloodlightService service) {
//         serviceMap.put(clazz, service);
//     }
//     
//     @SuppressWarnings("unchecked")
//     @Override
//     public <T extends IFloodlightService> T getServiceImpl(Class<T> service) {
//         IFloodlightService s = serviceMap.get(service);
//         return (T)s;
//     }
//     
//     @Override
//     public Collection<Class<? extends IFloodlightService>> getAllServices() {
//         return serviceMap.keySet();
//     }
//     
//     @Override
//     public Collection<IFloodlightModule> getAllModules() {
//         return moduleSet;
//     }
//     
//     public void setModuleSet(Collection<IFloodlightModule> modSet) {
//         this.moduleSet = modSet;
//     }
// 
//     @Override
//     public Map<String, String> getConfigParams(IFloodlightModule module) {
//         Class<? extends IFloodlightModule> clazz = module.getClass();
//         return getConfigParams(clazz);
//     }
// 
//     @Override
//     public Map<String, String> getConfigParams(Class<? extends IFloodlightModule> clazz) {
//         Map<String, String> retMap = configParams.get(clazz);
//         if (retMap == null) {
//             // Return an empty map if none exists so the module does not
//             // need to null check the map
//             retMap = new HashMap<String, String>();
//             configParams.put(clazz, retMap);
//         }
// 
//         // also add any configuration parameters for superclasses, but
//         // only if more specific configuration does not override it
//         for (Class<? extends IFloodlightModule> c : configParams.keySet()) {
//             if (c.isAssignableFrom(clazz)) {
//                 for (Map.Entry<String, String> ent : configParams.get(c).entrySet()) {
//                     if (!retMap.containsKey(ent.getKey())) {
//                         retMap.put(ent.getKey(), ent.getValue());
//                     }
//                 }
//             }
//         }
// 
//         return retMap;
//     }
//     
//     /**
//      * Adds a configuration parameter for a module
//      * @param mod The fully qualified module name to add the parameter to
//      * @param key The configuration parameter key
//      * @param value The configuration parameter value
//      */
//     public void addConfigParam(IFloodlightModule mod, String key, String value) {
//         Map<String, String> moduleParams = configParams.get(mod.getClass());
//         if (moduleParams == null) {
//             moduleParams = new HashMap<String, String>();
//             configParams.put(mod.getClass(), moduleParams);
//         }
//         moduleParams.put(key, value);
//     }
//  }


// Path: src/test/java/net/floodlightcontroller/flowcache/FlowReconcileMgrTest.java
import static org.easymock.EasyMock.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.ListIterator;
import net.floodlightcontroller.core.IListener.Command;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
import net.floodlightcontroller.counter.ICounterStoreService;
import net.floodlightcontroller.counter.SimpleCounter;
import net.floodlightcontroller.counter.CounterValue.CounterType;
import net.floodlightcontroller.flowcache.IFlowReconcileListener;
import net.floodlightcontroller.flowcache.OFMatchReconcile;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import org.easymock.EasyMock;
import org.easymock.IAnswer;
import org.junit.Before;
import org.junit.Test;
import org.openflow.protocol.OFStatisticsRequest;
import org.openflow.protocol.OFType;

/**
 *    Copyright 2013, Big Switch Networks, Inc.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may
 *    not use this file except in compliance with the License. You may obtain
 *    a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *    License for the specific language governing permissions and limitations
 *    under the License.
 **/

package net.floodlightcontroller.flowcache;





public class FlowReconcileMgrTest extends FloodlightTestCase {

    protected FlowReconcileManager flowReconcileMgr;
    protected MockThreadPoolService threadPool;
    protected ICounterStoreService counterStore;
    protected FloodlightModuleContext fmc;
    
    OFStatisticsRequest ofStatsRequest;

    protected int NUM_FLOWS_PER_THREAD = 100;
    protected int NUM_THREADS = 20;
    
    @Before
    public void setUp() throws Exception {
        super.setUp();

        fmc = new FloodlightModuleContext();