@Test public void expandArtifactsUnzipsAllArtifactsInaDirectory() throws IOException, TerraformException { Log log = Mockito.mock(Log.class); TerraformGet terraformGet = new TerraformGet(log, tfModules); terraformGet.expandMavenArtifacts(tfModules); List<Path> directories = Files.walk(tfModules, 1) .filter(path -> !tfModules.equals(path)) .collect(Collectors.toList()); Assert.assertEquals(directories.size(), 3); Assert.assertTrue(directories.stream().anyMatch(path -> path.getFileName().toString().equals("my.module2"))); Assert.assertTrue(directories.stream().anyMatch(path -> path.getFileName().toString().equals("my-module1"))); Assert.assertTrue(directories.stream().anyMatch(path -> path.getFileName().toString().equals("my-module3"))); }
final List<Path> expandMavenArtifacts(Path directory) throws TerraformException { log.info("Expanding artifacts from " + directory.toAbsolutePath()); try { List<Path> result = new ArrayList<>(); List<Path> zipFiles = Files.walk(directory, 1) .filter(path -> path.getFileName().toString().endsWith(".zip")) .collect(Collectors.toList()); for (Path zipFile : zipFiles) { result.add((new ExpandableZippedArtifact(zipFile, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + zipFile.getFileName()))); } return result; } catch (IOException e) { throw new TerraformException("Unable to extract maven artifacts"); } }
TerraformGet implements TerraformOperation<List<Path>> { final List<Path> expandMavenArtifacts(Path directory) throws TerraformException { log.info("Expanding artifacts from " + directory.toAbsolutePath()); try { List<Path> result = new ArrayList<>(); List<Path> zipFiles = Files.walk(directory, 1) .filter(path -> path.getFileName().toString().endsWith(".zip")) .collect(Collectors.toList()); for (Path zipFile : zipFiles) { result.add((new ExpandableZippedArtifact(zipFile, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + zipFile.getFileName()))); } return result; } catch (IOException e) { throw new TerraformException("Unable to extract maven artifacts"); } } }
TerraformGet implements TerraformOperation<List<Path>> { final List<Path> expandMavenArtifacts(Path directory) throws TerraformException { log.info("Expanding artifacts from " + directory.toAbsolutePath()); try { List<Path> result = new ArrayList<>(); List<Path> zipFiles = Files.walk(directory, 1) .filter(path -> path.getFileName().toString().endsWith(".zip")) .collect(Collectors.toList()); for (Path zipFile : zipFiles) { result.add((new ExpandableZippedArtifact(zipFile, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + zipFile.getFileName()))); } return result; } catch (IOException e) { throw new TerraformException("Unable to extract maven artifacts"); } } TerraformGet(Log log, String tfModules); protected  TerraformGet(Log log, Path tfModules);  TerraformGet(Log log);  TerraformGet(); }
TerraformGet implements TerraformOperation<List<Path>> { final List<Path> expandMavenArtifacts(Path directory) throws TerraformException { log.info("Expanding artifacts from " + directory.toAbsolutePath()); try { List<Path> result = new ArrayList<>(); List<Path> zipFiles = Files.walk(directory, 1) .filter(path -> path.getFileName().toString().endsWith(".zip")) .collect(Collectors.toList()); for (Path zipFile : zipFiles) { result.add((new ExpandableZippedArtifact(zipFile, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + zipFile.getFileName()))); } return result; } catch (IOException e) { throw new TerraformException("Unable to extract maven artifacts"); } } TerraformGet(Log log, String tfModules); protected  TerraformGet(Log log, Path tfModules);  TerraformGet(Log log);  TerraformGet(); @Override List<Path> execute(Properties properties); }
TerraformGet implements TerraformOperation<List<Path>> { final List<Path> expandMavenArtifacts(Path directory) throws TerraformException { log.info("Expanding artifacts from " + directory.toAbsolutePath()); try { List<Path> result = new ArrayList<>(); List<Path> zipFiles = Files.walk(directory, 1) .filter(path -> path.getFileName().toString().endsWith(".zip")) .collect(Collectors.toList()); for (Path zipFile : zipFiles) { result.add((new ExpandableZippedArtifact(zipFile, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + zipFile.getFileName()))); } return result; } catch (IOException e) { throw new TerraformException("Unable to extract maven artifacts"); } } TerraformGet(Log log, String tfModules); protected  TerraformGet(Log log, Path tfModules);  TerraformGet(Log log);  TerraformGet(); @Override List<Path> execute(Properties properties);  }