Merge "Add service reference binding to config registry."
[controller.git] / opendaylight / netconf / config-netconf-connector / src / test / java / org / opendaylight / controller / netconf / confignetconfconnector / NetconfMappingTest.java
1 /*
2  * Copyright (c) 2013 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.netconf.confignetconfconnector;
10
11 import com.google.common.base.Optional;
12 import com.google.common.base.Preconditions;
13 import com.google.common.collect.Lists;
14 import com.google.common.collect.Maps;
15 import org.junit.Before;
16 import org.junit.Ignore;
17 import org.junit.Test;
18 import org.junit.matchers.JUnitMatchers;
19 import org.mockito.Mock;
20 import org.mockito.MockitoAnnotations;
21 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
22 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
23 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
24 import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot;
25 import org.opendaylight.controller.config.yang.store.impl.MbeParser;
26 import org.opendaylight.controller.config.yang.test.impl.ComplexDtoBInner;
27 import org.opendaylight.controller.config.yang.test.impl.ComplexList;
28 import org.opendaylight.controller.config.yang.test.impl.Deep;
29 import org.opendaylight.controller.config.yang.test.impl.DepTestImplModuleFactory;
30 import org.opendaylight.controller.config.yang.test.impl.DtoAInner;
31 import org.opendaylight.controller.config.yang.test.impl.DtoAInnerInner;
32 import org.opendaylight.controller.config.yang.test.impl.DtoC;
33 import org.opendaylight.controller.config.yang.test.impl.DtoD;
34 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModuleFactory;
35 import org.opendaylight.controller.config.yang.test.impl.NetconfTestImplModuleMXBean;
36 import org.opendaylight.controller.config.yang.test.impl.Peers;
37 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
38 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
39 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
40 import org.opendaylight.controller.netconf.confignetconfconnector.operations.Commit;
41 import org.opendaylight.controller.netconf.confignetconfconnector.operations.DiscardChanges;
42 import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig;
43 import org.opendaylight.controller.netconf.confignetconfconnector.operations.get.Get;
44 import org.opendaylight.controller.netconf.confignetconfconnector.operations.getconfig.GetConfig;
45 import org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc.RuntimeRpc;
46 import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
47 import org.opendaylight.controller.netconf.impl.mapping.operations.DefaultCloseSession;
48 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
49 import org.opendaylight.controller.netconf.mapping.api.NetconfOperation;
50 import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
51 import org.opendaylight.controller.netconf.util.xml.XmlElement;
52 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
53 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
54 import org.slf4j.Logger;
55 import org.slf4j.LoggerFactory;
56 import org.w3c.dom.Document;
57 import org.w3c.dom.Element;
58 import org.xml.sax.SAXException;
59
60 import javax.management.InstanceAlreadyExistsException;
61 import javax.management.ObjectName;
62 import javax.xml.parsers.ParserConfigurationException;
63 import java.io.FileNotFoundException;
64 import java.io.IOException;
65 import java.io.InputStream;
66 import java.math.BigInteger;
67 import java.util.ArrayList;
68 import java.util.Arrays;
69 import java.util.Collection;
70 import java.util.List;
71 import java.util.Map;
72
73 import static org.junit.Assert.assertEquals;
74 import static org.junit.Assert.assertThat;
75 import static org.junit.Assert.fail;
76 import static org.mockito.Mockito.doNothing;
77 import static org.mockito.Mockito.doReturn;
78 import static org.mockito.Mockito.verify;
79 import static org.mockito.Mockito.verifyNoMoreInteractions;
80
81
82 public class NetconfMappingTest extends AbstractConfigTest {
83     private static final Logger logger = LoggerFactory.getLogger(NetconfMappingTest.class);
84
85     private static final String INSTANCE_NAME = "test1";
86     private static final String NETCONF_SESSION_ID = "foo";
87     private NetconfTestImplModuleFactory factory;
88     private DepTestImplModuleFactory factory2;
89
90     @Mock
91     YangStoreSnapshot yangStoreSnapshot;
92     @Mock
93     NetconfOperationRouter netconfOperationRouter;
94
95     private TransactionProvider transactionProvider;
96
97     @Before
98     public void setUp() throws Exception {
99         MockitoAnnotations.initMocks(this);
100         doReturn(getMbes()).when(this.yangStoreSnapshot).getModuleMXBeanEntryMap();
101         this.factory = new NetconfTestImplModuleFactory();
102         this.factory2 = new DepTestImplModuleFactory();
103         super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, this.factory2));
104
105         transactionProvider = new TransactionProvider(this.configRegistryClient, NETCONF_SESSION_ID);
106     }
107
108     private ObjectName createModule(final String instanceName) throws InstanceAlreadyExistsException {
109         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
110
111         final ObjectName on = transaction.createModule(this.factory.getImplementationName(), instanceName);
112         final NetconfTestImplModuleMXBean mxBean = transaction.newMXBeanProxy(on, NetconfTestImplModuleMXBean.class);
113         setModule(mxBean, transaction);
114
115         transaction.commit();
116         return on;
117     }
118
119     @Test
120     public void testConfigNetconf() throws Exception {
121
122         createModule(INSTANCE_NAME);
123
124         edit("netconfMessages/editConfig.xml");
125         checkBinaryLeafEdited(getConfigCandidate());
126
127
128         // default-operation:none, should not affect binary leaf
129         edit("netconfMessages/editConfig_none.xml");
130         checkBinaryLeafEdited(getConfigCandidate());
131
132         // check after edit
133         commit();
134         Element response = getConfigRunning();
135
136         checkBinaryLeafEdited(response);
137         checkTypeConfigAttribute(response);
138         checkTypedefs(response);
139         checkTestingDeps(response);
140         checkEnum(response);
141         checkBigDecimal(response);
142
143         edit("netconfMessages/editConfig_remove.xml");
144
145         commit();
146         response = getConfigCandidate();
147         final String responseFromCandidate = XmlUtil.toString(response).replaceAll("\\s+", "");
148         // System.out.println(responseFromCandidate);
149         response = getConfigRunning();
150         final String responseFromRunning = XmlUtil.toString(response).replaceAll("\\s+", "");
151         // System.out.println(responseFromRunning);
152         assertEquals(responseFromCandidate, responseFromRunning);
153
154         final String expectedResult = XmlFileLoader.fileToString("netconfMessages/editConfig_expectedResult.xml")
155                 .replaceAll("\\s+", "");
156
157         assertEquals(expectedResult, responseFromRunning);
158         assertEquals(expectedResult, responseFromCandidate);
159
160         edit("netconfMessages/editConfig_none.xml");
161         doNothing().when(netconfOperationRouter).close();
162         closeSession();
163         verify(netconfOperationRouter).close();
164         verifyNoMoreInteractions(netconfOperationRouter);
165     }
166
167     private void checkBigDecimal(Element response) {
168         String responseTrimmed = XmlUtil.toString(response).replaceAll("\\s", "");
169
170         assertContainsString(responseTrimmed, "<sleep-factorxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.58</sleep-factor>");
171         // Default
172         assertContainsString(responseTrimmed, "<sleep-factorxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2.00</sleep-factor>");
173
174     }
175
176     private void closeSession() throws NetconfDocumentedException, ParserConfigurationException, SAXException,
177             IOException {
178         DefaultCloseSession closeOp = new DefaultCloseSession(NETCONF_SESSION_ID);
179         executeOp(closeOp, "netconfMessages/closeSession.xml");
180     }
181
182     private void edit(String resource) throws ParserConfigurationException, SAXException, IOException,
183             NetconfDocumentedException {
184         EditConfig editOp = new EditConfig(yangStoreSnapshot, transactionProvider, configRegistryClient,
185                 NETCONF_SESSION_ID);
186         executeOp(editOp, resource);
187     }
188
189     private void commit() throws ParserConfigurationException, SAXException, IOException, NetconfDocumentedException {
190         Commit commitOp = new Commit(transactionProvider, configRegistryClient, NETCONF_SESSION_ID);
191         executeOp(commitOp, "netconfMessages/commit.xml");
192     }
193
194     private Element getConfigCandidate() throws ParserConfigurationException, SAXException, IOException,
195             NetconfDocumentedException {
196         GetConfig getConfigOp = new GetConfig(yangStoreSnapshot, Optional.<String> absent(), transactionProvider,
197                 configRegistryClient, NETCONF_SESSION_ID);
198         return executeOp(getConfigOp, "netconfMessages/getConfig_candidate.xml");
199     }
200
201     private Element getConfigRunning() throws ParserConfigurationException, SAXException, IOException,
202             NetconfDocumentedException {
203         GetConfig getConfigOp = new GetConfig(yangStoreSnapshot, Optional.<String> absent(), transactionProvider,
204                 configRegistryClient, NETCONF_SESSION_ID);
205         return executeOp(getConfigOp, "netconfMessages/getConfig.xml");
206     }
207
208     @Test(expected = NetconfDocumentedException.class)
209     public void testConfigNetconfReplaceDefaultEx() throws Exception {
210
211         createModule(INSTANCE_NAME);
212
213         edit("netconfMessages/editConfig.xml");
214         edit("netconfMessages/editConfig_replace_default_ex.xml");
215     }
216
217     @Test
218     public void testConfigNetconfReplaceDefault() throws Exception {
219
220         createModule(INSTANCE_NAME);
221
222         edit("netconfMessages/editConfig.xml");
223         commit();
224         Element response = getConfigRunning();
225         final int allInstances = response.getElementsByTagName("module").getLength();
226
227         edit("netconfMessages/editConfig_replace_default.xml");
228
229         commit();
230         response = getConfigRunning();
231
232         final int afterReplace = response.getElementsByTagName("module").getLength();
233         assertEquals(4, allInstances);
234         assertEquals(2, afterReplace);
235     }
236
237     @Test(expected = NetconfDocumentedException.class)
238     public void testSameAttrDifferentNamespaces() throws Exception {
239         try {
240             edit("netconfMessages/namespaces/editConfig_sameAttrDifferentNamespaces.xml");
241         } catch (NetconfDocumentedException e) {
242             String message = e.getMessage();
243             assertContainsString(message, "Element simple-long-2 present multiple times with different namespaces");
244             assertContainsString(message, "urn:opendaylight:params:xml:ns:yang:controller:test:impl");
245             assertContainsString(message, XmlNetconfConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG);
246             throw e;
247         }
248     }
249
250     @Test(expected = NetconfDocumentedException.class)
251     public void testDifferentNamespaceInTO() throws Exception {
252         try {
253             edit("netconfMessages/namespaces/editConfig_differentNamespaceTO.xml");
254         } catch (NetconfDocumentedException e) {
255             String message = e.getMessage();
256             assertContainsString(message, "Unrecognised elements");
257             assertContainsString(message, "simple-int2");
258             assertContainsString(message, "dto_d");
259             throw e;
260         }
261     }
262
263     @Test(expected = NetconfDocumentedException.class)
264     public void testSameAttrDifferentNamespacesList() throws Exception {
265         try {
266             edit("netconfMessages/namespaces/editConfig_sameAttrDifferentNamespacesList.xml");
267         } catch (NetconfDocumentedException e) {
268             String message = e.getMessage();
269             assertContainsString(message, "Element binaryLeaf present multiple times with different namespaces");
270             assertContainsString(message, "urn:opendaylight:params:xml:ns:yang:controller:test:impl");
271             assertContainsString(message, XmlNetconfConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG);
272             throw e;
273         }
274     }
275
276     @Test
277     public void testTypeNameConfigAttributeMatching() throws Exception {
278         edit("netconfMessages/editConfig.xml");
279         commit();
280         edit("netconfMessages/namespaces/editConfig_typeNameConfigAttributeMatching.xml");
281         commit();
282
283         Element response = getConfigRunning();
284         checkTypeConfigAttribute(response);
285     }
286
287     // TODO add <modules operation="replace"> functionality
288     @Test(expected = NetconfDocumentedException.class)
289     public void testConfigNetconfReplaceModuleEx() throws Exception {
290
291         createModule(INSTANCE_NAME);
292
293         edit("netconfMessages/editConfig.xml");
294         edit("netconfMessages/editConfig_replace_module_ex.xml");
295     }
296
297     @Test
298     public void testUnrecognisedConfigElements() throws Exception {
299
300         String format = "netconfMessages/unrecognised/editConfig_unrecognised%d.xml";
301         final int TESTS_COUNT = 8;
302
303         for (int i = 0; i < TESTS_COUNT; i++) {
304             String file = String.format(format, i + 1);
305             try {
306                 edit(file);
307             } catch (NetconfDocumentedException e) {
308                 assertContainsString(e.getMessage(), "Unrecognised elements");
309                 assertContainsString(e.getMessage(), "unknownAttribute");
310                 continue;
311             }
312             fail("Unrecognised test should throw exception " + file);
313         }
314     }
315
316     @Test
317     @Ignore
318     // FIXME
319     public void testConfigNetconfReplaceModule() throws Exception {
320
321         createModule(INSTANCE_NAME);
322
323         edit("netconfMessages/editConfig.xml");
324         commit();
325         Element response = getConfigRunning();
326         final int allInstances = response.getElementsByTagName("instance").getLength();
327
328         edit("netconfMessages/editConfig_replace_module.xml");
329
330         commit();
331         response = getConfigRunning();
332         final int afterReplace = response.getElementsByTagName("instance").getLength();
333
334         assertEquals(4 + 4 /* Instances from services */, allInstances);
335         assertEquals(3 + 3, afterReplace);
336     }
337
338     @Test(expected = NetconfDocumentedException.class)
339     public void testEx() throws Exception {
340
341         commit();
342     }
343
344     @Test(expected = NetconfDocumentedException.class)
345     public void testEx2() throws Exception {
346         discard();
347     }
348
349     private void discard() throws ParserConfigurationException, SAXException, IOException, NetconfDocumentedException {
350         DiscardChanges discardOp = new DiscardChanges(transactionProvider, configRegistryClient, NETCONF_SESSION_ID);
351         executeOp(discardOp, "netconfMessages/discardChanges.xml");
352     }
353
354     private void checkBinaryLeafEdited(final Element response) {
355         String responseTrimmed = XmlUtil.toString(response).replaceAll("\\s", "");
356         String substring = "<binaryLeafxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">YmluYXJ5</binaryLeaf>";
357         assertContainsString(responseTrimmed, substring);
358         substring = "<binaryLeafxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">ZGVmYXVsdEJpbg==</binaryLeaf>";
359         assertContainsString(responseTrimmed, substring);
360     }
361
362     private void checkTypedefs(final Element response) {
363         String responseTrimmed = XmlUtil.toString(response).replaceAll("\\s", "");
364
365         String substring = "<extendedxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">10</extended>";
366         assertContainsString(responseTrimmed, substring);
367         // Default
368         assertContainsString(responseTrimmed,
369                 "<extendedxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">1</extended>");
370
371         assertContainsString(responseTrimmed,
372                 "<extended-twicexmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">20</extended-twice>");
373         // Default
374         assertContainsString(responseTrimmed,
375                 "<extended-twicexmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">2</extended-twice>");
376
377         assertContainsString(responseTrimmed,
378                 "<extended-enumxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">TWO</extended-enum>");
379         // Default
380         assertContainsString(responseTrimmed,
381                 "<extended-enumxmlns=\"urn:opendaylight:params:xml:ns:yang:controller:test:impl\">ONE</extended-enum>");
382     }
383
384     private void assertContainsString(String string, String substring) {
385         assertThat(string, JUnitMatchers.containsString(substring));
386     }
387
388     private void checkEnum(final Element response) {
389         XmlElement modulesElement = XmlElement.fromDomElement(response).getOnlyChildElement("data")
390                 .getOnlyChildElement("modules");
391
392         String enumName = "extended-enum";
393         String enumContent = "TWO";
394
395         for (XmlElement moduleElement : modulesElement.getChildElements("module")) {
396             String name = moduleElement.getOnlyChildElement("name").getTextContent();
397             if(name.equals("test1")) {
398                 XmlElement enumAttr = moduleElement.getOnlyChildElement(enumName);
399                 assertEquals(enumContent, enumAttr.getTextContent());
400
401                 return;
402             }
403         }
404
405         fail("Enum attribute " + enumName + ":" + enumContent + " not present in " + XmlUtil.toString(response));
406     }
407
408     private void checkTestingDeps(Element response) {
409         int testingDepsSize = response.getElementsByTagName("testing-deps").getLength();
410         assertEquals(2, testingDepsSize);
411     }
412
413     private void checkTypeConfigAttribute(Element response) {
414
415         XmlElement modulesElement = XmlElement.fromDomElement(response).getOnlyChildElement("data")
416                 .getOnlyChildElement("modules");
417
418         XmlElement configAttributeType = null;
419         for (XmlElement moduleElement : modulesElement.getChildElements("module")) {
420             for (XmlElement type : moduleElement.getChildElements("type")) {
421                 if (type.getAttribute(XmlUtil.XMLNS_ATTRIBUTE_KEY).equals("") == false) {
422                     configAttributeType = type;
423                 }
424             }
425         }
426
427         assertEquals("configAttributeType", configAttributeType.getTextContent());
428     }
429
430     private Map<String, Map<String, ModuleMXBeanEntry>> getMbes() throws Exception {
431         final List<InputStream> yangDependencies = getYangs();
432
433         final Map<String, Map<String, ModuleMXBeanEntry>> mBeanEntries = Maps.newHashMap();
434         mBeanEntries.putAll(new MbeParser().parseYangFiles(yangDependencies).getModuleMXBeanEntryMap());
435
436         return mBeanEntries;
437     }
438
439     @Test
440     public void testConfigNetconfRuntime() throws Exception {
441
442         createModule(INSTANCE_NAME);
443
444         edit("netconfMessages/editConfig.xml");
445         checkBinaryLeafEdited(getConfigCandidate());
446
447         // check after edit
448         commit();
449         Element response = get();
450
451         assertEquals(2/*With runtime beans*/ + 2 /*Without runtime beans*/, getElementsSize(response, "module"));
452         // data from state
453         assertEquals(2, getElementsSize(response, "asdf"));
454         // data from running config
455         assertEquals(2, getElementsSize(response, "simple-short"));
456
457         assertEquals(8, getElementsSize(response, "inner-running-data"));
458         assertEquals(8, getElementsSize(response, "deep2"));
459         assertEquals(8 * 4, getElementsSize(response, "inner-inner-running-data"));
460         assertEquals(8 * 4, getElementsSize(response, "deep3"));
461         assertEquals(8 * 4 * 2, getElementsSize(response, "list-of-strings"));
462         assertEquals(8, getElementsSize(response, "inner-running-data-additional"));
463         assertEquals(8, getElementsSize(response, "deep4"));
464         // TODO assert keys
465
466         RuntimeRpc netconf = new RuntimeRpc(yangStoreSnapshot, configRegistryClient, NETCONF_SESSION_ID);
467
468         response = executeOp(netconf, "netconfMessages/rpc.xml");
469         assertContainsString(XmlUtil.toString(response), "testarg1".toUpperCase());
470
471         response = executeOp(netconf, "netconfMessages/rpcInner.xml");
472         assertContainsString(XmlUtil.toString(response), "ok");
473
474         response = executeOp(netconf, "netconfMessages/rpcInnerInner.xml");
475         assertContainsString(XmlUtil.toString(response), "true");
476
477         response = executeOp(netconf, "netconfMessages/rpcInnerInner_complex_output.xml");
478         assertContainsString(XmlUtil.toString(response), "1");
479         assertContainsString(XmlUtil.toString(response), "2");
480     }
481
482     private Element get() throws NetconfDocumentedException, ParserConfigurationException, SAXException, IOException {
483         Get getOp = new Get(yangStoreSnapshot, configRegistryClient, NETCONF_SESSION_ID);
484         return executeOp(getOp, "netconfMessages/get.xml");
485     }
486
487     private int getElementsSize(Element response, String elementName) {
488         return response.getElementsByTagName(elementName).getLength();
489     }
490
491     private Element executeOp(final NetconfOperation op, final String filename) throws ParserConfigurationException,
492             SAXException, IOException, NetconfDocumentedException {
493
494         final Document request = XmlFileLoader.xmlFileToDocument(filename);
495
496         logger.debug("Executing netconf operation\n{}", XmlUtil.toString(request));
497         HandlingPriority priority = op.canHandle(request);
498
499         Preconditions.checkState(priority != HandlingPriority.CANNOT_HANDLE);
500
501         final Document response = op.handle(request, netconfOperationRouter);
502         logger.debug("Got response\n{}", XmlUtil.toString(response));
503         return response.getDocumentElement();
504     }
505
506     private List<InputStream> getYangs() throws FileNotFoundException {
507         List<String> paths = Arrays.asList("/META-INF/yang/config.yang", "/META-INF/yang/rpc-context.yang",
508                 "/META-INF/yang/config-test.yang", "/META-INF/yang/config-test-impl.yang", "/META-INF/yang/test-types.yang",
509                 "/META-INF/yang/ietf-inet-types.yang");
510         final Collection<InputStream> yangDependencies = new ArrayList<>();
511         for (String path : paths) {
512             final InputStream is = Preconditions
513                     .checkNotNull(getClass().getResourceAsStream(path), path + " not found");
514             yangDependencies.add(is);
515         }
516         return Lists.newArrayList(yangDependencies);
517     }
518
519     private void setModule(final NetconfTestImplModuleMXBean mxBean, final ConfigTransactionJMXClient transaction)
520             throws InstanceAlreadyExistsException {
521         mxBean.setSimpleInt((long) 44);
522         mxBean.setBinaryLeaf(new byte[] { 8, 7, 9 });
523         final DtoD dtob = getDtoD();
524         mxBean.setDtoD(dtob);
525         //
526         final DtoC dtoa = getDtoC();
527         mxBean.setDtoC(dtoa);
528         mxBean.setSimpleBoolean(false);
529         //
530         final Peers p1 = new Peers();
531         p1.setCoreSize(44L);
532         p1.setPort("port1");
533         p1.setSimpleInt3(456);
534         final Peers p2 = new Peers();
535         p2.setCoreSize(44L);
536         p2.setPort("port23");
537         p2.setSimpleInt3(456);
538         mxBean.setPeers(Lists.<Peers> newArrayList(p1, p2));
539         // //
540         mxBean.setSimpleLong(454545L);
541         mxBean.setSimpleLong2(44L);
542         mxBean.setSimpleBigInteger(BigInteger.valueOf(999L));
543         mxBean.setSimpleByte(new Byte((byte) 4));
544         mxBean.setSimpleShort(new Short((short) 4));
545         mxBean.setSimpleTest(545);
546
547         mxBean.setComplexList(Lists.<ComplexList> newArrayList());
548         mxBean.setSimpleList(Lists.<Integer> newArrayList());
549
550         final ObjectName testingDepOn = transaction.createModule(this.factory2.getImplementationName(), "dep");
551         mxBean.setTestingDep(testingDepOn);
552     }
553
554     private static DtoD getDtoD() {
555         final DtoD dtob = new DtoD();
556         dtob.setSimpleInt1((long) 444);
557         dtob.setSimpleInt2((long) 4444);
558         dtob.setSimpleInt3(454);
559         final ComplexDtoBInner dtobInner = new ComplexDtoBInner();
560         final Deep deep = new Deep();
561         deep.setSimpleInt3(4);
562         dtobInner.setDeep(deep);
563         dtobInner.setSimpleInt3(44);
564         dtobInner.setSimpleList(Lists.newArrayList(4));
565         dtob.setComplexDtoBInner(Lists.newArrayList(dtobInner));
566         dtob.setSimpleList(Lists.newArrayList(4));
567         return dtob;
568     }
569
570     private static DtoC getDtoC() {
571         final DtoC dtoa = new DtoC();
572         // dtoa.setSimpleArg((long) 55);
573         final DtoAInner dtoAInner = new DtoAInner();
574         final DtoAInnerInner dtoAInnerInner = new DtoAInnerInner();
575         dtoAInnerInner.setSimpleArg(456L);
576         dtoAInner.setDtoAInnerInner(dtoAInnerInner);
577         dtoAInner.setSimpleArg(44L);
578         dtoa.setDtoAInner(dtoAInner);
579         return dtoa;
580     }
581
582 }