Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tinexw committed Apr 14, 2015
2 parents bf53a24 + 9a867e6 commit bae6294
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class AMQPPublisher extends AMQPSampler implements Interruptible {
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";

public static boolean DEFAULT_PERSISTENT = false;
Expand Down Expand Up @@ -191,6 +192,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 @@ -236,14 +248,15 @@ protected AMQP.BasicProperties getProperties() {
AMQP.BasicProperties parentProps = super.getProperties();

int deliveryMode = getPersistent() ? 2 : 1;

final String contentType = StringUtils.defaultIfBlank(getContentType(), parentProps.getContentType());

final String contentType = StringUtils.defaultIfEmpty(getContentType(), parentProps.getContentType());
final String messageId = StringUtils.defaultIfEmpty(getMessageId(), parentProps.getMessageId());

AMQP.BasicProperties publishProperties =
new AMQP.BasicProperties(contentType, parentProps.getContentEncoding(),
parentProps.getHeaders(), deliveryMode, parentProps.getPriority(),
getCorrelationId(), getReplyToQueue(), parentProps.getExpiration(),
parentProps.getMessageId(), parentProps.getTimestamp(), getMessageType(),
messageId, parentProps.getTimestamp(), getMessageType(),
parentProps.getUserId(), parentProps.getAppId(), parentProps.getClusterId());

return publishProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class AMQPPublisherGui extends AMQPSamplerGui {
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);
private JCheckBox useTx = new JCheckBox("Use Transactions?", AMQPPublisher.DEFAULT_USE_TX);
Expand Down Expand Up @@ -79,6 +80,7 @@ public void configure(TestElement element) {
replyToQueue.setText(sampler.getReplyToQueue());
contentType.setText(sampler.getContentType());
correlationId.setText(sampler.getCorrelationId());
messageId.setText(sampler.getMessageId());
message.setText(sampler.getMessage());
configureHeaders(sampler);
}
Expand Down Expand Up @@ -113,6 +115,7 @@ public void modifyTestElement(TestElement te) {
sampler.setReplyToQueue(replyToQueue.getText());
sampler.setCorrelationId(correlationId.getText());
sampler.setContentType(contentType.getText());
sampler.setMessageId(messageId.getText());
sampler.setHeaders((Arguments) headers.createTestElement());
}

Expand All @@ -134,6 +137,7 @@ protected final void init() {
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));

mainPanel.add(persistent);
Expand All @@ -143,6 +147,7 @@ protected final void init() {
mainPanel.add(replyToQueue);
mainPanel.add(correlationId);
mainPanel.add(contentType);
mainPanel.add(messageId);
mainPanel.add(headers);
mainPanel.add(message);
}
Expand All @@ -160,6 +165,7 @@ public void clearGui() {
replyToQueue.setText("");
correlationId.setText("");
contentType.setText("");
messageId.setText("");
headers.clearGui();
message.setText("");
}
Expand Down

0 comments on commit bae6294

Please sign in to comment.