X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-jmx-generator%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyangjmxgenerator%2FRuntimeBeanEntryTest.java;h=629b1542ba6e7f2843c1f73c5618c71137e662ae;hb=afa4469a5c4b0f4f0c24a10453b83287726089c7;hp=38b0a3afece740c22e897dc3d9642a594981ac04;hpb=e316a0ef36279a72767703d190f38a39d7d49395;p=controller.git diff --git a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java index 38b0a3afec..629b1542ba 100644 --- a/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java +++ b/opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntryTest.java @@ -13,20 +13,17 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; - import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; - import javax.management.openmbean.SimpleType; - import org.junit.Test; import org.mockito.Mockito; import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute; -import org.opendaylight.yangtools.sal.binding.yang.types.TypeProviderImpl; +import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode; @@ -48,15 +45,15 @@ public class RuntimeBeanEntryTest extends AbstractYangTest { @Test public void createRuntimeBean() { - ChoiceCaseNode caseNode = Mockito.mock(ChoiceCaseNode.class); + final ChoiceCaseNode caseNode = Mockito.mock(ChoiceCaseNode.class); doReturn(new HashSet()).when(caseNode).getChildNodes(); doReturn(new ArrayList()).when(caseNode) .getUnknownSchemaNodes(); - Map runtimeBeans = RuntimeBeanEntry + final Map runtimeBeans = RuntimeBeanEntry .extractClassNameToRuntimeBeanMap(PACKAGE_NAME, caseNode, "test-name", new TypeProviderWrapper(new - TypeProviderImpl(context)), "test", jmxImplModule); + TypeProviderImpl(this.context)), "test", this.jmxImplModule, this.context); assertEquals(1, runtimeBeans.size()); - RuntimeBeanEntry runtimeMXBean = runtimeBeans.get("testRuntimeMXBean"); + final RuntimeBeanEntry runtimeMXBean = runtimeBeans.get("testRuntimeMXBean"); assertTrue(runtimeMXBean.isRoot()); assertEquals("test-name", runtimeMXBean.getYangName()); } @@ -64,35 +61,35 @@ public class RuntimeBeanEntryTest extends AbstractYangTest { @Test public void runtimeBeanRPCTest() { // create service interfaces - Map modulesToSIEs = ServiceInterfaceEntry - .create(threadsModule, "packages.sis",identitiesToSIs); + final Map modulesToSIEs = ServiceInterfaceEntry + .create(this.threadsModule, "packages.sis",identitiesToSIs); assertNotNull(modulesToSIEs); // create MXBeans map - Map namesToMBEs = ModuleMXBeanEntry.create( - threadsJavaModule, modulesToSIEs, context, - new TypeProviderWrapper(new TypeProviderImpl(context)), + final Map namesToMBEs = ModuleMXBeanEntry.create( + this.threadsJavaModule, modulesToSIEs, this.context, + new TypeProviderWrapper(new TypeProviderImpl(this.context)), PACKAGE_NAME); assertFalse(namesToMBEs.isEmpty()); // get threadfactory-naming bean - ModuleMXBeanEntry threadfactoryNamingMXBean = namesToMBEs + final ModuleMXBeanEntry threadfactoryNamingMXBean = namesToMBEs .get(THREADFACTORY_NAMING_MXB_NAME); assertNotNull(threadfactoryNamingMXBean); // get runtime beans - Collection runtimeBeanEntries = threadfactoryNamingMXBean + final Collection runtimeBeanEntries = threadfactoryNamingMXBean .getRuntimeBeans(); assertFalse(runtimeBeanEntries.isEmpty()); // get root runtime bean - RuntimeBeanEntry threadfactoryRuntimeBeanEntry = getRuntimeBeanEntryByJavaName( + final RuntimeBeanEntry threadfactoryRuntimeBeanEntry = getRuntimeBeanEntryByJavaName( runtimeBeanEntries, "NamingThreadFactoryRuntimeMXBean"); assertNotNull(threadfactoryRuntimeBeanEntry); assertTrue(threadfactoryRuntimeBeanEntry.isRoot()); // get thread runtime bean - RuntimeBeanEntry runtimeBeanEntry = getRuntimeBeanEntryByJavaName( + final RuntimeBeanEntry runtimeBeanEntry = getRuntimeBeanEntryByJavaName( runtimeBeanEntries, THREAD_RUNTIME_BEAN_JAVA_NAME); assertNotNull(runtimeBeanEntry); @@ -105,21 +102,21 @@ public class RuntimeBeanEntryTest extends AbstractYangTest { assertEquals(THREAD_RUNTIME_BEAN_YANG_NAME, runtimeBeanEntry.getYangName()); // get thread runtime bean rpcs - List rpcs = new ArrayList( + final List rpcs = new ArrayList<>( runtimeBeanEntry.getRpcs()); assertEquals(2, rpcs.size()); // get sleep rpc and test it - RuntimeBeanEntry.Rpc rpc = getRpcByName(rpcs, SLEEP_RPC_NAME); + final RuntimeBeanEntry.Rpc rpc = getRpcByName(rpcs, SLEEP_RPC_NAME); assertNotNull(rpc); assertEquals(SLEEP_RPC_NAME, rpc.getYangName()); assertTrue(((JavaAttribute)rpc.getReturnType()).getType().getFullyQualifiedName().endsWith(SLEEP_RPC_OUTPUT)); // get sleep rpc input attribute and test it - List attributes = rpc.getParameters(); + final List attributes = rpc.getParameters(); assertEquals(1, attributes.size()); - JavaAttribute attribute = attributes.get(0); + final JavaAttribute attribute = attributes.get(0); assertEquals(SLEEP_RPC_INPUT_NAME, attribute.getAttributeYangName()); assertEquals(SLEEP_RPC_INPUT_TYPE, attribute.getType().getName()); assertEquals(SLEEP_RPC_INPUT_NAME, attribute.getLowerCaseCammelCase()); @@ -132,8 +129,8 @@ public class RuntimeBeanEntryTest extends AbstractYangTest { private RuntimeBeanEntry getRuntimeBeanEntryByJavaName( final Collection runtimeBeanEntries, final String javaName) { - if (runtimeBeanEntries != null && !runtimeBeanEntries.isEmpty()) { - for (RuntimeBeanEntry runtimeBeanEntry : runtimeBeanEntries) { + if ((runtimeBeanEntries != null) && !runtimeBeanEntries.isEmpty()) { + for (final RuntimeBeanEntry runtimeBeanEntry : runtimeBeanEntries) { if (runtimeBeanEntry.getJavaNameOfRuntimeMXBean().equals( javaName)) { return runtimeBeanEntry; @@ -145,8 +142,8 @@ public class RuntimeBeanEntryTest extends AbstractYangTest { private RuntimeBeanEntry.Rpc getRpcByName( final List rpcs, final String name) { - if (rpcs != null && !rpcs.isEmpty()) { - for (RuntimeBeanEntry.Rpc rpc : rpcs) { + if ((rpcs != null) && !rpcs.isEmpty()) { + for (final RuntimeBeanEntry.Rpc rpc : rpcs) { if (rpc.getName().equals(name)) { return rpc; }