Skip to content

Commit

Permalink
Checkstyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pablorodriguez-sngular committed Nov 24, 2023
1 parent 12d6c68 commit e13b8f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import com.sngular.kloadgen.exception.KLoadGenException;
Expand Down Expand Up @@ -82,7 +88,7 @@ public final class KafkaProducerSampler extends AbstractJavaSamplerClient implem
public void setupTest(final JavaSamplerContext context) {
props = JMeterContextService.getContext().getProperties();

if(context.getJMeterVariables().get(PropsKeysHelper.VALUE_SCHEMA) == null) {
if (context.getJMeterVariables().get(PropsKeysHelper.VALUE_SCHEMA) == null) {
generator = SamplerUtil.configureKeyGenerator(props);
} else {
generator = SamplerUtil.configureValueGenerator(props);
Expand Down Expand Up @@ -123,7 +129,7 @@ public void setupTest(final JavaSamplerContext context) {
valueSerializer);
} catch (final KafkaException ex) {
getNewLogger().error(ex.getMessage(), ex);
} catch (ClassNotFoundException e) {
} catch (final ClassNotFoundException e) {
getNewLogger().error(e.getMessage(), e);
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.apache.avro.io.EncoderFactory;
import org.apache.kafka.common.errors.SerializationException;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.serialization.Serializer;

@Slf4j
public class AvroSerializer<T extends EnrichedRecord> implements EnrichedRecordSerializer<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package com.sngular.kloadgen.serializer;

import org.apache.kafka.common.serialization.Serializer;
import org.apache.kafka.common.serialization.StringSerializer;

import java.util.Map;

public class CustomStringEnrichedRecordSerializer<T extends EnrichedRecord> implements EnrichedRecordSerializer<T> {
StringSerializer stringSerializer;
import org.apache.kafka.common.serialization.StringSerializer;

public final class CustomStringEnrichedRecordSerializer<T extends EnrichedRecord> implements EnrichedRecordSerializer<T> {
private final StringSerializer stringSerializer;

public CustomStringEnrichedRecordSerializer() {
stringSerializer = new StringSerializer();
}

public void configure(Map<String, ?> configs, boolean isKey) {
public void configure(final Map<String, ?> configs, final boolean isKey) {
stringSerializer.configure(configs, isKey);
}
public byte[] serialize(String topic, EnrichedRecord data) {

public byte[] serialize(final String topic, final EnrichedRecord data) {
return stringSerializer.serialize(topic, data.toString());
}
}

0 comments on commit e13b8f2

Please sign in to comment.