|
|
|
@ -26,10 +26,7 @@ import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.FileCopyUtils;
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.notNullValue;
|
|
|
|
|
import static org.junit.Assert.assertFalse;
|
|
|
|
|
import static org.junit.Assert.assertThat;
|
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Integration tests for gradle repackaging.
|
|
|
|
@ -55,10 +52,11 @@ public class RepackagingTests {
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
File repackageFile = new File(buildLibs, "repackage.jar");
|
|
|
|
|
assertTrue(repackageFile.exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertTrue(isDevToolsJarIncluded(repackageFile));
|
|
|
|
|
assertThat(repackageFile.exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(isDevToolsJarIncluded(repackageFile)).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -68,9 +66,10 @@ public class RepackagingTests {
|
|
|
|
|
"-PexcludeDevtools=false")
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -80,11 +79,12 @@ public class RepackagingTests {
|
|
|
|
|
"-PexcludeDevtools=false")
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar.original").exists());
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -95,11 +95,12 @@ public class RepackagingTests {
|
|
|
|
|
"-PexcludeDevtools=false")
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar.original").exists());
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -109,11 +110,12 @@ public class RepackagingTests {
|
|
|
|
|
"-PexcludeDevtools=false")
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar.original").exists());
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -124,11 +126,12 @@ public class RepackagingTests {
|
|
|
|
|
"-PexcludeDevtools=false")
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar").exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "custom.jar.original").exists());
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -141,7 +144,7 @@ public class RepackagingTests {
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
JarFile jarFile = new JarFile(new File(buildLibs, "repackage.jar"));
|
|
|
|
|
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
|
|
|
|
|
assertThat(jarFile.getEntry("lib/foo.jar")).isNotNull();
|
|
|
|
|
jarFile.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -153,10 +156,11 @@ public class RepackagingTests {
|
|
|
|
|
.run();
|
|
|
|
|
File buildLibs = new File("target/repackage/build/libs");
|
|
|
|
|
File repackageFile = new File(buildLibs, "repackage.jar");
|
|
|
|
|
assertTrue(repackageFile.exists());
|
|
|
|
|
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
|
|
|
|
|
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
|
|
|
|
|
assertFalse(isDevToolsJarIncluded(repackageFile));
|
|
|
|
|
assertThat(repackageFile.exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
|
|
|
|
|
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
|
|
|
|
|
.isFalse();
|
|
|
|
|
assertThat(isDevToolsJarIncluded(repackageFile)).isFalse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isDevToolsJarIncluded(File repackageFile) throws IOException {
|
|
|
|
|