aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-06-14 15:48:53 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-06-25 17:46:41 -0700
commitcad10e6640258fd6bc6bc3183e4dbc61e83bf544 (patch)
treef61e2f8c1cedf9620a784b7c537697b1044f4619 /org.eclipse.jgit.test/tst/org/eclipse/jgit
parent3e3a50db5e9c396769c24778f7f496c79068412d (diff)
downloadjgit-cad10e6640258fd6bc6bc3183e4dbc61e83bf544.tar.gz
jgit-cad10e6640258fd6bc6bc3183e4dbc61e83bf544.zip
Refactor object writing responsiblities to ObjectDatabase
The ObjectInserter API permits ObjectDatabase implementations to control their own object insertion behavior, rather than forcing it to always be a new loose file created in the local filesystem. Inserted objects can also be queued and written asynchronously to the main application, such as by appending into a pack file that is later closed and added to the repository. This change also starts to open the door to non-file based object storage, such as an in-memory HashMap for unit testing, or a more complex system built on top of a distributed hash table. To help existing application code port to the newer interface we are keeping ObjectWriter as a delegation wrapper to the new API. Each ObjectWriter instances holds a reference to an ObjectInserter for the Repository's top-level ObjectDatabase, and it flushes and releases that instance on each object processed. Change-Id: I413224fb95563e7330c82748deb0aada4e0d6ace Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
index feef66f9ad..e2a3564662 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
@@ -46,10 +46,8 @@
package org.eclipse.jgit.lib;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
@@ -125,11 +123,9 @@ public class ReadTreeTest extends RepositoryTestCase {
}
ObjectId genSha1(String data) {
- InputStream is = new ByteArrayInputStream(data.getBytes());
ObjectWriter objectWriter = new ObjectWriter(db);
try {
- return objectWriter.writeObject(Constants.OBJ_BLOB, data
- .getBytes().length, is, true);
+ return objectWriter.writeBlob(data.getBytes());
} catch (IOException e) {
fail(e.toString());
}