diff --git a/plugins/protocol/amqp/pom.xml b/plugins/protocol/amqp/pom.xml
index b3540a1..f91c51b 100644
--- a/plugins/protocol/amqp/pom.xml
+++ b/plugins/protocol/amqp/pom.xml
@@ -4,7 +4,7 @@
jp.co.pnop
jmeter-plugins-azure-amqp
- 0.2.1
+ 0.2.2
Azure AMQP Configure
Conigure of AMQP
diff --git a/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/AzAmqpMessages.java b/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/AzAmqpMessages.java
index fa70fb7..32d066d 100644
--- a/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/AzAmqpMessages.java
+++ b/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/AzAmqpMessages.java
@@ -38,6 +38,7 @@ public class AzAmqpMessages extends AbstractTestElement {
public static final String MESSAGE_TYPE_STRING = "String";
public static final String MESSAGE_TYPE_BASE64 = "Base64 encoded binary";
public static final String MESSAGE_TYPE_FILE = "File";
+ public static final String MESSAGE_TYPE_BYTES = "Bytes";
/**
* Create a new Messages object with no messages.
diff --git a/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/gui/AzAmqpMessagesPanel.java b/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/gui/AzAmqpMessagesPanel.java
index 370373b..33b6827 100644
--- a/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/gui/AzAmqpMessagesPanel.java
+++ b/plugins/protocol/amqp/src/main/java/jp/co/pnop/jmeter/protocol/amqp/sampler/gui/AzAmqpMessagesPanel.java
@@ -62,7 +62,7 @@ public class AzAmqpMessagesPanel extends AbstractSamplerGui implements ActionLis
//private static final Logger log = LoggerFactory.getLogger(AzAmqpMessagesPanel.class);
/** The title label for this component. */
- private JLabel tableLabel;
+ protected JLabel tableLabel;
/** The table containing the list of messages. */
private transient JTable table;
@@ -359,7 +359,7 @@ private JPanel makeButtonPanel() {
/**
* Initialize the components and layout of this component.
*/
- private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
+ protected void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
setLayout(new BorderLayout());
setBorder(makeBorder());
@@ -378,7 +378,9 @@ public MessageTypeCelEditor() {
super (new JComboBox<>(new String[]{
AzAmqpMessages.MESSAGE_TYPE_STRING,
AzAmqpMessages.MESSAGE_TYPE_BASE64,
- AzAmqpMessages.MESSAGE_TYPE_FILE
+ AzAmqpMessages.MESSAGE_TYPE_FILE,
+ AzAmqpMessages.MESSAGE_TYPE_BYTES
+
}));
}
diff --git a/plugins/protocol/eventhubs/pom.xml b/plugins/protocol/eventhubs/pom.xml
index 01f2b6f..aebc716 100644
--- a/plugins/protocol/eventhubs/pom.xml
+++ b/plugins/protocol/eventhubs/pom.xml
@@ -4,7 +4,7 @@
jp.co.pnop
jmeter-plugins-azure-eventhubs
- 0.2.4
+ 0.3.0
Azure Event Hubs Sampler
Sample to Azure Event Hubs
@@ -123,7 +123,7 @@
jp.co.pnop
jmeter-plugins-azure-amqp
- 0.2.1
+ 0.2.2
jp.co.pnop
diff --git a/plugins/protocol/eventhubs/src/main/java/jp/co/pnop/jmeter/protocol/azureeventhubs/sampler/AzEventHubsSampler.java b/plugins/protocol/eventhubs/src/main/java/jp/co/pnop/jmeter/protocol/azureeventhubs/sampler/AzEventHubsSampler.java
index 1ed27e5..6d042a0 100644
--- a/plugins/protocol/eventhubs/src/main/java/jp/co/pnop/jmeter/protocol/azureeventhubs/sampler/AzEventHubsSampler.java
+++ b/plugins/protocol/eventhubs/src/main/java/jp/co/pnop/jmeter/protocol/azureeventhubs/sampler/AzEventHubsSampler.java
@@ -20,12 +20,18 @@
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.Set;
import java.util.HashSet;
-//import java.util.HashMap;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.jmeter.config.ConfigTestElement;
@@ -43,6 +49,8 @@
import com.azure.messaging.eventhubs.*;
import com.azure.messaging.eventhubs.models.CreateBatchOptions;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.azure.core.amqp.exception.*;
import jp.co.pnop.jmeter.protocol.aad.config.AzAdCredential;
@@ -68,6 +76,15 @@ public class AzEventHubsSampler extends AbstractSampler implements TestStateList
private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(AzEventHubsSampler.class);
+ private static final Map chronoUnit = new HashMap();
+ static {
+ chronoUnit.put ("MILLIS", ChronoUnit.MILLIS);
+ chronoUnit.put ("SECONDS", ChronoUnit.SECONDS);
+ chronoUnit.put ("MINUTES", ChronoUnit.MINUTES);
+ chronoUnit.put ("HOURS", ChronoUnit.HOURS);
+ chronoUnit.put ("DAYS", ChronoUnit.DAYS);
+ };
+
private static final Set APPLIABLE_CONFIG_CLASSES = new HashSet<>(
Arrays.asList(
"org.apache.jmeter.config.gui.SimpleConfigGui"
@@ -250,10 +267,107 @@ public SampleResult sample(Entry e) {
bi = new BufferedInputStream(new FileInputStream(msg.getMessage()));
eventData = new EventData(IOUtils.toByteArray(bi));
break;
+ case AzAmqpMessages.MESSAGE_TYPE_BYTES:
+ eventData = new EventData(msg.getMessage().getBytes());
+ break;
+
default: // AzAmqpMessages.MESSAGE_TYPE_STRING
eventData = new EventData(msg.getMessage());
}
+ String messageId = msg.getMessageId();
+ if (!messageId.isEmpty()) {
+ eventData.setMessageId(messageId);
+ requestBody = requestBody.concat("\n").concat("Message ID: ").concat(messageId);
+ }
+
+ /*
+ String partitionKey = msg.getPartitionKey();
+ if (!partitionKey.isEmpty()) {
+ eventData.setPartitionKey(partitionKey);
+ requestBody = requestBody.concat("\n").concat("Partition Key: ").concat(partitionKey);
+ }
+ */
+
+ String customProperties = msg.getCustomProperties();
+ if (!customProperties.isEmpty()) {
+ ObjectMapper mapper = new ObjectMapper();
+ Map properties = mapper.readValue(customProperties, new TypeReference