Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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[][] {
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -50,26 +49,18 @@
* 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";
private static final String SHORT_TOPIC = "topic2";
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 {
Expand Down