Package org.eclipse.jgit.junit

Examples of org.eclipse.jgit.junit.TestRng


  }

  public void testDestroyWhileOpen() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    try {
      b.write(new TestRng(getName())
          .nextBytes(TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 2));
    } finally {
      b.destroy();
    }
  }
View Full Code Here


    }
  }

  public void testRandomWrites() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final TestRng rng = new TestRng(getName());
    final int max = TemporaryBuffer.DEFAULT_IN_CORE_LIMIT * 2;
    final byte[] expect = new byte[max];
    try {
      int written = 0;
      boolean onebyte = true;
      while (written < max) {
        if (onebyte) {
          final byte v = (byte) rng.nextInt();
          b.write(v);
          expect[written++] = v;
        } else {
          final int len = Math
              .min(rng.nextInt() & 127, max - written);
          final byte[] tmp = rng.nextBytes(len);
          b.write(tmp, 0, len);
          System.arraycopy(tmp, 0, expect, written, len);
          written += len;
        }
        onebyte = !onebyte;
View Full Code Here

  private byte[] delta;

  protected void setUp() throws Exception {
    super.setUp();
    rng = new TestRng(getName());
    deltaBuf = new ByteArrayOutputStream();
  }
View Full Code Here

        .getResponseHeader(HDR_CONTENT_TYPE));
  }

  public void testPush_ChunkedEncoding() throws Exception {
    final TestRepository<FileRepository> 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 FileRepository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;

View Full Code Here

  private ByteArrayOutputStream dstBuf;

  protected void setUp() throws Exception {
    super.setUp();
    rng = new TestRng(getName());
    actDeltaBuf = new ByteArrayOutputStream();
    expDeltaBuf = new ByteArrayOutputStream();
    expDeltaEnc = new DeltaEncoder(expDeltaBuf, 0, 0);
    dstBuf = new ByteArrayOutputStream();
  }
View Full Code Here

    }
  }

  public void testOneByte() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final byte test = (byte) new TestRng(getName()).nextInt();
    try {
      b.write(test);
      b.close();
      assertEquals(1, b.length());
      {
View Full Code Here

    }
  }

  public void testOneBlock_BulkWrite() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final byte[] test = new TestRng(getName())
        .nextBytes(TemporaryBuffer.Block.SZ);
    try {
      b.write(test, 0, 2);
      b.write(test, 2, 4);
      b.write(test, 6, test.length - 6 - 2);
View Full Code Here

    }
  }

  public void testOneBlockAndHalf_BulkWrite() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final byte[] test = new TestRng(getName())
        .nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
    try {
      b.write(test, 0, 2);
      b.write(test, 2, 4);
      b.write(test, 6, test.length - 6 - 2);
View Full Code Here

    }
  }

  public void testOneBlockAndHalf_SingleWrite() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final byte[] test = new TestRng(getName())
        .nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
    try {
      for (int i = 0; i < test.length; i++)
        b.write(test[i]);
      b.close();
View Full Code Here

    }
  }

  public void testOneBlockAndHalf_Copy() throws IOException {
    final TemporaryBuffer b = new TemporaryBuffer.LocalFile();
    final byte[] test = new TestRng(getName())
        .nextBytes(TemporaryBuffer.Block.SZ * 3 / 2);
    try {
      final ByteArrayInputStream in = new ByteArrayInputStream(test);
      b.write(in.read());
      b.copy(in);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.junit.TestRng

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.