@Test void testResolveOptions() throws Exception { CreateImage createImage = new CreateImage(); Field optionsField = CommonOptions.class.getDeclaredField("dockerfileOptions"); optionsField.setAccessible(true); DockerfileOptions dockerfile = new DockerfileOptions("testbuildid"); optionsField.set(createImage, dockerfile); Field imageTagField = CommonOptions.class.getDeclaredField("imageTag"); imageTagField.setAccessible(true); imageTagField.set(createImage, "mydomain:latest"); Field resolveFilesField = CommonOptions.class.getDeclaredField("resolveFiles"); resolveFilesField.setAccessible(true); List<Path> resolveFiles = Arrays.asList(new File("target/test-classes/templates/resolver.yml").toPath(), new File("target/test-classes/templates/verrazzano.yml").toPath()); resolveFilesField.set(createImage, resolveFiles); Utils.writeResolvedFiles(resolveFiles, createImage.resolveOptions()); List<String> linesRead = Files.readAllLines(new File("target/test-classes/templates/resolver.yml").toPath()); assertEquals(2, linesRead.size(), "Number of lines read from the file was unexpected"); for (String line : linesRead) { line = line.trim(); if (line.startsWith("domainHome")) { assertTrue(line.endsWith("/u01/domains/base_domain"), "Invalid domain home value " + line); } else if (line.startsWith("image")) { assertTrue(line.endsWith("mydomain:latest"), "Invalid tag name " + line); } else { fail("Unexpected line read " + line); } } }
List<Object> resolveOptions() { if (resolveFiles != null && !resolveFiles.isEmpty()) { resolveOptions = Collections.singletonList(new VerrazzanoModel(imageTag, dockerfileOptions.domain_home())); } return resolveOptions; }
CommonOptions { List<Object> resolveOptions() { if (resolveFiles != null && !resolveFiles.isEmpty()) { resolveOptions = Collections.singletonList(new VerrazzanoModel(imageTag, dockerfileOptions.domain_home())); } return resolveOptions; } }
CommonOptions { List<Object> resolveOptions() { if (resolveFiles != null && !resolveFiles.isEmpty()) { resolveOptions = Collections.singletonList(new VerrazzanoModel(imageTag, dockerfileOptions.domain_home())); } return resolveOptions; }  }
CommonOptions { List<Object> resolveOptions() { if (resolveFiles != null && !resolveFiles.isEmpty()) { resolveOptions = Collections.singletonList(new VerrazzanoModel(imageTag, dockerfileOptions.domain_home())); } return resolveOptions; }  void copyOptionsFromImage(String fromImage, String tmpDir); }
CommonOptions { List<Object> resolveOptions() { if (resolveFiles != null && !resolveFiles.isEmpty()) { resolveOptions = Collections.singletonList(new VerrazzanoModel(imageTag, dockerfileOptions.domain_home())); } return resolveOptions; }  void copyOptionsFromImage(String fromImage, String tmpDir);  }