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

(cherry picked from commit 5470de420b2660e3042a5fec566ecc6b0d8ff93a)
This commit is contained in:
Nanda kumar 2018-09-15 01:38:13 +05:30
parent 5d47072b43
commit 1b3f1b89a5

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