Skip to content

Commit

Permalink
try to split context
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jul 17, 2023
1 parent 9ddf2fe commit f8b7f55
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class PulsarSinkE2ECase extends SinkTestSuiteBase<String> {
@TestExternalSystem
PulsarContainerTestEnvironment pulsar = new PulsarContainerTestEnvironment(flink);

// Defines a set of external context Factories for different test cases.
@TestContext
PulsarTestContextFactory<String, SingleTopicProducingContext> sinkContext =
new PulsarTestContextFactory<>(pulsar, SingleTopicProducingContext::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

package org.apache.flink.tests.util.pulsar;

import static org.apache.flink.streaming.api.CheckpointingMode.EXACTLY_ONCE;
import org.apache.flink.connector.pulsar.testutils.PulsarTestContextFactory;
import org.apache.flink.connector.pulsar.testutils.source.cases.MultipleTopicsConsumingContext;
import org.apache.flink.connector.pulsar.testutils.source.cases.PartialKeysConsumingContext;
import org.apache.flink.connector.testframe.junit.annotations.TestContext;
import org.apache.flink.connector.testframe.junit.annotations.TestEnv;
import org.apache.flink.connector.testframe.junit.annotations.TestExternalSystem;
Expand All @@ -29,15 +29,12 @@
import org.apache.flink.streaming.api.CheckpointingMode;
import org.apache.flink.tests.util.pulsar.common.FlinkContainerWithPulsarEnvironment;
import org.apache.flink.tests.util.pulsar.common.PulsarContainerTestEnvironment;

import org.junit.jupiter.api.Tag;

import static org.apache.flink.streaming.api.CheckpointingMode.EXACTLY_ONCE;

/** Pulsar source E2E test based on the connector testing framework. */
@SuppressWarnings("unused")
@Tag("org.apache.flink.testutils.junit.FailsOnJava11")
public class PulsarSourceE2ECase extends SourceTestSuiteBase<String> {
public class PulsarSourceKeySharedE2ECase extends SourceTestSuiteBase<String> {

// Defines the Semantic.
@TestSemantics CheckpointingMode[] semantics = new CheckpointingMode[] {EXACTLY_ONCE};
Expand All @@ -50,12 +47,7 @@ public class PulsarSourceE2ECase extends SourceTestSuiteBase<String> {
@TestExternalSystem
PulsarContainerTestEnvironment pulsar = new PulsarContainerTestEnvironment(flink);

// Defines a set of external context Factories for different test cases.
@TestContext
PulsarTestContextFactory<String, MultipleTopicsConsumingContext> multipleTopic =
PulsarTestContextFactory<String, MultipleTopicsConsumingContext> context =
new PulsarTestContextFactory<>(pulsar, MultipleTopicsConsumingContext::new);

@TestContext
PulsarTestContextFactory<String, PartialKeysConsumingContext> partialKeys =
new PulsarTestContextFactory<>(pulsar, PartialKeysConsumingContext::new);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.flink.tests.util.pulsar;

import org.apache.flink.connector.pulsar.testutils.PulsarTestContextFactory;
import org.apache.flink.connector.pulsar.testutils.source.cases.PartialKeysConsumingContext;
import org.apache.flink.connector.testframe.junit.annotations.TestContext;
import org.apache.flink.connector.testframe.junit.annotations.TestEnv;
import org.apache.flink.connector.testframe.junit.annotations.TestExternalSystem;
import org.apache.flink.connector.testframe.junit.annotations.TestSemantics;
import org.apache.flink.connector.testframe.testsuites.SourceTestSuiteBase;
import org.apache.flink.streaming.api.CheckpointingMode;
import org.apache.flink.tests.util.pulsar.common.FlinkContainerWithPulsarEnvironment;
import org.apache.flink.tests.util.pulsar.common.PulsarContainerTestEnvironment;

import org.junit.jupiter.api.Tag;

import static org.apache.flink.streaming.api.CheckpointingMode.EXACTLY_ONCE;

/** Pulsar source E2E test based on the connector testing framework. */
@SuppressWarnings("unused")
@Tag("org.apache.flink.testutils.junit.FailsOnJava11")
public class PulsarSourceMultipleTopicsE2ECase extends SourceTestSuiteBase<String> {

// Defines the Semantic.
@TestSemantics CheckpointingMode[] semantics = new CheckpointingMode[] {EXACTLY_ONCE};

// Defines TestEnvironment.
@TestEnv
FlinkContainerWithPulsarEnvironment flink = new FlinkContainerWithPulsarEnvironment(1, 6);

// Defines ConnectorExternalSystem.
@TestExternalSystem
PulsarContainerTestEnvironment pulsar = new PulsarContainerTestEnvironment(flink);

@TestContext
PulsarTestContextFactory<String, PartialKeysConsumingContext> context =
new PulsarTestContextFactory<>(pulsar, PartialKeysConsumingContext::new);
}

0 comments on commit f8b7f55

Please sign in to comment.