aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/java_tools/singlejar/javatests/com
diff options
context:
space:
mode:
authorGravatar cushon <cushon@google.com>2017-04-04 20:40:34 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-04-05 15:19:06 +0200
commit664a38f48f0172bf6b3ca6e81b54cb85167850fa (patch)
tree5dd103e10502628e21724842f4e1e5a3513f44a8 /src/java_tools/singlejar/javatests/com
parentb5bb3a21bca352bf0e7ed8f5fe866369979be272 (diff)
Create parent directories for resource entries in singlejar
This mirrors the change to the c++ implementation made in https://github.com/bazelbuild/bazel/commit/874852ec52f9e03242fb4eccb41c2ea3f3036ac3. PiperOrigin-RevId: 152173345
Diffstat (limited to 'src/java_tools/singlejar/javatests/com')
-rw-r--r--src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SingleJarTest.java40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SingleJarTest.java b/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SingleJarTest.java
index 763c097b81..4b66d13e51 100644
--- a/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SingleJarTest.java
+++ b/src/java_tools/singlejar/javatests/com/google/devtools/build/singlejar/SingleJarTest.java
@@ -22,11 +22,6 @@ import static org.junit.Assert.fail;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.singlejar.FakeZipFile.ByteValidator;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -34,6 +29,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarFile;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
/**
* Unit tests for {@link SingleJar}.
@@ -563,6 +561,8 @@ public class SingleJarTest {
.addEntry(JarFile.MANIFEST_NAME, new ManifestValidator(
"Manifest-Version: 1.0",
"Created-By: blaze-singlejar"))
+ .addEntry("c/", (String) null)
+ .addEntry("c/b/", (String) null)
.addEntry("c/b/a", "Test");
expectedResult.assertSame(mockFs.toByteArray());
}
@@ -574,12 +574,15 @@ public class SingleJarTest {
SingleJar singleJar = new SingleJar(mockFs);
singleJar.run(ImmutableList.of("--output", "output.jar", "--exclude_build_data",
"--resources", "a/b/c"));
- FakeZipFile expectedResult = new FakeZipFile()
- .addEntry("META-INF/", EXTRA_FOR_META_INF)
- .addEntry(JarFile.MANIFEST_NAME, new ManifestValidator(
- "Manifest-Version: 1.0",
- "Created-By: blaze-singlejar"))
- .addEntry("a/b/c", "Test");
+ FakeZipFile expectedResult =
+ new FakeZipFile()
+ .addEntry("META-INF/", EXTRA_FOR_META_INF)
+ .addEntry(
+ JarFile.MANIFEST_NAME,
+ new ManifestValidator("Manifest-Version: 1.0", "Created-By: blaze-singlejar"))
+ .addEntry("a/", (String) null)
+ .addEntry("a/b/", (String) null)
+ .addEntry("a/b/c", "Test");
expectedResult.assertSame(mockFs.toByteArray());
}
@@ -604,12 +607,15 @@ public class SingleJarTest {
SingleJar singleJar = new SingleJar(mockFs);
singleJar.run(ImmutableList.of("--output", "output.jar", "--exclude_build_data",
"--warn_duplicate_resources", "--resources", "a/b/c", "a/b/c"));
- FakeZipFile expectedResult = new FakeZipFile()
- .addEntry("META-INF/", EXTRA_FOR_META_INF)
- .addEntry(JarFile.MANIFEST_NAME, new ManifestValidator(
- "Manifest-Version: 1.0",
- "Created-By: blaze-singlejar"))
- .addEntry("a/b/c", "Test");
+ FakeZipFile expectedResult =
+ new FakeZipFile()
+ .addEntry("META-INF/", EXTRA_FOR_META_INF)
+ .addEntry(
+ JarFile.MANIFEST_NAME,
+ new ManifestValidator("Manifest-Version: 1.0", "Created-By: blaze-singlejar"))
+ .addEntry("a/", (String) null)
+ .addEntry("a/b/", (String) null)
+ .addEntry("a/b/c", "Test");
expectedResult.assertSame(mockFs.toByteArray());
}