diff --git a/pom-maven-central.xml b/pom-maven-central.xml
index 17769b03..2137a7e0 100644
--- a/pom-maven-central.xml
+++ b/pom-maven-central.xml
@@ -7,7 +7,7 @@
kloadgen
- 5.6.6
+ 5.6.7
KLoadGen
Load Generation Jmeter plugin for Kafka Cluster. Supporting AVRO, JSON Schema and Protobuf schema types. Generate Artificial
diff --git a/pom.xml b/pom.xml
index 841dab45..b9fad739 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
kloadgen
- 5.6.6
+ 5.6.7
KLoadGen
Load Generation Jmeter plugin for Kafka Cluster. Supporting AVRO, JSON Schema and Protobuf schema types. Generate Artificial
@@ -426,6 +426,12 @@
io.apicurio
apicurio-registry-client
${apicurio-registry.version}
+
+
+ org.jboss.slf4j
+ slf4j-jboss-logmanager
+
+
io.apicurio
@@ -467,6 +473,7 @@
org.slf4j
slf4j-api
${slf4j-api.version}
+ provided
org.apache.commons
diff --git a/src/main/java/com/sngular/kloadgen/extractor/extractors/avro/AbstractAvroFileExtractor.java b/src/main/java/com/sngular/kloadgen/extractor/extractors/avro/AbstractAvroFileExtractor.java
index fbe9de28..882c068e 100644
--- a/src/main/java/com/sngular/kloadgen/extractor/extractors/avro/AbstractAvroFileExtractor.java
+++ b/src/main/java/com/sngular/kloadgen/extractor/extractors/avro/AbstractAvroFileExtractor.java
@@ -358,7 +358,6 @@ private Set extractSchemaNames(Schema schema) {
Set schemaNames = new HashSet<>();
if (checkIfRecord(schema)) {
schemaNames.add(schema.getName());
- schema.getFields().forEach(field -> schemaNames.addAll(extractSchemaNames(field.schema())));
} else if (checkIfArray(schema)) {
schemaNames.addAll(extractSchemaNames(schema.getElementType()));
} else if (checkIfUnion(schema)) {
diff --git a/src/main/java/com/sngular/kloadgen/model/FieldValueMapping.java b/src/main/java/com/sngular/kloadgen/model/FieldValueMapping.java
index c3f257a2..c7882fae 100644
--- a/src/main/java/com/sngular/kloadgen/model/FieldValueMapping.java
+++ b/src/main/java/com/sngular/kloadgen/model/FieldValueMapping.java
@@ -7,12 +7,13 @@
package com.sngular.kloadgen.model;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -107,28 +108,42 @@ public final List getFieldValuesList() {
if (StringUtils.isNotBlank(inputFieldValueList) && !"[]".equalsIgnoreCase(inputFieldValueList)) {
try {
inputFieldValueAux = inputFieldValueList;
- if (inputFieldValueAux.charAt(0) != "[".charAt(0)) {
+
+ if (inputFieldValueAux.charAt(0) != '[') {
inputFieldValueAux = "[" + inputFieldValueAux;
}
- if (inputFieldValueAux.charAt(inputFieldValueAux.length() - 1) != "]".charAt(0)) {
+ if (inputFieldValueAux.charAt(inputFieldValueAux.length() - 1) != ']') {
inputFieldValueAux += "]";
}
final JsonNode nodes = OBJECT_MAPPER.readTree(inputFieldValueAux);
final Iterator nodeElements = nodes.elements();
while (nodeElements.hasNext()) {
result.add(nodeElements.next().toString());
+
}
} catch (final JsonProcessingException ex) {
- inputFieldValueAux = inputFieldValueList;
- if (inputFieldValueAux.charAt(0) == "[".charAt(0)) {
- inputFieldValueAux = inputFieldValueAux.substring(1);
+ // Warning: even though IntelliJ say that can be simplified, it can't be simplified!! (test fails)
+
+ if (inputFieldValueList.startsWith("[") && inputFieldValueList.endsWith("]")) {
+ final String pattern = "(?<=\\[?)((([À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+:([À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+|\\[([À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+,"
+ + "[À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+|)*]))|[À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+)(?=[]|,]))";
+ final Pattern r = Pattern.compile(pattern);
+ final Matcher matcher = r.matcher(inputFieldValueList.trim());
+ while (matcher.find()) {
+ result.add(matcher.group(0));
+ }
+ } else {
+ final String pattern = "([À-ÿ\\p{Alnum}\\p{Punct}&&[^,\\[\\]]][À-ÿ\\s\\p{Alnum}\\p{Punct}&&[^,\\[\\]]]+)[^,\\s]?+";
+ final Pattern r = Pattern.compile(pattern);
+ final Matcher matcher = r.matcher(inputFieldValueList.trim());
+ while (matcher.find()) {
+ result.add(matcher.group(0));
+ }
}
- if (inputFieldValueAux.charAt(inputFieldValueAux.length() - 1) == "]".charAt(0)) {
- inputFieldValueAux = inputFieldValueAux.substring(0, inputFieldValueAux.length() - 1);
- }
- result.addAll(Arrays.asList(inputFieldValueAux.trim().split("\\s*,\\s*", -1)));
+
}
}
+
return result;
}
diff --git a/src/main/java/com/sngular/kloadgen/property/editor/FileSubjectPropertyEditor.java b/src/main/java/com/sngular/kloadgen/property/editor/FileSubjectPropertyEditor.java
index d4883119..6db26c5b 100644
--- a/src/main/java/com/sngular/kloadgen/property/editor/FileSubjectPropertyEditor.java
+++ b/src/main/java/com/sngular/kloadgen/property/editor/FileSubjectPropertyEditor.java
@@ -38,7 +38,6 @@
import javax.swing.filechooser.FileSystemView;
import lombok.extern.slf4j.Slf4j;
import org.apache.avro.AvroRuntimeException;
-import org.apache.commons.compress.utils.Lists;
import org.apache.jmeter.gui.ClearGui;
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer;
@@ -135,10 +134,10 @@ public final List getAttributeList(final ParsedSchema selecte
public final void actionPerformed(final ActionEvent event) {
if (subjectNameComboBox.getItemCount() != 0) {
- final String schemaType = schemaTypeComboBox.getSelectedItem().toString();
+ final String schemaType = (String) schemaTypeComboBox.getSelectedItem();
final String selectedItem = (String) subjectNameComboBox.getSelectedItem();
final String selectedSchema = getSelectedSchema(selectedItem);
- final List attributeList = Lists.newArrayList();
+ final List attributeList = SchemaExtractor.flatPropertiesList(selectedSchema).getValue();
if (!attributeList.isEmpty()) {
try {
diff --git a/src/main/java/com/sngular/kloadgen/randomtool/generator/AvroGeneratorTool.java b/src/main/java/com/sngular/kloadgen/randomtool/generator/AvroGeneratorTool.java
index 0c45cfee..3f3aa8f6 100644
--- a/src/main/java/com/sngular/kloadgen/randomtool/generator/AvroGeneratorTool.java
+++ b/src/main/java/com/sngular/kloadgen/randomtool/generator/AvroGeneratorTool.java
@@ -248,7 +248,7 @@ public final Object generateMap(
}
}
} else {
- value = (HashMap