Browse Source

Only import the sample data packs on tests that need them

Not all of our test cases really require the sample data packs,
and we are better off not using them because its hard to see exactly
what condition a test is testing when looking only at the Java code.
Clarify the dependency by only making the packs available when
there is a real need for it.

Change-Id: Id8a76ee7ee1f7efba585be4bed19a8fb5b3b3585
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.7
Shawn O. Pearce 15 years ago
parent
commit
e336bad367
  1. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java
  2. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
  3. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java
  4. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
  5. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java
  6. 22
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
  7. 77
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java
  8. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java
  9. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java
  10. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java
  11. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java
  12. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java
  13. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
  14. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
  15. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java
  16. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java

@ -65,7 +65,7 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.transport.IndexPack;
import org.eclipse.jgit.util.JGitTestUtil;
public class PackWriterTest extends RepositoryTestCase {
public class PackWriterTest extends SampleDataRepositoryTestCase {
private static final List<ObjectId> EMPTY_LIST_OBJECT = Collections
.<ObjectId> emptyList();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java

@ -56,7 +56,7 @@ import org.eclipse.jgit.lib.RefUpdate.Result;
* Misc tests for refs. A lot of things are tested elsewhere so not having a
* test for a ref related method, does not mean it is untested.
*/
public class RefTest extends RepositoryTestCase {
public class RefTest extends SampleDataRepositoryTestCase {
public void testReadAllIncludingSymrefs() throws Exception {
ObjectId masterId = db.resolve("refs/heads/master");

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefUpdateTest.java

@ -54,7 +54,7 @@ import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
public class RefUpdateTest extends RepositoryTestCase {
public class RefUpdateTest extends SampleDataRepositoryTestCase {
private RefUpdate updateRef(final String name) throws IOException {
final RefUpdate ref = db.updateRef(name);

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java

@ -54,8 +54,7 @@ public class ReflogConfigTest extends RepositoryTestCase {
// check that there are no entries in the reflog and turn off writing
// reflogs
assertTrue("there should be no entries in reflog", db.getReflogReader(
Constants.HEAD).getReverseEntries().size() == 0);
assertNull(db.getReflogReader(Constants.HEAD));
db.getConfig().setBoolean("core", null, "logallrefupdates", false);
// do one commit and check that reflog size is 0: no reflogs should be

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogReaderTest.java

@ -53,7 +53,7 @@ import java.util.List;
import org.eclipse.jgit.lib.ReflogReader.Entry;
public class ReflogReaderTest extends RepositoryTestCase {
public class ReflogReaderTest extends SampleDataRepositoryTestCase {
static byte[] oneLine = "da85355dfc525c9f6f3927b876f379f46ccf826e 3e7549db262d1e836d9bf0af7e22355468f1717c A O Thor Too <authortoo@wri.tr> 1243028200 +0200\tcommit: Add a toString for debugging to RemoteRefUpdate\n"
.getBytes();

22
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java

@ -1,7 +1,6 @@
/*
* Copyright (C) 2009, Google Inc.
* Copyright (C) 2008-2009, Jonas Fonseca <fonseca@diku.dk>
* Copyright (C) 2007-2009, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2006-2007, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2009, Yann Simon <yann.simon.fr@gmail.com>
* and other copyright owners as documented in the project's IP log.
@ -55,7 +54,6 @@ import java.io.InputStreamReader;
import java.io.Reader;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.util.JGitTestUtil;
/**
* Base class for most JGit unit tests.
@ -114,23 +112,5 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
super.setUp();
db = createWorkRepository();
trash = db.getWorkDir();
final String[] packs = {
"pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f",
"pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371",
"pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745",
"pack-546ff360fe3488adb20860ce3436a2d6373d2796",
"pack-cbdeda40019ae0e6e789088ea0f51f164f489d14",
"pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa",
"pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12"
};
final File packDir = new File(db.getObjectsDirectory(), "pack");
for (String n : packs) {
copyFile(JGitTestUtil.getTestResourceFile(n + ".pack"), new File(packDir, n + ".pack"));
copyFile(JGitTestUtil.getTestResourceFile(n + ".idx"), new File(packDir, n + ".idx"));
}
copyFile(JGitTestUtil.getTestResourceFile("packed-refs"), new File(db
.getDirectory(), "packed-refs"));
}
}

77
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java

@ -0,0 +1,77 @@
/*
* Copyright (C) 2009, Google Inc.
* Copyright (C) 2008-2009, Jonas Fonseca <fonseca@diku.dk>
* Copyright (C) 2007-2009, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2006-2007, Shawn O. Pearce <spearce@spearce.org>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Distribution License v1.0 which
* accompanies this distribution, is reproduced below, and is
* available at http://www.eclipse.org/org/documents/edl-v10.php
*
* 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 Eclipse Foundation, Inc. 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.
*/
package org.eclipse.jgit.lib;
import java.io.File;
import org.eclipse.jgit.util.JGitTestUtil;
/** Test case which includes C Git generated pack files for testing. */
public abstract class SampleDataRepositoryTestCase extends RepositoryTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
final String[] packs = {
"pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f",
"pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371",
"pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745",
"pack-546ff360fe3488adb20860ce3436a2d6373d2796",
"pack-cbdeda40019ae0e6e789088ea0f51f164f489d14",
"pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa",
"pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12"
};
final File packDir = new File(db.getObjectsDirectory(), "pack");
for (String n : packs) {
copyFile(JGitTestUtil.getTestResourceFile(n + ".pack"), new File(packDir, n + ".pack"));
copyFile(JGitTestUtil.getTestResourceFile(n + ".idx"), new File(packDir, n + ".idx"));
}
copyFile(JGitTestUtil.getTestResourceFile("packed-refs"), new File(db
.getDirectory(), "packed-refs"));
}
}

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_Tree.java

@ -49,7 +49,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
public class T0002_Tree extends RepositoryTestCase {
public class T0002_Tree extends SampleDataRepositoryTestCase {
private static final ObjectId SOME_FAKE_ID = ObjectId.fromString(
"0123456789abcdef0123456789abcdef01234567");

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0003_Basic.java

@ -55,7 +55,7 @@ import java.io.PrintWriter;
import org.eclipse.jgit.errors.ConfigInvalidException;
public class T0003_Basic extends RepositoryTestCase {
public class T0003_Basic extends SampleDataRepositoryTestCase {
public void test001_Initalize() {
final File gitdir = new File(trash, ".git");
final File objects = new File(gitdir, "objects");

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java

@ -51,7 +51,7 @@ import java.io.IOException;
import org.eclipse.jgit.util.JGitTestUtil;
public class T0004_PackReader extends RepositoryTestCase {
public class T0004_PackReader extends SampleDataRepositoryTestCase {
private static final String PACK_NAME = "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f";
private static final File TEST_PACK = JGitTestUtil.getTestResourceFile(PACK_NAME + ".pack");
private static final File TEST_IDX = JGitTestUtil.getTestResourceFile(PACK_NAME + ".idx");

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0008_testparserev.java

@ -1,4 +1,5 @@
/*
* Copyright (C) 2009, Google Inc.
* Copyright (C) 2008, Jonas Fonseca <fonseca@diku.dk>
* Copyright (C) 2007-2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2006, Shawn O. Pearce <spearce@spearce.org>
@ -47,7 +48,7 @@ package org.eclipse.jgit.lib;
import java.io.IOException;
public class T0008_testparserev extends RepositoryTestCase {
public class T0008_testparserev extends SampleDataRepositoryTestCase {
public void testObjectId_existing() throws IOException {
assertEquals("49322bb17d3acc9146f98c97d078513228bbf3c0",db.resolve("49322bb17d3acc9146f98c97d078513228bbf3c0").name());

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WindowCacheGetTest.java

@ -54,7 +54,7 @@ import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.util.JGitTestUtil;
import org.eclipse.jgit.util.MutableInteger;
public class WindowCacheGetTest extends RepositoryTestCase {
public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
private List<TestObject> toLoad;
@Override

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java

@ -56,10 +56,10 @@ import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectWriter;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.SampleDataRepositoryTestCase;
import org.eclipse.jgit.treewalk.TreeWalk;
public class SimpleMergeTest extends RepositoryTestCase {
public class SimpleMergeTest extends SampleDataRepositoryTestCase {
public void testOurs() throws IOException {
Merger ourMerger = MergeStrategy.OURS.newMerger(db);

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java

@ -60,11 +60,11 @@ import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.SampleDataRepositoryTestCase;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
public class BundleWriterTest extends RepositoryTestCase {
public class BundleWriterTest extends SampleDataRepositoryTestCase {
public void testWrite0() throws Exception {
// Create a tiny bundle, (well one of) the first commits only

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java

@ -54,12 +54,12 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.SampleDataRepositoryTestCase;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
public class PushProcessTest extends RepositoryTestCase {
public class PushProcessTest extends SampleDataRepositoryTestCase {
private PushProcess process;
private MockTransport transport;

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java

@ -49,9 +49,9 @@ import java.util.Collection;
import java.util.Collections;
import org.eclipse.jgit.lib.RepositoryConfig;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.lib.SampleDataRepositoryTestCase;
public class TransportTest extends RepositoryTestCase {
public class TransportTest extends SampleDataRepositoryTestCase {
private Transport transport;
private RemoteConfig remoteConfig;

Loading…
Cancel
Save