You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/11/06 03:08:45 UTC
[pulsar] branch master updated: Add @Test annotation to test
methods (#12640)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 370f47f Add @Test annotation to test methods (#12640)
370f47f is described below
commit 370f47fe17a23b56f34c1e12e7abb28dd794c3b8
Author: Masahiro Sakamoto <ma...@yahoo-corp.jp>
AuthorDate: Sat Nov 6 12:07:54 2021 +0900
Add @Test annotation to test methods (#12640)
---
.../java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java | 1 +
.../broker/intercept/BrokerInterceptorWithClassLoaderTest.java | 1 +
.../pulsar/broker/protocol/ProtocolHandlerWithClassLoaderTest.java | 1 +
.../pulsar/broker/resourcegroup/ResourceGroupRateLimiterTest.java | 2 +-
.../org/apache/pulsar/broker/stats/ManagedCursorMetricsTest.java | 1 +
.../apache/pulsar/client/api/SimpleProducerConsumerStatTest.java | 1 +
.../src/test/java/org/apache/pulsar/schema/SchemaTest.java | 1 +
.../src/test/java/org/apache/pulsar/admin/cli/TestCmdClusters.java | 3 ++-
.../src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java | 6 +++---
.../src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java | 6 +++---
.../functions/runtime/kubernetes/KubernetesRuntimeFactoryTest.java | 2 +-
.../pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java | 3 ++-
.../apache/pulsar/io/elasticsearch/ElasticSearchClientSslTests.java | 2 +-
.../org/apache/pulsar/io/elasticsearch/ElasticSearchSinkTests.java | 2 +-
.../pulsar/proxy/extensions/ProxyExtensionWithClassLoaderTest.java | 1 +
.../pulsar/tests/integration/functions/PulsarFunctionsTest.java | 4 ++--
.../apache/pulsar/tests/integration/offload/TestBaseOffload.java | 6 +++---
.../apache/pulsar/tests/integration/topologies/PulsarTestBase.java | 6 +++---
.../mledger/offload/jcloud/impl/BufferedOffloadStreamTest.java | 2 +-
19 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
index 9c3221d..0333a0b 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/PersistentTopicsTest.java
@@ -921,6 +921,7 @@ public class PersistentTopicsTest extends MockedPulsarServiceBaseTest {
Assert.assertEquals(responseCaptor.getValue().getStatus(), Response.Status.NO_CONTENT.getStatusCode());
}
+ @Test
public void testGetMessageById() throws Exception {
TenantInfoImpl tenantInfo = new TenantInfoImpl(Sets.newHashSet("role1", "role2"), Sets.newHashSet("test"));
admin.tenants().createTenant("tenant-xyz", tenantInfo);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorWithClassLoaderTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorWithClassLoaderTest.java
index aa4a5bc..ae66937 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorWithClassLoaderTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorWithClassLoaderTest.java
@@ -33,6 +33,7 @@ import static org.mockito.Mockito.verify;
@Test(groups = "broker")
public class BrokerInterceptorWithClassLoaderTest {
+ @Test
public void testWrapper() throws Exception {
BrokerInterceptor h = mock(BrokerInterceptor.class);
NarClassLoader loader = mock(NarClassLoader.class);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/protocol/ProtocolHandlerWithClassLoaderTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/protocol/ProtocolHandlerWithClassLoaderTest.java
index 42d26d5..75d8c64 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/protocol/ProtocolHandlerWithClassLoaderTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/protocol/ProtocolHandlerWithClassLoaderTest.java
@@ -74,6 +74,7 @@ public class ProtocolHandlerWithClassLoaderTest {
verify(h, times(1)).getProtocolDataToAdvertise();
}
+ @Test
public void testClassLoaderSwitcher() throws Exception {
NarClassLoader loader = mock(NarClassLoader.class);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupRateLimiterTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupRateLimiterTest.java
index 395f086..1887801 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupRateLimiterTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupRateLimiterTest.java
@@ -80,7 +80,7 @@ public class ResourceGroupRateLimiterTest extends BrokerTestBase {
.untilAsserted(() -> assertNull(pulsar.getResourceGroupServiceManager().resourceGroupGet(rgName)));
}
- public void testRateLimit() throws PulsarAdminException, PulsarClientException,
+ private void testRateLimit() throws PulsarAdminException, PulsarClientException,
InterruptedException, ExecutionException, TimeoutException {
createResourceGroup(rgName, testAddRg);
admin.namespaces().setNamespaceResourceGroup(namespaceName, rgName);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/ManagedCursorMetricsTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/ManagedCursorMetricsTest.java
index 9b3b354..5e20c09 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/ManagedCursorMetricsTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/ManagedCursorMetricsTest.java
@@ -49,6 +49,7 @@ public class ManagedCursorMetricsTest extends MockedPulsarServiceBaseTest {
super.internalCleanup();
}
+ @Test
public void testManagedCursorMetrics() throws Exception {
final String subName = "my-sub";
final String topicName = "persistent://my-namespace/use/my-ns/my-topic1";
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerStatTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerStatTest.java
index cc83ba2..480d835 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerStatTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerStatTest.java
@@ -335,6 +335,7 @@ public class SimpleProducerConsumerStatTest extends ProducerConsumerBase {
log.info("-- Exiting {} test --", methodName);
}
+ @Test
public void testBatchMessagesRateOut() throws PulsarClientException, InterruptedException, PulsarAdminException {
log.info("-- Starting {} test --", methodName);
String topicName = "persistent://my-property/cluster/my-ns/testBatchMessagesRateOut";
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
index dab9d08..db56fbc 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/schema/SchemaTest.java
@@ -800,6 +800,7 @@ public class SchemaTest extends MockedPulsarServiceBaseTest {
assertEquals("foo", message.getValue());
}
+ @Test
public void testConsumeMultipleSchemaMessages() throws Exception {
final String namespace = "test-namespace-" + randomName(16);
String ns = PUBLIC_TENANT + "/" + namespace;
diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdClusters.java b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdClusters.java
index 0ab093d..cd4c22f 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdClusters.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdClusters.java
@@ -62,7 +62,8 @@ public class TestCmdClusters {
testCmdClusterConfigFile(clusterData, clusterData);
}
- public void testCmdClusterConfigFile(ClusterData testClusterData, ClusterData expectedClusterData) throws Exception {
+ private void testCmdClusterConfigFile(ClusterData testClusterData, ClusterData expectedClusterData)
+ throws Exception {
File file = Files.createTempFile("tmp_cluster", ".yaml").toFile();
ObjectMapperFactory.getThreadLocalYaml().writeValue(file, testClusterData);
Assert.assertEquals(testClusterData, CmdUtils.loadConfig(file.getAbsolutePath(), ClusterData.class));
diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
index 87f9a3f..27402bd 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSinks.java
@@ -341,7 +341,7 @@ public class TestCmdSinks {
);
}
- public void testCmdSinkCliMissingArgs(
+ private void testCmdSinkCliMissingArgs(
String tenant,
String namespace,
String name,
@@ -492,7 +492,7 @@ public class TestCmdSinks {
testCmdSinkConfigFile(testSinkConfig, expectedSinkConfig);
}
- public void testCmdSinkConfigFile(SinkConfig testSinkConfig, SinkConfig expectedSinkConfig) throws Exception {
+ private void testCmdSinkConfigFile(SinkConfig testSinkConfig, SinkConfig expectedSinkConfig) throws Exception {
File file = Files.createTempFile("", "").toFile();
@@ -572,7 +572,7 @@ public class TestCmdSinks {
);
}
- public void testMixCliAndConfigFile(
+ private void testMixCliAndConfigFile(
String tenant,
String namespace,
String name,
diff --git a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
index 5b4d906..ff75d26 100644
--- a/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
+++ b/pulsar-client-tools/src/test/java/org/apache/pulsar/admin/cli/TestCmdSources.java
@@ -261,7 +261,7 @@ public class TestCmdSources {
);
}
- public void testCmdSourceCliMissingArgs(
+ private void testCmdSourceCliMissingArgs(
String tenant,
String namespace,
String name,
@@ -500,7 +500,7 @@ public class TestCmdSources {
);
}
- public void testMixCliAndConfigFile(
+ private void testMixCliAndConfigFile(
String tenant,
String namespace,
String name,
@@ -674,4 +674,4 @@ public class TestCmdSources {
Assert.assertEquals(config.get("float_string"), "1000.0");
Assert.assertEquals(config.get("created_at"), "Mon Jul 02 00:33:15 +0000 2018");
}
-}
\ No newline at end of file
+}
diff --git a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactoryTest.java b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactoryTest.java
index 1b8946b..dc0119c 100644
--- a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactoryTest.java
+++ b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactoryTest.java
@@ -333,7 +333,7 @@ public class KubernetesRuntimeFactoryTest {
"Per instance ram requested, 0, for function should be positive and a multiple of the granularity, 1000");
}
- public void testAuthProvider(Optional<FunctionAuthProvider> authProvider) throws Exception {
+ private void testAuthProvider(Optional<FunctionAuthProvider> authProvider) throws Exception {
factory = createKubernetesRuntimeFactory(null, null, null, null, false,
authProvider, Optional.empty());
}
diff --git a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
index 9f064f5..ca14c63 100644
--- a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
+++ b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
@@ -358,7 +358,8 @@ public class KubernetesRuntimeTest {
testResources(1.0 / 1.5, 1000, 1.3, 1.0);
}
- public void testResources(double userCpuRequest, long userMemoryRequest, double cpuOverCommitRatio, double memoryOverCommitRatio) throws Exception {
+ private void testResources(double userCpuRequest, long userMemoryRequest, double cpuOverCommitRatio,
+ double memoryOverCommitRatio) throws Exception {
Function.Resources resources = Function.Resources.newBuilder()
.setRam(userMemoryRequest).setCpu(userCpuRequest).setDisk(10000L).build();
diff --git a/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClientSslTests.java b/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClientSslTests.java
index 9f878aa..7cbd249 100644
--- a/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClientSslTests.java
+++ b/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClientSslTests.java
@@ -157,7 +157,7 @@ public class ElasticSearchClientSslTests {
}
- public void testIndexExists(ElasticSearchClient client) throws IOException {
+ private void testIndexExists(ElasticSearchClient client) throws IOException {
assertFalse(client.indexExists("mynewindex"));
assertTrue(client.createIndexIfNeeded("mynewindex"));
assertTrue(client.indexExists("mynewindex"));
diff --git a/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSinkTests.java b/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSinkTests.java
index 9e3363c..c752354 100644
--- a/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSinkTests.java
+++ b/pulsar-io/elastic-search/src/test/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSinkTests.java
@@ -292,7 +292,7 @@ public class ElasticSearchSinkTests {
testNullValue(ElasticSearchConfig.NullValueAction.DELETE);
}
- public void testNullValue(ElasticSearchConfig.NullValueAction action) throws Exception {
+ private void testNullValue(ElasticSearchConfig.NullValueAction action) throws Exception {
String index = "testnullvalue" + action.toString().toLowerCase(Locale.ROOT);
map.put("indexName", index);
map.put("keyIgnore", "false");
diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/extensions/ProxyExtensionWithClassLoaderTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/extensions/ProxyExtensionWithClassLoaderTest.java
index b43eb22..57882a6 100644
--- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/extensions/ProxyExtensionWithClassLoaderTest.java
+++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/extensions/ProxyExtensionWithClassLoaderTest.java
@@ -70,6 +70,7 @@ public class ProxyExtensionWithClassLoaderTest {
verify(h, times(1)).start(service);
}
+ @Test
public void testClassLoaderSwitcher() throws Exception {
NarClassLoader loader = mock(NarClassLoader.class);
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
index 97d2c7b..d547b46 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
@@ -120,7 +120,7 @@ public abstract class PulsarFunctionsTest extends PulsarFunctionsTestBase {
return kvs;
}
- public void testFunctionLocalRun(Runtime runtime) throws Exception {
+ protected void testFunctionLocalRun(Runtime runtime) throws Exception {
if (functionRuntimeType == FunctionRuntimeType.THREAD) {
return;
}
@@ -243,7 +243,7 @@ public abstract class PulsarFunctionsTest extends PulsarFunctionsTestBase {
}
- public void testWindowFunction(String type, String[] expectedResults) throws Exception {
+ protected void testWindowFunction(String type, String[] expectedResults) throws Exception {
int NUM_OF_MESSAGES = 100;
int windowLengthCount = 10;
int slidingIntervalCount = 5;
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java
index ad7a8fd..f5a320e 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/offload/TestBaseOffload.java
@@ -48,7 +48,7 @@ public abstract class TestBaseOffload extends PulsarTieredStorageTestSuite {
return entry;
}
- public void testPublishOffloadAndConsumeViaCLI(String serviceUrl, String adminUrl) throws Exception {
+ protected void testPublishOffloadAndConsumeViaCLI(String serviceUrl, String adminUrl) throws Exception {
final String tenant = "offload-test-cli-" + randomName(4);
final String namespace = tenant + "/ns1";
final String topic = "persistent://" + namespace + "/topic1";
@@ -120,7 +120,7 @@ public abstract class TestBaseOffload extends PulsarTieredStorageTestSuite {
}
}
- public void testPublishOffloadAndConsumeViaThreshold(String serviceUrl, String adminUrl) throws Exception {
+ protected void testPublishOffloadAndConsumeViaThreshold(String serviceUrl, String adminUrl) throws Exception {
final String tenant = "offload-test-threshold-" + randomName(4);
final String namespace = tenant + "/ns1";
final String topic = "persistent://" + namespace + "/topic1";
@@ -240,7 +240,7 @@ public abstract class TestBaseOffload extends PulsarTieredStorageTestSuite {
}
}
- public void testPublishOffloadAndConsumeDeletionLag(String serviceUrl, String adminUrl) throws Exception {
+ protected void testPublishOffloadAndConsumeDeletionLag(String serviceUrl, String adminUrl) throws Exception {
final String tenant = "offload-test-deletion-lag-" + randomName(4);
final String namespace = tenant + "/ns1";
final String topic = "persistent://" + namespace + "/topic1";
diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarTestBase.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarTestBase.java
index 9989b15..baa0186 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarTestBase.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/topologies/PulsarTestBase.java
@@ -67,7 +67,7 @@ public abstract class PulsarTestBase extends TestRetrySupport {
}
}
- public void testPublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception {
+ protected void testPublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception {
String topicName = generateTopicName("testpubconsume", isPersistent);
int numMessages = 10;
@@ -98,7 +98,7 @@ public abstract class PulsarTestBase extends TestRetrySupport {
}
}
- public void testBatchMessagePublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception {
+ protected void testBatchMessagePublishAndConsume(String serviceUrl, boolean isPersistent) throws Exception {
String topicName = generateTopicName("test-batch-publish-consume", isPersistent);
final int numMessages = 10000;
@@ -133,7 +133,7 @@ public abstract class PulsarTestBase extends TestRetrySupport {
}
}
- public void testBatchIndexAckDisabled(String serviceUrl) throws Exception {
+ protected void testBatchIndexAckDisabled(String serviceUrl) throws Exception {
String topicName = generateTopicName("test-batch-index-ack-disabled", true);
final int numMessages = 100;
try (PulsarClient client = PulsarClient.builder()
diff --git a/tiered-storage/jcloud/src/test/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BufferedOffloadStreamTest.java b/tiered-storage/jcloud/src/test/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BufferedOffloadStreamTest.java
index 4ebf943..a5dc7ba 100644
--- a/tiered-storage/jcloud/src/test/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BufferedOffloadStreamTest.java
+++ b/tiered-storage/jcloud/src/test/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BufferedOffloadStreamTest.java
@@ -42,7 +42,7 @@ import org.testng.Assert;
public class BufferedOffloadStreamTest {
final Random random = new Random();
- public void testWithPadding(int paddingLen) throws Exception {
+ private void testWithPadding(int paddingLen) throws Exception {
int blockSize = StreamingDataBlockHeaderImpl.getDataStartOffset();
List<Entry> entryBuffer = new LinkedList<>();
final UUID uuid = UUID.randomUUID();