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