Convert DataChangeListeners to DataTreeChangeListeners
[groupbasedpolicy.git] / renderers / faas / src / test / java / org / opendaylight / groupbasedpolicy / renderer / faas / MockFaasContractManagerListener.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.Executor;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.common.rev151013.Uuid;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.faas.logical.faas.security.rules.rev151013.security.rule.groups.attributes.security.rule.groups.container.SecurityRuleGroupsBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.Contract;
18
19 public class MockFaasContractManagerListener extends FaasContractManagerListener {
20
21     private Contract expectedContract;
22     private Uuid expectedFaasSecId;
23
24     public MockFaasContractManagerListener(DataBroker dataProvider, TenantId gbpTenantId, Uuid faasTenantId,
25             Executor executor) {
26         super(dataProvider, gbpTenantId, faasTenantId, executor);
27     }
28
29     // *******************************************************
30     // Test Stubs
31     // *******************************************************
32     @Override
33     protected SecurityRuleGroupsBuilder initSecurityGroupBuilder(Contract contract) {
34         if (expectedContract != null) {
35             assertTrue("FaasContractManagerListener.initSecurityGroupBuilder", expectedContract.equals(contract));
36         }
37         SecurityRuleGroupsBuilder sec = new SecurityRuleGroupsBuilder();
38         sec.setUuid(expectedFaasSecId);
39         return sec;
40     }
41
42     // *******************************************************
43     // The following Methods are to input test data
44     // *******************************************************
45     public void setExpectedContract(Contract expectedContract) {
46         this.expectedContract = expectedContract;
47     }
48
49     public void setExpectedFaasSecId(Uuid expectedFaasSecId) {
50         this.expectedFaasSecId = expectedFaasSecId;
51     }
52 }