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

[Volunteer #5641] Improper word usage in Plugin Logging-Kafka configuration#namesrvAddr #5918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Expand Up @@ -66,13 +66,13 @@ public class KafkaLogCollectClient extends AbstractLogConsumeClient<KafkaLogColl
@Override
public void initClient0(@NonNull final KafkaLogCollectConfig.KafkaLogConfig config) {
if (Objects.isNull(config)
|| StringUtils.isBlank(config.getNamesrvAddr())
|| StringUtils.isBlank(config.getBootstrapServer())
|| StringUtils.isBlank(config.getTopic())) {
LOG.error("kafka props is empty. failed init kafka producer");
return;
}
String topic = config.getTopic();
String nameserverAddress = config.getNamesrvAddr();
String nameserverAddress = config.getBootstrapServer();

if (StringUtils.isBlank(topic) || StringUtils.isBlank(nameserverAddress)) {
LOG.error("init kafkaLogCollectClient error, please check topic or nameserverAddress");
Expand All @@ -83,7 +83,7 @@ public void initClient0(@NonNull final KafkaLogCollectConfig.KafkaLogConfig conf
Properties props = new Properties();
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, config.getNamesrvAddr());
props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, config.getBootstrapServer());
if (!StringUtils.isBlank(config.getSecurityProtocol())
&& !StringUtils.isBlank(config.getSaslMechanism())) {
props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, config.getSecurityProtocol());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static class KafkaLogConfig extends GenericGlobalConfig {

private String topic;

private String namesrvAddr;
private String bootstrapServer;

private String producerGroup;

Expand Down Expand Up @@ -186,17 +186,17 @@ public void setTopic(final String topic) {
*
* @return kafka nameserver address
*/
public String getNamesrvAddr() {
return namesrvAddr;
public String getBootstrapServer() {
return bootstrapServer;
}

/**
* set kafka nameserver address.
*
* @param namesrvAddr kafka nameserver address
* @param bootstrapServer kafka nameserver address
*/
public void setNamesrvAddr(final String namesrvAddr) {
this.namesrvAddr = namesrvAddr;
public void setBootstrapServer(final String bootstrapServer) {
this.bootstrapServer = bootstrapServer;
}

/**
Expand Down Expand Up @@ -230,7 +230,7 @@ public boolean equals(final Object o) {
KafkaLogConfig that = (KafkaLogConfig) o;
return Objects.equals(getTopic(), that.getTopic())
&& Objects.equals(getCompressAlg(), that.getCompressAlg())
&& Objects.equals(getNamesrvAddr(), that.getNamesrvAddr())
&& Objects.equals(getBootstrapServer(), that.getBootstrapServer())
&& Objects.equals(getProducerGroup(), that.getProducerGroup())
&& Objects.equals(getSampleRate(), that.getSampleRate())
&& Objects.equals(getBufferQueueSize(), that.getBufferQueueSize())
Expand All @@ -240,7 +240,7 @@ public boolean equals(final Object o) {

@Override
public int hashCode() {
return Objects.hash(topic, compressAlg, namesrvAddr, producerGroup);
return Objects.hash(topic, compressAlg, bootstrapServer, producerGroup);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public void testSetGlobalLogConfigMaxRequestBody() {
}

@Test
public void testSetGlobalLogConfigNamesrvAddr() {
public void testSetGlobalLogConfigBootstrapServer() {
KafkaLogCollectConfig.KafkaLogConfig kafkaLogConfig = new KafkaLogCollectConfig.KafkaLogConfig();
kafkaLogConfig.setNamesrvAddr("test");
Assertions.assertEquals(kafkaLogConfig.getNamesrvAddr(), "test");
kafkaLogConfig.setBootstrapServer("test");
Assertions.assertEquals(kafkaLogConfig.getBootstrapServer(), "test");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void setUp() {
selectorData.setConditionList(list);
pluginData.setEnabled(false);
pluginData.setId(UUID.randomUUID().toString().replace("-", ""));
pluginData.setConfig("{\"topic\":\"test\", \"namesrvAddr\":\"localhost:8082\"}");
pluginData.setConfig("{\"topic\":\"test\", \"bootstrapServer\":\"localhost:8082\"}");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import static org.mockito.Mockito.mockConstruction;

/**
* The Test Case For RocketMQLogCollectClient.
* The Test Case For KafkaLogCollectClient.
*/
public class KafkaLogCollectClientTest {

Expand All @@ -50,7 +50,7 @@ public class KafkaLogCollectClientTest {
public void setUp() {
this.kafkaLogCollectClient = new KafkaLogCollectClient();
pluginData.setEnabled(true);
pluginData.setConfig("{\"topic\":\"shenyu-access-logging\", \"namesrvAddr\":\"localhost:8082\"}");
pluginData.setConfig("{\"topic\":\"shenyu-access-logging\", \"bootstrapServer\":\"localhost:8082\"}");
globalLogConfig = GsonUtils.getInstance().fromJson(pluginData.getConfig(), KafkaLogCollectConfig.KafkaLogConfig.class);
globalLogConfig.setCompressAlg("LZ4");
shenyuRequestLog.setClientIp("0.0.0.0");
Expand Down
Loading