7a4831329a2dc09ae753537691a1391521bcc440
[groupbasedpolicy.git] / renderers / faas / src / test / java / org / opendaylight / groupbasedpolicy / renderer / faas / MockFaasSubnetManagerListener.java
1 /*
2  * Copyright (c) 2016 Huawei Technologies 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.groupbasedpolicy.renderer.faas;
9
10 import static org.junit.Assert.assertTrue;
11
12 import java.util.concurrent.ScheduledExecutorService;
13
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.common.rev151013.Uuid;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.subnets.rev151013.subnets.container.subnets.SubnetBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.Subnet;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20
21 public class MockFaasSubnetManagerListener extends FaasSubnetManagerListener {
22
23     Subnet expectedGbpSubnet;
24     private Uuid expectedFaasSubnetId;
25
26     public MockFaasSubnetManagerListener(DataBroker dataProvider, TenantId gbpTenantId, Uuid faasTenantId,
27             ScheduledExecutorService executor) {
28         super(dataProvider, gbpTenantId, faasTenantId, executor);
29     }
30
31     // *******************************************************
32     // Test Stubs
33     // *******************************************************
34     @Override
35     protected SubnetBuilder initSubnetBuilder(Subnet subnet) {
36         if (expectedGbpSubnet != null)
37             assertTrue("FaasSubnetManagerListener.initSubnetBuilder", expectedGbpSubnet.equals(subnet));
38         SubnetBuilder builder = new SubnetBuilder();
39         builder.setUuid(expectedFaasSubnetId);
40         return builder;
41     }
42
43     // *******************************************************
44     // The following Methods are to input test data
45     // *******************************************************
46     public void setExpectedFaasSubnetId(Uuid expectedFaasSubnetId) {
47         this.expectedFaasSubnetId = expectedFaasSubnetId;
48     }
49
50     public void setExpectedGbpSubnet(DataObject obj) {
51         expectedGbpSubnet = (Subnet) obj;
52     }
53 }