Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor][cli][PIP-280] Refactor pulsar-client-tools module #20764

Merged
merged 45 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4924135
Implement for CmdNamespaces
JooHyukKim Jul 1, 2023
90e51ed
Fix changes
JooHyukKim Jul 4, 2023
1ea46bb
Merge remote-tracking branch 'upstream/master' into pip280-namespaces
JooHyukKim Jul 5, 2023
4a2e2f7
Fix coerced validation
JooHyukKim Jul 5, 2023
94bb470
Update
JooHyukKim Jul 5, 2023
9914aee
Revert "Merge remote-tracking branch 'upstream/master' into pip280-na…
JooHyukKim Jul 5, 2023
82a17c5
Fix name and checkstyle
JooHyukKim Jul 5, 2023
7e2ae5b
Clean up test
JooHyukKim Jul 5, 2023
72f1bfe
Fix tests and validations
JooHyukKim Jul 5, 2023
26d3348
Temp change
JooHyukKim Jul 5, 2023
d528acd
Revert revert merge upstream
JooHyukKim Jul 5, 2023
e9f3630
Revert "Temp change"
JooHyukKim Jul 5, 2023
df3279f
Fixing changes via PulsarAdminToolConverterTest
JooHyukKim Jul 5, 2023
9d3a9c1
Fix human error wrt long/integer converter
JooHyukKim Jul 6, 2023
8aee04f
Update PulsarAdminToolConverterTest.java
JooHyukKim Jul 6, 2023
c1f4388
Refactor CmdTopics
JooHyukKim Jul 7, 2023
9ddb051
Refactor CmdTopicPolicies
JooHyukKim Jul 7, 2023
a354c33
Clean up changes
JooHyukKim Jul 7, 2023
78627ce
.
JooHyukKim Jul 8, 2023
315a463
Fix CmdTopics
JooHyukKim Jul 8, 2023
7a77e08
Merge remote-tracking branch 'upstream/master' into PIP280-ALL
JooHyukKim Jul 9, 2023
5f4b14f
Add new module
JooHyukKim Jul 11, 2023
4945b0e
Fix maven
JooHyukKim Jul 11, 2023
ceb3fc4
Fix compile error wrt validation utils
JooHyukKim Jul 11, 2023
45b2120
Add apache commons dep
JooHyukKim Jul 11, 2023
963a7e3
Add test for ValueValidationUtilsTest
JooHyukKim Jul 11, 2023
cbdda80
Refactor test methods
JooHyukKim Jul 11, 2023
346a361
Fix tests and compile errors
JooHyukKim Jul 11, 2023
25a93ab
Fix checkstyle
JooHyukKim Jul 11, 2023
352714f
Merge branch 'pip280-separate-module' into PIP280-ALL
JooHyukKim Jul 11, 2023
44c85f4
Remove validators and converters
JooHyukKim Jul 11, 2023
b4e2971
Fix build failure wrt findBugsFIlter
JooHyukKim Jul 11, 2023
9aa70c2
Merge branch 'pip280-separate-module' into PIP280-ALL
JooHyukKim Jul 11, 2023
64d7ece
Remove temporarily used cli-utils
JooHyukKim Aug 23, 2023
751504e
Merge branch 'master' into PIP280-CmdTopics
JooHyukKim Aug 23, 2023
38565f8
Clean up temporary tests and checkstyle
JooHyukKim Aug 23, 2023
c188fe8
Fix build failure
JooHyukKim Aug 23, 2023
19d638f
Merge remote-tracking branch 'upstream/master' into PIP280-CmdTopics
JooHyukKim Aug 30, 2023
5dd1c77
Merge remote-tracking branch 'upstream/master' into PIP280-CmdTopics
JooHyukKim Sep 1, 2023
3581d55
Merge remote-tracking branch 'upstream/master' into PIP280-CmdTopics
JooHyukKim Sep 4, 2023
aeeb9f7
Merge branch 'master' into PIP280-CmdTopics
tisonkun Sep 15, 2023
fbcf8de
Update CmdTopics.java
JooHyukKim Sep 18, 2023
edf7b90
Merge branch 'master' into PIP280-CmdTopics
tisonkun Sep 23, 2023
0ad6cda
Merge branch 'master' into PIP280-CmdTopics
tisonkun Oct 10, 2023
cf43812
retrigger CI
tisonkun Oct 10, 2023
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
5 changes: 5 additions & 0 deletions pulsar-client-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
<artifactId>pulsar-client-admin-original</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-cli-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.beust.jcommander.ParameterException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.google.common.collect.Sets;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -78,46 +77,6 @@ static String validateNonPersistentTopic(List<String> params) {
return topicName.toString();
}

static void validateLatencySampleRate(int sampleRate) {
if (sampleRate < 0) {
throw new ParameterException(
"Latency sample rate should be positive and non-zero (found " + sampleRate + ")");
}
}

static long validateSizeString(String s) {
char last = s.charAt(s.length() - 1);
String subStr = s.substring(0, s.length() - 1);
long size;
try {
size = SIZE_UNIT.contains(last) ? Long.parseLong(subStr) : Long.parseLong(s);
} catch (IllegalArgumentException e) {
throw new ParameterException(
String.format("Invalid size '%s'. Valid formats are: %s",
s, "(4096, 100K, 10M, 16G, 2T)"));
}
switch (last) {
case 'k':
case 'K':
return size * 1024;

case 'm':
case 'M':
return size * 1024 * 1024;

case 'g':
case 'G':
return size * 1024 * 1024 * 1024;

case 't':
case 'T':
return size * 1024 * 1024 * 1024 * 1024;

default:
return size;
}
}

static MessageId validateMessageIdString(String resetMessageIdStr) throws PulsarAdminException {
return validateMessageIdString(resetMessageIdStr, -1);
}
Expand Down Expand Up @@ -230,7 +189,6 @@ <T> void prettyPrint(T item) {

private static final ObjectMapper MAPPER = ObjectMapperFactory.create();
private static final ObjectWriter WRITER = MAPPER.writerWithDefaultPrettyPrinter();
private static final Set<Character> SIZE_UNIT = Sets.newHashSet('k', 'K', 'm', 'M', 'g', 'G', 't', 'T');

abstract void run() throws Exception;
}
Loading
Loading