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

Examples of org.eclipse.jgit.internal.storage.pack.DeltaIndex.encode()


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

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

  @Test
  public void testLimitObjectSize_Length130InsertFails() throws IOException {
    src = getRng().nextBytes(130);
View Full Code Here


  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));
  }

  @Test
  public void testLimitObjectSize_Length130CopyOk() throws IOException {
    src = getRng().nextBytes(130);
View Full Code Here

    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

    // 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());
  }

  @Test
  public void testLimitObjectSize_InsertFrontFails() throws IOException {
View Full Code Here

    // 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());
  }

  private void copy(int offset, int len) throws IOException {
    dstBuf.write(src, offset, len);
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
Copyright © 2018 www.massapi.com. 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.