* [JGit Patch v2 1/7] Add a POM file for setting JGit library as a Maven project @ 2008-08-21 3:13 imyousuf 2008-08-21 3:13 ` [JGit Patch v2 2/7] Add test resources to a new package structured directory imyousuf 0 siblings, 1 reply; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- jgit-maven/jgit/pom.xml | 169 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 169 insertions(+), 0 deletions(-) create mode 100644 jgit-maven/jgit/pom.xml diff --git a/jgit-maven/jgit/pom.xml b/jgit-maven/jgit/pom.xml new file mode 100644 index 0000000..c4d7c24 --- /dev/null +++ b/jgit-maven/jgit/pom.xml @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +All rights reserved. +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following +conditions are met: + +Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided +with the distribution. + +Neither the name of the Git Development Community nor the +names of its contributors may be used to endorse or promote +products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.spearce</groupId> + <artifactId>jgit</artifactId> + <packaging>jar</packaging> + <version>0.4-SNAPSHOT</version> + <name>jgit</name> + <url>http://repo.or.cz/w/egit.git</url> + <mailingLists> + <mailingList> + <name>GIT Mailing List</name> + <post>git@vger.kernel.org</post> + <archive>http://marc.info/?l=git</archive> + </mailingList> + </mailingLists> + <description>Pure Java implementation of Git</description> + <developers> + <developer> + <name>Shawn O. Pearce</name> + <email>spearce@spearce.org</email> + <roles> + <role>Maintainer</role> + </roles> + </developer> + <developer> + <name>Robin Rosenberg</name> + <email>robin.rosenberg@dewire.com</email> + <roles> + <role>Maintainer</role> + </roles> + </developer> + <developer> + <name>Dave Watson</name> + <email>dwatson@mimvista.com</email> + <roles> + <role>Developer</role> + </roles> + </developer> + <developer> + <name>Roger C. Soares</name> + <email>rogersoares@intelinet.com.br</email> + <roles> + <role>Developer</role> + </roles> + </developer> + <developer> + <name>Marek Zawirski</name> + <email>marek.zawirski@gmail.com</email> + <roles> + <role>Developer</role> + </roles> + </developer> + <developer> + <name>Imran M Yousuf</name> + <email>imyousuf@smartitengineering.com</email> + <organization>Smart IT Engineering</organization> + <roles> + <role>Contributor</role> + </roles> + </developer> + </developers> + <licenses> + <license> + <name>3-clause (new-style) BSD license.</name> + <comments> + All rights reserved. + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + Neither the name of the Git Development Community nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + </comments> + </license> + </licenses> + <build> + <sourceDirectory>../../org.spearce.jgit/src/</sourceDirectory> + <testResources> + <testResource> + <directory>../../org.spearce.jgit.test/tst-rsrc/</directory> + </testResource> + </testResources> + <testSourceDirectory>../../org.spearce.jgit.test/tst/</testSourceDirectory> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.jcraft</groupId> + <artifactId>jsch</artifactId> + <version>0.1.38</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> -- 1.5.6 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [JGit Patch v2 2/7] Add test resources to a new package structured directory 2008-08-21 3:13 [JGit Patch v2 1/7] Add a POM file for setting JGit library as a Maven project imyousuf @ 2008-08-21 3:13 ` imyousuf 2008-08-21 3:13 ` [JGit Patch v2 3/7] Add test resources directory as a classpath entry imyousuf 0 siblings, 1 reply; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Previously the test resources were read from a path in filesystem from now on it wil be read from classpath and thus resources are added to a java package structured directory. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- .../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 15 files changed, 0 insertions(+), 0 deletions(-) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.index (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.lsfiles (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/gitgit.lstree (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/pack-huge.idx (100%) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/packed-refs (100%) 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% copy from org.spearce.jgit.test/tst/gitgit.index copy 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% copy from org.spearce.jgit.test/tst/gitgit.lsfiles copy 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% copy from org.spearce.jgit.test/tst/gitgit.lstree copy 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% copy from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx copy 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% copy from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2 copy 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% copy from org.spearce.jgit.test/tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack copy 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% copy from org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx copy 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% copy from org.spearce.jgit.test/tst/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack copy 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% copy from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx copy 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% copy from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2 copy 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% copy from org.spearce.jgit.test/tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack copy 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% copy from org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx copy 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% copy from org.spearce.jgit.test/tst/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack copy 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% copy from org.spearce.jgit.test/tst/pack-huge.idx copy 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% copy from org.spearce.jgit.test/tst/packed-refs copy to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs -- 1.5.6 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [JGit Patch v2 3/7] Add test resources directory as a classpath entry 2008-08-21 3:13 ` [JGit Patch v2 2/7] Add test resources to a new package structured directory imyousuf @ 2008-08-21 3:13 ` imyousuf 2008-08-21 3:13 ` [JGit Patch v2 4/7] Use test resources from classpath imyousuf 0 siblings, 1 reply; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Since test resources will be required to be read from classpath thus adding record to Eclipse's .classpath setting file. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- org.spearce.jgit.test/.classpath | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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"/> -- 1.5.6 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [JGit Patch v2 4/7] Use test resources from classpath 2008-08-21 3:13 ` [JGit Patch v2 3/7] Add test resources directory as a classpath entry imyousuf @ 2008-08-21 3:13 ` imyousuf 2008-08-21 3:13 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose imyousuf 2008-08-21 15:19 ` [JGit Patch v2 4/7] Use test resources from classpath Shawn O. Pearce 0 siblings, 2 replies; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Searched and fixed usage of resources, all tests are now passing and using classpath resources. A utility class for test classes are created. One of its operation turns classpath resources to File and it is used by all test classes to locate test resources. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- .../dircache/DirCacheCGitCompatabilityTest.java | 3 +- .../tst/org/spearce/jgit/lib/PackIndexV1Test.java | 9 +++-- .../tst/org/spearce/jgit/lib/PackIndexV2Test.java | 5 ++- .../org/spearce/jgit/lib/PackReverseIndexTest.java | 5 +-- .../tst/org/spearce/jgit/lib/PackWriterTest.java | 3 +- .../org/spearce/jgit/lib/RepositoryTestCase.java | 7 ++-- .../org/spearce/jgit/transport/IndexPackTest.java | 6 ++-- .../tst/org/spearce/jgit/util/JGitTestUtil.java | 35 ++++++++++++------- 8 files changed, 43 insertions(+), 30 deletions(-) copy org.spearce.jgit/src/org/spearce/jgit/util/FS_POSIX_Java5.java => org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java (70%) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java index 43b23f6..b052686 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -50,6 +50,7 @@ import org.spearce.jgit.lib.ObjectId; import org.spearce.jgit.lib.RepositoryTestCase; import org.spearce.jgit.treewalk.TreeWalk; +import org.spearce.jgit.util.JGitTestUtil; public class DirCacheCGitCompatabilityTest extends RepositoryTestCase { private final File index = pathOf("gitgit.index"); @@ -138,7 +139,7 @@ assertEquals(ObjectId } private File pathOf(final String name) { - return new File("tst", name); + return JGitTestUtil.getTestResourceFile(name); } private Map<String, CGitIndexRecord> readLsFiles() throws Exception { diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV1Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV1Test.java index 49235ca..645e054 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV1Test.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV1Test.java @@ -40,18 +40,19 @@ import java.io.File; import org.spearce.jgit.errors.MissingObjectException; +import org.spearce.jgit.util.JGitTestUtil; public class PackIndexV1Test extends PackIndexTest { @Override public File getFileForPack34be9032() { - return new File(new File("tst"), - "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx"); + return JGitTestUtil.getTestResourceFile( + "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx"); } @Override public File getFileForPackdf2982f28() { - return new File(new File("tst"), - "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx"); + return JGitTestUtil.getTestResourceFile( + "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx"); } /** diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV2Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV2Test.java index c986c49..d95937c 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV2Test.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackIndexV2Test.java @@ -40,17 +40,18 @@ import java.io.File; import org.spearce.jgit.errors.MissingObjectException; +import org.spearce.jgit.util.JGitTestUtil; public class PackIndexV2Test extends PackIndexTest { @Override public File getFileForPack34be9032() { - return new File(new File("tst"), + return JGitTestUtil.getTestResourceFile( "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2"); } @Override public File getFileForPackdf2982f28() { - return new File(new File("tst"), + return JGitTestUtil.getTestResourceFile( "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2"); } diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackReverseIndexTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackReverseIndexTest.java index 52d1282..c66818f 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackReverseIndexTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackReverseIndexTest.java @@ -37,10 +37,9 @@ package org.spearce.jgit.lib; -import java.io.File; - import org.spearce.jgit.errors.CorruptObjectException; import org.spearce.jgit.lib.PackIndex.MutableEntry; +import org.spearce.jgit.util.JGitTestUtil; public class PackReverseIndexTest extends RepositoryTestCase { @@ -54,7 +53,7 @@ public void setUp() throws Exception { super.setUp(); // index with both small (< 2^31) and big offsets - idx = PackIndex.open(new File(new File("tst"), + idx = PackIndex.open(JGitTestUtil.getTestResourceFile( "pack-huge.idx")); reverseIdx = new PackReverseIndex(idx); } diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java index 4dd4b2a..87ec091 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java @@ -57,6 +57,7 @@ import org.spearce.jgit.revwalk.RevWalk; import org.spearce.jgit.transport.IndexPack; import org.spearce.jgit.util.CountingOutputStream; +import org.spearce.jgit.util.JGitTestUtil; public class PackWriterTest extends RepositoryTestCase { @@ -239,7 +240,7 @@ public void testWritePack2DeltasCRC32Copy() throws IOException { "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack"); final File crc32Idx = new File(packDir, "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx"); - copyFile(new File(new File("tst"), + copyFile(JGitTestUtil.getTestResourceFile( "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2"), crc32Idx); db.openPack(crc32Pack, crc32Idx); diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java index 14e7179..310690a 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java @@ -47,6 +47,7 @@ import java.io.Reader; import junit.framework.TestCase; +import org.spearce.jgit.util.JGitTestUtil; public abstract class RepositoryTestCase extends TestCase { @@ -145,13 +146,13 @@ public void run() { final File tst = new File("tst"); final File packDir = new File(db.getObjectsDirectory(), "pack"); for (int k = 0; k < packs.length; k++) { - copyFile(new File(tst, packs[k] + ".pack"), new File(packDir, + copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".pack"), new File(packDir, packs[k] + ".pack")); - copyFile(new File(tst, packs[k] + ".idx"), new File(packDir, + copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".idx"), new File(packDir, packs[k] + ".idx")); } - copyFile(new File(tst, "packed-refs"), new File(trash_git,"packed-refs")); + copyFile(JGitTestUtil.getTestResourceFile("packed-refs"), new File(trash_git,"packed-refs")); db.scanForPacks(); } diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/IndexPackTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/IndexPackTest.java index ffa9142..46bd969 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/IndexPackTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/IndexPackTest.java @@ -47,7 +47,7 @@ import org.spearce.jgit.lib.PackFile; import org.spearce.jgit.lib.RepositoryTestCase; import org.spearce.jgit.lib.TextProgressMonitor; -import org.spearce.jgit.transport.IndexPack; +import org.spearce.jgit.util.JGitTestUtil; /** * Test indexing of git packs. A pack is read from a stream, copied @@ -63,7 +63,7 @@ * @throws IOException */ public void test1() throws IOException { - File packFile = new File("tst/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack"); + File packFile = JGitTestUtil.getTestResourceFile("pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack"); final InputStream is = new FileInputStream(packFile); try { IndexPack pack = new IndexPack(db, is, new File(trash, "tmp_pack1")); @@ -89,7 +89,7 @@ public void test1() throws IOException { * @throws IOException */ public void test2() throws IOException { - File packFile = new File("tst/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack"); + File packFile = JGitTestUtil.getTestResourceFile("pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack"); final InputStream is = new FileInputStream(packFile); try { IndexPack pack = new IndexPack(db, is, new File(trash, "tmp_pack2")); diff --git a/org.spearce.jgit/src/org/spearce/jgit/util/FS_POSIX_Java5.java b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java similarity index 70% copy from org.spearce.jgit/src/org/spearce/jgit/util/FS_POSIX_Java5.java copy to org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java index d62b210..161ff78 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/util/FS_POSIX_Java5.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/JGitTestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com> * * All rights reserved. * @@ -38,17 +38,26 @@ package org.spearce.jgit.util; import java.io.File; +import java.net.URL; -class FS_POSIX_Java5 extends FS { - public boolean supportsExecute() { - return false; - } - - public boolean canExecute(final File f) { - return false; - } - - public boolean setExecute(final File f, final boolean canExec) { - return false; - } +/** + * + * @author imyousuf + */ +public abstract class JGitTestUtil { + public static final String CLASSPATH_TO_RESOURCES = + "/org/spearce/jgit/test/resources/"; + private JGitTestUtil() { + throw new AssertionError(); + } + + public static File getTestResourceFile(String fileName) { + if(fileName == null || fileName.length() <= 0) { + return null; + } + URL url = JGitTestUtil.class.getResource( + new StringBuilder(CLASSPATH_TO_RESOURCES) + .append(fileName).toString()); + return new File(url.getPath()); + } } -- 1.5.6 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [JGit Patch v2 5/7] Add script for adding second pack for test purpose 2008-08-21 3:13 ` [JGit Patch v2 4/7] Use test resources from classpath imyousuf @ 2008-08-21 3:13 ` imyousuf [not found] ` <1219288394-1241-6-git-send-email-imyousuf@gmail.com> 2008-08-21 15:12 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose Shawn O. Pearce 2008-08-21 15:19 ` [JGit Patch v2 4/7] Use test resources from classpath Shawn O. Pearce 1 sibling, 2 replies; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Forgot to add it last time and thus adding it before removing duplicate resources. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- .../jgit/test/resources}/create-second-pack | 0 1 files changed, 0 insertions(+), 0 deletions(-) copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/create-second-pack (100%) 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% copy from org.spearce.jgit.test/tst/create-second-pack copy to org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack -- 1.5.6 ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <1219288394-1241-6-git-send-email-imyousuf@gmail.com>]
* [JGit Patch v2 7/7] Add ignore list for mavenized JGit [not found] ` <1219288394-1241-6-git-send-email-imyousuf@gmail.com> @ 2008-08-21 3:13 ` imyousuf 0 siblings, 0 replies; 11+ messages in thread From: imyousuf @ 2008-08-21 3:13 UTC (permalink / raw) To: git; +Cc: spearce, robin.rosenberg, Imran M Yousuf From: Imran M Yousuf <imyousuf@smartitengineering.com> Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> --- jgit-maven/.gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 jgit-maven/.gitignore diff --git a/jgit-maven/.gitignore b/jgit-maven/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/jgit-maven/.gitignore @@ -0,0 +1 @@ +target -- 1.5.6 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [JGit Patch v2 5/7] Add script for adding second pack for test purpose 2008-08-21 3:13 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose imyousuf [not found] ` <1219288394-1241-6-git-send-email-imyousuf@gmail.com> @ 2008-08-21 15:12 ` Shawn O. Pearce 2008-08-22 2:52 ` Imran M Yousuf 1 sibling, 1 reply; 11+ messages in thread From: Shawn O. Pearce @ 2008-08-21 15:12 UTC (permalink / raw) To: imyousuf; +Cc: git, robin.rosenberg, Imran M Yousuf imyousuf@gmail.com wrote: > From: Imran M Yousuf <imyousuf@smartitengineering.com> > > Forgot to add it last time and thus adding it before removing duplicate > resources. I would squash this to the one that copies the other resources. > 1 files changed, 0 insertions(+), 0 deletions(-) > copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/create-second-pack (100%) -- Shawn. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JGit Patch v2 5/7] Add script for adding second pack for test purpose 2008-08-21 15:12 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose Shawn O. Pearce @ 2008-08-22 2:52 ` Imran M Yousuf 2008-08-22 16:06 ` Shawn O. Pearce 0 siblings, 1 reply; 11+ messages in thread From: Imran M Yousuf @ 2008-08-22 2:52 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: imyousuf, git, robin.rosenberg, Imran M Yousuf On Thu, Aug 21, 2008 at 9:12 PM, Shawn O. Pearce <spearce@spearce.org> wrote: > imyousuf@gmail.com wrote: >> From: Imran M Yousuf <imyousuf@smartitengineering.com> >> >> Forgot to add it last time and thus adding it before removing duplicate >> resources. > > I would squash this to the one that copies the other resources. Hi Shawn, I would gladly make the changes (in this patch and the other ones) if I am sure that this series does not break the build with Eclipse. I would be extremely grateful if you would please confirm this to me. Best regards, Imran > >> 1 files changed, 0 insertions(+), 0 deletions(-) >> copy org.spearce.jgit.test/{tst => tst-rsrc/org/spearce/jgit/test/resources}/create-second-pack (100%) > > -- > Shawn. > -- Imran M Yousuf Entrepreneur & Software Engineer Smart IT Engineering Dhaka, Bangladesh Email: imran@smartitengineering.com Blog: http://imyousuf-tech.blogs.smartitengineering.com/ Mobile: +880-1711402557 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JGit Patch v2 5/7] Add script for adding second pack for test purpose 2008-08-22 2:52 ` Imran M Yousuf @ 2008-08-22 16:06 ` Shawn O. Pearce 2008-08-23 5:21 ` Imran M Yousuf 0 siblings, 1 reply; 11+ messages in thread From: Shawn O. Pearce @ 2008-08-22 16:06 UTC (permalink / raw) To: Imran M Yousuf; +Cc: imyousuf, git, robin.rosenberg, Imran M Yousuf Imran M Yousuf <imran@smartitengineering.com> wrote: > On Thu, Aug 21, 2008 at 9:12 PM, Shawn O. Pearce <spearce@spearce.org> wrote: > > imyousuf@gmail.com wrote: > >> From: Imran M Yousuf <imyousuf@smartitengineering.com> > >> > >> Forgot to add it last time and thus adding it before removing duplicate > >> resources. > > > > I would squash this to the one that copies the other resources. > > I would gladly make the changes (in this patch and the other ones) if > I am sure that this series does not break the build with Eclipse. I > would be extremely grateful if you would please confirm this to me. OK, so your series end result would be fine, if you squash this into it as well. The "tst" variable is no longe rused in one location due to the introduction of JGitTestUtil, and you missed one location that needed to be converted from "tst" to JGitTestUtil. Otherwise the end result looks good in Eclipse and in ./make_jgit.sh. diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java index 310690a..270b90a 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java @@ -143,7 +143,6 @@ public void run() { "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745", "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa" }; - final File tst = new File("tst"); final File packDir = new File(db.getObjectsDirectory(), "pack"); for (int k = 0; k < packs.length; k++) { copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".pack"), new File(packDir, diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java index c036e79..3d81bc4 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java @@ -41,9 +41,11 @@ import java.io.File; import java.io.IOException; +import org.spearce.jgit.util.JGitTestUtil; + public class T0004_PackReader extends RepositoryTestCase { private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f"; - private static final File TEST_PACK = new File(new File("tst"), PACK_NAME + ".pack"); + private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack"); private static final File TEST_IDX = new File(TEST_PACK.getParentFile(), PACK_NAME + ".idx"); public void test003_lookupCompressedObject() throws IOException { -- Shawn. ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [JGit Patch v2 5/7] Add script for adding second pack for test purpose 2008-08-22 16:06 ` Shawn O. Pearce @ 2008-08-23 5:21 ` Imran M Yousuf 0 siblings, 0 replies; 11+ messages in thread From: Imran M Yousuf @ 2008-08-23 5:21 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: imyousuf, git, robin.rosenberg, Imran M Yousuf On Fri, Aug 22, 2008 at 10:06 PM, Shawn O. Pearce <spearce@spearce.org> wrote: > Imran M Yousuf <imran@smartitengineering.com> wrote: >> On Thu, Aug 21, 2008 at 9:12 PM, Shawn O. Pearce <spearce@spearce.org> wrote: >> > imyousuf@gmail.com wrote: >> >> From: Imran M Yousuf <imyousuf@smartitengineering.com> >> >> >> >> Forgot to add it last time and thus adding it before removing duplicate >> >> resources. >> > >> > I would squash this to the one that copies the other resources. >> >> I would gladly make the changes (in this patch and the other ones) if >> I am sure that this series does not break the build with Eclipse. I >> would be extremely grateful if you would please confirm this to me. > > OK, so your series end result would be fine, if you squash this into > it as well. The "tst" variable is no longe rused in one location due > to the introduction of JGitTestUtil, and you missed one location that > needed to be converted from "tst" to JGitTestUtil. Otherwise the end > result looks good in Eclipse and in ./make_jgit.sh. Thanks for the confirmation and additional change, for some reason it was not failing thus I could not detect the case. I will now follow the suggestions and will resubmit the patches on Mon/Tuesday. - Imran > > diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java > index 310690a..270b90a 100644 > --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java > +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java > @@ -143,7 +143,6 @@ public void run() { > "pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745", > "pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa" > }; > - final File tst = new File("tst"); > final File packDir = new File(db.getObjectsDirectory(), "pack"); > for (int k = 0; k < packs.length; k++) { > copyFile(JGitTestUtil.getTestResourceFile(packs[k] + ".pack"), new File(packDir, > diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java > index c036e79..3d81bc4 100644 > --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java > +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java > @@ -41,9 +41,11 @@ > import java.io.File; > import java.io.IOException; > > +import org.spearce.jgit.util.JGitTestUtil; > + > public class T0004_PackReader extends RepositoryTestCase { > private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f"; > - private static final File TEST_PACK = new File(new File("tst"), PACK_NAME + ".pack"); > + private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack"); > private static final File TEST_IDX = new File(TEST_PACK.getParentFile(), PACK_NAME + ".idx"); > > public void test003_lookupCompressedObject() throws IOException { > > > -- > Shawn. > -- Imran M Yousuf Entrepreneur & Software Engineer Smart IT Engineering Dhaka, Bangladesh Email: imran@smartitengineering.com Blog: http://imyousuf-tech.blogs.smartitengineering.com/ Mobile: +880-1711402557 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [JGit Patch v2 4/7] Use test resources from classpath 2008-08-21 3:13 ` [JGit Patch v2 4/7] Use test resources from classpath imyousuf 2008-08-21 3:13 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose imyousuf @ 2008-08-21 15:19 ` Shawn O. Pearce 1 sibling, 0 replies; 11+ messages in thread From: Shawn O. Pearce @ 2008-08-21 15:19 UTC (permalink / raw) To: imyousuf; +Cc: git, robin.rosenberg, Imran M Yousuf imyousuf@gmail.com wrote: > From: Imran M Yousuf <imyousuf@smartitengineering.com> > > Searched and fixed usage of resources, all tests are now passing and using > classpath resources. > > A utility class for test classes are created. One of its operation turns > classpath resources to File and it is used by all test classes to locate > test resources. I would change the way you do this series a little bit. Start the series with this patch, only have JGitTestUtil do: return new File("test", name); like DirCacheCGitCompatabilityTest.pathOf does. That way you have the code replacement done in the first step, before you start mucking around with the resource locations. In the 2nd patch, change JGitTestUtil to get resources from the classpath, move (not copy) the resources, and add the tst-rsc directory to the Eclipse .classpath file. In the 3rd patch, add your Maven POM file, including the .gitignore for "target". The tests will always work, and we don't get this weird copy-delete pair on the resources. > +/** > + * > + * @author imyousuf > + */ > +public abstract class JGitTestUtil { We don't comment classes like this. Either document it for real, or remove the Javadoc comment entirely. In "real" documentation we do not include @author tags. > + public static final String CLASSPATH_TO_RESOURCES = > + "/org/spearce/jgit/test/resources/"; > + private JGitTestUtil() { > + throw new AssertionError(); > + } > + > + public static File getTestResourceFile(String fileName) { > + if(fileName == null || fileName.length() <= 0) { Formatting error. We put space between "if(". > + return null; > + } > + URL url = JGitTestUtil.class.getResource( > + new StringBuilder(CLASSPATH_TO_RESOURCES) > + .append(fileName).toString()); > + return new File(url.getPath()); > + } > } -- Shawn. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-08-23 5:22 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-21 3:13 [JGit Patch v2 1/7] Add a POM file for setting JGit library as a Maven project imyousuf 2008-08-21 3:13 ` [JGit Patch v2 2/7] Add test resources to a new package structured directory imyousuf 2008-08-21 3:13 ` [JGit Patch v2 3/7] Add test resources directory as a classpath entry imyousuf 2008-08-21 3:13 ` [JGit Patch v2 4/7] Use test resources from classpath imyousuf 2008-08-21 3:13 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose imyousuf [not found] ` <1219288394-1241-6-git-send-email-imyousuf@gmail.com> 2008-08-21 3:13 ` [JGit Patch v2 7/7] Add ignore list for mavenized JGit imyousuf 2008-08-21 15:12 ` [JGit Patch v2 5/7] Add script for adding second pack for test purpose Shawn O. Pearce 2008-08-22 2:52 ` Imran M Yousuf 2008-08-22 16:06 ` Shawn O. Pearce 2008-08-23 5:21 ` Imran M Yousuf 2008-08-21 15:19 ` [JGit Patch v2 4/7] Use test resources from classpath Shawn O. Pearce
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).