@Test public void addPackageInfoTest() throws IOException { File dirPath = new File(CREATE_PATH); dirPath.mkdirs(); addPackageInfo(dirPath, CHECK1, CREATE_PATH, false, getStubPluginConfig()); File filePath = new File(dirPath + File.separator + PKG_INFO); assertThat(filePath.isFile(), is(true)); FileUtils.deleteDirectory(dirPath); }
public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException { pack = parsePkg(pack); try { File packageInfo = new File(path + SLASH + "package-info.java"); packageInfo.createNewFile(); FileWriter fileWriter = new FileWriter(packageInfo); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(CopyrightHeader.getCopyrightHeader()); bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig)); String pkg = PACKAGE + SPACE + pack + SEMI_COLAN; if (pkg.length() > LINE_SIZE) { pkg = whenDelimiterIsPersent(pkg, LINE_SIZE); } bufferedWriter.write(pkg); bufferedWriter.close(); fileWriter.close(); } catch (IOException e) { throw new IOException("Exception occured while creating package info file."); } }
YangIoUtils { public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException { pack = parsePkg(pack); try { File packageInfo = new File(path + SLASH + "package-info.java"); packageInfo.createNewFile(); FileWriter fileWriter = new FileWriter(packageInfo); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(CopyrightHeader.getCopyrightHeader()); bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig)); String pkg = PACKAGE + SPACE + pack + SEMI_COLAN; if (pkg.length() > LINE_SIZE) { pkg = whenDelimiterIsPersent(pkg, LINE_SIZE); } bufferedWriter.write(pkg); bufferedWriter.close(); fileWriter.close(); } catch (IOException e) { throw new IOException("Exception occured while creating package info file."); } } }
YangIoUtils { public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException { pack = parsePkg(pack); try { File packageInfo = new File(path + SLASH + "package-info.java"); packageInfo.createNewFile(); FileWriter fileWriter = new FileWriter(packageInfo); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(CopyrightHeader.getCopyrightHeader()); bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig)); String pkg = PACKAGE + SPACE + pack + SEMI_COLAN; if (pkg.length() > LINE_SIZE) { pkg = whenDelimiterIsPersent(pkg, LINE_SIZE); } bufferedWriter.write(pkg); bufferedWriter.close(); fileWriter.close(); } catch (IOException e) { throw new IOException("Exception occured while creating package info file."); } } private  YangIoUtils(); }
YangIoUtils { public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException { pack = parsePkg(pack); try { File packageInfo = new File(path + SLASH + "package-info.java"); packageInfo.createNewFile(); FileWriter fileWriter = new FileWriter(packageInfo); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(CopyrightHeader.getCopyrightHeader()); bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig)); String pkg = PACKAGE + SPACE + pack + SEMI_COLAN; if (pkg.length() > LINE_SIZE) { pkg = whenDelimiterIsPersent(pkg, LINE_SIZE); } bufferedWriter.write(pkg); bufferedWriter.close(); fileWriter.close(); } catch (IOException e) { throw new IOException("Exception occured while creating package info file."); } } private  YangIoUtils(); static File createDirectories(String path); static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode,
            YangPluginConfig pluginConfig); static String parsePkg(String pack); static void deleteDirectory(String dir); static void searchAndDeleteTempDir(String root); static String trimAtLast(String valueString, String removealStirng); static String partString(String partString); static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg); static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg); static void mergeJavaFiles(File appendFile, File srcFile); static void insertDataIntoJavaFile(File file, String data); static File validateLineLength(File dataFile); static String getJavaPackageFromPackagePath(String packagePath); static String getPackageDirPathFromJavaJPackage(String packagePath); static String getSmallCase(String yangIdentifier); static String getCapitalCase(String yangIdentifier); static String restrictConsecutiveCapitalCase(String consecCapitalCaseRemover); static String addPrefix(String camelCasePrefix, YangToJavaNamingConflictUtil conflictResolver); static String applyCamelCaseRule(String[] stringArray, YangToJavaNamingConflictUtil conflictResolver); static String upperCaseConflictResolver(String[] stringArray,
                                                   YangToJavaNamingConflictUtil conflictResolver); static String getCamelCase(String yangIdentifier, YangToJavaNamingConflictUtil conflictResolver); static String getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver); }
YangIoUtils { public static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException { pack = parsePkg(pack); try { File packageInfo = new File(path + SLASH + "package-info.java"); packageInfo.createNewFile(); FileWriter fileWriter = new FileWriter(packageInfo); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(CopyrightHeader.getCopyrightHeader()); bufferedWriter.write(getJavaDoc(PACKAGE_INFO, classInfo, isChildNode, pluginConfig)); String pkg = PACKAGE + SPACE + pack + SEMI_COLAN; if (pkg.length() > LINE_SIZE) { pkg = whenDelimiterIsPersent(pkg, LINE_SIZE); } bufferedWriter.write(pkg); bufferedWriter.close(); fileWriter.close(); } catch (IOException e) { throw new IOException("Exception occured while creating package info file."); } } private  YangIoUtils(); static File createDirectories(String path); static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode,
            YangPluginConfig pluginConfig); static String parsePkg(String pack); static void deleteDirectory(String dir); static void searchAndDeleteTempDir(String root); static String trimAtLast(String valueString, String removealStirng); static String partString(String partString); static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg); static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg); static void mergeJavaFiles(File appendFile, File srcFile); static void insertDataIntoJavaFile(File file, String data); static File validateLineLength(File dataFile); static String getJavaPackageFromPackagePath(String packagePath); static String getPackageDirPathFromJavaJPackage(String packagePath); static String getSmallCase(String yangIdentifier); static String getCapitalCase(String yangIdentifier); static String restrictConsecutiveCapitalCase(String consecCapitalCaseRemover); static String addPrefix(String camelCasePrefix, YangToJavaNamingConflictUtil conflictResolver); static String applyCamelCaseRule(String[] stringArray, YangToJavaNamingConflictUtil conflictResolver); static String upperCaseConflictResolver(String[] stringArray,
                                                   YangToJavaNamingConflictUtil conflictResolver); static String getCamelCase(String yangIdentifier, YangToJavaNamingConflictUtil conflictResolver); static String getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver);  }