@Test public void getTerraformExampleModuleDirReturnsTheRootModuleDirRelativeToTheTfExamplesDir() throws IOException, TerraformException { try { FileUtils.copyDirectory( Paths.get("src", "test", "resources", "tf_initialized", "root").toFile(), Paths.get("src", "main", "tf-examples", "test").toFile() ); Path tfRootModulePath = TerraformUtils.getTerraformRootModuleDir("tf-examples/test"); Assert.assertEquals(Paths.get("src", "main", "tf-examples", "test"), tfRootModulePath); } finally { FileUtils.forceDelete(Paths.get("src", "main", "tf-examples").toFile()); } }
public static Path getTerraformRootModuleDir(String tfmodule) throws IOException, TerraformException { Path path; if (tfmodule.startsWith("tf-examples")) { path = Paths.get("src", "main", tfmodule); } else if (tfmodule.contains(File.separator)) { path = Paths.get(tfmodule); } else { path = Paths.get("src", "main", "tf", tfmodule); } if (!path.toFile().exists()) { throw new TerraformException(String.format("%1$s does not exist", tfmodule)); } return path; }
TerraformUtils { public static Path getTerraformRootModuleDir(String tfmodule) throws IOException, TerraformException { Path path; if (tfmodule.startsWith("tf-examples")) { path = Paths.get("src", "main", tfmodule); } else if (tfmodule.contains(File.separator)) { path = Paths.get(tfmodule); } else { path = Paths.get("src", "main", "tf", tfmodule); } if (!path.toFile().exists()) { throw new TerraformException(String.format("%1$s does not exist", tfmodule)); } return path; } }
TerraformUtils { public static Path getTerraformRootModuleDir(String tfmodule) throws IOException, TerraformException { Path path; if (tfmodule.startsWith("tf-examples")) { path = Paths.get("src", "main", tfmodule); } else if (tfmodule.contains(File.separator)) { path = Paths.get(tfmodule); } else { path = Paths.get("src", "main", "tf", tfmodule); } if (!path.toFile().exists()) { throw new TerraformException(String.format("%1$s does not exist", tfmodule)); } return path; } private  TerraformUtils(); }
TerraformUtils { public static Path getTerraformRootModuleDir(String tfmodule) throws IOException, TerraformException { Path path; if (tfmodule.startsWith("tf-examples")) { path = Paths.get("src", "main", tfmodule); } else if (tfmodule.contains(File.separator)) { path = Paths.get(tfmodule); } else { path = Paths.get("src", "main", "tf", tfmodule); } if (!path.toFile().exists()) { throw new TerraformException(String.format("%1$s does not exist", tfmodule)); } return path; } private  TerraformUtils(); static Path getDefaultTerraformRootModuleDir(); static Path getTerraformRootModuleDir(String tfmodule); static Path getDefaultTfModulesDir(); }
TerraformUtils { public static Path getTerraformRootModuleDir(String tfmodule) throws IOException, TerraformException { Path path; if (tfmodule.startsWith("tf-examples")) { path = Paths.get("src", "main", tfmodule); } else if (tfmodule.contains(File.separator)) { path = Paths.get(tfmodule); } else { path = Paths.get("src", "main", "tf", tfmodule); } if (!path.toFile().exists()) { throw new TerraformException(String.format("%1$s does not exist", tfmodule)); } return path; } private  TerraformUtils(); static Path getDefaultTerraformRootModuleDir(); static Path getTerraformRootModuleDir(String tfmodule); static Path getDefaultTfModulesDir();  }