Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/24'
Browse files Browse the repository at this point in the history
Conflicts:
	src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
  • Loading branch information
jlavallee committed Apr 15, 2015
2 parents 6dbe0a4 + bae6294 commit f8dffce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.zeroclue.jmeter.protocol.amqp;

import com.rabbitmq.client.AMQP;

import java.io.IOException;
import java.security.*;
import java.util.*;

import com.rabbitmq.client.MessageProperties;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.Interruptible;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class AMQPPublisher extends AMQPSampler implements Interruptible {
private final static String MESSAGE_ROUTING_KEY = "AMQPPublisher.MessageRoutingKey";
private final static String MESSAGE_TYPE = "AMQPPublisher.MessageType";
private final static String REPLY_TO_QUEUE = "AMQPPublisher.ReplyToQueue";
private final static String CONTENT_TYPE = "AMQPPublisher.ContentType";
private final static String CORRELATION_ID = "AMQPPublisher.CorrelationId";
private final static String MESSAGE_ID = "AMQPPublisher.MessageId";
private final static String HEADERS = "AMQPPublisher.Headers";
Expand Down Expand Up @@ -170,6 +172,14 @@ public void setReplyToQueue(String content) {
setProperty(REPLY_TO_QUEUE, content);
}

public String getContentType() {
return getPropertyAsString(CONTENT_TYPE);
}

public void setContentType(String contentType) {
setProperty(CONTENT_TYPE, contentType);
}

/**
* @return the correlation identifier for the sample
*/
Expand Down Expand Up @@ -233,11 +243,12 @@ protected void setChannel(Channel channel) {
}

protected AMQP.BasicProperties getProperties() {
AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();
final AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();

int deliveryMode = getPersistent() ? 2 : 1;
final int deliveryMode = getPersistent() ? 2 : 1;
final String contentType = StringUtils.defaultIfEmpty(getContentType(), "text/plain");

builder.contentType("text/plain")
builder.contentType(contentType)
.deliveryMode(deliveryMode)
.priority(0)
.correlationId(getCorrelationId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class AMQPPublisherGui extends AMQPSamplerGui {
private JLabeledTextField messageType = new JLabeledTextField("Message Type");
private JLabeledTextField replyToQueue = new JLabeledTextField("Reply-To Queue");
private JLabeledTextField correlationId = new JLabeledTextField("Correlation Id");
private JLabeledTextField contentType = new JLabeledTextField("ContentType");
private JLabeledTextField messageId = new JLabeledTextField("Message Id");

private JCheckBox persistent = new JCheckBox("Persistent?", AMQPPublisher.DEFAULT_PERSISTENT);
Expand Down Expand Up @@ -77,6 +78,7 @@ public void configure(TestElement element) {
messageRoutingKey.setText(sampler.getMessageRoutingKey());
messageType.setText(sampler.getMessageType());
replyToQueue.setText(sampler.getReplyToQueue());
contentType.setText(sampler.getContentType());
correlationId.setText(sampler.getCorrelationId());
messageId.setText(sampler.getMessageId());
message.setText(sampler.getMessage());
Expand Down Expand Up @@ -112,6 +114,7 @@ public void modifyTestElement(TestElement te) {
sampler.setMessageType(messageType.getText());
sampler.setReplyToQueue(replyToQueue.getText());
sampler.setCorrelationId(correlationId.getText());
sampler.setContentType(contentType.getText());
sampler.setMessageId(messageId.getText());
sampler.setHeaders((Arguments) headers.createTestElement());
}
Expand All @@ -133,6 +136,7 @@ protected final void init() {
messageType.setPreferredSize(new Dimension(100, 25));
replyToQueue.setPreferredSize(new Dimension(100, 25));
correlationId.setPreferredSize(new Dimension(100, 25));
contentType.setPreferredSize(new Dimension(100, 25));
messageId.setPreferredSize(new Dimension(100, 25));
message.setPreferredSize(new Dimension(400, 150));

Expand All @@ -142,6 +146,7 @@ protected final void init() {
mainPanel.add(messageType);
mainPanel.add(replyToQueue);
mainPanel.add(correlationId);
mainPanel.add(contentType);
mainPanel.add(messageId);
mainPanel.add(headers);
mainPanel.add(message);
Expand All @@ -159,6 +164,7 @@ public void clearGui() {
messageType.setText("");
replyToQueue.setText("");
correlationId.setText("");
contentType.setText("");
messageId.setText("");
headers.clearGui();
message.setText("");
Expand Down

0 comments on commit f8dffce

Please sign in to comment.