This is an automated email from the ASF dual-hosted git repository.
chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new a390675 [FLINK-24986][tests] Replace anonymous StreamStateHandle class
a390675 is described below
commit a390675e6f778387933d0fc53cca0e627bbd7c1a
Author: Chesnay Schepler <[email protected]>
AuthorDate: Mon Nov 22 12:09:06 2021 +0100
[FLINK-24986][tests] Replace anonymous StreamStateHandle class
---
.../state/RocksDBStateDownloaderTest.java | 49 +++++++++++++---------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloaderTest.java
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloaderTest.java
index 2e22487..ee5bcec 100644
---
a/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloaderTest.java
+++
b/flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloaderTest.java
@@ -56,26 +56,7 @@ public class RocksDBStateDownloaderTest extends TestLogger {
public void testMultiThreadRestoreThreadPoolExceptionRethrow() {
SpecifiedException expectedException =
new SpecifiedException("throw exception while multi thread
restore.");
- StreamStateHandle stateHandle =
- new StreamStateHandle() {
- @Override
- public FSDataInputStream openInputStream() throws
IOException {
- throw expectedException;
- }
-
- @Override
- public Optional<byte[]> asBytesIfInMemory() {
- return Optional.empty();
- }
-
- @Override
- public void discardState() {}
-
- @Override
- public long getStateSize() {
- return 0;
- }
- };
+ StreamStateHandle stateHandle = new
ThrowingStateHandle(expectedException);
Map<StateHandleID, StreamStateHandle> stateHandles = new HashMap<>(1);
stateHandles.put(new StateHandleID("state1"), stateHandle);
@@ -155,4 +136,32 @@ public class RocksDBStateDownloaderTest extends TestLogger
{
super(message);
}
}
+
+ private static class ThrowingStateHandle implements StreamStateHandle {
+ private static final long serialVersionUID = -2102069659550694805L;
+
+ private final IOException expectedException;
+
+ private ThrowingStateHandle(IOException expectedException) {
+ this.expectedException = expectedException;
+ }
+
+ @Override
+ public FSDataInputStream openInputStream() throws IOException {
+ throw expectedException;
+ }
+
+ @Override
+ public Optional<byte[]> asBytesIfInMemory() {
+ return Optional.empty();
+ }
+
+ @Override
+ public void discardState() {}
+
+ @Override
+ public long getStateSize() {
+ return 0;
+ }
+ }
}