/*
 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.netvirt.aclservice.tests;

import com.google.inject.AbstractModule;
import com.mycila.guice.ext.closeable.CloseableModule;
import com.mycila.guice.ext.jsr250.Jsr250Module;
import org.opendaylight.netvirt.aclservice.AclServiceManagerImpl;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager;
import org.opendaylight.netvirt.aclservice.listeners.AclEventListener;
import org.opendaylight.netvirt.aclservice.listeners.AclInterfaceListener;
import org.opendaylight.netvirt.aclservice.listeners.AclInterfaceStateListener;
import org.opendaylight.netvirt.aclservice.listeners.AclNodeListener;

/**
 * Main (non-Test) Dependency Injection (DI) Wiring (currently through Guice).
 *
 * @author Michael Vorburger
 */
public class AclServiceModule extends AbstractModule {

    @Override
    protected void configure() {
        // This is needed so that @PostConstruct & @PreDestroy works
        //
        install(new CloseableModule());
        install(new Jsr250Module());

        // asEagerSingleton() is required here, because of ODL architecture:
        // These *Listener classes MUST be "eagerly" created, and not "lazily",
        // only if something needs them @Inject-ed (because nothing ever will;
        // they register themselves on the DataBroker in their @PostConstruct start).
        //
        bind(AclServiceManager.class).to(AclServiceManagerImpl.class).asEagerSingleton();
        bind(AclInterfaceStateListener.class).asEagerSingleton();
        bind(AclNodeListener.class).asEagerSingleton();
        bind(AclInterfaceListener.class).asEagerSingleton();
        bind(AclEventListener.class).asEagerSingleton();
    }

}

@@ -357,132 +357,72 @@
 ort 
-com.google.inject.AbstractModule;%0Aimport com.mycila.guice.ext.closeable.CloseableModule;%0Aimport com.mycila.guice.ext.jsr250.
+org.opendaylight.infrautils.inject.guice.testutils.AbstractGuice
 Jsr2
@@ -1025,16 +1025,27 @@
 Abstract
+GuiceJsr250
 Module %7B
@@ -1092,503 +1092,20 @@
 gure
-() %7B%0A        // This is needed so that @PostConstruct & @PreDestroy works%0A        //%0A        install(new CloseableModule());%0A        install(new Jsr250Module());%0A%0A        // asEagerSingleton() is required here, because of ODL architecture:%0A        // These *Listener classes MUST be %22eagerly%22 created, and not %22lazily%22,%0A        // only if something needs them @Inject-ed (because nothing ever will;%0A        // they register themselves on the DataBroker in their @PostConstruct start).%0A        //
+Bindings() %7B
 %0A   
@@ -1170,35 +1170,16 @@
 l.class)
-.asEagerSingleton()
 ;%0A      
@@ -1217,35 +1217,16 @@
 r.class)
-.asEagerSingleton()
 ;%0A      
@@ -1254,35 +1254,16 @@
 r.class)
-.asEagerSingleton()
 ;%0A      
@@ -1296,35 +1296,16 @@
 r.class)
-.asEagerSingleton()
 ;%0A      
@@ -1338,27 +1338,8 @@
 ass)
-.asEagerSingleton()
 ;%0A  

Use new AbstractGuiceJsr250Module, which simplifies AclServiceModule