@Test public void expandMavenArtifactsExpandsTheMavenZipArtifactInTheWorkingDir() throws IOException, TerraformException { String artifact = "groupId:artifactId:0.1"; Path mainTfPath = tfWorkingPath.resolve("src").resolve("main").resolve("tf"); Log log = Mockito.mock(Log.class); if (!mainTfPath.toFile().exists()) forceMkdir(mainTfPath.toFile()); copyURLToFile(this.getClass().getResource("/zips/tf-module-my-module1-0.12-rc.zip"), mainTfPath.resolve("artifactId-0.1.zip").toFile()); TerraformGetMavenRootArtifact terraformGetMavenRootArtifact = new TerraformGetMavenRootArtifact(artifact, log); terraformGetMavenRootArtifact.expandMavenArtifacts(); Assert.assertTrue(mainTfPath.resolve("artifactId").toFile().exists()); Assert.assertEquals(mainTfPath.resolve("artifactId").toFile().listFiles().length, 2); }
final Path expandMavenArtifacts() throws TerraformException { String artifactZip = getArtifactZip(this.artifact); Path artifactZipPath = mainTfPath.resolve(artifactZip); log.info("Expanding artifacts from " + artifactZipPath.toAbsolutePath()); return (new ExpandableZippedArtifact(artifactZipPath, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + artifactZipPath.getFileName())); }
TerraformGetMavenRootArtifact implements TerraformOperation<String> { final Path expandMavenArtifacts() throws TerraformException { String artifactZip = getArtifactZip(this.artifact); Path artifactZipPath = mainTfPath.resolve(artifactZip); log.info("Expanding artifacts from " + artifactZipPath.toAbsolutePath()); return (new ExpandableZippedArtifact(artifactZipPath, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + artifactZipPath.getFileName())); } }
TerraformGetMavenRootArtifact implements TerraformOperation<String> { final Path expandMavenArtifacts() throws TerraformException { String artifactZip = getArtifactZip(this.artifact); Path artifactZipPath = mainTfPath.resolve(artifactZip); log.info("Expanding artifacts from " + artifactZipPath.toAbsolutePath()); return (new ExpandableZippedArtifact(artifactZipPath, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + artifactZipPath.getFileName())); } TerraformGetMavenRootArtifact(String artifact, Log log);  TerraformGetMavenRootArtifact(String artifact, String tfRootDir, Log log); }
TerraformGetMavenRootArtifact implements TerraformOperation<String> { final Path expandMavenArtifacts() throws TerraformException { String artifactZip = getArtifactZip(this.artifact); Path artifactZipPath = mainTfPath.resolve(artifactZip); log.info("Expanding artifacts from " + artifactZipPath.toAbsolutePath()); return (new ExpandableZippedArtifact(artifactZipPath, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + artifactZipPath.getFileName())); } TerraformGetMavenRootArtifact(String artifact, Log log);  TerraformGetMavenRootArtifact(String artifact, String tfRootDir, Log log); @Override String execute(Properties properties); }
TerraformGetMavenRootArtifact implements TerraformOperation<String> { final Path expandMavenArtifacts() throws TerraformException { String artifactZip = getArtifactZip(this.artifact); Path artifactZipPath = mainTfPath.resolve(artifactZip); log.info("Expanding artifacts from " + artifactZipPath.toAbsolutePath()); return (new ExpandableZippedArtifact(artifactZipPath, log)).expand() .orElseThrow(() -> new TerraformException("unable to extract " + artifactZipPath.getFileName())); } TerraformGetMavenRootArtifact(String artifact, Log log);  TerraformGetMavenRootArtifact(String artifact, String tfRootDir, Log log); @Override String execute(Properties properties);  }