From: Imran M Yousuf <imyousuf@xxxxxxxxxxxxxxxxxxxxxx> Previously test case resources were located in the root directory, this change relocates them to a classpath location and loads the resources from there. If there is request for any test resource that is not present in classpath then util method will return the same value as it would in previous state. Signed-off-by: Imran M Yousuf <imyousuf@xxxxxxxxxxxxxxxxxxxxxx> --- org.spearce.jgit.test/.classpath | 1 + .../jgit/test/resources}/create-second-pack | 0 .../org/spearce/jgit/test/resources}/gitgit.index | Bin 134799 -> 134799 bytes .../spearce/jgit/test/resources}/gitgit.lsfiles | 0 .../org/spearce/jgit/test/resources}/gitgit.lstree | 0 ...ck-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx | Bin 1256 -> 1256 bytes ...-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 | Bin 1296 -> 1296 bytes ...k-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack | Bin 7811 -> 7811 bytes ...ck-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx | Bin 1088 -> 1088 bytes ...k-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack | Bin 164 -> 164 bytes ...ck-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx | Bin 2696 -> 2696 bytes ...-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 | Bin 2976 -> 2976 bytes ...k-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack | Bin 5956 -> 5956 bytes ...ck-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx | Bin 1112 -> 1112 bytes ...k-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack | Bin 1643 -> 1643 bytes .../org/spearce/jgit/test/resources}/pack-huge.idx | Bin 2368 -> 2368 bytes .../org/spearce/jgit/test/resources}/packed-refs | 0 .../tst/org/spearce/jgit/util/JGitTestUtil.java | 15 ++++++++++++++- 18 files changed, 15 insertions(+), 1 deletions(-) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/create-second-pack (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.index (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.lsfiles (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.lstree (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-huge.idx (100%) rename org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/packed-refs (100%) diff --git a/org.spearce.jgit.test/.classpath b/org.spearce.jgit.test/.classpath index 592fa17..a276507 100644 --- a/org.spearce.jgit.test/.classpath +++ b/org.spearce.jgit.test/.classpath @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="**/*.idx|**/*.pack" kind="src" path="tst"/> + <classpathentry kind="src" path="tst-rsrc"/> <classpathentry kind="src" path="exttst"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry combineaccessrules="false" kind="src" path="/org.spearce.jgit"/> diff --git a/org.spearce.jgit.test/tst/create-second-pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack similarity index 100% rename from org.spearce.jgit.test/tst/create-second-pack rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack diff --git a/org.spearce.jgit.test/tst/gitgit.index b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.index similarity index 100% rename from org.spearce.jgit.test/tst/gitgit.index rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.index diff --git a/org.spearce.jgit.test/tst/gitgit.lsfiles b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.lsfiles similarity index 100% rename from org.spearce.jgit.test/tst/gitgit.lsfiles rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.lsfiles diff --git a/org.spearce.jgit.test/tst/gitgit.lstree b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.lstree similarity index 100% rename from org.spearce.jgit.test/tst/gitgit.lstree rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/gitgit.lstree diff --git a/org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx similarity index 100% rename from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx diff --git a/org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 similarity index 100% rename from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 diff --git a/org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack similarity index 100% rename from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack diff --git a/org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx similarity index 100% rename from org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx diff --git a/org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack similarity index 100% rename from org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack diff --git a/org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx similarity index 100% rename from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx diff --git a/org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 similarity index 100% rename from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 diff --git a/org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack similarity index 100% rename from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack diff --git a/org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx similarity index 100% rename from org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx diff --git a/org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack similarity index 100% rename from org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack diff --git a/org.spearce.jgit.test/tst/pack-huge.idx b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-huge.idx similarity index 100% rename from org.spearce.jgit.test/tst/pack-huge.idx rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-huge.idx diff --git a/org.spearce.jgit.test/tst/packed-refs b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs similarity index 100% rename from org.spearce.jgit.test/tst/packed-refs rename to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java index bfeb2a0..121b929 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java @@ -38,8 +38,13 @@ package org.spearce.jgit.util; import java.io.File; +import java.net.URL; public abstract class JGitTestUtil { + + public static final String CLASSPATH_TO_RESOURCES = + "/org/spearce/jgit/test/resources/"; + private JGitTestUtil() { throw new AssertionError(); } @@ -48,6 +53,14 @@ public static File getTestResourceFile(String fileName) { if (fileName == null || fileName.length() <= 0) { return null; } - return new File("tst", fileName); + URL url = JGitTestUtil.class.getResource( + new StringBuilder(CLASSPATH_TO_RESOURCES) + .append(fileName).toString()); + //If URL is null then try to load it as it was being + //loaded previously + if (url == null) { + return new File("tst", fileName); + } + return new File(url.getPath()); } } -- 1.5.6 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html