@Test void oracleHomeFromResponseFile() throws Exception { LoggingFacade logger = LoggingFactory.getLogger(CachedFile.class); Level oldLevel = logger.getLevel(); logger.setLevel(Level.WARNING); try { Path responseFile = Paths.get("./src/test/resources/utilsTest/responseFile1.txt"); List<Path> responseFiles = new ArrayList<>(); responseFiles.add(responseFile); DockerfileOptions options = new DockerfileOptions("tests"); Utils.setOracleHome(responseFiles, options); assertEquals("/my/oraclehomeDir", options.oracle_home(), "set Oracle Home from response file failed"); } finally { logger.setLevel(oldLevel); } }
public static void setOracleHome(List<Path> responseFiles, DockerfileOptions options) throws IOException { if (responseFiles == null || responseFiles.size() < 1) { return; } Path installerResponseFile = responseFiles.get(0); Pattern pattern = Pattern.compile("^\\s*ORACLE_HOME=(.*)?"); Matcher matcher = pattern.matcher(""); logger.finer("Reading installer response file: {0}", installerResponseFile.getFileName()); try (BufferedReader reader = new BufferedReader(new FileReader(installerResponseFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { logger.finest("Read response file line: {0}", line); matcher.reset(line); if (matcher.find()) { String oracleHome = matcher.group(1); if (oracleHome != null) { options.setOracleHome(oracleHome); logger.info("IMG-0010", oracleHome); } break; } } } catch (FileNotFoundException notFound) { logger.severe("Unable to find installer response file: {0}", installerResponseFile); throw notFound; } }
Utils { public static void setOracleHome(List<Path> responseFiles, DockerfileOptions options) throws IOException { if (responseFiles == null || responseFiles.size() < 1) { return; } Path installerResponseFile = responseFiles.get(0); Pattern pattern = Pattern.compile("^\\s*ORACLE_HOME=(.*)?"); Matcher matcher = pattern.matcher(""); logger.finer("Reading installer response file: {0}", installerResponseFile.getFileName()); try (BufferedReader reader = new BufferedReader(new FileReader(installerResponseFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { logger.finest("Read response file line: {0}", line); matcher.reset(line); if (matcher.find()) { String oracleHome = matcher.group(1); if (oracleHome != null) { options.setOracleHome(oracleHome); logger.info("IMG-0010", oracleHome); } break; } } } catch (FileNotFoundException notFound) { logger.severe("Unable to find installer response file: {0}", installerResponseFile); throw notFound; } } }
Utils { public static void setOracleHome(List<Path> responseFiles, DockerfileOptions options) throws IOException { if (responseFiles == null || responseFiles.size() < 1) { return; } Path installerResponseFile = responseFiles.get(0); Pattern pattern = Pattern.compile("^\\s*ORACLE_HOME=(.*)?"); Matcher matcher = pattern.matcher(""); logger.finer("Reading installer response file: {0}", installerResponseFile.getFileName()); try (BufferedReader reader = new BufferedReader(new FileReader(installerResponseFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { logger.finest("Read response file line: {0}", line); matcher.reset(line); if (matcher.find()) { String oracleHome = matcher.group(1); if (oracleHome != null) { options.setOracleHome(oracleHome); logger.info("IMG-0010", oracleHome); } break; } } } catch (FileNotFoundException notFound) { logger.severe("Unable to find installer response file: {0}", installerResponseFile); throw notFound; } } private  Utils(); }
Utils { public static void setOracleHome(List<Path> responseFiles, DockerfileOptions options) throws IOException { if (responseFiles == null || responseFiles.size() < 1) { return; } Path installerResponseFile = responseFiles.get(0); Pattern pattern = Pattern.compile("^\\s*ORACLE_HOME=(.*)?"); Matcher matcher = pattern.matcher(""); logger.finer("Reading installer response file: {0}", installerResponseFile.getFileName()); try (BufferedReader reader = new BufferedReader(new FileReader(installerResponseFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { logger.finest("Read response file line: {0}", line); matcher.reset(line); if (matcher.find()) { String oracleHome = matcher.group(1); if (oracleHome != null) { options.setOracleHome(oracleHome); logger.info("IMG-0010", oracleHome); } break; } } } catch (FileNotFoundException notFound) { logger.severe("Unable to find installer response file: {0}", installerResponseFile); throw notFound; } } private  Utils(); static void copyResourceAsFile(String resourcePath, String destPath, boolean markExec); static void copyLocalFile(Path sourcePath, Path destPath, boolean markExec); static void copyLocalDirectory(Path sourcePath, Path destPath, boolean markExec); static void setProxyIfRequired(String httpProxyUrl, String httpsProxyUrl, String nonProxyHosts); static String writeDockerfile(String destPath, String template, DockerfileOptions options, boolean dryRun); static void writeResolvedFiles(List<Path> paths, List<Object> options); static void deleteFilesRecursively(String pathDir); static int compareVersions(String thisVersion, String otherVersion); static boolean isEmptyString(String s); static Properties getBaseImageProperties(String dockerImage, String tmpDir); static String findProxyUrl(String proxyUrl, String protocol); static String getPasswordFromInputs(String passwordStr, Path passwordFile, String passwordEnv); static String getEnvironmentProperty(String name); static String getBuildWorkingDir(); static String getOpatchVersionFromZip(String fileName); static boolean validatePatchIds(List<String> patches, boolean rigid); static void setOracleHome(List<Path> responseFiles, DockerfileOptions options); static void setInventoryLocation(String inventoryLocFile, DockerfileOptions options); static String getMessage(@PropertyKey(resourceBundle = "ImageTool") String key, Object... params); static void removeIntermediateDockerImages(String buildId); static String getPsuVersion(String lsInventory); @SafeVarargs static List<T> list(Collection<? extends T> start, T... elements); }
Utils { public static void setOracleHome(List<Path> responseFiles, DockerfileOptions options) throws IOException { if (responseFiles == null || responseFiles.size() < 1) { return; } Path installerResponseFile = responseFiles.get(0); Pattern pattern = Pattern.compile("^\\s*ORACLE_HOME=(.*)?"); Matcher matcher = pattern.matcher(""); logger.finer("Reading installer response file: {0}", installerResponseFile.getFileName()); try (BufferedReader reader = new BufferedReader(new FileReader(installerResponseFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { logger.finest("Read response file line: {0}", line); matcher.reset(line); if (matcher.find()) { String oracleHome = matcher.group(1); if (oracleHome != null) { options.setOracleHome(oracleHome); logger.info("IMG-0010", oracleHome); } break; } } } catch (FileNotFoundException notFound) { logger.severe("Unable to find installer response file: {0}", installerResponseFile); throw notFound; } } private  Utils(); static void copyResourceAsFile(String resourcePath, String destPath, boolean markExec); static void copyLocalFile(Path sourcePath, Path destPath, boolean markExec); static void copyLocalDirectory(Path sourcePath, Path destPath, boolean markExec); static void setProxyIfRequired(String httpProxyUrl, String httpsProxyUrl, String nonProxyHosts); static String writeDockerfile(String destPath, String template, DockerfileOptions options, boolean dryRun); static void writeResolvedFiles(List<Path> paths, List<Object> options); static void deleteFilesRecursively(String pathDir); static int compareVersions(String thisVersion, String otherVersion); static boolean isEmptyString(String s); static Properties getBaseImageProperties(String dockerImage, String tmpDir); static String findProxyUrl(String proxyUrl, String protocol); static String getPasswordFromInputs(String passwordStr, Path passwordFile, String passwordEnv); static String getEnvironmentProperty(String name); static String getBuildWorkingDir(); static String getOpatchVersionFromZip(String fileName); static boolean validatePatchIds(List<String> patches, boolean rigid); static void setOracleHome(List<Path> responseFiles, DockerfileOptions options); static void setInventoryLocation(String inventoryLocFile, DockerfileOptions options); static String getMessage(@PropertyKey(resourceBundle = "ImageTool") String key, Object... params); static void removeIntermediateDockerImages(String buildId); static String getPsuVersion(String lsInventory); @SafeVarargs static List<T> list(Collection<? extends T> start, T... elements);  }