2 * Copyright (c) 2016 Huawei Technologies and others. All rights reserved.
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
8 package org.opendaylight.groupbasedpolicy.renderer.faas;
10 import static org.junit.Assert.assertTrue;
12 import java.util.concurrent.Executor;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.faas.uln.datastore.api.UlnDatastoreUtil;
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.security.rules.rev151013.security.rule.groups.attributes.security.rule.groups.container.SecurityRuleGroupsBuilder;
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.policy.Contract;
20 public class MockFaasContractManagerListener extends FaasContractManagerListener {
22 private Contract expectedContract;
23 private Uuid expectedFaasSecId;
25 public MockFaasContractManagerListener(DataBroker dataProvider, TenantId gbpTenantId, Uuid faasTenantId,
26 Executor executor, UlnDatastoreUtil ulnDatastoreUtil) {
27 super(dataProvider, gbpTenantId, faasTenantId, executor, ulnDatastoreUtil);
30 // *******************************************************
32 // *******************************************************
34 protected SecurityRuleGroupsBuilder initSecurityGroupBuilder(Contract contract) {
35 if (expectedContract != null) {
36 assertTrue("FaasContractManagerListener.initSecurityGroupBuilder", expectedContract.equals(contract));
38 SecurityRuleGroupsBuilder sec = new SecurityRuleGroupsBuilder();
39 sec.setUuid(expectedFaasSecId);
43 // *******************************************************
44 // The following Methods are to input test data
45 // *******************************************************
46 public void setExpectedContract(Contract expectedContract) {
47 this.expectedContract = expectedContract;
50 public void setExpectedFaasSecId(Uuid expectedFaasSecId) {
51 this.expectedFaasSecId = expectedFaasSecId;