|
|
@ -52,6 +52,7 @@ import static org.junit.Assert.fail; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.junit.TestRng; |
|
|
|
import org.eclipse.jgit.junit.TestRng; |
|
|
@ -248,6 +249,20 @@ public class TemporaryBufferTest { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testInCoreInputStream() throws IOException { |
|
|
|
|
|
|
|
final int cnt = 256; |
|
|
|
|
|
|
|
final byte[] test = new TestRng(getName()).nextBytes(cnt); |
|
|
|
|
|
|
|
final TemporaryBuffer.Heap b = new TemporaryBuffer.Heap(cnt + 4); |
|
|
|
|
|
|
|
b.write(test); |
|
|
|
|
|
|
|
b.close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InputStream in = b.openInputStream(); |
|
|
|
|
|
|
|
byte[] act = new byte[cnt]; |
|
|
|
|
|
|
|
IO.readFully(in, act, 0, cnt); |
|
|
|
|
|
|
|
assertTrue(Arrays.equals(test, act)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testInCoreLimit_SwitchOnAppendByte() throws IOException { |
|
|
|
public void testInCoreLimit_SwitchOnAppendByte() throws IOException { |
|
|
|
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(); |
|
|
|
final TemporaryBuffer b = new TemporaryBuffer.LocalFile(); |
|
|
|