diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 651edad9c0..59d89d233e 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -15,66 +15,200 @@ concurrency: cancel-in-progress: true jobs: - build: - + basic-validation: + name: Style check and basic unit tests runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 + - uses: actions/checkout@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 - - name: License check - run: mvn -ntp -B license:check + - name: License check + run: mvn -ntp -B license:check - - name: Style check - run: mvn -ntp -B checkstyle:check + - name: Style check + run: mvn -ntp -B checkstyle:check - - name: Build with Maven skipTests - run: mvn clean install -ntp -B -DskipTests + - name: Build with Maven skipTests + run: mvn clean install -ntp -B -DskipTests - - name: Building JavaDocs - run: mvn -ntp -B javadoc:jar + - name: Building JavaDocs + run: mvn -ntp -B javadoc:jar - - name: Spotbugs check - run: mvn -ntp -B spotbugs:check + - name: Spotbugs check + run: mvn -ntp -B spotbugs:check - - name: kafka-impl test after build - run: mvn test -ntp -B -DfailIfNoTests=false -pl kafka-impl + - name: kafka-impl test after build + run: mvn test -ntp -B -DfailIfNoTests=false -pl kafka-impl - - name: schema registry test after build - run: mvn test -ntp -B -DfailIfNoTests=false -pl schema-registry + - name: schema registry test after build + run: mvn test -ntp -B -DfailIfNoTests=false -pl schema-registry - - name: kafka-payload-processor test after build - run: mvn test -ntp -B -DfailIfNoTests=false -pl kafka-payload-processor-shaded-tests + - name: kafka-payload-processor test after build + run: mvn test -ntp -B -DfailIfNoTests=false -pl kafka-payload-processor-shaded-tests - - name: Start and init the oauth server - run: ./ci/init_hydra_oauth_server.sh - timeout-minutes: 5 + - name: Start and init the oauth server + run: ./ci/init_hydra_oauth_server.sh + timeout-minutes: 5 - - name: oauth-client test after build - run: mvn test -ntp -B -DfailIfNoTests=false -pl oauth-client + - name: oauth-client test after build + run: mvn test -ntp -B -DfailIfNoTests=false -pl oauth-client - - name: tests module - run: mvn test -ntp -B -DfailIfNoTests=false '-Dtest=!KafkaIntegration*Test' -pl tests - timeout-minutes: 60 + - name: Upload to Codecov + uses: codecov/codecov-action@v3 - - name: Upload to Codecov - uses: codecov/codecov-action@v3 + - name: package surefire artifacts + if: failure() + run: | + rm -rf artifacts + mkdir artifacts + find . -type d -name "*surefire*" -exec cp --parents -R {} artifacts/ \; + zip -r artifacts.zip artifacts - - name: package surefire artifacts - if: failure() - run: | - rm -rf artifacts - mkdir artifacts - find . -type d -name "*surefire*" -exec cp --parents -R {} artifacts/ \; - zip -r artifacts.zip artifacts + - uses: actions/upload-artifact@master + name: upload surefire-artifacts + if: failure() + with: + name: surefire-artifacts + path: artifacts.zip - - uses: actions/upload-artifact@master - name: upload surefire-artifacts - if: failure() - with: - name: surefire-artifacts - path: artifacts.zip + kop-unit-tests: + name: Unit Test (${{ matrix.test.name }}) + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + # other jobs should run even if one test fails + fail-fast: false + matrix: + test: [ + { + name: "admin test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.admin.*Test' -pl tests" + ] + }, + { + name: "compatibility test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.compatibility.*Test' -pl tests", + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.compatibility..*.*Test' -pl tests" + ] + }, + { + name: "coordinator test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.coordinator.*Test' -pl tests", + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.coordinator..*.*Test' -pl tests" + ] + }, + { + name: "end to end test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.e2e.*Test' -pl tests" + ] + }, + { + name: "format test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.format.*Test' -pl tests" + ] + }, + { + name: "metadata test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.metadata.*Test' -pl tests" + ] + }, + { + name: "metrics test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.metrics.*Test' -pl tests" + ] + }, + { + name: "producer test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.producer.*Test' -pl tests" + ] + }, + { + name: "schema test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.schemaregistry.model.impl.*Test' -pl tests" + ] + }, + { + name: "security test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.security.*Test' -pl tests", + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.security.*.*Test' -pl tests" + ] + }, + { + name: "storage test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.storage.*Test' -pl tests" + ] + }, + { + name: "streams test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.streams.*Test' -pl tests" + ] + }, + { + name: "util test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.util.timer.*Test' -pl tests" + ] + }, + { + name: "other test", + scripts: [ + "mvn test -ntp -B -DfailIfNoTests=false '-Dtest=io.streamnative.pulsar.handlers.kop.*Test' -pl tests" + ] + }, + ] + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install jq + run: sudo apt-get install -y jq + + - name: Build with Maven skipTests + run: mvn clean install -ntp -B -DskipTests + + - name: Start and init the oauth server + run: ./ci/init_hydra_oauth_server.sh + timeout-minutes: 5 + + - name: ${{ matrix.test.name }} + run: | + echo '${{ matrix.test.scripts }}' + scripts=$(echo '${{ toJson(matrix.test.scripts) }}' | jq -r '.[]') + IFS=$'\n' # change the internal field separator to newline + echo $scripts + for script in $scripts + do + bash -c "${script}" + done + unset IFS # revert the internal field separator back to default + + unit-test-check: + name: Unit Test Check + runs-on: ubuntu-latest + needs: kop-unit-tests # This job will only run if all 'kop-unit-tests' jobs have completed successfully + steps: + - name: Check + run: echo "All tests have passed!" diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAdminTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KafkaAdminTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAdminTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KafkaAdminTest.java index 7e5a88c028..897af7490c 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAdminTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KafkaAdminTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.admin; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; @@ -21,6 +21,8 @@ import com.google.common.collect.Sets; import io.jsonwebtoken.lang.Maps; +import io.streamnative.pulsar.handlers.kop.KafkaLogConfig; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.ArrayList; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KopBrokerLookupManagerTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KopBrokerLookupManagerTest.java similarity index 91% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KopBrokerLookupManagerTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KopBrokerLookupManagerTest.java index 4120cd7c80..830a29193c 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KopBrokerLookupManagerTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/KopBrokerLookupManagerTest.java @@ -11,11 +11,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.admin; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; +import io.streamnative.pulsar.handlers.kop.KopBrokerLookupManager; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; +import io.streamnative.pulsar.handlers.kop.LookupClient; import java.util.Collections; import lombok.extern.slf4j.Slf4j; import org.apache.pulsar.common.policies.data.TenantInfo; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/OffsetResetTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/OffsetResetTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/OffsetResetTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/OffsetResetTest.java index 6085fb10f5..7c4e7f5fbf 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/OffsetResetTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/admin/OffsetResetTest.java @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.admin; import static org.apache.pulsar.common.naming.TopicName.PARTITIONED_TOPIC_SUFFIX; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import io.streamnative.pulsar.handlers.kop.coordinator.group.GroupMetadataConstants; import io.streamnative.pulsar.handlers.kop.coordinator.group.GroupMetadataManager.BaseKey; import io.streamnative.pulsar.handlers.kop.coordinator.group.GroupMetadataManager.OffsetKey; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionTest.java index b045307010..6b18cac4bf 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.coordinator.transaction; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.MatcherAssert.assertThat; @@ -22,9 +22,8 @@ import static org.testng.Assert.fail; import com.google.common.collect.ImmutableMap; -import io.streamnative.pulsar.handlers.kop.coordinator.transaction.TransactionCoordinator; -import io.streamnative.pulsar.handlers.kop.coordinator.transaction.TransactionState; -import io.streamnative.pulsar.handlers.kop.coordinator.transaction.TransactionStateManager; +import io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import io.streamnative.pulsar.handlers.kop.scala.Either; import io.streamnative.pulsar.handlers.kop.storage.PartitionLog; import java.time.Duration; @@ -111,17 +110,17 @@ protected static Object[][] produceConfigProvider() { }; } - @Test(timeOut = 1000 * 10, dataProvider = "produceConfigProvider") + @Test(timeOut = 1000 * 30, dataProvider = "produceConfigProvider") public void readCommittedTest(boolean isBatch) throws Exception { basicProduceAndConsumeTest("read-committed-test", "txn-11", "read_committed", isBatch); } - @Test(timeOut = 1000 * 10, dataProvider = "produceConfigProvider") + @Test(timeOut = 1000 * 30, dataProvider = "produceConfigProvider") public void readUncommittedTest(boolean isBatch) throws Exception { basicProduceAndConsumeTest("read-uncommitted-test", "txn-12", "read_uncommitted", isBatch); } - @Test(timeOut = 1000 * 10) + @Test(timeOut = 1000 * 30) public void testInitTransaction() { final KafkaProducer producer = buildTransactionProducer("prod-1"); @@ -129,7 +128,7 @@ public void testInitTransaction() { producer.close(); } - @Test(timeOut = 1000 * 10) + @Test(timeOut = 1000 * 30) public void testMultiCommits() throws Exception { final String topic = "test-multi-commits"; final KafkaProducer producer1 = buildTransactionProducer("X1"); @@ -278,7 +277,7 @@ public void offsetCommitTest() throws Exception { txnOffsetTest("txn-offset-commit-test", 10, true); } - @Test(timeOut = 1000 * 10) + @Test(timeOut = 3000 * 10) public void offsetAbortTest() throws Exception { txnOffsetTest("txn-offset-abort-test", 10, false); } diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionWithOAuthBearerAuthTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionWithOAuthBearerAuthTest.java similarity index 95% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionWithOAuthBearerAuthTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionWithOAuthBearerAuthTest.java index f320f98718..7eb82cee89 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/TransactionWithOAuthBearerAuthTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/coordinator/transaction/TransactionWithOAuthBearerAuthTest.java @@ -11,11 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.coordinator.transaction; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.security.oauth.HydraOAuthUtils; import io.streamnative.pulsar.handlers.kop.security.oauth.OauthLoginCallbackHandler; import io.streamnative.pulsar.handlers.kop.security.oauth.OauthValidatorCallbackHandler; +import io.streamnative.pulsar.handlers.kop.security.oauth.SaslOAuthKopHandlersTest; import java.net.URL; import java.util.Properties; import lombok.extern.slf4j.Slf4j; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndKafkaTest.java similarity index 88% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndKafkaTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndKafkaTest.java index 4ec924384b..a5a17719e2 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndKafkaTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndKafkaTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; @@ -19,6 +19,8 @@ import static org.testng.Assert.fail; import io.streamnative.kafka.client.api.Header; +import io.streamnative.pulsar.handlers.kop.KafkaPayloadProcessor; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Arrays; @@ -60,27 +62,25 @@ public BasicEndToEndKafkaTest() { @DataProvider(name = "enableBatching") public static Object[][] enableBatching() { - return new Object[][]{ { true }, { false } }; + return new Object[][]{{true}, {false}}; } @Test(timeOut = 20000) public void testNullValueMessages() throws Exception { final String topic = "test-produce-null-value"; - @Cleanup - final KafkaProducer kafkaProducer = newKafkaProducer(); + @Cleanup final KafkaProducer kafkaProducer = newKafkaProducer(); sendSingleMessages(kafkaProducer, topic, Arrays.asList(null, "")); sendBatchedMessages(kafkaProducer, topic, Arrays.asList("test", "", null)); final List expectedMessages = Arrays.asList(null, "", "test", "", null); - @Cleanup - final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); + @Cleanup final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); List kafkaReceives = receiveMessages(kafkaConsumer, expectedMessages.size()); assertEquals(kafkaReceives, expectedMessages); - @Cleanup - final Consumer pulsarConsumer = newPulsarConsumer(topic, SUBSCRIPTION, new KafkaPayloadProcessor()); + @Cleanup final Consumer pulsarConsumer = + newPulsarConsumer(topic, SUBSCRIPTION, new KafkaPayloadProcessor()); List pulsarReceives = receiveMessages(pulsarConsumer, expectedMessages.size()); assertEquals(pulsarReceives, expectedMessages); } @@ -143,22 +143,28 @@ public void testPollEmptyTopic() throws Exception { String msgStrPrefix = "Message_kop_KafkaProduceAndConsume_" + partitionNumber + "_"; @Cleanup - KProducer kProducer = new KProducer(kafkaTopic, false, getKafkaBrokerPort(), true); + KopProtocolHandlerTestBase.KProducer kProducer = + new KopProtocolHandlerTestBase.KProducer(kafkaTopic, false, getKafkaBrokerPort(), true); kafkaPublishMessage(kProducer, totalMsg, msgStrPrefix); @Cleanup - KConsumer kConsumer1 = new KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-1"); + KopProtocolHandlerTestBase.KConsumer kConsumer1 = + new KopProtocolHandlerTestBase.KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-1"); @Cleanup - KConsumer kConsumer2 = new KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-2"); + KopProtocolHandlerTestBase.KConsumer kConsumer2 = + new KopProtocolHandlerTestBase.KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-2"); @Cleanup - KConsumer kConsumer3 = new KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-3"); + KopProtocolHandlerTestBase.KConsumer kConsumer3 = + new KopProtocolHandlerTestBase.KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-3"); @Cleanup - KConsumer kConsumer4 = new KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-4"); + KopProtocolHandlerTestBase.KConsumer kConsumer4 = + new KopProtocolHandlerTestBase.KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-4"); @Cleanup - KConsumer kConsumer5 = new KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-5"); + KopProtocolHandlerTestBase.KConsumer kConsumer5 = + new KopProtocolHandlerTestBase.KConsumer(kafkaTopic, getKafkaBrokerPort(), "consumer-group-5"); List topicPartitions = IntStream.range(0, partitionNumber) - .mapToObj(i -> new TopicPartition(kafkaTopic, i)).collect(Collectors.toList()); + .mapToObj(i -> new TopicPartition(kafkaTopic, i)).collect(Collectors.toList()); kafkaConsumeCommitMessage(kConsumer1, totalMsg, msgStrPrefix, topicPartitions); kafkaConsumeCommitMessage(kConsumer2, totalMsg, msgStrPrefix, topicPartitions); @@ -240,8 +246,7 @@ public void testPulsarProduceKafkaConsume(boolean enableBatching) throws Excepti sendCompleteLatch.await(); pulsarProducer.close(); - @Cleanup - final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); + @Cleanup final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); final List> receivedRecords = receiveRecords(kafkaConsumer, numMessages); assertEquals(getValuesFromRecords(receivedRecords), values); @@ -271,14 +276,14 @@ public void testMixedProduceKafkaConsume() throws Exception { final Header header = headers.get(i); if (i % 2 == 0) { - final MessageId id = pulsarProducer.newMessage() + final MessageId id = pulsarProducer.newMessage() .value(value.getBytes(StandardCharsets.UTF_8)) .key(key) .property(header.getKey(), header.getValue()) .send(); - if (log.isDebugEnabled()) { - log.debug("PulsarProducer send {} to {}", i, id); - } + if (log.isDebugEnabled()) { + log.debug("PulsarProducer send {} to {}", i, id); + } } else { final RecordMetadata metadata = kafkaProducer.send(new ProducerRecord<>(topic, 0, key, value, Header.toHeaders(Collections.singletonList(header), RecordHeader::new))).get(); @@ -291,8 +296,7 @@ public void testMixedProduceKafkaConsume() throws Exception { kafkaProducer.close(); pulsarProducer.close(); - @Cleanup - final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); + @Cleanup final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic); final List> receivedRecords = receiveRecords(kafkaConsumer, numMessages); assertEquals(getValuesFromRecords(receivedRecords), values); @@ -321,8 +325,7 @@ public void testKafkaProducePulsarConsume(boolean enableBatching) throws Excepti sendFuture.get(); producer.close(); - @Cleanup - final Consumer consumer = newPulsarConsumer( + @Cleanup final Consumer consumer = newPulsarConsumer( topic, "my-sub-" + enableBatching, new KafkaPayloadProcessor()); final List> messages = receivePulsarMessages(consumer, numMessages); assertEquals(messages.size(), numMessages); @@ -353,8 +356,7 @@ public void testKafkaProducePulsarConsumeWithHeaders(boolean enableBatching) thr sendFuture.get(); producer.close(); - @Cleanup - final Consumer consumer = newPulsarConsumer( + @Cleanup final Consumer consumer = newPulsarConsumer( topic, "my-sub-" + enableBatching, new KafkaPayloadProcessor()); final List> messages = receivePulsarMessages(consumer, numMessages); assertEquals(messages.size(), numMessages); @@ -390,8 +392,7 @@ public void testMixedProducePulsarConsume() throws Exception { kafkaProducer.close(); pulsarProducer.close(); - @Cleanup - final Consumer consumer = newPulsarConsumer(topic, SUBSCRIPTION, new KafkaPayloadProcessor()); + @Cleanup final Consumer consumer = newPulsarConsumer(topic, SUBSCRIPTION, new KafkaPayloadProcessor()); final List> messages = receivePulsarMessages(consumer, numMessages); assertEquals(messages.size(), numMessages); @@ -461,14 +462,12 @@ public void testReadCommitted() throws Exception { pulsar.getAdminClient().topics().createPartitionedTopic(topic, 2); - @Cleanup - final KafkaProducer kafkaProducer = newKafkaProducer(); + @Cleanup final KafkaProducer kafkaProducer = newKafkaProducer(); sendSingleMessages(kafkaProducer, topic, Arrays.asList("a", "b", "c")); List expectValues = Arrays.asList("a", "b", "c"); - @Cleanup - final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic, "test-group", true); + @Cleanup final KafkaConsumer kafkaConsumer = newKafkaConsumer(topic, "test-group", true); List kafkaReceives = receiveMessages(kafkaConsumer, expectValues.size()); assertEquals(kafkaReceives.stream().sorted().collect(Collectors.toList()), expectValues); } diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndPulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndPulsarTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndPulsarTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndPulsarTest.java index d612865b68..62ae9d6668 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndPulsarTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndPulsarTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndTestBase.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndTestBase.java index 46c8062daf..6958222584 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/BasicEndToEndTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/BasicEndToEndTestBase.java @@ -11,13 +11,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import io.streamnative.kafka.client.api.Header; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.ArrayList; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DistributedClusterTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/DistributedClusterTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/DistributedClusterTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/DistributedClusterTest.java index 5c11d517bf..97cf46e17d 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DistributedClusterTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/DistributedClusterTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.apache.kafka.common.internals.Topic.GROUP_METADATA_TOPIC_NAME; import static org.apache.pulsar.common.naming.TopicName.PARTITIONED_TOPIC_SUFFIX; @@ -22,6 +22,9 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; +import io.streamnative.pulsar.handlers.kop.PortManager; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderKafkaTest.java similarity index 94% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderKafkaTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderKafkaTest.java index e3fb37fea4..4266d8c997 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderKafkaTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderKafkaTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; /** * Unit test for Different kafka produce messages with `entryFormat=kafka`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderPulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderPulsarTest.java similarity index 94% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderPulsarTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderPulsarTest.java index 6ed3ee2539..374c82dc3e 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderPulsarTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderPulsarTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; /** * Unit test for Different kafka produce messages with `entryFormat=pulsar`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderTestBase.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderTestBase.java index 4204c2560e..e3198e4b3a 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaMessageOrderTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaMessageOrderTestBase.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; @@ -20,6 +20,7 @@ import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.ArrayList; import java.util.Base64; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaNonPartitionedTopicTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaNonPartitionedTopicTest.java similarity index 96% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaNonPartitionedTopicTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaNonPartitionedTopicTest.java index 465e55d1b0..5b11878242 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaNonPartitionedTopicTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/KafkaNonPartitionedTopicTest.java @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.Collections; import java.util.List; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MultiLedgerTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/MultiLedgerTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MultiLedgerTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/MultiLedgerTest.java index 3f7fe76e2c..6197e78942 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MultiLedgerTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/MultiLedgerTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedLedgerInfo.LedgerInfo; @@ -21,6 +21,7 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.lang.reflect.Field; import java.time.Duration; import java.util.ArrayList; @@ -190,7 +191,7 @@ public void testProduceConsumeMultiLedger() throws Exception { assertEquals(i, totalMsgs); } - @Test + @Test(timeOut = 30000) public void testListOffsetForEmptyRolloverLedger() throws Exception { final String topic = "test-list-offset-for-empty-rollover-ledger"; final String partitionName = TopicName.get(topic).getPartition(0).toString(); @@ -220,7 +221,7 @@ public void testListOffsetForEmptyRolloverLedger() throws Exception { // Rollover and delete the old ledgers, wait until there is only one empty ledger managedLedger.getConfig().setRetentionTime(0, TimeUnit.MILLISECONDS); managedLedger.rollCurrentLedgerIfFull(); - Awaitility.await().atMost(Duration.ofSeconds(10)) + Awaitility.await().atMost(Duration.ofSeconds(15)) .until(() -> { log.info("Managed ledger status: [{}], ledgers info: [{}]", managedLedger.getState(), managedLedger.getLedgersInfo().toString()); diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PerTopicConfigurationTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/PerTopicConfigurationTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/PerTopicConfigurationTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/PerTopicConfigurationTest.java index 3c1dd67a61..9c5682ea03 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PerTopicConfigurationTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/e2e/PerTopicConfigurationTest.java @@ -11,11 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.e2e; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.Base64; import java.util.HashMap; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/DifferentNamespaceTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/DifferentNamespaceTest.java index fdae5c9f79..a1311725a8 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DifferentNamespaceTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/DifferentNamespaceTest.java @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.metadata; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetadataInitTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/MetadataInitTest.java similarity index 96% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetadataInitTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/MetadataInitTest.java index 8a6d8bd3f1..35af8d5b9b 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetadataInitTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metadata/MetadataInitTest.java @@ -11,12 +11,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.metadata; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertThrows; +import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; +import io.streamnative.pulsar.handlers.kop.PortManager; import io.streamnative.pulsar.handlers.kop.utils.MetadataUtils; import java.net.URISyntaxException; import java.net.URL; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaProducerStatsTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/KafkaProducerStatsTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaProducerStatsTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/KafkaProducerStatsTest.java index 96b63e54da..4d97f89d14 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaProducerStatsTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/KafkaProducerStatsTest.java @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.metrics; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotEquals; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.util.Properties; import lombok.Cleanup; import lombok.extern.slf4j.Slf4j; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderTest.java index d231be51b8..17109602ae 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderTest.java @@ -11,10 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.metrics; import static org.testng.AssertJUnit.fail; +import io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -314,7 +316,7 @@ public void testUpdateGroupId() { }); } - @Test(timeOut = 30000, expectedExceptions = KeeperException.NoNodeException.class) + @Test(timeOut = 60000, expectedExceptions = KeeperException.NoNodeException.class) public void testFindTransactionCoordinatorShouldNotStoreGroupId() throws Exception { String kafkaServer = "localhost:" + getKafkaBrokerPort(); diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java index 0e59248508..368f9e4794 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/metrics/MetricsProviderWithDisableGroupLevelConsumerMetricsTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.metrics; public class MetricsProviderWithDisableGroupLevelConsumerMetricsTest extends MetricsProviderTest { public MetricsProviderWithDisableGroupLevelConsumerMetricsTest() { diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/IdempotentProducerTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/IdempotentProducerTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/IdempotentProducerTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/IdempotentProducerTest.java index ef08a17e91..0944cfb283 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/IdempotentProducerTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/IdempotentProducerTest.java @@ -11,10 +11,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; import static org.testng.Assert.assertEquals; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.Collections; import java.util.Properties; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/InnerTopicProtectionTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/InnerTopicProtectionTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/InnerTopicProtectionTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/InnerTopicProtectionTest.java index 23f73c8f1a..7810dde048 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/InnerTopicProtectionTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/InnerTopicProtectionTest.java @@ -11,9 +11,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleKafkaTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleKafkaTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleKafkaTest.java index 88143bfa7b..cfa56ac5b2 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleKafkaTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleKafkaTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; /** * {@link MessagePublishBufferThrottleTestBase} with `entryFormat=kafka`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottlePulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottlePulsarTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottlePulsarTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottlePulsarTest.java index dac09c1d48..c439b5a328 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottlePulsarTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottlePulsarTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; /** * {@link MessagePublishBufferThrottleTestBase} with `entryFormat=kafka`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleTestBase.java similarity index 96% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleTestBase.java index 07b6d81951..87484dfaae 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishBufferThrottleTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishBufferThrottleTestBase.java @@ -11,12 +11,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mockStatic; +import io.streamnative.pulsar.handlers.kop.KafkaRequestHandler; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -37,7 +39,7 @@ * */ @Slf4j -public abstract class MessagePublishBufferThrottleTestBase extends KopProtocolHandlerTestBase{ +public abstract class MessagePublishBufferThrottleTestBase extends KopProtocolHandlerTestBase { public MessagePublishBufferThrottleTestBase(final String entryFormat) { super(entryFormat); diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishThrottlingTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishThrottlingTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishThrottlingTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishThrottlingTest.java index 37b0ea4414..d7af69bf2b 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/MessagePublishThrottlingTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/MessagePublishThrottlingTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; import static org.testng.Assert.assertEquals; @@ -19,6 +19,7 @@ import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.util.ArrayList; import java.util.List; import java.util.Properties; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PreciselyMessagePublishThrottlingTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PreciselyMessagePublishThrottlingTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/PreciselyMessagePublishThrottlingTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PreciselyMessagePublishThrottlingTest.java index b302daa62f..e9548f0db0 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PreciselyMessagePublishThrottlingTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PreciselyMessagePublishThrottlingTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; /** * Test KoP precisely messages publish throttling. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PublishRateLimitTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PublishRateLimitTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/PublishRateLimitTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PublishRateLimitTest.java index e6c3dda1c9..b95ea501b1 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/PublishRateLimitTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/producer/PublishRateLimitTest.java @@ -11,9 +11,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.producer; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import lombok.Cleanup; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.producer.ProducerRecord; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRegistryTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRegistryTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRegistryTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRegistryTest.java index 9f81950f72..91d0c782c4 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRegistryTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRegistryTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.schemaregistry.model.impl; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -23,6 +23,7 @@ import io.confluent.kafka.serializers.KafkaAvroDeserializer; import io.confluent.kafka.serializers.KafkaAvroSerializer; import io.confluent.kafka.serializers.KafkaAvroSerializerConfig; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.lang.reflect.Field; import java.time.Duration; import java.util.Collections; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRestApiTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRestApiTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRestApiTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRestApiTest.java index b768c46f58..6dfe672f58 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SchemaRestApiTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/schemaregistry/model/impl/SchemaRestApiTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.schemaregistry.model.impl; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; @@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import io.streamnative.pulsar.handlers.kop.schemaregistry.model.Schema; import io.streamnative.pulsar.handlers.kop.schemaregistry.resources.SubjectResource; import java.io.BufferedReader; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelTest.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelTest.java index 13e7b42ca6..7d7fbd785e 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelTest.java @@ -11,11 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security; import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.AssertJUnit.assertFalse; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.io.Closeable; import java.time.Duration; import java.time.temporal.ChronoUnit; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelWithClientAuthTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelWithClientAuthTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelWithClientAuthTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelWithClientAuthTest.java index f22b7c275d..57fb22f225 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaSSLChannelWithClientAuthTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/KafkaSSLChannelWithClientAuthTest.java @@ -11,10 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security; import static java.nio.charset.StandardCharsets.UTF_8; +import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.io.Closeable; import java.util.Properties; import javax.net.ssl.HostnameVerifier; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainKafkaTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainKafkaTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainKafkaTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainKafkaTest.java index 4389f160a3..9c28900043 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainKafkaTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainKafkaTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security; /** * Testing the SASL-PLAIN features on KoP with `entry.format=kafka`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainPulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainPulsarTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainPulsarTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainPulsarTest.java index 15ab454916..db0e503d1f 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainPulsarTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainPulsarTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security; /** * Testing the SASL-PLAIN features on KoP with `entry.format=pulsar`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainTestBase.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainTestBase.java index a3dbc4368a..dd38891c49 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslPlainTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/SaslPlainTestBase.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security; import static org.mockito.Mockito.spy; import static org.testng.Assert.assertEquals; @@ -20,6 +20,8 @@ import com.google.common.collect.Sets; import io.jsonwebtoken.SignatureAlgorithm; +import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.Collections; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DelayAuthorizationFailedCloseTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/DelayAuthorizationFailedCloseTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/DelayAuthorizationFailedCloseTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/DelayAuthorizationFailedCloseTest.java index 777b3771a9..6e315d9014 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/DelayAuthorizationFailedCloseTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/DelayAuthorizationFailedCloseTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.auth; import static org.mockito.Mockito.spy; import static org.testng.Assert.assertTrue; @@ -21,6 +21,7 @@ import io.jsonwebtoken.SignatureAlgorithm; import io.streamnative.kafka.client.api.KafkaVersion; import io.streamnative.kafka.client.api.ProducerConfiguration; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.io.IOException; import java.net.InetSocketAddress; import java.util.Optional; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java similarity index 96% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java index a2101116c6..ebb18d256d 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationKafkaMultitenantTenantMetadataTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.auth; import static org.testng.Assert.assertFalse; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationMockTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationMockTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationMockTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationMockTest.java index 3a3a735f87..edeada2ce6 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationMockTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationMockTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.auth; import static org.mockito.Mockito.spy; import static org.testng.Assert.assertEquals; @@ -19,7 +19,7 @@ import com.google.common.collect.Sets; import io.jsonwebtoken.SignatureAlgorithm; -import io.streamnative.pulsar.handlers.kop.security.auth.KafkaMockAuthorizationProvider; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.Collections; import java.util.List; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationPulsarTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationPulsarTest.java similarity index 93% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationPulsarTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationPulsarTest.java index 35b4ff0e28..a725603798 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationPulsarTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationPulsarTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.auth; /** * Unit test for Authorization with `entryFormat=pulsar`. diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationTestBase.java similarity index 99% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationTestBase.java index 98f2fc645a..325edf8b8c 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/KafkaAuthorizationTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/auth/KafkaAuthorizationTestBase.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.auth; import static org.mockito.Mockito.spy; import static org.testng.Assert.assertEquals; @@ -27,6 +27,7 @@ import io.confluent.kafka.serializers.KafkaAvroSerializerConfig; import io.jsonwebtoken.SignatureAlgorithm; import io.netty.handler.codec.http.HttpResponseStatus; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.Collections; import java.util.List; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/CustomOAuthBearerCallbackHandlerTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/CustomOAuthBearerCallbackHandlerTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/CustomOAuthBearerCallbackHandlerTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/CustomOAuthBearerCallbackHandlerTest.java index 6c27876775..b0297206a0 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/CustomOAuthBearerCallbackHandlerTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/CustomOAuthBearerCallbackHandlerTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import static org.mockito.Mockito.spy; import static org.testng.Assert.assertEquals; @@ -19,8 +19,7 @@ import com.google.common.collect.Sets; import io.jsonwebtoken.SignatureAlgorithm; -import io.streamnative.pulsar.handlers.kop.security.oauth.KopOAuthBearerToken; -import io.streamnative.pulsar.handlers.kop.security.oauth.KopOAuthBearerValidatorCallback; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.util.HashSet; import java.util.List; import java.util.Map; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/HydraOAuthUtils.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/HydraOAuthUtils.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/HydraOAuthUtils.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/HydraOAuthUtils.java index b95dfd813a..02bd8e1330 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/HydraOAuthUtils.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/HydraOAuthUtils.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthBearerTestBase.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthBearerTestBase.java similarity index 96% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthBearerTestBase.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthBearerTestBase.java index 2e9f268a86..3d7ff7e42d 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthBearerTestBase.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthBearerTestBase.java @@ -11,12 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; +import io.streamnative.pulsar.handlers.kop.KopProtocolHandlerTestBase; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthDefaultHandlersTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthDefaultHandlersTest.java similarity index 98% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthDefaultHandlersTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthDefaultHandlersTest.java index 5bae4d7440..8c36cf4f91 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthDefaultHandlersTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthDefaultHandlersTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import static org.mockito.Mockito.spy; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersTest.java index c0f3a5048e..b2efb5b4c8 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersTest.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -21,9 +21,6 @@ import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; -import io.streamnative.pulsar.handlers.kop.security.oauth.OauthLoginCallbackHandler; -import io.streamnative.pulsar.handlers.kop.security.oauth.OauthValidatorCallbackHandler; -import io.streamnative.pulsar.handlers.kop.security.oauth.ServerConfig; import java.io.IOException; import java.net.URL; import java.time.Duration; diff --git a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersWithMultiTenantTest.java b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersWithMultiTenantTest.java similarity index 97% rename from tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersWithMultiTenantTest.java rename to tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersWithMultiTenantTest.java index 4497a6abf9..f8632a712c 100644 --- a/tests/src/test/java/io/streamnative/pulsar/handlers/kop/SaslOAuthKopHandlersWithMultiTenantTest.java +++ b/tests/src/test/java/io/streamnative/pulsar/handlers/kop/security/oauth/SaslOAuthKopHandlersWithMultiTenantTest.java @@ -11,15 +11,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.streamnative.pulsar.handlers.kop; +package io.streamnative.pulsar.handlers.kop.security.oauth; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import com.google.common.collect.Sets; -import io.streamnative.pulsar.handlers.kop.security.oauth.OauthLoginCallbackHandler; -import io.streamnative.pulsar.handlers.kop.security.oauth.OauthValidatorCallbackHandler; import java.net.URL; import java.time.Duration; import java.util.Collections;