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.lisp.translate.read;
19 import static org.junit.Assert.assertEquals;
20 import static org.mockito.Mockito.when;
22 import io.fd.honeycomb.translate.read.ReadFailedException;
23 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
24 import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.mockito.Mockito;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
30 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
31 import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
33 public class LispStateCustomizerTest extends ReaderCustomizerTest<LispState, LispStateBuilder> {
35 private InstanceIdentifier<LispState> identifier;
37 public LispStateCustomizerTest() {
38 super(LispState.class, null);
43 identifier = InstanceIdentifier.create(LispState.class);
44 final ShowLispStatusReply reply = new ShowLispStatusReply();
45 reply.featureStatus = 1;
47 when(api.showLispStatus(Mockito.any())).thenReturn(future(reply));
51 public void testReadCurrentAttributes() throws ReadFailedException {
53 LispStateBuilder builder = new LispStateBuilder();
54 getCustomizer().readCurrentAttributes(identifier, builder, ctx);
56 assertEquals(true, builder.build().isEnable());
60 protected ReaderCustomizer<LispState, LispStateBuilder> initCustomizer() {
61 return new LispStateCustomizer(api);
65 public void testMerge() throws Exception {
66 //LispState is root node, so there is no way to implement merge(it is also not needed)