org.apache.flink.runtime.state.ttl.mock.MockStateBackend Java Examples

The following examples show how to use org.apache.flink.runtime.state.ttl.mock.MockStateBackend. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiStateKeyIteratorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static AbstractKeyedStateBackend<Integer> createKeyedStateBackend() {
	MockStateBackend backend = new MockStateBackend();

	return backend.createKeyedStateBackend(
		new DummyEnvironment(),
		new JobID(),
		"mock-backend",
		IntSerializer.INSTANCE,
		129,
		KeyGroupRange.of(0, 128),
		null,
		TtlTimeProvider.DEFAULT,
		UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(),
		Collections.emptyList(),
		new CloseableRegistry());
}
 
Example #2
Source File: MultiStateKeyIteratorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static AbstractKeyedStateBackend<Integer> createKeyedStateBackend() {
	MockStateBackend backend = new MockStateBackend();

	return backend.createKeyedStateBackend(
		new DummyEnvironment(),
		new JobID(),
		"mock-backend",
		IntSerializer.INSTANCE,
		129,
		KeyGroupRange.of(0, 128),
		null,
		TtlTimeProvider.DEFAULT,
		UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(),
		Collections.emptyList(),
		new CloseableRegistry());
}
 
Example #3
Source File: MockTtlStateTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected StateBackendTestContext createStateBackendTestContext(TtlTimeProvider timeProvider) {
	return new StateBackendTestContext(timeProvider) {
		@Override
		protected StateBackend createStateBackend() {
			return new MockStateBackend();
		}
	};
}
 
Example #4
Source File: SnapshotUtilsTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testSnapshotUtilsLifecycle() throws Exception {
	StreamOperator<Void> operator 		= new LifecycleOperator();
	CheckpointStorageWorkerView storage = new MockStateBackend().createCheckpointStorage(new JobID());

	Path path = new Path(folder.newFolder().getAbsolutePath());

	SnapshotUtils.snapshot(operator, 0, 0L, storage, path);

	Assert.assertEquals(EXPECTED_CALL_OPERATOR_SNAPSHOT, ACTUAL_ORDER_TRACKING);
}
 
Example #5
Source File: MockTtlStateTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected StateBackendTestContext createStateBackendTestContext(TtlTimeProvider timeProvider) {
	return new StateBackendTestContext(timeProvider) {
		@Override
		protected StateBackend createStateBackend() {
			return new MockStateBackend();
		}
	};
}
 
Example #6
Source File: SnapshotUtilsTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testSnapshotUtilsLifecycle() throws Exception {
	StreamOperator<Void> operator 		= new LifecycleOperator();
	CheckpointStorageWorkerView storage = new MockStateBackend().createCheckpointStorage(new JobID());

	Path path = new Path(folder.newFolder().getAbsolutePath());

	SnapshotUtils.snapshot(operator, 0, 0L, true, false, storage, path);

	Assert.assertEquals(EXPECTED_CALL_OPERATOR_SNAPSHOT, ACTUAL_ORDER_TRACKING);
}
 
Example #7
Source File: MockTtlStateTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected StateBackendTestContext createStateBackendTestContext(TtlTimeProvider timeProvider) {
	return new StateBackendTestContext(timeProvider) {
		@Override
		protected StateBackend createStateBackend() {
			return new MockStateBackend();
		}
	};
}