[ONOS-4302] RPC translator implementation

Change-Id: I457f12a2b0edaadee5ff888e0297b40854d53096
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
index 95c402a..61775f6 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/InputListenerTest.java
@@ -61,7 +61,7 @@
         assertThat(yangRpc.getName(), is("activate-software-image"));
 
         YangInput yangInput = (YangInput) yangRpc.getChild();
-        assertThat(yangInput.getName(), is("activate-software-imageInput"));
+        assertThat(yangInput.getName(), is("activate-software-image_input"));
         ListIterator<YangLeaf> leafIterator = yangInput.getListOfLeaf().listIterator();
         YangLeaf leafInfo = leafIterator.next();
 
@@ -102,7 +102,7 @@
         assertThat(yangRpc.getName(), is("activate-software-image"));
 
         YangInput yangInput = (YangInput) yangRpc.getChild();
-        assertThat(yangInput.getName(), is("activate-software-imageInput"));
+        assertThat(yangInput.getName(), is("activate-software-image_input"));
         YangTypeDef typeDef = (YangTypeDef) yangInput.getChild();
         assertThat(typeDef.getName(), is("my-type"));
         assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
index ded5c49..2ea9347 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/OutputListenerTest.java
@@ -19,18 +19,17 @@
 import java.io.IOException;
 import java.util.ListIterator;
 import org.junit.Test;
-
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangList;
 import org.onosproject.yangutils.datamodel.YangModule;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangRpc;
 import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
+import org.onosproject.yangutils.datamodel.YangRpc;
 import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
+import org.onosproject.yangutils.datamodel.YangTypeDef;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
 
@@ -61,7 +60,7 @@
         assertThat(yangRpc.getName(), is("activate-software-image"));
 
         YangOutput yangOutput = (YangOutput) yangRpc.getChild();
-        assertThat(yangOutput.getName(), is("activate-software-imageOutput"));
+        assertThat(yangOutput.getName(), is("activate-software-image_output"));
         ListIterator<YangLeaf> leafIterator = yangOutput.getListOfLeaf().listIterator();
         YangLeaf leafInfo = leafIterator.next();
 
@@ -102,7 +101,7 @@
         assertThat(yangRpc.getName(), is("activate-software-image"));
 
         YangOutput yangOutput = (YangOutput) yangRpc.getChild();
-        assertThat(yangOutput.getName(), is("activate-software-imageOutput"));
+        assertThat(yangOutput.getName(), is("activate-software-image_output"));
         YangTypeDef typeDef = (YangTypeDef) yangOutput.getChild();
         assertThat(typeDef.getName(), is("my-type"));
         assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/translator/tojava/utils/RpcTranslatorTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/translator/tojava/utils/RpcTranslatorTest.java
new file mode 100644
index 0000000..b1c7f74
--- /dev/null
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/translator/tojava/utils/RpcTranslatorTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.translator.tojava.utils;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.clean;
+
+/**
+ * Unit tests for rpc translator.
+ */
+public final class RpcTranslatorTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks rpc translation should not result in any exception.
+     */
+    @Test
+    public void processRpcTranslator() throws IOException, ParserException {
+
+        String userDir = System.getProperty("user.dir");
+        YangNode node = manager.getDataModel("src/test/resources/RpcTranslator.yang");
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(userDir + "/target/RpcTestGenFile/");
+
+        generateJavaCode(node, yangPluginConfig);
+
+        clean(userDir + "/target/RpcTestGenFile/");
+    }
+    // TODO enhance the test cases, after having a framework of translator test.
+}