Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into fix_amqp_client

# Conflicts:
#	src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
  • Loading branch information
John Kelly committed Apr 14, 2015
2 parents 5043b6a + 9a867e6 commit cee3099
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class AMQPPublisher extends AMQPSampler implements Interruptible {
private final static String MESSAGE_TYPE = "AMQPPublisher.MessageType";
private final static String REPLY_TO_QUEUE = "AMQPPublisher.ReplyToQueue";
private final static String CORRELATION_ID = "AMQPPublisher.CorrelationId";
private final static String MESSAGE_ID = "AMQPPublisher.MessageId";
private final static String HEADERS = "AMQPPublisher.Headers";

public static boolean DEFAULT_PERSISTENT = false;
Expand Down Expand Up @@ -180,6 +181,17 @@ public void setCorrelationId(String content) {
setProperty(CORRELATION_ID, content);
}

/**
* @return the message id for the sample
*/
public String getMessageId() {
return getPropertyAsString(MESSAGE_ID);
}

public void setMessageId(String content) {
setProperty(MESSAGE_ID, content);
}

public Arguments getHeaders() {
return (Arguments) getProperty(HEADERS).getObjectValue();
}
Expand Down Expand Up @@ -224,7 +236,8 @@ protected AMQP.BasicProperties getProperties() {
AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();

int deliveryMode = getPersistent() ? 2 : 1;

String messageId = getMessageId().isEmpty() ? parentProps.getMessageId() : getMessageId();

return builder
.contentType("text/plain")
.deliveryMode(deliveryMode)
Expand All @@ -233,6 +246,7 @@ protected AMQP.BasicProperties getProperties() {
.replyTo(getReplyToQueue())
.type(getMessageType())
.headers(prepareHeaders())
.messageId(messageId)
.build();
}

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 messageId = new JLabeledTextField("Message Id");

private JCheckBox persistent = new JCheckBox("Persistent?", AMQPPublisher.DEFAULT_PERSISTENT);
private JCheckBox useTx = new JCheckBox("Use Transactions?", AMQPPublisher.DEFAULT_USE_TX);
Expand Down Expand Up @@ -77,6 +78,7 @@ public void configure(TestElement element) {
messageType.setText(sampler.getMessageType());
replyToQueue.setText(sampler.getReplyToQueue());
correlationId.setText(sampler.getCorrelationId());
messageId.setText(sampler.getMessageId());
message.setText(sampler.getMessage());
configureHeaders(sampler);
}
Expand Down Expand Up @@ -110,6 +112,7 @@ public void modifyTestElement(TestElement te) {
sampler.setMessageType(messageType.getText());
sampler.setReplyToQueue(replyToQueue.getText());
sampler.setCorrelationId(correlationId.getText());
sampler.setMessageId(messageId.getText());
sampler.setHeaders((Arguments) headers.createTestElement());
}

Expand All @@ -130,6 +133,7 @@ protected final void init() {
messageType.setPreferredSize(new Dimension(100, 25));
replyToQueue.setPreferredSize(new Dimension(100, 25));
correlationId.setPreferredSize(new Dimension(100, 25));
messageId.setPreferredSize(new Dimension(100, 25));
message.setPreferredSize(new Dimension(400, 150));

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

0 comments on commit cee3099

Please sign in to comment.