80403eb583aa45be9b0f3072d9d85f716cee0706
[hc2vpp.git] /
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package io.fd.honeycomb.v3po.translate.v3po.vppstate;
17
18 import static org.mockito.Mockito.mock;
19 import static org.mockito.Mockito.verify;
20
21 import io.fd.honeycomb.v3po.translate.spi.read.RootReaderCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.test.ListReaderCustomizerTest;
23 import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
24 import java.util.Collections;
25 import java.util.List;
26 import org.junit.Test;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainKey;
31
32 public class BridgeDomainCustomizerTest extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
33
34     private NamingContext bdContext;
35     private NamingContext interfacesContext;
36
37     public BridgeDomainCustomizerTest() {
38         super(BridgeDomain.class);
39     }
40
41     @Override
42     public void setUpBefore() {
43         bdContext = new NamingContext("generatedBdName", "bd-test-instance");
44         interfacesContext = new NamingContext("generatedIfaceName", "ifc-test-instance");
45     }
46
47     @Test
48     public void testMerge() throws Exception {
49         final BridgeDomainsBuilder builder = mock(BridgeDomainsBuilder.class);
50         final List<BridgeDomain> value = Collections.emptyList();
51         getCustomizer().merge(builder, value);
52         verify(builder).setBridgeDomain(value);
53     }
54
55     @Override
56     protected RootReaderCustomizer<BridgeDomain, BridgeDomainBuilder> initCustomizer() {
57         return new BridgeDomainCustomizer(api, bdContext);
58     }
59 }