2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.translate.v3po.interfaces.acl.common;
19 import static org.mockito.Mockito.verify;
20 import static org.mockito.MockitoAnnotations.initMocks;
22 import io.fd.honeycomb.translate.MappingContext;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.mockito.Mock;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.MappingTable;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntry;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.context.rev161214.mapping.entry.context.attributes.acl.mapping.entry.context.mapping.table.MappingEntryBuilder;
30 public class AclTableContextManagerImplTest {
32 private AclTableContextManagerImpl ctx;
34 private MappingContext mappingContext;
35 private static final int INDEX = 42;
38 public void setUp() throws Exception {
40 ctx = new AclTableContextManagerImpl(MappingTable.Direction.Ingress);
44 public void testAddEntry() throws Exception {
45 final MappingEntry entry =
46 new MappingEntryBuilder().setL2TableId(1).setIp4TableId(2).setIp6TableId(3).setIndex(INDEX).build();
47 ctx.addEntry(entry, mappingContext);
48 verify(mappingContext).put(ctx.getId(INDEX), entry);
52 public void testRemoveEntry() throws Exception {
53 ctx.removeEntry(INDEX, mappingContext);
54 verify(mappingContext).delete(ctx.getId(INDEX));
58 public void testReadEntry() throws Exception {
59 ctx.getEntry(INDEX, mappingContext);
60 verify(mappingContext).read(ctx.getId(INDEX));