HDDS-454. TestChunkStreams#testErrorReadGroupInputStream & TestChunkStreams#testReadGroupInputStream are failing. Contributed by chencan.

This commit is contained in:
Nanda kumar 2018-09-15 01:38:13 +05:30
parent c1df3084ff
commit 5470de420b

View File

@ -121,6 +121,7 @@ public void testReadGroupInputStream() throws Exception {
int tempOffset = offset;
ChunkInputStream in =
new ChunkInputStream(null, null, null, new ArrayList<>(), null) {
private long pos = 0;
private ByteArrayInputStream in =
new ByteArrayInputStream(buf, tempOffset, 100);
@ -131,7 +132,7 @@ public void seek(long pos) throws IOException {
@Override
public long getPos() throws IOException {
throw new UnsupportedOperationException();
return pos;
}
@Override
@ -147,7 +148,9 @@ public int read() throws IOException {
@Override
public int read(byte[] b, int off, int len) throws IOException {
return in.read(b, off, len);
int readLen = in.read(b, off, len);
pos += readLen;
return readLen;
}
};
inputStreams.add(in);
@ -175,6 +178,7 @@ public void testErrorReadGroupInputStream() throws Exception {
int tempOffset = offset;
ChunkInputStream in =
new ChunkInputStream(null, null, null, new ArrayList<>(), null) {
private long pos = 0;
private ByteArrayInputStream in =
new ByteArrayInputStream(buf, tempOffset, 100);
@ -185,7 +189,7 @@ public void seek(long pos) throws IOException {
@Override
public long getPos() throws IOException {
throw new UnsupportedOperationException();
return pos;
}
@Override
@ -201,7 +205,9 @@ public int read() throws IOException {
@Override
public int read(byte[] b, int off, int len) throws IOException {
return in.read(b, off, len);
int readLen = in.read(b, off, len);
pos += readLen;
return readLen;
}
};
inputStreams.add(in);