Add missing license headers
[controller.git] / opendaylight / config / yang-test / src / main / java / org / opendaylight / controller / config / yang / test / util / NetconfTestImplModuleUtil.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.config.yang.test.util;
10
11 import com.google.common.collect.Lists;
12 import java.math.BigInteger;
13 import java.util.List;
14 import org.opendaylight.controller.config.yang.test.impl.Asdf;
15 import org.opendaylight.controller.config.yang.test.impl.Deep2;
16 import org.opendaylight.controller.config.yang.test.impl.Deep3;
17 import org.opendaylight.controller.config.yang.test.impl.Deep4;
18 import org.opendaylight.controller.config.yang.test.impl.InnerInnerRunningDataRuntimeMXBean;
19 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataAdditionalRuntimeMXBean;
20 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataRuntimeMXBean;
21 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataRuntimeRegistration;
22 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModule;
23 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeMXBean;
24 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeRegistration;
25 import org.opendaylight.controller.config.yang.test.impl.NotStateBean;
26 import org.opendaylight.controller.config.yang.test.impl.RetValContainer;
27 import org.opendaylight.controller.config.yang.test.impl.RetValList;
28
29 public class NetconfTestImplModuleUtil {
30     public static NetconfTestImplRuntimeRegistration registerRuntimeBeans(final NetconfTestImplModule module) {
31         NetconfTestImplRuntimeRegistration reg = module.getRootRuntimeBeanRegistratorWrapper().register(new NetconfTestImplRuntimeMXBean() {
32
33             @Override
34             public Long getCreatedSessions() {
35                 return module.getSimpleLong();
36             }
37
38             @Override
39             public Asdf getAsdf() {
40                 final Asdf asdf = new Asdf();
41                 asdf.setSimpleString("asdf");
42                 return asdf;
43             }
44
45             @Override
46             public BigInteger getCommonStat() {
47                 return new BigInteger("54");
48             }
49
50             @Override
51             public String noArg(final String arg1) {
52                 return arg1.toUpperCase();
53             }
54
55             @Override
56             public Long commonRpcTwo() {
57                 return 1L;
58             }
59
60             @Override
61             public String commonRpcThree() {
62                 return "true";
63             }
64
65             @Override
66             public Boolean commonRpc() {
67                 return true;
68             }
69
70             @Override
71             public void netconfImplRpcFromGrouping() {
72                 // rpc from grouping within same yang module
73             }
74
75         });
76
77         for (int i = 0; i < module.getSimpleShort(); i++) {
78             final int finalI = i;
79
80             reg.register(new InnerRunningDataAdditionalRuntimeMXBean() {
81                 @Override
82                 public Integer getSimpleInt3() {
83                     return module.getSimpleTest();
84                 }
85
86                 @Override
87                 public Deep4 getDeep4() {
88                     final Deep4 d = new Deep4();
89                     d.setBoool(false);
90                     return d;
91                 }
92
93                 @Override
94                 public String getSimpleString() {
95                     return Integer.toString(finalI);
96                 }
97
98                 @Override
99                 public void noArgInner() {
100                 }
101             });
102
103             InnerRunningDataRuntimeRegistration innerReg = reg.register(new InnerRunningDataRuntimeMXBean() {
104                 @Override
105                 public Integer getSimpleInt3() {
106                     return finalI;
107                 }
108
109                 @Override
110                 public Deep2 getDeep2() {
111                     return new Deep2();
112                 }
113             });
114
115             for (int j = 0; j < module.getSimpleShort(); j++) {
116                 final int finalJ = j;
117                 innerReg.register(new InnerInnerRunningDataRuntimeMXBean() {
118                     @Override
119                     public List<NotStateBean> getNotStateBean() {
120                         NotStateBean b1 = new NotStateBean();
121                         b1.setElement("not state");
122                         return Lists.newArrayList(b1);
123                     }
124
125                     @Override
126                     public Integer getSimpleInt3() {
127                         return finalJ;
128                     }
129
130                     @Override
131                     public Deep3 getDeep3() {
132                         return new Deep3();
133                     }
134
135                     @Override
136                     public List<String> getListOfStrings() {
137                         return Lists.newArrayList("l1", "l2");
138                     }
139
140                     @Override
141                     public List<RetValList> listOutput() {
142                         return Lists.newArrayList(new RetValList());
143                     }
144
145                     @Override
146                     public Boolean noArgInnerInner(Integer integer, Boolean aBoolean) {
147                         return aBoolean;
148                     }
149
150                     @Override
151                     public RetValContainer containerOutput() {
152                         return new RetValContainer();
153                     }
154
155                     @Override
156                     public List<String> leafListOutput() {
157                         return Lists.newArrayList("1", "2");
158                     }
159                 });
160             }
161         }
162
163         return reg;
164     }
165 }