|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Enumeration;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
import java.util.zip.ZipFile;
|
|
|
|
|
|
|
|
|
@ -156,6 +157,26 @@ public class ApplicationPluginActionIntegrationTests {
|
|
|
|
|
"custom-boot/bin/custom.bat");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void scriptsHaveCorrectPermissions() throws IOException {
|
|
|
|
|
assertThat(
|
|
|
|
|
this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
|
|
|
|
.isEqualTo(TaskOutcome.SUCCESS);
|
|
|
|
|
String name = this.gradleBuild.getProjectDir().getName();
|
|
|
|
|
File distribution = new File(this.gradleBuild.getProjectDir(),
|
|
|
|
|
"build/distributions/" + name + "-boot.tar");
|
|
|
|
|
assertThat(distribution).isFile();
|
|
|
|
|
tarEntries(distribution, (entry) -> {
|
|
|
|
|
int filePermissions = entry.getMode() & 0777;
|
|
|
|
|
if (entry.isFile() && !entry.getName().startsWith(name + "-boot/bin/")) {
|
|
|
|
|
assertThat(filePermissions).isEqualTo(0644);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
assertThat(filePermissions).isEqualTo(0755);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> zipEntryNames(File distribution) throws IOException {
|
|
|
|
|
List<String> entryNames = new ArrayList<>();
|
|
|
|
|
try (ZipFile zipFile = new ZipFile(distribution)) {
|
|
|
|
@ -179,4 +200,15 @@ public class ApplicationPluginActionIntegrationTests {
|
|
|
|
|
return entryNames;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tarEntries(File distribution, Consumer<TarArchiveEntry> consumer)
|
|
|
|
|
throws IOException {
|
|
|
|
|
try (TarArchiveInputStream input = new TarArchiveInputStream(
|
|
|
|
|
new FileInputStream(distribution))) {
|
|
|
|
|
TarArchiveEntry entry;
|
|
|
|
|
while ((entry = input.getNextTarEntry()) != null) {
|
|
|
|
|
consumer.accept(entry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|