Merge "Bug-6741: eth1 flows on table 0 are missing from d2 ovs"
[netvirt.git] / vpnservice / aclservice / impl / src / test / java / org / opendaylight / netvirt / aclservice / tests / AclServiceTestModule.java
1 /*
2  * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netvirt.aclservice.tests;
9
10 import static org.mockito.Mockito.mock;
11
12 import com.google.inject.AbstractModule;
13 import org.mockito.Mockito;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
16 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
17 import org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager;
18 import org.opendaylight.netvirt.aclservice.utils.AclClusterUtil;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig.SecurityGroupMode;
21
22 /**
23  * Test Dependency Injection (DI) Wiring (currently through Guice).
24  *
25  * @author Michael Vorburger
26  */
27 public class AclServiceTestModule extends AbstractModule {
28
29     @Override
30     protected void configure() {
31         install(new AclServiceModule());
32
33         bind(DataBroker.class).toInstance(DataBrokerTestModule.dataBroker());
34         bind(AclserviceConfig.class).toInstance(aclServiceConfig());
35
36         bind(AclClusterUtil.class).toInstance(() -> true);
37
38         TestIMdsalApiManager singleton = TestIMdsalApiManager.newInstance();
39         bind(IMdsalApiManager.class).toInstance(singleton);
40         bind(TestIMdsalApiManager.class).toInstance(singleton);
41     }
42
43     private AclserviceConfig aclServiceConfig() {
44         AclserviceConfig aclServiceConfig = mock(AclserviceConfig.class);
45         Mockito.when(aclServiceConfig.getSecurityGroupMode()).thenReturn(SecurityGroupMode.Stateful);
46         return aclServiceConfig;
47     }
48 }