Skip to content

Commit

Permalink
get The Parser un and Running
Browse files Browse the repository at this point in the history
  • Loading branch information
jemacineiras committed Sep 19, 2023
1 parent e64d467 commit 55dcb94
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 39 deletions.
4 changes: 2 additions & 2 deletions pom-maven-central.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<artifactId>kloadgen</artifactId>

<version>5.6.5</version>
<version>5.7.0</version>

<name>KLoadGen</name>
<description>Load Generation Jmeter plugin for Kafka Cluster. Supporting AVRO, JSON Schema and Protobuf schema types. Generate Artificial
Expand Down Expand Up @@ -307,7 +307,7 @@
<commons-collections4.version>4.4</commons-collections4.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<gson.version>2.8.6</gson.version>
<guava.version>31.0.1-jre</guava.version>
<guava.version>32.0.0-jre</guava.version>
<jaxb-api.version>2.4.0-b180830.0359</jaxb-api.version>
<jdk.version>11</jdk.version>
<jmeter.lib.scope>provided</jmeter.lib.scope>
Expand Down
21 changes: 1 addition & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<artifactId>kloadgen</artifactId>

<version>5.6.5</version>
<version>5.7.0</version>

<name>KLoadGen</name>
<description>Load Generation Jmeter plugin for Kafka Cluster. Supporting AVRO, JSON Schema and Protobuf schema types. Generate Artificial
Expand Down Expand Up @@ -317,17 +317,6 @@
</properties>

<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
Expand Down Expand Up @@ -721,10 +710,6 @@
<version>${jmeter.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down Expand Up @@ -791,10 +776,6 @@
<artifactId>ApacheJMeter_java</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package com.sngular.kloadgen.config.asyncapi;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
Expand All @@ -23,6 +22,13 @@
import java.util.List;
import java.util.Objects;

import com.sngular.kloadgen.extractor.ApiExtractor;
import com.sngular.kloadgen.extractor.asyncapi.AsyncApiExtractorImpl;
import com.sngular.kloadgen.extractor.model.AsyncApiAbstract;
import com.sngular.kloadgen.extractor.model.AsyncApiSchema;
import com.sngular.kloadgen.extractor.model.AsyncApiServer;
import com.sngular.kloadgen.model.FieldValueMapping;
import com.sngular.kloadgen.sampler.AsyncApiSampler;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
Expand All @@ -35,13 +41,6 @@
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileSystemView;
import javax.swing.table.DefaultTableModel;

import com.sngular.kloadgen.extractor.ApiExtractor;
import com.sngular.kloadgen.extractor.asyncapi.AsyncApiExtractorImpl;
import com.sngular.kloadgen.extractor.model.AsyncApiAbstract;
import com.sngular.kloadgen.extractor.model.AsyncApiSchema;
import com.sngular.kloadgen.extractor.model.AsyncApiServer;
import com.sngular.kloadgen.sampler.AsyncApiSampler;
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
Expand Down Expand Up @@ -167,6 +166,18 @@ private <T extends AsyncApiAbstract> void fillTable(final DefaultTableModel sche
}
}

private <T extends AsyncApiAbstract> void fillTable(final DefaultTableModel schemaFields, final Object[] schemaData) {
if (Objects.nonNull(schemaData)) {
final var count = schemaFields.getRowCount();
for (var i = 0; i < count; i++) {
schemaFields.removeRow(0);
}
for (var data : schemaData) {
schemaFields.addRow(((FieldValueMapping) data).getProperties());
}
}
}

private <T extends AsyncApiAbstract> Object[] dataToRow(final T data) {
return data.getProperties();
}
Expand Down Expand Up @@ -219,21 +230,19 @@ private JPanel createRegistryTab() {

private JPanel createSchemaTab() {
final JPanel schemaTab = new JPanel();
schemaTab.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
schemaTab.setLayout(new BorderLayout(5, 5));
topicComboBox = new JComboBox<>();
topicComboBox.setRenderer(new ApiSchemaRenderer());
topicComboBox.addActionListener(this::topicComboActionListener);
schemaTab.add(topicComboBox);
schemaTab.add(new JTable(schemaFieldModel));
return schemaTab;
}

private static Component getComponentProperty(final String property) {
return new Component() {
@Override
public String getName() {
return property;
}
};
private void topicComboActionListener(final ActionEvent event) {
final JComboBox cb = (JComboBox)event.getSource();
final var selectedSchema = (AsyncApiSchema) cb.getSelectedItem();
fillTable(schemaFieldModel, selectedSchema.getProperties());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.sngular.kloadgen.extractor.model;

import java.util.List;

import com.sngular.kloadgen.model.FieldValueMapping;
import lombok.Builder;
import lombok.Value;

@Value
@Builder

public class AsyncApiSchema implements AsyncApiAbstract {

String topicName;
Expand All @@ -23,4 +25,9 @@ public class AsyncApiSchema implements AsyncApiAbstract {
public Object[] getProperties() {
return model.toArray();
}

@Override
public String toString() {
return topicName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class AsyncApiSampler extends AbstractSampler implements Serializable {

@Override
public boolean applies(final ConfigTestElement configElement) {
public final boolean applies(final ConfigTestElement configElement) {
return super.applies(configElement);
}

Expand Down

0 comments on commit 55dcb94

Please sign in to comment.