Package io.github.flink.gcp.connector.testutils
package io.github.flink.gcp.connector.testutils
-
ClassDescriptionDeadline-bounded polling for test assertions.
ReaderOutputfor tests that driveSourceReaderBase.pollNext(...), delegating to one sharedCollectingSourceOutputwhatever split a record came from.SourceOutputrecording emitted records and their timestamps — what aRecordEmitteris handed, and what a test driving one asserts against.Deadline-bounded draining of a running job's collect iterator.A queue-backedMailboxExecutorfor tests:FakeMailboxExecutor.execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions, org.apache.flink.util.function.ThrowingRunnable<? extends java.lang.Exception>, java.lang.String, java.lang.Object...)enqueues mails,FakeMailboxExecutor.yield()runs the next mail (blocking until one arrives, like the real mailbox),FakeMailboxExecutor.drain()runs every mail already enqueued, andFakeMailboxExecutor.quiesce()makes every laterFakeMailboxExecutor.execute(org.apache.flink.api.common.operators.MailboxExecutor.MailOptions, org.apache.flink.util.function.ThrowingRunnable<? extends java.lang.Exception>, java.lang.String, java.lang.Object...)throw theRejectedExecutionExceptionthe real mailbox throws once the task has quiesced it, which happens before the operators close.In-memorySourceReaderContextfor the tests of a pull-assignment source reader.FakeSplitEnumeratorContext<SplitT extends org.apache.flink.api.connector.source.SourceSplit>In-memorySplitEnumeratorContextfor the tests of a pull-assignment enumerator — one whose readers ask for work throughhandleSplitRequest.Captures what a class logs, so a test can assert the line rather than only its side effects.One collected log event, flattened out of log4j2's own type.The levels a capture can be taken at, so no log4j2 type reaches this class's signature.Publishes every container's ports on the loopback address the Docker host resolves to, rather than on the wildcard address, so a host-port collision with an unrelated local process cannot form (ADR-0132).Assertions shared by the Table API option-set tests.Creates synthetic service-account keys for credential wiring tests: structurally valid enough for the Google auth libraries to parse — a real RSA key in a real PEM envelope — while naming anexample.invalidaccount no service would ever accept, so a test that leaks one at a real endpoint fails loudly rather than authenticating.The parts ofWriterInitContexta sink reads when creating a writer; everything a sink has no reason to touch is unsupported, so a new dependency on the context shows up as a failing test rather than as a silent null.Shared test stubs forSinkWriter.Context.Random resource-name helpers for tests whose resources share a namespace — the gated real-GCP suites above all, where concurrent runs must not collide on resource names and a crashed run must leave behind names that identify it, but also an emulator harness giving each test a database of its own.ASinkCommitterMetricGroupwhose metrics can be read back by the names they registered under —TestSinkCommitterMetricGroupis to a committer whatTestSinkWriterMetricGroupis to a writer, and for the same reason:UnregisteredMetricsGroup.createSinkCommitterMetricGroup()hands out a freshSimpleCounterper call, so a counter the committer registered is unreachable afterwards.ASinkWriterMetricGroupwhose metrics can be read back by the names they registered under, so a sink writer's metrics are asserted the way a reporter would see them.