Package org.eclipse.jgit.internal.storage.pack

Examples of org.eclipse.jgit.internal.storage.pack.DeltaIndex


    // The index should be smaller than expected due to the chain
    // being truncated. Without truncation we would expect to have
    // more than 3584 bytes used.
    //
    assertEquals(2636, new DeltaIndex(src).getIndexSize());
  }
View Full Code Here


  }

  @Test
  public void testIndexSize() {
    src = getRng().nextBytes(1024);
    DeltaIndex di = new DeltaIndex(src);
    assertEquals(1860, di.getIndexSize());
    assertEquals("DeltaIndex[2 KiB]", di.toString());
  }
View Full Code Here

  @Test
  public void testLimitObjectSize_Length12InsertFails() throws IOException {
    src = getRng().nextBytes(12);
    dst = src;

    DeltaIndex di = new DeltaIndex(src);
    assertFalse(di.encode(actDeltaBuf, dst, src.length));
  }
View Full Code Here

  @Test
  public void testLimitObjectSize_Length130InsertFails() throws IOException {
    src = getRng().nextBytes(130);
    dst = getRng().nextBytes(130);

    DeltaIndex di = new DeltaIndex(src);
    assertFalse(di.encode(actDeltaBuf, dst, src.length));
  }
View Full Code Here

  public void testLimitObjectSize_Length130CopyOk() throws IOException {
    src = getRng().nextBytes(130);
    copy(0, 130);
    dst = dstBuf.toByteArray();

    DeltaIndex di = new DeltaIndex(src);
    assertTrue(di.encode(actDeltaBuf, dst, dst.length));

    byte[] actDelta = actDeltaBuf.toByteArray();
    byte[] expDelta = expDeltaBuf.toByteArray();

    assertEquals(BinaryDelta.format(expDelta, false), //
View Full Code Here

    dst = dstBuf.toByteArray();

    // The header requires 4 bytes for these objects, so a target length
    // of 5 is bigger than the copy instruction and should cause an abort.
    //
    DeltaIndex di = new DeltaIndex(src);
    assertFalse(di.encode(actDeltaBuf, dst, 5));
    assertEquals(4, actDeltaBuf.size());
  }
View Full Code Here

    dst = dstBuf.toByteArray();

    // The header requires 4 bytes for these objects, so a target length
    // of 5 is bigger than the copy instruction and should cause an abort.
    //
    DeltaIndex di = new DeltaIndex(src);
    assertFalse(di.encode(actDeltaBuf, dst, 5));
    assertEquals(4, actDeltaBuf.size());
  }
View Full Code Here

  }

  private void doTest() throws IOException {
    dst = dstBuf.toByteArray();

    DeltaIndex di = new DeltaIndex(src);
    di.encode(actDeltaBuf, dst);

    byte[] actDelta = actDeltaBuf.toByteArray();
    byte[] expDelta = expDeltaBuf.toByteArray();

    assertEquals(BinaryDelta.format(expDelta, false), //
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.internal.storage.pack.DeltaIndex

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.