diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceKafkaTest.java new file mode 100644 index 0000000000..41026ddfd8 --- /dev/null +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceKafkaTest.java @@ -0,0 +1,24 @@ +/** + * Licensed 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 io.streamnative.pulsar.handlers.kop; + +/** + * test topics in different namespaces with `entryFormat=kafka`. + */ +public class DifferentNamespaceKafkaTest extends DifferentNamespaceTestBase { + + public DifferentNamespaceKafkaTest() { + super("kafka"); + } +} diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespacePulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespacePulsarTest.java new file mode 100644 index 0000000000..b77640fe2d --- /dev/null +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespacePulsarTest.java @@ -0,0 +1,24 @@ +/** + * Licensed 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 io.streamnative.pulsar.handlers.kop; + +/** + * test topics in different namespaces with `entryFormat=pulsar`. + */ +public class DifferentNamespacePulsarTest extends DifferentNamespaceTestBase { + + public DifferentNamespacePulsarTest() { + super("pulsar"); + } +} diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTestBase.java similarity index 95% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTestBase.java index 52d56dd50e..be8016c414 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTestBase.java @@ -43,32 +43,23 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; import org.testng.annotations.Test; /** * test topics in different namespaces. */ @Slf4j -public class DifferentNamespaceTest extends KopProtocolHandlerTestBase { +public abstract class DifferentNamespaceTestBase extends KopProtocolHandlerTestBase { private static final String DEFAULT_TENANT = "public"; private static final String DEFAULT_NAMESPACE = "default"; private static final String ANOTHER_TENANT = "my-tenant"; private static final String ANOTHER_NAMESPACE = "my-ns"; - public DifferentNamespaceTest(final String entryFormat) { + public DifferentNamespaceTestBase(final String entryFormat) { super(entryFormat); } - @Factory - public static Object[] instances() { - return new Object[] { - new DifferentNamespaceTest("pulsar"), - new DifferentNamespaceTest("kafka") - }; - } - @DataProvider(name = "topics") public static Object[][] topics() { return new Object[][] { diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledKafkaTest.java new file mode 100644 index 0000000000..73fa423af9 --- /dev/null +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledKafkaTest.java @@ -0,0 +1,24 @@ +/** + * Licensed 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 io.streamnative.pulsar.handlers.kop; + +/** + * Test authentication enabled with `entryFormat=kafka`. + */ +public class PulsarAuthEnabledKafkaTest extends PulsarAuthEnabledTestBase { + + public PulsarAuthEnabledKafkaTest() { + super("kafka"); + } +} diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledPulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledPulsarTest.java new file mode 100644 index 0000000000..e05f3f87ec --- /dev/null +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledPulsarTest.java @@ -0,0 +1,24 @@ +/** + * Licensed 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 io.streamnative.pulsar.handlers.kop; + +/** + * Test authentication enabled with `entryFormat=pulsar`. + */ +public class PulsarAuthEnabledPulsarTest extends PulsarAuthEnabledTestBase { + + public PulsarAuthEnabledPulsarTest() { + super("pulsar"); + } +} diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTestBase.java similarity index 94% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTestBase.java index aac84277f5..ba6786df25 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PulsarAuthEnabledTestBase.java @@ -40,7 +40,6 @@ import org.apache.pulsar.common.policies.data.AuthAction; import org.apache.pulsar.common.policies.data.TenantInfo; import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; import org.testng.annotations.Test; /** @@ -50,7 +49,7 @@ * This is similar to SaslPlainTest, but the KoP SASL is not enabled. */ @Slf4j -public class PulsarAuthEnabledTest extends KopProtocolHandlerTestBase { +public abstract class PulsarAuthEnabledTestBase extends KopProtocolHandlerTestBase { private static final String TENANT = "PulsarAuthEnabledTest"; private static final String ADMIN_USER = "admin_user"; private static final String NAMESPACE = "ns2"; @@ -58,18 +57,10 @@ public class PulsarAuthEnabledTest extends KopProtocolHandlerTestBase { private static final String TOPIC = "persistent://" + TENANT + "/" + NAMESPACE + "/" + SHORT_TOPIC; private String adminToken; - public PulsarAuthEnabledTest(final String entryFormat) { + public PulsarAuthEnabledTestBase(final String entryFormat) { super(entryFormat); } - @Factory - public static Object[] instances() { - return new Object[] { - new PulsarAuthEnabledTest("pulsar"), - new PulsarAuthEnabledTest("kafka") - }; - } - @BeforeClass @Override protected void setup() throws Exception {