[ONOS-5539] Process sub tree defect fix

Change-Id: I6e06a8ca430a86cc538543b161bbbc56dc9cade6
diff --git a/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java b/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java
index 00331b2..9f461b6 100644
--- a/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java
+++ b/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangPluginUtils.java
@@ -18,18 +18,18 @@
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Plugin;
 import org.apache.maven.model.Resource;
 import org.apache.maven.project.MavenProject;
 import org.onosproject.yangutils.datamodel.YangNode;
 import org.slf4j.Logger;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
-import java.io.PrintWriter;
 import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
@@ -39,8 +39,6 @@
 import java.util.Set;
 
 import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.parseJarFile;
-import static org.onosproject.yangutils.utils.UtilConstants.COLON;
-import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
 import static org.onosproject.yangutils.utils.UtilConstants.HYPHEN;
 import static org.onosproject.yangutils.utils.UtilConstants.JAR;
 import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
@@ -56,14 +54,10 @@
 public final class YangPluginUtils {
 
     private static final Logger log = getLogger(YangPluginUtils.class);
-
-    private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH + YANG_RESOURCES + SLASH;
-
+    private static final String TARGET_RESOURCE_PATH = SLASH + TEMP + SLASH +
+            YANG_RESOURCES + SLASH;
     private static final String SERIALIZED_FILE_EXTENSION = ".ser";
-    private static final String TEXT_FILE_EXTENSION = ".txt";
     private static final String YANG_META_DATA = "YangMetaData";
-    private static final String VERSION_META_DATA = "VersionMetaData";
-    private static final String PLUGIN_ARTIFACT = "onos-yang-maven-plugin";
 
     private YangPluginUtils() {
     }
@@ -75,7 +69,8 @@
      * @param project current maven project
      * @param context current build context
      */
-    static void addToCompilationRoot(String source, MavenProject project, BuildContext context) {
+    static void addToCompilationRoot(String source, MavenProject project,
+                                     BuildContext context) {
         project.addCompileSourceRoot(source);
         context.refresh(project.getBasedir());
         log.info("Source directory added to compilation root: " + source);
@@ -89,15 +84,14 @@
      * @param project      maven project
      * @throws IOException when fails to copy files to destination resource directory
      */
-    static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo, String outputDir, MavenProject project)
+    static void copyYangFilesToTarget(Set<YangFileInfo> yangFileInfo,
+                                      String outputDir, MavenProject project)
             throws IOException {
 
         List<File> files = getListOfFile(yangFileInfo);
-
         String path = outputDir + TARGET_RESOURCE_PATH;
         File targetDir = new File(path);
         targetDir.mkdirs();
-
         for (File file : files) {
             Files.copy(file.toPath(),
                        new File(path + file.getName()).toPath(),
@@ -127,93 +121,58 @@
     /**
      * Serializes data-model.
      *
-     * @param directory   base directory for serialized files
-     * @param fileInfoSet YANG file info set
-     * @param project     maven project
-     * @param operation   true if need to add to resource
+     * @param dir       base directory for serialized files
+     * @param fileSet   YANG file info set
+     * @param project   maven project
+     * @param operation true if need to add to resource
      * @throws IOException when fails to do IO operations
      */
-    public static void serializeDataModel(String directory, Set<YangFileInfo> fileInfoSet,
-                                          MavenProject project, boolean operation) throws IOException {
-
-        String serFileDirPath = directory + TARGET_RESOURCE_PATH;
-        File dir = new File(serFileDirPath);
-        dir.mkdirs();
-
+    public static void serializeDataModel(String dir, Set<YangFileInfo> fileSet,
+                                          MavenProject project, boolean operation)
+            throws IOException {
+        String serFileDirPath = dir + TARGET_RESOURCE_PATH;
+        File dir1 = new File(serFileDirPath);
+        dir1.mkdirs();
         if (operation) {
-            addToProjectResource(directory + SLASH + TEMP + SLASH, project);
+            addToProjectResource(dir + SLASH + TEMP + SLASH, project);
         }
-
         Set<YangNode> nodes = new HashSet<>();
-        for (YangFileInfo fileInfo : fileInfoSet) {
+        for (YangFileInfo fileInfo : fileSet) {
             nodes.add(fileInfo.getRootNode());
         }
 
-        String serFileName = serFileDirPath + YANG_META_DATA + SERIALIZED_FILE_EXTENSION;
-        FileOutputStream fileOutputStream = new FileOutputStream(serFileName);
-        ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
+        String serFileName = serFileDirPath + YANG_META_DATA +
+                SERIALIZED_FILE_EXTENSION;
+        FileOutputStream out = new FileOutputStream(serFileName);
+        ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
         objectOutputStream.writeObject(nodes);
         objectOutputStream.close();
-        fileOutputStream.close();
-        if (operation) {
-            addVersionMetaDataFile(project, serFileDirPath);
-        }
-    }
-
-    /**
-     * Adds version meta data files for YSR to know version of YANG tools.
-     *
-     * @param project maven project
-     * @param dir     directory
-     * @throws IOException when fails to do IO operations
-     */
-    private static void addVersionMetaDataFile(MavenProject project, String dir)
-            throws IOException {
-        List<Plugin> plugins = project.getBuildPlugins();
-        Iterator<Plugin> it = plugins.iterator();
-        Plugin plugin = it.next();
-        String data = EMPTY_STRING;
-        while (it.hasNext()) {
-            if (plugin.getArtifactId().equals(PLUGIN_ARTIFACT)) {
-                data = plugin.getGroupId() + COLON + plugin.getArtifactId()
-                        + COLON + plugin.getVersion();
-            }
-            plugin = it.next();
-        }
-        if (data.equals(EMPTY_STRING)) {
-            throw new IOException("Invalid artifact for " + PLUGIN_ARTIFACT);
-        }
-        String verFileName = dir + VERSION_META_DATA + TEXT_FILE_EXTENSION;
-        PrintWriter out = new PrintWriter(verFileName);
-        out.print(data);
         out.close();
     }
 
     /**
      * Returns list of jar path.
      *
-     * @param project         maven project
-     * @param localRepository local repository
-     * @param remoteRepos     remote repository
+     * @param project     maven project
+     * @param localRepo   local repository
+     * @param remoteRepos remote repository
      * @return list of jar paths
      */
-    private static List<String> resolveDependencyJarPath(MavenProject project, ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepos) {
+    private static List<String> resolveDependencyJarPath(
+            MavenProject project, ArtifactRepository localRepo,
+            List<ArtifactRepository> remoteRepos) {
 
         StringBuilder path = new StringBuilder();
         List<String> jarPaths = new ArrayList<>();
         for (Object obj : project.getDependencies()) {
 
             Dependency dependency = (Dependency) obj;
-            path.append(localRepository.getBasedir());
-            path.append(SLASH);
-            path.append(getPackageDirPathFromJavaJPackage(dependency.getGroupId()));
-            path.append(SLASH);
-            path.append(dependency.getArtifactId());
-            path.append(SLASH);
-            path.append(dependency.getVersion());
-            path.append(SLASH);
-            path.append(dependency.getArtifactId() + HYPHEN + dependency.getVersion() + PERIOD + JAR);
+            path.append(localRepo.getBasedir()).append(SLASH)
+                    .append(getPackageDirPathFromJavaJPackage(dependency.getGroupId()))
+                    .append(SLASH).append(dependency.getArtifactId())
+                    .append(SLASH).append(dependency.getVersion()).append(SLASH)
+                    .append(dependency.getArtifactId()).append(HYPHEN)
+                    .append(dependency.getVersion()).append(PERIOD).append(JAR);
             File jarFile = new File(path.toString());
             if (jarFile.exists()) {
                 jarPaths.add(path.toString());
@@ -230,21 +189,23 @@
     /**
      * Resolves inter jar dependencies.
      *
-     * @param project         current maven project
-     * @param localRepository local maven repository
-     * @param remoteRepos     list of remote repository
-     * @param directory       directory for serialized files
+     * @param project     current maven project
+     * @param localRepo   local maven repository
+     * @param remoteRepos list of remote repository
+     * @param dir         directory for serialized files
      * @return list of resolved datamodel nodes
      * @throws IOException when fails to do IO operations
      */
-    static List<YangNode> resolveInterJarDependencies(MavenProject project, ArtifactRepository localRepository,
-                                                      List<ArtifactRepository> remoteRepos, String directory)
+    static List<YangNode> resolveInterJarDependencies(
+            MavenProject project, ArtifactRepository localRepo,
+            List<ArtifactRepository> remoteRepos, String dir)
             throws IOException {
 
-        List<String> dependenciesJarPaths = resolveDependencyJarPath(project, localRepository, remoteRepos);
+        List<String> dependenciesJarPaths =
+                resolveDependencyJarPath(project, localRepo, remoteRepos);
         List<YangNode> resolvedDataModelNodes = new ArrayList<>();
         for (String dependency : dependenciesJarPaths) {
-            resolvedDataModelNodes.addAll(parseJarFile(dependency, directory));
+            resolvedDataModelNodes.addAll(parseJarFile(dependency, dir));
         }
         return resolvedDataModelNodes;
     }
diff --git a/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
index c56d8aa..ba0f6fd 100644
--- a/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ b/plugin/maven/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -78,8 +78,7 @@
  */
 @Mojo(name = "yang2java", defaultPhase = PROCESS_SOURCES,
         requiresDependencyResolution = COMPILE)
-public class YangUtilManager
-        extends AbstractMojo {
+public class YangUtilManager extends AbstractMojo {
 
     private static final String DEFAULT_PKG =
             getPackageDirPathFromJavaJPackage(DEFAULT_BASE_PKG);
@@ -278,7 +277,7 @@
      *
      * @return YANG node set
      */
-    Set<YangNode> getYangNodeSet() {
+    public Set<YangNode> getYangNodeSet() {
         return yangNodeSet;
     }
 
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
index c4a2341..531a285 100644
--- a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
@@ -57,7 +57,7 @@
         yangPluginConfig.setCodeGenDir(DIR);
         utilManager.translateToJava(yangPluginConfig);
         compileCode(COMP);
-        //deleteDirectory(DIR);
+        deleteDirectory(DIR);
     }
 
     /**
@@ -113,8 +113,6 @@
     @Test
     public void processChoiceAugmentInterTranslator() throws IOException,
             ParserException, MojoExecutionException {
-        //FIXME: for augment having node with child nodes.
-        /*
         deleteDirectory(DIR);
         String searchDir = "src/test/resources/choiceAugment";
         utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
@@ -127,7 +125,6 @@
         utilManager.translateToJava(yangPluginConfig);
         compileCode(COMP);
         deleteDirectory(DIR);
-        */
     }
 
 }
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
index 662b7e5..367bf82 100644
--- a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
@@ -16,11 +16,13 @@
 
 package org.onosproject.yangutils.plugin.manager;
 
+import org.apache.maven.plugin.MojoExecutionException;
 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 org.onosproject.yangutils.utils.io.YangPluginConfig;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
 
 import java.io.File;
 import java.io.IOException;
@@ -33,7 +35,10 @@
  * Unit tests for choice-case translator.
  */
 public final class ChoiceCaseTranslatorTest {
-
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/ChoiceCaseTestGenFile/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
     private final YangUtilsParserManager manager = new YangUtilsParserManager();
 
     /**
@@ -54,5 +59,26 @@
         compileCode(dir1);
         deleteDirectory(dir);
     }
-    // TODO enhance the test cases, after having a framework of translator test.
+
+    /**
+     * Checks augment translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processChoiceAllTranslator() throws IOException,
+            ParserException, MojoExecutionException {
+        deleteDirectory(DIR);
+        String searchDir = "src/test/resources/choiceTranslator";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        compileCode(COMP);
+        deleteDirectory(DIR);
+    }
 }
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/GroupingTranslatorTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/GroupingTranslatorTest.java
new file mode 100644
index 0000000..a590cc0
--- /dev/null
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/GroupingTranslatorTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.plugin.manager;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.utils.io.YangPluginConfig;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.onosproject.yangutils.utils.io.YangPluginConfig.compileCode;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Unit test case for grouping translator.
+ */
+public class GroupingTranslatorTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/groupingTranslator/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks grouping translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        deleteDirectory(DIR);
+        String searchDir = "src/test/resources/grouping";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        compileCode(COMP);
+        deleteDirectory(DIR);
+    }
+
+}
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/IdentityTranslatorTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/IdentityTranslatorTest.java
index 4e9cdcb..adeb42f 100644
--- a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/IdentityTranslatorTest.java
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/IdentityTranslatorTest.java
@@ -57,6 +57,6 @@
         yangPluginConfig.setCodeGenDir(DIR);
         utilManager.translateToJava(yangPluginConfig);
         compileCode(COMP);
-        //deleteDirectory(DIR);
+        deleteDirectory(DIR);
     }
 }
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
index 6ec65b9..e80bf0b 100644
--- a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
@@ -49,6 +49,7 @@
 import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
 import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
 import static org.onosproject.yangutils.utils.UtilConstants.YANG_RESOURCES;
+import static org.onosproject.yangutils.utils.io.impl.YangFileScanner.getYangFiles;
 import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
 
 /**
@@ -78,7 +79,7 @@
     @Test
     public void processSingleJarLinking()
             throws IOException, MojoExecutionException {
-        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
+        utilManager.createYangFileInfoSet(getYangFiles(YANG_FILES_DIR));
         Set<YangFileInfo> info = utilManager.getYangFileInfoSet();
         int size1 = info.size();
         utilManager.parseYangFileInfoSet();
@@ -104,7 +105,7 @@
     @Test
     public void processMultipleJarLinking()
             throws IOException, MojoExecutionException {
-        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(YANG_FILES_DIR));
+        utilManager.createYangFileInfoSet(getYangFiles(YANG_FILES_DIR));
 
         Set<YangFileInfo> info = utilManager.getYangFileInfoSet();
         int size1 = info.size();
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ProcessSubTreeCodeGenTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ProcessSubTreeCodeGenTest.java
new file mode 100644
index 0000000..501e2bc
--- /dev/null
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/plugin/manager/ProcessSubTreeCodeGenTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.plugin.manager;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.utils.io.YangPluginConfig;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.onosproject.yangutils.utils.io.YangPluginConfig.compileCode;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Unit test case for process sub tree code generation test.
+ */
+public class ProcessSubTreeCodeGenTest {
+
+    private final YangUtilManager utilManager = new YangUtilManager();
+    private static final String DIR = "target/pstf/";
+    private static final String COMP = System.getProperty("user.dir") + File
+            .separator + DIR;
+
+    /**
+     * Checks pst translation should not result in any exception.
+     *
+     * @throws MojoExecutionException
+     */
+    @Test
+    public void processTranslator() throws IOException, ParserException, MojoExecutionException {
+
+        deleteDirectory(DIR);
+        String searchDir = "src/test/resources/pstcodegen";
+        utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+        utilManager.parseYangFileInfoSet();
+        utilManager.createYangNodeSet();
+        utilManager.resolveDependenciesUsingLinker();
+
+        YangPluginConfig yangPluginConfig = new YangPluginConfig();
+        yangPluginConfig.setCodeGenDir(DIR);
+        utilManager.translateToJava(yangPluginConfig);
+        compileCode(COMP);
+        //deleteDirectory(DIR);
+    }
+
+}
diff --git a/plugin/maven/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java b/plugin/maven/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
index a6fdf76..6a31ba0 100644
--- a/plugin/maven/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
+++ b/plugin/maven/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
@@ -203,7 +203,7 @@
         String method = getConstructor(testAttr, GENERATE_SERVICE_AND_MANAGER
         );
         assertThat(true, is(method.contains(
-                THIS + PERIOD + ATTRIBUTE_NAME + SPACE + EQUAL + SPACE +
+                ATTRIBUTE_NAME + SPACE + EQUAL + SPACE +
                         BUILDER_LOWER_CASE + OBJECT + PERIOD +
                         GET_METHOD_PREFIX + CLASS_NAME + OPEN_PARENTHESIS +
                         CLOSE_PARENTHESIS + SEMI_COLON)));
diff --git a/plugin/maven/src/test/resources/choiceAugment/all.yang b/plugin/maven/src/test/resources/choiceAugment/all.yang
deleted file mode 100644
index 4c08537..0000000
--- a/plugin/maven/src/test/resources/choiceAugment/all.yang
+++ /dev/null
@@ -1,128 +0,0 @@
-module ietf-inet {
-
-  namespace "yang:all";
-  prefix "inet";
-  yang-version 1;
-
-  choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-           }
-       }
-   }
-
-
-   container c {
-       choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-   }
-
-   list l {
-   config false;
-choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-   }
-
-
-   grouping g {
-    choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-   }
-
-   notification n {
-    choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-    }
-    rpc r {
-        input {
-           choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-       }
-      output {
-        choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-        }
-     }
-
-     augment /name {
-        choice name {
-             case a {
-                 leaf udp {
-                     type empty;
-                 }
-             }
-             case b {
-                 leaf tcp {
-                    type empty;
-                 }
-             }
-         }
-     }
-
-}
\ No newline at end of file
diff --git a/plugin/maven/src/test/resources/choiceTranslator/all.yang b/plugin/maven/src/test/resources/choiceTranslator/all.yang
new file mode 100644
index 0000000..be2fd07
--- /dev/null
+++ b/plugin/maven/src/test/resources/choiceTranslator/all.yang
@@ -0,0 +1,157 @@
+module all {
+
+  namespace "yang:all";
+  prefix "all";
+  yang-version 1;
+
+  choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+           }
+       }
+   }
+
+
+   container c {
+       choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+
+   list l {
+   config false;
+choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+
+
+   grouping g {
+    choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+   }
+    rpc r {
+        input {
+           choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+       }
+      output {
+        choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+             }
+             case b {
+                 leaf tcp {
+                    type empty;
+                 }
+             }
+         }
+        }
+     }
+
+     augment /name {
+        choice name {
+             case a {
+                 leaf udp {
+                     type empty;
+                 }
+                 container cont1 {
+                     container cont2 {
+                     choice name {
+                                  case a {
+                                      leaf udp {
+                                          type empty;
+                                      }
+                                      container cont1 {
+                                          container cont2 {
+                                               leaf udp1 {
+                                                  type empty;
+                                                   }
+                                           }
+                                          leaf udp2 {
+                                              type empty;
+                                          }
+                                      }
+                                  }
+                                  case b {
+                                      leaf tcp3 {
+                                         type empty;
+                                      }
+                                  }
+                              }
+                          leaf udp4 {
+                             type empty;
+                              }
+                      }
+                     leaf udp5 {
+                         type empty;
+                     }
+                 }
+             }
+             case b {
+                 leaf tcp2 {
+                    type empty;
+                 }
+             }
+         }
+         choice name1 {
+                      case a {
+                          leaf udp {
+                              type empty;
+                          }
+                      }
+                      case b {
+                          leaf tcp {
+                             type empty;
+                          }
+                      }
+                  }
+     }
+
+}
\ No newline at end of file
diff --git a/plugin/maven/src/test/resources/grouping/grouping.yang b/plugin/maven/src/test/resources/grouping/grouping.yang
new file mode 100644
index 0000000..518150f
--- /dev/null
+++ b/plugin/maven/src/test/resources/grouping/grouping.yang
@@ -0,0 +1,58 @@
+module grouping {
+
+  namespace "yang:grouping";
+  prefix "grouping";
+  yang-version 1;
+  revision 2016-10-08;
+
+  grouping link-details {
+      leaf link-id {
+          type union {
+              type int32;
+              type uint16;
+              type enumeration {
+                   enum one;
+                   enum two;
+                   enum five {
+                      value 5;
+                   }
+                   enum six-square {
+                      value 36;
+                   }
+              }
+          }
+      }
+      typedef group {
+          type bits {
+              bit disable-nagle {
+                  position 0;
+                           }
+              bit auto-sense-speed {
+                  position 1;
+              }
+              bit Mb-only {
+                  position 2;
+              }
+          }
+      }
+      container link {
+          leaf port {
+            type int32;
+          }
+  
+          leaf-list port-id {
+              type string;
+          }
+          list areas {
+             key "name1";
+             leaf name1 {
+              type string;
+             }
+          }
+      }
+  }
+
+  container cont2 {
+       uses link-details;
+  }
+}
diff --git a/plugin/maven/src/test/resources/pstcodegen/test.yang b/plugin/maven/src/test/resources/pstcodegen/test.yang
new file mode 100644
index 0000000..93e1476
--- /dev/null
+++ b/plugin/maven/src/test/resources/pstcodegen/test.yang
@@ -0,0 +1,83 @@
+module test {
+    namespace "test:test";
+    prefix test;
+
+    container cont1 {
+        leaf leaf1 {
+            type int32;
+        }
+        leaf-list leaf-list1 {
+            type int32;
+        }
+        list list1 {
+            key "name";
+            leaf name {
+                type string;
+            }
+        }
+        container cont2 {
+            leaf leaf2 {
+                type int32;
+            }
+        }
+    }
+    leaf leaf2 {
+        type int32;
+    }
+    leaf-list leaf-list2 {
+        type int32;
+    }
+    list list2 {
+        key "name";
+        leaf name {
+            type string;
+        }
+    }
+    choice choice1 {
+         case case1 {
+             leaf leaf3 {
+                 type int32;
+             }
+             leaf-list leaf-list3 {
+                 type int32;
+             }
+             list list3 {
+                 key "name";
+                 leaf name {
+                     type string;
+                 }
+             }
+         }
+    }
+    grouping group1 {
+        container cont1 {
+            leaf leaf1 {
+                type int32;
+            }
+            leaf-list leaf-list1 {
+                type int32;
+            }
+            list list1 {
+                key "name";
+                leaf name {
+                    type string;
+                }
+            }
+            container cont2 {
+                leaf leaf2 {
+                    type int32;
+                }
+            }
+        }
+    }
+    rpc rpc1 {
+        input {
+            uses group1;
+        }
+    }
+    augment /cont1/list1 {
+        leaf leaf2 {
+            type int64;
+        }
+    }
+}
\ No newline at end of file