Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevBlob


import org.junit.Test;

public class GcTagTest extends GcTestCase {
  @Test
  public void lightweightTag_objectNotPruned() throws Exception {
    RevBlob a = tr.blob("a");
    tr.lightweightTag("t", a);
    gc.setExpireAgeMillis(0);
    fsTick();
    gc.prune(Collections.<ObjectId> emptySet());
    assertTrue(repo.hasObject(a));
View Full Code Here


    assertTrue(repo.hasObject(a));
  }

  @Test
  public void annotatedTag_objectNotPruned() throws Exception {
    RevBlob a = tr.blob("a");
    RevTag t = tr.tag("t", a); // this doesn't create the refs/tags/t ref
    tr.lightweightTag("t", t);

    gc.setExpireAgeMillis(0);
    fsTick();
View Full Code Here

  }

  @Test
  public void testPush_NotAuthorized() throws Exception {
    final TestRepository src = createTestRepository();
    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
View Full Code Here

  }

  @Test
  public void testPush_CreateBranch() throws Exception {
    final TestRepository src = createTestRepository();
    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
View Full Code Here

  }

  @Test
  public void testPush_ChunkedEncoding() throws Exception {
    final TestRepository<Repository> src = createTestRepository();
    final RevBlob Q_bin = src.blob(new TestRng("Q").nextBytes(128 * 1024));
    final RevCommit Q = src.commit().add("Q", Q_bin).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;

View Full Code Here

  }

  @Test
  public void testPush_packSize() throws Exception {
    final TestRepository src = createTestRepository();
    final RevBlob Q_txt = src
        .blob("some blob content to measure pack size");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
View Full Code Here

  }

  public void testWhole_SmallObject() throws Exception {
    final int type = Constants.OBJ_BLOB;
    byte[] data = rng.nextBytes(300);
    RevBlob id = tr.blob(data);
    tr.branch("master").commit().add("A", id).create();
    tr.packAndPrune();
    assertTrue("has blob", wc.has(id));

    ObjectLoader ol = wc.open(id);
View Full Code Here

  }

  public void testWhole_LargeObject() throws Exception {
    final int type = Constants.OBJ_BLOB;
    byte[] data = rng.nextBytes(ObjectLoader.STREAM_THRESHOLD + 5);
    RevBlob id = tr.blob(data);
    tr.branch("master").commit().add("A", id).create();
    tr.packAndPrune();
    assertTrue("has blob", wc.has(id));

    ObjectLoader ol = wc.open(id);
    assertNotNull("created loader", ol);
    assertEquals(type, ol.getType());
    assertEquals(data.length, ol.getSize());
    assertTrue("is large", ol.isLarge());
    try {
      ol.getCachedBytes();
      fail("Should have thrown LargeObjectException");
    } catch (LargeObjectException tooBig) {
      assertEquals(id.name(), tooBig.getMessage());
    }

    ObjectStream in = ol.openStream();
    assertNotNull("have stream", in);
    assertEquals(type, in.getType());
View Full Code Here

  public void testUsingUnknownBlobFails() throws Exception {
    // Try to use the 'n' blob that is not on the server.
    //
    TestRepository<Repository> s = new TestRepository<Repository>(src);
    RevBlob n = s.blob("n");
    RevCommit N = s.commit().parent(B).add("q", n).create();

    // But don't include it in the pack.
    //
    final TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);
    packHeader(pack, 2);
    copy(pack, src.open(N));
    copy(pack,src.open(s.parseBody(N).getTree()));
    digest(pack);

    final TemporaryBuffer.Heap inBuf = new TemporaryBuffer.Heap(1024);
    final PacketLineOut inPckLine = new PacketLineOut(inBuf);
    inPckLine.writeString(ObjectId.zeroId().name() + ' ' + N.name() + ' '
        + "refs/heads/s" + '\0'
        + BasePackPushConnection.CAPABILITY_REPORT_STATUS);
    inPckLine.end();
    pack.writeTo(inBuf, PM);

    final TemporaryBuffer.Heap outBuf = new TemporaryBuffer.Heap(1024);
    final ReceivePack rp = new ReceivePack(dst);
    rp.setCheckReceivedObjects(true);
    rp.setCheckReferencedObjectsAreReachable(true);
    rp.setRefFilter(new HidePrivateFilter());
    rp.receive(new ByteArrayInputStream(inBuf.toByteArray()), outBuf, null);

    final PacketLineIn r = asPacketLineIn(outBuf);
    String master = r.readString();
    int nul = master.indexOf('\0');
    assertTrue("has capability list", nul > 0);
    assertEquals(B.name() + ' ' + R_MASTER, master.substring(0, nul));
    assertSame(PacketLineIn.END, r.readString());

    assertEquals("unpack error Missing blob " + n.name(), r.readString());
    assertEquals("ng refs/heads/s n/a (unpacker error)", r.readString());
    assertSame(PacketLineIn.END, r.readString());
  }
View Full Code Here

    cfg.save();
  }

  public void testPush_CreateBranch() throws Exception {
    final TestRepository src = createTestRepository();
    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    final Transport t = Transport.open(db, remoteURI);
    try {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.revwalk.RevBlob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.