Repository: skiptests/astraea
Pull request #332 (2022-05-13 08:14:30)

Rename brokersMetrics to broker; Rename topic to admin; Rename smooth…
如標題，在要開始給別人之前先把一些雜亂的package歸類一下

chia7712: @wycccccc 要麻煩之後注意一下，package盡量不要用`smoothPartitioner`這個命名~
wycccccc: 好 以後注意

Patch:
diff --git a/app/src/main/java/org/astraea/App.java b/app/src/main/java/org/astraea/App.java
index c936550a..cf9ec3c3 100644
--- a/app/src/main/java/org/astraea/App.java
+++ b/app/src/main/java/org/astraea/App.java
@@ -5,13 +5,13 @@ import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import org.astraea.admin.ReplicaCollie;
+import org.astraea.admin.ReplicaSyncingMonitor;
+import org.astraea.admin.TopicExplorer;
 import org.astraea.automation.Automation;
+import org.astraea.cost.topic.PartitionScore;
 import org.astraea.metrics.MetricExplorer;
 import org.astraea.performance.Performance;
-import org.astraea.topic.ReplicaCollie;
-import org.astraea.topic.ReplicaSyncingMonitor;
-import org.astraea.topic.TopicExplorer;
-import org.astraea.topic.cost.PartitionScore;
 import org.astraea.web.WebService;
 
 public class App {
diff --git a/app/src/main/java/org/astraea/topic/Builder.java b/app/src/main/java/org/astraea/admin/Builder.java
similarity index 99%
rename from app/src/main/java/org/astraea/topic/Builder.java
rename to app/src/main/java/org/astraea/admin/Builder.java
index 92fabba8..babcbb58 100644
--- a/app/src/main/java/org/astraea/topic/Builder.java
+++ b/app/src/main/java/org/astraea/admin/Builder.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.ArrayList;
 import java.util.Collection;
diff --git a/app/src/main/java/org/astraea/topic/Compression.java b/app/src/main/java/org/astraea/admin/Compression.java
similarity index 92%
rename from app/src/main/java/org/astraea/topic/Compression.java
rename to app/src/main/java/org/astraea/admin/Compression.java
index 30e19b3a..1e1d7977 100644
--- a/app/src/main/java/org/astraea/topic/Compression.java
+++ b/app/src/main/java/org/astraea/admin/Compression.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.Locale;
 
diff --git a/app/src/main/java/org/astraea/topic/ConsumerGroup.java b/app/src/main/java/org/astraea/admin/ConsumerGroup.java
similarity index 97%
rename from app/src/main/java/org/astraea/topic/ConsumerGroup.java
rename to app/src/main/java/org/astraea/admin/ConsumerGroup.java
index 559c4448..d9682933 100644
--- a/app/src/main/java/org/astraea/topic/ConsumerGroup.java
+++ b/app/src/main/java/org/astraea/admin/ConsumerGroup.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.List;
 import java.util.Map;
diff --git a/app/src/main/java/org/astraea/topic/Creator.java b/app/src/main/java/org/astraea/admin/Creator.java
similarity index 97%
rename from app/src/main/java/org/astraea/topic/Creator.java
rename to app/src/main/java/org/astraea/admin/Creator.java
index 1940c28f..0d2aad97 100644
--- a/app/src/main/java/org/astraea/topic/Creator.java
+++ b/app/src/main/java/org/astraea/admin/Creator.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.time.Duration;
 import java.util.Map;
diff --git a/app/src/main/java/org/astraea/topic/Member.java b/app/src/main/java/org/astraea/admin/Member.java
similarity index 98%
rename from app/src/main/java/org/astraea/topic/Member.java
rename to app/src/main/java/org/astraea/admin/Member.java
index 1dd5a939..6eaad442 100644
--- a/app/src/main/java/org/astraea/topic/Member.java
+++ b/app/src/main/java/org/astraea/admin/Member.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.Objects;
 import java.util.Optional;
diff --git a/app/src/main/java/org/astraea/topic/Migrator.java b/app/src/main/java/org/astraea/admin/Migrator.java
similarity index 97%
rename from app/src/main/java/org/astraea/topic/Migrator.java
rename to app/src/main/java/org/astraea/admin/Migrator.java
index 9a9bfdbd..7660c326 100644
--- a/app/src/main/java/org/astraea/topic/Migrator.java
+++ b/app/src/main/java/org/astraea/admin/Migrator.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.List;
 import java.util.Map;
diff --git a/app/src/main/java/org/astraea/topic/Offset.java b/app/src/main/java/org/astraea/admin/Offset.java
similarity index 93%
rename from app/src/main/java/org/astraea/topic/Offset.java
rename to app/src/main/java/org/astraea/admin/Offset.java
index 03b25b5a..ba13ba4a 100644
--- a/app/src/main/java/org/astraea/topic/Offset.java
+++ b/app/src/main/java/org/astraea/admin/Offset.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 public final class Offset {
   private final long earliest;
diff --git a/app/src/main/java/org/astraea/topic/Replica.java b/app/src/main/java/org/astraea/admin/Replica.java
similarity index 98%
rename from app/src/main/java/org/astraea/topic/Replica.java
rename to app/src/main/java/org/astraea/admin/Replica.java
index cbcc9554..5a8ec623 100644
--- a/app/src/main/java/org/astraea/topic/Replica.java
+++ b/app/src/main/java/org/astraea/admin/Replica.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.Objects;
 
diff --git a/app/src/main/java/org/astraea/topic/ReplicaCollie.java b/app/src/main/java/org/astraea/admin/ReplicaCollie.java
similarity index 99%
rename from app/src/main/java/org/astraea/topic/ReplicaCollie.java
rename to app/src/main/java/org/astraea/admin/ReplicaCollie.java
index f2966462..caf5e039 100644
--- a/app/src/main/java/org/astraea/topic/ReplicaCollie.java
+++ b/app/src/main/java/org/astraea/admin/ReplicaCollie.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import com.beust.jcommander.Parameter;
 import java.io.IOException;
diff --git a/app/src/main/java/org/astraea/topic/ReplicaSyncingMonitor.java b/app/src/main/java/org/astraea/admin/ReplicaSyncingMonitor.java
similarity index 99%
rename from app/src/main/java/org/astraea/topic/ReplicaSyncingMonitor.java
rename to app/src/main/java/org/astraea/admin/ReplicaSyncingMonitor.java
index ac234496..4cde57b6 100644
--- a/app/src/main/java/org/astraea/topic/ReplicaSyncingMonitor.java
+++ b/app/src/main/java/org/astraea/admin/ReplicaSyncingMonitor.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import com.beust.jcommander.Parameter;
 import java.time.Duration;
diff --git a/app/src/main/java/org/astraea/topic/TopicAdmin.java b/app/src/main/java/org/astraea/admin/TopicAdmin.java
similarity index 98%
rename from app/src/main/java/org/astraea/topic/TopicAdmin.java
rename to app/src/main/java/org/astraea/admin/TopicAdmin.java
index 5b17c376..93902bc8 100644
--- a/app/src/main/java/org/astraea/topic/TopicAdmin.java
+++ b/app/src/main/java/org/astraea/admin/TopicAdmin.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.io.Closeable;
 import java.util.Collection;
diff --git a/app/src/main/java/org/astraea/topic/TopicConfig.java b/app/src/main/java/org/astraea/admin/TopicConfig.java
similarity index 91%
rename from app/src/main/java/org/astraea/topic/TopicConfig.java
rename to app/src/main/java/org/astraea/admin/TopicConfig.java
index 1322cc9d..8cd4548a 100644
--- a/app/src/main/java/org/astraea/topic/TopicConfig.java
+++ b/app/src/main/java/org/astraea/admin/TopicConfig.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.Collection;
 import java.util.Map;
diff --git a/app/src/main/java/org/astraea/topic/TopicExplorer.java b/app/src/main/java/org/astraea/admin/TopicExplorer.java
similarity index 99%
rename from app/src/main/java/org/astraea/topic/TopicExplorer.java
rename to app/src/main/java/org/astraea/admin/TopicExplorer.java
index e45680a8..e95f31ba 100644
--- a/app/src/main/java/org/astraea/topic/TopicExplorer.java
+++ b/app/src/main/java/org/astraea/admin/TopicExplorer.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import com.beust.jcommander.Parameter;
 import java.io.IOException;
diff --git a/app/src/main/java/org/astraea/argument/CompressionField.java b/app/src/main/java/org/astraea/argument/CompressionField.java
index 9f02ebbe..996ea6c4 100644
--- a/app/src/main/java/org/astraea/argument/CompressionField.java
+++ b/app/src/main/java/org/astraea/argument/CompressionField.java
@@ -4,7 +4,7 @@ import com.beust.jcommander.ParameterException;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import org.apache.kafka.common.record.CompressionType;
-import org.astraea.topic.Compression;
+import org.astraea.admin.Compression;
 
 public class CompressionField extends Field<Compression> {
   /**
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/BrokerInputCost.java b/app/src/main/java/org/astraea/cost/broker/BrokerInputCost.java
similarity index 97%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/BrokerInputCost.java
rename to app/src/main/java/org/astraea/cost/broker/BrokerInputCost.java
index 29870e17..6e3ef9ee 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/BrokerInputCost.java
+++ b/app/src/main/java/org/astraea/cost/broker/BrokerInputCost.java
@@ -1,6 +1,6 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
-import static org.astraea.cost.brokersMetrics.CostUtils.TScore;
+import static org.astraea.cost.broker.CostUtils.TScore;
 
 import java.util.HashMap;
 import java.util.List;
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/BrokerOutputCost.java b/app/src/main/java/org/astraea/cost/broker/BrokerOutputCost.java
similarity index 97%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/BrokerOutputCost.java
rename to app/src/main/java/org/astraea/cost/broker/BrokerOutputCost.java
index 7c60c49f..a175cdd9 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/BrokerOutputCost.java
+++ b/app/src/main/java/org/astraea/cost/broker/BrokerOutputCost.java
@@ -1,6 +1,6 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
-import static org.astraea.cost.brokersMetrics.CostUtils.TScore;
+import static org.astraea.cost.broker.CostUtils.TScore;
 
 import java.util.HashMap;
 import java.util.List;
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/CostUtils.java b/app/src/main/java/org/astraea/cost/broker/CostUtils.java
similarity index 97%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/CostUtils.java
rename to app/src/main/java/org/astraea/cost/broker/CostUtils.java
index 7c788af9..bc1234ea 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/CostUtils.java
+++ b/app/src/main/java/org/astraea/cost/broker/CostUtils.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/CpuCost.java b/app/src/main/java/org/astraea/cost/broker/CpuCost.java
similarity index 97%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/CpuCost.java
rename to app/src/main/java/org/astraea/cost/broker/CpuCost.java
index 1b33e06a..7639f6f8 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/CpuCost.java
+++ b/app/src/main/java/org/astraea/cost/broker/CpuCost.java
@@ -1,6 +1,6 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
-import static org.astraea.cost.brokersMetrics.CostUtils.TScore;
+import static org.astraea.cost.broker.CostUtils.TScore;
 
 import java.util.HashMap;
 import java.util.List;
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/MemoryCost.java b/app/src/main/java/org/astraea/cost/broker/MemoryCost.java
similarity index 97%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/MemoryCost.java
rename to app/src/main/java/org/astraea/cost/broker/MemoryCost.java
index dabf7855..8d18ae49 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/MemoryCost.java
+++ b/app/src/main/java/org/astraea/cost/broker/MemoryCost.java
@@ -1,6 +1,6 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
-import static org.astraea.cost.brokersMetrics.CostUtils.TScore;
+import static org.astraea.cost.broker.CostUtils.TScore;
 
 import java.util.HashMap;
 import java.util.List;
diff --git a/app/src/main/java/org/astraea/cost/brokersMetrics/NeutralIntegratedCost.java b/app/src/main/java/org/astraea/cost/broker/NeutralIntegratedCost.java
similarity index 99%
rename from app/src/main/java/org/astraea/cost/brokersMetrics/NeutralIntegratedCost.java
rename to app/src/main/java/org/astraea/cost/broker/NeutralIntegratedCost.java
index 623fb8be..c01f708b 100644
--- a/app/src/main/java/org/astraea/cost/brokersMetrics/NeutralIntegratedCost.java
+++ b/app/src/main/java/org/astraea/cost/broker/NeutralIntegratedCost.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Comparator;
 import java.util.HashMap;
diff --git a/app/src/main/java/org/astraea/topic/cost/CalculateUtils.java b/app/src/main/java/org/astraea/cost/topic/CalculateUtils.java
similarity index 99%
rename from app/src/main/java/org/astraea/topic/cost/CalculateUtils.java
rename to app/src/main/java/org/astraea/cost/topic/CalculateUtils.java
index 43bca13c..d48e73db 100644
--- a/app/src/main/java/org/astraea/topic/cost/CalculateUtils.java
+++ b/app/src/main/java/org/astraea/cost/topic/CalculateUtils.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import java.util.Comparator;
 import java.util.HashMap;
diff --git a/app/src/main/java/org/astraea/topic/cost/GetPartitionInf.java b/app/src/main/java/org/astraea/cost/topic/GetPartitionInf.java
similarity index 96%
rename from app/src/main/java/org/astraea/topic/cost/GetPartitionInf.java
rename to app/src/main/java/org/astraea/cost/topic/GetPartitionInf.java
index 26145320..5e6a6496 100644
--- a/app/src/main/java/org/astraea/topic/cost/GetPartitionInf.java
+++ b/app/src/main/java/org/astraea/cost/topic/GetPartitionInf.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import java.util.Comparator;
 import java.util.HashMap;
@@ -7,7 +7,7 @@ import java.util.NoSuchElementException;
 import java.util.TreeMap;
 import java.util.stream.Collectors;
 import org.apache.kafka.common.TopicPartition;
-import org.astraea.topic.TopicAdmin;
+import org.astraea.admin.TopicAdmin;
 
 public class GetPartitionInf {
   static Map<Integer, Map<TopicPartition, Integer>> getSize(TopicAdmin client) {
diff --git a/app/src/main/java/org/astraea/topic/cost/PartitionScore.java b/app/src/main/java/org/astraea/cost/topic/PartitionScore.java
similarity index 98%
rename from app/src/main/java/org/astraea/topic/cost/PartitionScore.java
rename to app/src/main/java/org/astraea/cost/topic/PartitionScore.java
index e4393f06..0fb29b04 100644
--- a/app/src/main/java/org/astraea/topic/cost/PartitionScore.java
+++ b/app/src/main/java/org/astraea/cost/topic/PartitionScore.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import com.beust.jcommander.Parameter;
 import java.util.ArrayList;
@@ -9,8 +9,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 import org.apache.kafka.common.TopicPartition;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.argument.BooleanField;
-import org.astraea.topic.TopicAdmin;
 
 public class PartitionScore {
   public static void printScore(
diff --git a/app/src/main/java/org/astraea/partitioner/StrictCostDispatcher.java b/app/src/main/java/org/astraea/partitioner/StrictCostDispatcher.java
index 903502a1..58a11193 100644
--- a/app/src/main/java/org/astraea/partitioner/StrictCostDispatcher.java
+++ b/app/src/main/java/org/astraea/partitioner/StrictCostDispatcher.java
@@ -30,7 +30,7 @@ import org.astraea.metrics.collector.Receiver;
  *
  * <p>You can configure the cost functions you want to use. By giving the name of that cost function
  * and its weight. For example,
- * `org.astraea.cost.ThroughputCost=1,org.astraea.cost.brokersMetrics.BrokerOutputCost=1`.
+ * `org.astraea.cost.ThroughputCost=1,org.astraea.cost.broker.BrokerOutputCost=1`.
  */
 public class StrictCostDispatcher implements Dispatcher {
   public static final String JMX_PORT = "jmx.port";
@@ -153,8 +153,8 @@ public class StrictCostDispatcher implements Dispatcher {
 
   /**
    * Helps parse cost-function names and weights. The format of the key and value is "<CostFunction
-   * name>"="<weight>". For example, {"org.astraea.cost.brokersMetrics.BrokerInputCost", "20"} will
-   * be parsed to {(BrokerInputCost object), 20.0}.
+   * name>"="<weight>". For example, {"org.astraea.cost.broker.BrokerInputCost", "20"} will be
+   * parsed to {(BrokerInputCost object), 20.0}.
    *
    * @param config that contains cost-function names and its corresponding weight
    * @return pairs of cost-function object and its corresponding weight
diff --git a/app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeight.java b/app/src/main/java/org/astraea/partitioner/smooth/SmoothWeight.java
similarity index 96%
rename from app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeight.java
rename to app/src/main/java/org/astraea/partitioner/smooth/SmoothWeight.java
index b28aaffa..e049650b 100644
--- a/app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeight.java
+++ b/app/src/main/java/org/astraea/partitioner/smooth/SmoothWeight.java
@@ -1,4 +1,4 @@
-package org.astraea.partitioner.smoothPartitioner;
+package org.astraea.partitioner.smooth;
 
 import java.util.Comparator;
 import java.util.HashMap;
diff --git a/app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightDispatcher.java b/app/src/main/java/org/astraea/partitioner/smooth/SmoothWeightDispatcher.java
similarity index 99%
rename from app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightDispatcher.java
rename to app/src/main/java/org/astraea/partitioner/smooth/SmoothWeightDispatcher.java
index 53e35834..a3247359 100644
--- a/app/src/main/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightDispatcher.java
+++ b/app/src/main/java/org/astraea/partitioner/smooth/SmoothWeightDispatcher.java
@@ -1,4 +1,4 @@
-package org.astraea.partitioner.smoothPartitioner;
+package org.astraea.partitioner.smooth;
 
 import java.time.Duration;
 import java.util.Collection;
diff --git a/app/src/main/java/org/astraea/performance/Performance.java b/app/src/main/java/org/astraea/performance/Performance.java
index 55905e1f..0d9b999a 100644
--- a/app/src/main/java/org/astraea/performance/Performance.java
+++ b/app/src/main/java/org/astraea/performance/Performance.java
@@ -18,6 +18,8 @@ import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
 import org.apache.kafka.common.TopicPartition;
 import org.apache.kafka.common.errors.WakeupException;
 import org.astraea.Utils;
+import org.astraea.admin.Compression;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.argument.CompressionField;
 import org.astraea.argument.NonEmptyStringField;
 import org.astraea.argument.NonNegativeShortField;
@@ -30,8 +32,6 @@ import org.astraea.concurrent.ThreadPool;
 import org.astraea.consumer.Consumer;
 import org.astraea.consumer.Isolation;
 import org.astraea.producer.Producer;
-import org.astraea.topic.Compression;
-import org.astraea.topic.TopicAdmin;
 import org.astraea.utils.DataSize;
 import org.astraea.utils.DataUnit;
 
diff --git a/app/src/main/java/org/astraea/producer/Builder.java b/app/src/main/java/org/astraea/producer/Builder.java
index 10ca9a81..a3a70d93 100644
--- a/app/src/main/java/org/astraea/producer/Builder.java
+++ b/app/src/main/java/org/astraea/producer/Builder.java
@@ -16,7 +16,7 @@ import org.apache.kafka.common.KafkaException;
 import org.apache.kafka.common.errors.AuthorizationException;
 import org.apache.kafka.common.errors.OutOfOrderSequenceException;
 import org.apache.kafka.common.errors.ProducerFencedException;
-import org.astraea.topic.Compression;
+import org.astraea.admin.Compression;
 
 public class Builder<Key, Value> {
   private final Map<String, Object> configs = new HashMap<>();
diff --git a/app/src/main/java/org/astraea/web/GroupHandler.java b/app/src/main/java/org/astraea/web/GroupHandler.java
index aab2050b..a5d3bf45 100644
--- a/app/src/main/java/org/astraea/web/GroupHandler.java
+++ b/app/src/main/java/org/astraea/web/GroupHandler.java
@@ -6,7 +6,7 @@ import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
-import org.astraea.topic.TopicAdmin;
+import org.astraea.admin.TopicAdmin;
 
 public class GroupHandler implements Handler {
 
diff --git a/app/src/main/java/org/astraea/web/TopicHandler.java b/app/src/main/java/org/astraea/web/TopicHandler.java
index bab43f8d..6591e678 100644
--- a/app/src/main/java/org/astraea/web/TopicHandler.java
+++ b/app/src/main/java/org/astraea/web/TopicHandler.java
@@ -8,8 +8,8 @@ import java.util.Optional;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
-import org.astraea.topic.TopicAdmin;
-import org.astraea.topic.TopicConfig;
+import org.astraea.admin.TopicAdmin;
+import org.astraea.admin.TopicConfig;
 
 class TopicHandler implements Handler {
 
@@ -98,7 +98,7 @@ class TopicHandler implements Handler {
     private final boolean isFuture;
     private final String path;
 
-    Replica(org.astraea.topic.Replica replica) {
+    Replica(org.astraea.admin.Replica replica) {
       this(
           replica.broker(),
           replica.lag(),
diff --git a/app/src/main/java/org/astraea/web/WebService.java b/app/src/main/java/org/astraea/web/WebService.java
index 7ca1c001..72d1ee73 100644
--- a/app/src/main/java/org/astraea/web/WebService.java
+++ b/app/src/main/java/org/astraea/web/WebService.java
@@ -4,8 +4,8 @@ import com.beust.jcommander.Parameter;
 import com.sun.net.httpserver.HttpServer;
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.argument.NonNegativeIntegerField;
-import org.astraea.topic.TopicAdmin;
 
 public class WebService {
 


Test patch:
diff --git a/app/src/test/java/org/astraea/topic/CompressionTest.java b/app/src/test/java/org/astraea/admin/CompressionTest.java
similarity index 95%
rename from app/src/test/java/org/astraea/topic/CompressionTest.java
rename to app/src/test/java/org/astraea/admin/CompressionTest.java
index 5c9c954e..cf121f3c 100644
--- a/app/src/test/java/org/astraea/topic/CompressionTest.java
+++ b/app/src/test/java/org/astraea/admin/CompressionTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import java.util.Arrays;
 import org.apache.kafka.common.record.CompressionType;
diff --git a/app/src/test/java/org/astraea/topic/ReplicaCollieTest.java b/app/src/test/java/org/astraea/admin/ReplicaCollieTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/ReplicaCollieTest.java
rename to app/src/test/java/org/astraea/admin/ReplicaCollieTest.java
index aa502e33..c9bdabad 100644
--- a/app/src/test/java/org/astraea/topic/ReplicaCollieTest.java
+++ b/app/src/test/java/org/astraea/admin/ReplicaCollieTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import static org.junit.jupiter.api.condition.OS.WINDOWS;
 
diff --git a/app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorIntegrationTest.java b/app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorIntegrationTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorIntegrationTest.java
rename to app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorIntegrationTest.java
index a694460a..06e567ff 100644
--- a/app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorIntegrationTest.java
+++ b/app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertSame;
diff --git a/app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorTest.java b/app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorTest.java
rename to app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorTest.java
index 1b07485d..cf81fa18 100644
--- a/app/src/test/java/org/astraea/topic/ReplicaSyncingMonitorTest.java
+++ b/app/src/test/java/org/astraea/admin/ReplicaSyncingMonitorTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/app/src/test/java/org/astraea/topic/TopicAdminTest.java b/app/src/test/java/org/astraea/admin/TopicAdminTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/TopicAdminTest.java
rename to app/src/test/java/org/astraea/admin/TopicAdminTest.java
index aa3768d4..841a69d9 100644
--- a/app/src/test/java/org/astraea/topic/TopicAdminTest.java
+++ b/app/src/test/java/org/astraea/admin/TopicAdminTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import static org.junit.jupiter.api.condition.OS.WINDOWS;
 
diff --git a/app/src/test/java/org/astraea/topic/TopicExplorerTest.java b/app/src/test/java/org/astraea/admin/TopicExplorerTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/TopicExplorerTest.java
rename to app/src/test/java/org/astraea/admin/TopicExplorerTest.java
index d5701754..032af0db 100644
--- a/app/src/test/java/org/astraea/topic/TopicExplorerTest.java
+++ b/app/src/test/java/org/astraea/admin/TopicExplorerTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic;
+package org.astraea.admin;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
diff --git a/app/src/test/java/org/astraea/argument/CompressionFieldTest.java b/app/src/test/java/org/astraea/argument/CompressionFieldTest.java
index dc28a507..c6648d4f 100644
--- a/app/src/test/java/org/astraea/argument/CompressionFieldTest.java
+++ b/app/src/test/java/org/astraea/argument/CompressionFieldTest.java
@@ -3,7 +3,7 @@ package org.astraea.argument;
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.ParameterException;
 import java.util.stream.Stream;
-import org.astraea.topic.Compression;
+import org.astraea.admin.Compression;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
diff --git a/app/src/test/java/org/astraea/cost/brokersMetrics/BrokerInputCostTest.java b/app/src/test/java/org/astraea/cost/broker/BrokerInputCostTest.java
similarity index 98%
rename from app/src/test/java/org/astraea/cost/brokersMetrics/BrokerInputCostTest.java
rename to app/src/test/java/org/astraea/cost/broker/BrokerInputCostTest.java
index 50228a95..b1effd31 100644
--- a/app/src/test/java/org/astraea/cost/brokersMetrics/BrokerInputCostTest.java
+++ b/app/src/test/java/org/astraea/cost/broker/BrokerInputCostTest.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Collection;
 import java.util.List;
diff --git a/app/src/test/java/org/astraea/cost/brokersMetrics/BrokerOutPutCostTest.java b/app/src/test/java/org/astraea/cost/broker/BrokerOutPutCostTest.java
similarity index 98%
rename from app/src/test/java/org/astraea/cost/brokersMetrics/BrokerOutPutCostTest.java
rename to app/src/test/java/org/astraea/cost/broker/BrokerOutPutCostTest.java
index 1027c3fa..a8ca9a15 100644
--- a/app/src/test/java/org/astraea/cost/brokersMetrics/BrokerOutPutCostTest.java
+++ b/app/src/test/java/org/astraea/cost/broker/BrokerOutPutCostTest.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Collection;
 import java.util.List;
diff --git a/app/src/test/java/org/astraea/cost/brokersMetrics/CpuCostTest.java b/app/src/test/java/org/astraea/cost/broker/CpuCostTest.java
similarity index 98%
rename from app/src/test/java/org/astraea/cost/brokersMetrics/CpuCostTest.java
rename to app/src/test/java/org/astraea/cost/broker/CpuCostTest.java
index 8c6dfe92..f8042f59 100644
--- a/app/src/test/java/org/astraea/cost/brokersMetrics/CpuCostTest.java
+++ b/app/src/test/java/org/astraea/cost/broker/CpuCostTest.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Collection;
 import java.util.List;
diff --git a/app/src/test/java/org/astraea/cost/brokersMetrics/IntegratedScoreTest.java b/app/src/test/java/org/astraea/cost/broker/IntegratedScoreTest.java
similarity index 97%
rename from app/src/test/java/org/astraea/cost/brokersMetrics/IntegratedScoreTest.java
rename to app/src/test/java/org/astraea/cost/broker/IntegratedScoreTest.java
index cdc82a34..079958bb 100644
--- a/app/src/test/java/org/astraea/cost/brokersMetrics/IntegratedScoreTest.java
+++ b/app/src/test/java/org/astraea/cost/broker/IntegratedScoreTest.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.util.Map;
 import org.junit.jupiter.api.Assertions;
diff --git a/app/src/test/java/org/astraea/cost/brokersMetrics/MemoryCostTest.java b/app/src/test/java/org/astraea/cost/broker/MemoryCostTest.java
similarity index 98%
rename from app/src/test/java/org/astraea/cost/brokersMetrics/MemoryCostTest.java
rename to app/src/test/java/org/astraea/cost/broker/MemoryCostTest.java
index 538b0c80..95760900 100644
--- a/app/src/test/java/org/astraea/cost/brokersMetrics/MemoryCostTest.java
+++ b/app/src/test/java/org/astraea/cost/broker/MemoryCostTest.java
@@ -1,4 +1,4 @@
-package org.astraea.cost.brokersMetrics;
+package org.astraea.cost.broker;
 
 import java.lang.management.MemoryUsage;
 import java.util.Collection;
diff --git a/app/src/test/java/org/astraea/topic/cost/CalculateUtilsTest.java b/app/src/test/java/org/astraea/cost/topic/CalculateUtilsTest.java
similarity index 99%
rename from app/src/test/java/org/astraea/topic/cost/CalculateUtilsTest.java
rename to app/src/test/java/org/astraea/cost/topic/CalculateUtilsTest.java
index 96b6a68c..c3186317 100644
--- a/app/src/test/java/org/astraea/topic/cost/CalculateUtilsTest.java
+++ b/app/src/test/java/org/astraea/cost/topic/CalculateUtilsTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
diff --git a/app/src/test/java/org/astraea/topic/cost/GetPartitionInfTest.java b/app/src/test/java/org/astraea/cost/topic/GetPartitionInfTest.java
similarity index 97%
rename from app/src/test/java/org/astraea/topic/cost/GetPartitionInfTest.java
rename to app/src/test/java/org/astraea/cost/topic/GetPartitionInfTest.java
index 1c770111..0c4e5a5c 100644
--- a/app/src/test/java/org/astraea/topic/cost/GetPartitionInfTest.java
+++ b/app/src/test/java/org/astraea/cost/topic/GetPartitionInfTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -6,10 +6,10 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.producer.Producer;
 import org.astraea.producer.Serializer;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
diff --git a/app/src/test/java/org/astraea/topic/cost/PartitionScoreTest.java b/app/src/test/java/org/astraea/cost/topic/PartitionScoreTest.java
similarity index 97%
rename from app/src/test/java/org/astraea/topic/cost/PartitionScoreTest.java
rename to app/src/test/java/org/astraea/cost/topic/PartitionScoreTest.java
index cad9bfff..90c64b9e 100644
--- a/app/src/test/java/org/astraea/topic/cost/PartitionScoreTest.java
+++ b/app/src/test/java/org/astraea/cost/topic/PartitionScoreTest.java
@@ -1,4 +1,4 @@
-package org.astraea.topic.cost;
+package org.astraea.cost.topic;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -6,10 +6,10 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.producer.Producer;
 import org.astraea.producer.Serializer;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
diff --git a/app/src/test/java/org/astraea/metrics/kafka/KafkaMetricsTest.java b/app/src/test/java/org/astraea/metrics/kafka/KafkaMetricsTest.java
index 0a006df0..f6e9d890 100644
--- a/app/src/test/java/org/astraea/metrics/kafka/KafkaMetricsTest.java
+++ b/app/src/test/java/org/astraea/metrics/kafka/KafkaMetricsTest.java
@@ -15,11 +15,11 @@ import javax.management.MBeanServer;
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.metrics.java.JvmMemory;
 import org.astraea.metrics.java.OperatingSystemInfo;
 import org.astraea.metrics.jmx.MBeanClient;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
diff --git a/app/src/test/java/org/astraea/partitioner/StrictCostDispatcherTest.java b/app/src/test/java/org/astraea/partitioner/StrictCostDispatcherTest.java
index b91cae76..7df0b8ba 100644
--- a/app/src/test/java/org/astraea/partitioner/StrictCostDispatcherTest.java
+++ b/app/src/test/java/org/astraea/partitioner/StrictCostDispatcherTest.java
@@ -12,7 +12,7 @@ import org.astraea.cost.HasBrokerCost;
 import org.astraea.cost.NodeInfo;
 import org.astraea.cost.ReplicaInfo;
 import org.astraea.cost.ThroughputCost;
-import org.astraea.cost.brokersMetrics.BrokerInputCost;
+import org.astraea.cost.broker.BrokerInputCost;
 import org.astraea.metrics.collector.Fetcher;
 import org.astraea.metrics.collector.Receiver;
 import org.junit.jupiter.api.Assertions;
@@ -160,24 +160,20 @@ public class StrictCostDispatcherTest {
     var config =
         Configuration.of(
             Map.of(
-                "org.astraea.cost.brokersMetrics.BrokerInputCost",
+                "org.astraea.cost.broker.BrokerInputCost",
                 "20",
-                "org.astraea.cost.brokersMetrics.BrokerOutputCost",
+                "org.astraea.cost.broker.BrokerOutputCost",
                 "1.25"));
     var ans = StrictCostDispatcher.parseCostFunctionWeight(config);
     Assertions.assertEquals(2, ans.size());
     for (var entry : ans.entrySet()) {
-      if (entry
-          .getKey()
-          .getClass()
-          .getName()
-          .equals("org.astraea.cost.brokersMetrics.BrokerInputCost")) {
+      if (entry.getKey().getClass().getName().equals("org.astraea.cost.broker.BrokerInputCost")) {
         Assertions.assertEquals(20.0, entry.getValue());
       } else if (entry
           .getKey()
           .getClass()
           .getName()
-          .equals("org.astraea.cost.brokersMetrics.BrokerOutputCost")) {
+          .equals("org.astraea.cost.broker.BrokerOutputCost")) {
         Assertions.assertEquals(1.25, entry.getValue());
       } else {
         Assertions.assertEquals(0.0, entry.getValue());
@@ -188,9 +184,9 @@ public class StrictCostDispatcherTest {
     var config2 =
         Configuration.of(
             Map.of(
-                "org.astraea.cost.brokersMetrics.BrokerInputCost",
+                "org.astraea.cost.broker.BrokerInputCost",
                 "-20",
-                "org.astraea.cost.brokersMetrics.BrokerOutputCost",
+                "org.astraea.cost.broker.BrokerOutputCost",
                 "1.25"));
     Assertions.assertThrows(
         IllegalArgumentException.class,
diff --git a/app/src/test/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightTest.java b/app/src/test/java/org/astraea/partitioner/smooth/SmoothWeightTest.java
similarity index 92%
rename from app/src/test/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightTest.java
rename to app/src/test/java/org/astraea/partitioner/smooth/SmoothWeightTest.java
index 56434137..6f853448 100644
--- a/app/src/test/java/org/astraea/partitioner/smoothPartitioner/SmoothWeightTest.java
+++ b/app/src/test/java/org/astraea/partitioner/smooth/SmoothWeightTest.java
@@ -1,4 +1,4 @@
-package org.astraea.partitioner.smoothPartitioner;
+package org.astraea.partitioner.smooth;
 
 import java.util.Map;
 import org.junit.jupiter.api.Assertions;
diff --git a/app/src/test/java/org/astraea/performance/PerformanceTest.java b/app/src/test/java/org/astraea/performance/PerformanceTest.java
index e4368181..67a2d732 100644
--- a/app/src/test/java/org/astraea/performance/PerformanceTest.java
+++ b/app/src/test/java/org/astraea/performance/PerformanceTest.java
@@ -9,13 +9,13 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.function.BiConsumer;
 import org.apache.kafka.common.TopicPartition;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.concurrent.Executor;
 import org.astraea.concurrent.State;
 import org.astraea.consumer.Consumer;
 import org.astraea.consumer.Isolation;
 import org.astraea.producer.Producer;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
@@ -137,7 +137,7 @@ public class PerformanceTest extends RequireBrokerCluster {
       "--record.size",
       "10KiB",
       "--partitioner",
-      "org.astraea.partitioner.smoothPartitioner.SmoothWeightPartitioner",
+      "org.astraea.partitioner.smooth.SmoothWeightPartitioner",
       "--compression",
       "lz4",
       "--key.distribution",
diff --git a/app/src/test/java/org/astraea/performance/ProducerExecutorTest.java b/app/src/test/java/org/astraea/performance/ProducerExecutorTest.java
index 21cafc4f..32336b84 100644
--- a/app/src/test/java/org/astraea/performance/ProducerExecutorTest.java
+++ b/app/src/test/java/org/astraea/performance/ProducerExecutorTest.java
@@ -10,10 +10,10 @@ import java.util.function.Supplier;
 import java.util.stream.Stream;
 import org.apache.kafka.common.TopicPartition;
 import org.astraea.Utils;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.concurrent.State;
 import org.astraea.producer.Producer;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Named;
 import org.junit.jupiter.params.ParameterizedTest;
diff --git a/app/src/test/java/org/astraea/web/GroupHandlerTest.java b/app/src/test/java/org/astraea/web/GroupHandlerTest.java
index 85f3879f..aa5880a9 100644
--- a/app/src/test/java/org/astraea/web/GroupHandlerTest.java
+++ b/app/src/test/java/org/astraea/web/GroupHandlerTest.java
@@ -7,9 +7,9 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import org.astraea.Utils;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.consumer.Consumer;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
diff --git a/app/src/test/java/org/astraea/web/TopicHandlerTest.java b/app/src/test/java/org/astraea/web/TopicHandlerTest.java
index 3cf09750..19cc1e2b 100644
--- a/app/src/test/java/org/astraea/web/TopicHandlerTest.java
+++ b/app/src/test/java/org/astraea/web/TopicHandlerTest.java
@@ -5,8 +5,8 @@ import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import org.astraea.Utils;
+import org.astraea.admin.TopicAdmin;
 import org.astraea.service.RequireBrokerCluster;
-import org.astraea.topic.TopicAdmin;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;