Merge "Fixed for bug 1168 : Issue while update subnet"
[controller.git] / opendaylight / config / yang-test / src / main / java / org / opendaylight / controller / config / yang / test / util / NetconfTestImplModuleUtil.java
1
2
3 /*
4  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
5  *
6  * This program and the accompanying materials are made available under the
7  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
8  * and is available at http://www.eclipse.org/legal/epl-v10.html
9  */
10
11 package org.opendaylight.controller.config.yang.test.util;
12
13 import com.google.common.collect.Lists;
14 import java.util.List;
15 import org.opendaylight.controller.config.yang.test.impl.Asdf;
16 import org.opendaylight.controller.config.yang.test.impl.Deep2;
17 import org.opendaylight.controller.config.yang.test.impl.Deep3;
18 import org.opendaylight.controller.config.yang.test.impl.Deep4;
19 import org.opendaylight.controller.config.yang.test.impl.InnerInnerRunningDataRuntimeMXBean;
20 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataAdditionalRuntimeMXBean;
21 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataRuntimeMXBean;
22 import org.opendaylight.controller.config.yang.test.impl.InnerRunningDataRuntimeRegistration;
23 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModule;
24 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeMXBean;
25 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplRuntimeRegistration;
26 import org.opendaylight.controller.config.yang.test.impl.NotStateBean;
27 import org.opendaylight.controller.config.yang.test.impl.RetValContainer;
28 import org.opendaylight.controller.config.yang.test.impl.RetValList;
29
30 public class NetconfTestImplModuleUtil {
31     public static NetconfTestImplRuntimeRegistration registerRuntimeBeans(final NetconfTestImplModule module) {
32         NetconfTestImplRuntimeRegistration reg = module.getRootRuntimeBeanRegistratorWrapper().register(new NetconfTestImplRuntimeMXBean() {
33
34             @Override
35             public Long getCreatedSessions() {
36                 return module.getSimpleLong();
37             }
38
39             @Override
40             public Asdf getAsdf() {
41                 final Asdf asdf = new Asdf();
42                 asdf.setSimpleString("asdf");
43                 return asdf;
44             }
45
46             @Override
47             public String noArg(final String arg1) {
48                 return arg1.toUpperCase();
49             }
50
51         });
52
53         for (int i = 0; i < module.getSimpleShort(); i++) {
54             final int finalI = i;
55
56             reg.register(new InnerRunningDataAdditionalRuntimeMXBean() {
57                 @Override
58                 public Integer getSimpleInt3() {
59                     return module.getSimpleTest();
60                 }
61
62                 @Override
63                 public Deep4 getDeep4() {
64                     final Deep4 d = new Deep4();
65                     d.setBoool(false);
66                     return d;
67                 }
68
69                 @Override
70                 public String getSimpleString() {
71                     return Integer.toString(finalI);
72                 }
73
74                 @Override
75                 public void noArgInner() {
76                 }
77             });
78
79             InnerRunningDataRuntimeRegistration innerReg = reg.register(new InnerRunningDataRuntimeMXBean() {
80                 @Override
81                 public Integer getSimpleInt3() {
82                     return finalI;
83                 }
84
85                 @Override
86                 public Deep2 getDeep2() {
87                     return new Deep2();
88                 }
89             });
90
91             for (int j = 0; j < module.getSimpleShort(); j++) {
92                 final int finalJ = j;
93                 innerReg.register(new InnerInnerRunningDataRuntimeMXBean() {
94                     @Override
95                     public List<NotStateBean> getNotStateBean() {
96                         NotStateBean b1 = new NotStateBean();
97                         b1.setElement("not state");
98                         return Lists.newArrayList(b1);
99                     }
100
101                     @Override
102                     public Integer getSimpleInt3() {
103                         return finalJ;
104                     }
105
106                     @Override
107                     public Deep3 getDeep3() {
108                         return new Deep3();
109                     }
110
111                     @Override
112                     public List<String> getListOfStrings() {
113                         return Lists.newArrayList("l1", "l2");
114                     }
115
116                     @Override
117                     public List<RetValList> listOutput() {
118                         return Lists.newArrayList(new RetValList());
119                     }
120
121                     @Override
122                     public Boolean noArgInnerInner(Integer integer, Boolean aBoolean) {
123                         return aBoolean;
124                     }
125
126                     @Override
127                     public RetValContainer containerOutput() {
128                         return new RetValContainer();
129                     }
130
131                     @Override
132                     public List<String> leafListOutput() {
133                         return Lists.newArrayList("1", "2");
134                     }
135                 });
136             }
137         }
138
139         return reg;
140     }
141 }