You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/05/04 01:31:06 UTC
[incubator-pulsar] branch master updated: Changed property to
tenant in various helper messages and tests (#1726)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 7cd7034 Changed property to tenant in various helper messages and tests (#1726)
7cd7034 is described below
commit 7cd7034731a8964d2853c9af81aa645f5309f5d1
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Thu May 3 18:31:02 2018 -0700
Changed property to tenant in various helper messages and tests (#1726)
---
.../org/apache/pulsar/admin/cli/CmdTopics.java | 58 +++++++-------
.../apache/pulsar/common/naming/TopicNameTest.java | 92 +++++++++++-----------
2 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
index 1981c71..b8f93f7 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
@@ -93,7 +93,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the list of topics under a namespace.")
private class ListCmd extends CliCommand {
- @Parameter(description = "property/namespace\n", required = true)
+ @Parameter(description = "tenant/namespace\n", required = true)
private java.util.List<String> params;
@Override
@@ -105,7 +105,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the list of partitioned topics under a namespace.")
private class PartitionedTopicListCmd extends CliCommand {
- @Parameter(description = "property/namespace\n", required = true)
+ @Parameter(description = "tenant/namespace\n", required = true)
private java.util.List<String> params;
@Override
@@ -117,7 +117,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Grant a new permission to a client role on a single topic.")
private class GrantPermissions extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = "--role", description = "Client role to which grant permissions", required = true)
@@ -138,7 +138,7 @@ public class CmdTopics extends CmdBase {
+ "\t\t\t was not set at the topic level, but rather at the namespace level, this \n"
+ "\t\t\t operation will return an error (HTTP status code 412).")
private class RevokePermissions extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = "--role", description = "Client role to which revoke permissions", required = true)
@@ -156,7 +156,7 @@ public class CmdTopics extends CmdBase {
+ "\t\t by the permissions set at the namespace level combined (union) with any eventual \n"
+ "\t\t specific permission set on the topic.")
private class Permissions extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -168,7 +168,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Lookup a topic from the current serving broker")
private class Lookup extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -180,7 +180,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get Namespace bundle range of a topic")
private class GetBundleRange extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -194,7 +194,7 @@ public class CmdTopics extends CmdBase {
+ "\t\tThe partitioned topic has to be created before creating a producer on it.")
private class CreatePartitionedCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Parameter(names = { "-p",
@@ -212,7 +212,7 @@ public class CmdTopics extends CmdBase {
+ "\t\tNew updating number of partitions must be greater than existing number of partitions.")
private class UpdatePartitionedCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Parameter(names = { "-p",
@@ -230,7 +230,7 @@ public class CmdTopics extends CmdBase {
+ "\t\tIf the topic is not created or is a non-partitioned topic, it returns empty topic with 0 partitions")
private class GetPartitionedTopicMetadataCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -244,7 +244,7 @@ public class CmdTopics extends CmdBase {
+ "\t\tIt will also delete all the partitions of the topic if it exists.")
private class DeletePartitionedCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Parameter(names = { "-f",
@@ -261,7 +261,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Delete a topic. \n"
+ "\t\tThe topic cannot be deleted if there's any active subscription or producers connected to it.")
private class DeleteCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Parameter(names = { "-f",
@@ -277,7 +277,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Unload a topic. \n")
private class UnloadCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -289,7 +289,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the list of subscriptions on the topic")
private class ListSubscriptions extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -302,7 +302,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Delete a durable subscriber from a topic. \n"
+ "\t\tThe subscription cannot be deleted if there are any active consumers attached to it \n")
private class DeleteSubscription extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s", "--subscription" }, description = "Subscription to be deleted", required = true)
@@ -318,7 +318,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the stats for the topic and its connected producers and consumers. \n"
+ "\t All the rates are computed over a 1 minute window and are relative the last completed 1 minute period.")
private class GetStats extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -330,7 +330,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the internal stats for the topic")
private class GetInternalStats extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -342,7 +342,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the internal metadata info for the topic")
private class GetInternalInfo extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Override
@@ -357,7 +357,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Get the stats for the partitioned topic and its connected producers and consumers. \n"
+ "\t All the rates are computed over a 1 minute window and are relative the last completed 1 minute period.")
private class GetPartitionedStats extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic\n", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic\n", required = true)
private java.util.List<String> params;
@Parameter(names = "--per-partition", description = "Get per partition stats")
@@ -372,7 +372,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Skip all the messages for the subscription")
private class ClearBacklog extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s", "--subscription" }, description = "Subscription to be cleared", required = true)
@@ -387,7 +387,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Skip some messages for the subscription")
private class Skip extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s",
@@ -406,7 +406,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Expire messages that older than given expiry time (in seconds) for the subscription")
private class ExpireMessages extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s",
@@ -425,7 +425,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Expire messages that older than given expiry time (in seconds) for all subscriptions")
private class ExpireMessagesForAllSubscriptions extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-t", "--expireTime" }, description = "Expire messages older than time in seconds", required = true)
@@ -440,7 +440,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Create a new subscription on a topic")
private class CreateSubscription extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s",
@@ -469,7 +469,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Reset position for subscription to position closest to timestamp or messageId")
private class ResetCursor extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s",
@@ -505,7 +505,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Terminate a topic and don't allow any more messages to be published")
private class Terminate extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Override
@@ -523,7 +523,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Peek some messages for the subscription")
private class PeekMessages extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-s",
@@ -561,7 +561,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Compact a topic")
private class Compact extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Override
@@ -575,7 +575,7 @@ public class CmdTopics extends CmdBase {
@Parameters(commandDescription = "Status of compaction on a topic")
private class CompactionStatusCmd extends CliCommand {
- @Parameter(description = "persistent://property/namespace/topic", required = true)
+ @Parameter(description = "persistent://tenant/namespace/topic", required = true)
private java.util.List<String> params;
@Parameter(names = { "-w", "--wait-complete" },
diff --git a/pulsar-common/src/test/java/org/apache/pulsar/common/naming/TopicNameTest.java b/pulsar-common/src/test/java/org/apache/pulsar/common/naming/TopicNameTest.java
index 6232853..fdbbc9f 100644
--- a/pulsar-common/src/test/java/org/apache/pulsar/common/naming/TopicNameTest.java
+++ b/pulsar-common/src/test/java/org/apache/pulsar/common/naming/TopicNameTest.java
@@ -31,93 +31,93 @@ public class TopicNameTest {
@Test
void topic() {
try {
- TopicName.get("://property.namespace:topic").getNamespace();
+ TopicName.get("://tenant.namespace:topic").getNamespace();
fail("Should have thrown exception");
} catch (IllegalArgumentException e) {
// Expected
}
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getNamespace(),
- "property/cluster/namespace");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getNamespace(),
- "property/cluster/namespace");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getNamespace(),
+ "tenant/cluster/namespace");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getNamespace(),
+ "tenant/cluster/namespace");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic"),
- TopicName.get("persistent", "property", "cluster", "namespace", "topic"));
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic"),
+ TopicName.get("persistent", "tenant", "cluster", "namespace", "topic"));
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").hashCode(),
- TopicName.get("persistent", "property", "cluster", "namespace", "topic").hashCode());
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").hashCode(),
+ TopicName.get("persistent", "tenant", "cluster", "namespace", "topic").hashCode());
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").toString(),
- "persistent://property/cluster/namespace/topic");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").toString(),
+ "persistent://tenant/cluster/namespace/topic");
- assertFalse(TopicName.get("persistent://property/cluster/namespace/topic")
- .equals("persistent://property/cluster/namespace/topic"));
+ assertFalse(TopicName.get("persistent://tenant/cluster/namespace/topic")
+ .equals("persistent://tenant/cluster/namespace/topic"));
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getDomain(),
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getDomain(),
TopicDomain.persistent);
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getTenant(),
- "property");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getCluster(),
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getTenant(),
+ "tenant");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getCluster(),
"cluster");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getNamespacePortion(),
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getNamespacePortion(),
"namespace");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getNamespace(),
- "property/cluster/namespace");
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic").getLocalName(),
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getNamespace(),
+ "tenant/cluster/namespace");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic").getLocalName(),
"topic");
try {
- TopicName.get("://property.namespace:my-topic").getDomain();
+ TopicName.get("://tenant.namespace:my-topic").getDomain();
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property.namespace:my-topic").getTenant();
+ TopicName.get("://tenant.namespace:my-topic").getTenant();
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property.namespace:my-topic").getCluster();
+ TopicName.get("://tenant.namespace:my-topic").getCluster();
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property.namespace:my-topic").getNamespacePortion();
+ TopicName.get("://tenant.namespace:my-topic").getNamespacePortion();
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property.namespace:my-topic").getLocalName();
+ TopicName.get("://tenant.namespace:my-topic").getLocalName();
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property.namespace");
+ TopicName.get("://tenant.namespace");
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("invalid://property/cluster/namespace/topic");
+ TopicName.get("invalid://tenant/cluster/namespace/topic");
fail("Should have raied exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("property/cluster/namespace/topic");
+ TopicName.get("tenant/cluster/namespace/topic");
fail("Should have raised exception");
} catch (IllegalArgumentException e) {
// Ok
@@ -158,36 +158,36 @@ public class TopicNameTest {
// Ok
}
- assertEquals(TopicName.get("persistent://property/cluster/namespace/topic")
- .getPersistenceNamingEncoding(), "property/cluster/namespace/persistent/topic");
+ assertEquals(TopicName.get("persistent://tenant/cluster/namespace/topic")
+ .getPersistenceNamingEncoding(), "tenant/cluster/namespace/persistent/topic");
try {
- TopicName.get("://property.namespace");
+ TopicName.get("://tenant.namespace");
fail("Should have raied exception");
} catch (IllegalArgumentException e) {
// Ok
}
try {
- TopicName.get("://property/cluster/namespace");
+ TopicName.get("://tenant/cluster/namespace");
fail("Should have raied exception");
} catch (IllegalArgumentException e) {
// Ok
}
- TopicName nameWithSlash = TopicName.get("persistent://property/cluster/namespace/ns-abc/table/1");
+ TopicName nameWithSlash = TopicName.get("persistent://tenant/cluster/namespace/ns-abc/table/1");
assertEquals(nameWithSlash.getEncodedLocalName(), Codec.encode("ns-abc/table/1"));
TopicName nameEndingInSlash = TopicName
- .get("persistent://property/cluster/namespace/ns-abc/table/1/");
+ .get("persistent://tenant/cluster/namespace/ns-abc/table/1/");
assertEquals(nameEndingInSlash.getEncodedLocalName(), Codec.encode("ns-abc/table/1/"));
TopicName nameWithTwoSlashes = TopicName
- .get("persistent://property/cluster/namespace//ns-abc//table//1//");
+ .get("persistent://tenant/cluster/namespace//ns-abc//table//1//");
assertEquals(nameWithTwoSlashes.getEncodedLocalName(), Codec.encode("/ns-abc//table//1//"));
TopicName nameWithRandomCharacters = TopicName
- .get("persistent://property/cluster/namespace/$#3rpa/table/1");
+ .get("persistent://tenant/cluster/namespace/$#3rpa/table/1");
assertEquals(nameWithRandomCharacters.getEncodedLocalName(), Codec.encode("$#3rpa/table/1"));
TopicName topicName = TopicName.get("persistent://myprop/mycolo/myns/mytopic");
@@ -217,26 +217,26 @@ public class TopicNameTest {
@Test
public void testTopicNameWithoutCluster() throws Exception {
- TopicName topicName = TopicName.get("persistent://property/namespace/topic");
+ TopicName topicName = TopicName.get("persistent://tenant/namespace/topic");
- assertEquals(topicName.getNamespace(), "property/namespace");
+ assertEquals(topicName.getNamespace(), "tenant/namespace");
- assertEquals(topicName, TopicName.get("persistent", "property", "namespace", "topic"));
+ assertEquals(topicName, TopicName.get("persistent", "tenant", "namespace", "topic"));
assertEquals(topicName.hashCode(),
- TopicName.get("persistent", "property", "namespace", "topic").hashCode());
+ TopicName.get("persistent", "tenant", "namespace", "topic").hashCode());
- assertEquals(topicName.toString(), "persistent://property/namespace/topic");
+ assertEquals(topicName.toString(), "persistent://tenant/namespace/topic");
assertEquals(topicName.getDomain(), TopicDomain.persistent);
- assertEquals(topicName.getTenant(), "property");
+ assertEquals(topicName.getTenant(), "tenant");
assertEquals(topicName.getCluster(), null);
assertEquals(topicName.getNamespacePortion(), "namespace");
- assertEquals(topicName.getNamespace(), "property/namespace");
+ assertEquals(topicName.getNamespace(), "tenant/namespace");
assertEquals(topicName.getLocalName(), "topic");
assertEquals(topicName.getEncodedLocalName(), "topic");
- assertEquals(topicName.getPartitionedTopicName(), "persistent://property/namespace/topic");
- assertEquals(topicName.getPersistenceNamingEncoding(), "property/namespace/persistent/topic");
+ assertEquals(topicName.getPartitionedTopicName(), "persistent://tenant/namespace/topic");
+ assertEquals(topicName.getPersistenceNamingEncoding(), "tenant/namespace/persistent/topic");
}
@Test
--
To stop receiving notification emails like this one, please contact
mmerli@apache.org.