Merge "Switch initial config files format to xml and add autodetect adapter for confi...
[controller.git] / opendaylight / config / yang-jmx-generator / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / RuntimeBeanEntryTest.java
index 597cf4ccc9d1cf033cb6ae919662c69ec89008f0..b570302563b9d9c4e00a4171614beb28df578cd8 100644 (file)
@@ -7,29 +7,31 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.openmbean.SimpleType;
-
+import java.util.HashMap;
 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.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 
+import javax.management.openmbean.SimpleType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static org.hamcrest.CoreMatchers.is;
+
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
+
 public class RuntimeBeanEntryTest extends AbstractYangTest {
 
     public static final String PACKAGE_NAME = "packages.sis";
@@ -41,6 +43,7 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
     public static final String SLEEP_RPC_OUTPUT = "ThreadState";
     public static final String SLEEP_RPC_INPUT_NAME = "millis";
     public static final String SLEEP_RPC_INPUT_TYPE = "Long";
+    private static final Map<IdentitySchemaNode, ServiceInterfaceEntry> identitiesToSIs = new HashMap<>();
 
     @Test
     public void createRuntimeBean() {
@@ -61,7 +64,7 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
     public void runtimeBeanRPCTest() {
         // create service interfaces
         Map<QName, ServiceInterfaceEntry> modulesToSIEs = ServiceInterfaceEntry
-                .create(threadsModule, "packages.sis");
+                .create(threadsModule, "packages.sis",identitiesToSIs);
         assertNotNull(modulesToSIEs);
 
         // create MXBeans map
@@ -111,7 +114,8 @@ public class RuntimeBeanEntryTest extends AbstractYangTest {
         RuntimeBeanEntry.Rpc rpc = getRpcByName(rpcs, SLEEP_RPC_NAME);
         assertNotNull(rpc);
         assertThat(rpc.getYangName(), is(SLEEP_RPC_NAME));
-        assertThat(rpc.getReturnType().endsWith(SLEEP_RPC_OUTPUT), is(true));
+
+        assertThat(((JavaAttribute)rpc.getReturnType()).getType().getFullyQualifiedName().endsWith(SLEEP_RPC_OUTPUT),  is(true));
 
         // get sleep rpc input attribute and test it
         List<JavaAttribute> attributes = rpc.getParameters();