Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ jdom.md5 = 140bfed13341fe2039eee0f26a16d705
# Optional for use by checkstyle
checkstyle-all.version = 6.13
checkstyle-all.jar = checkstyle-${checkstyle-all.version}-all.jar
checkstyle-all.loc = http://downloads.sourceforge.net/checkstyle/checkstyle/${checkstyle-all.version}/checkstyle-${checkstyle-all.version}-all.jar?ts=${EPOCHSECONDS}&use_mirror=autoselect
checkstyle-all.loc = https://downloads.sourceforge.net/checkstyle/checkstyle/${checkstyle-all.version}/checkstyle-${checkstyle-all.version}-all.jar?ts=${EPOCHSECONDS}&use_mirror=autoselect
checkstyle-all.md5 = ac6e1e81d09bcaf4c0c22181e9bda1d9

# Optional for use by rat
Expand Down
4 changes: 4 additions & 0 deletions src/jorphan/org/apache/jorphan/gui/JLabeledChoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ public void itemStateChanged(ItemEvent e) {

}

public void setChoiceListEnabled(boolean enabled) {
choiceList.setEnabled(enabled);
}

/**
* Set the text displayed in the label.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.gui.JLabeledChoice;
import org.apache.jorphan.gui.JLabeledPasswordField;
import org.apache.jorphan.gui.JLabeledTextField;

Expand All @@ -56,7 +57,7 @@ public class JMSPublisherGui extends AbstractSamplerGui implements ChangeListene
/** Take source from a random file */
public static final String USE_RANDOM_RSC = "jms_use_random_file"; //$NON-NLS-1$
/** Take source from the text area */
private static final String USE_TEXT_RSC = "jms_use_text"; //$NON-NLS-1$
public static final String USE_TEXT_RSC = "jms_use_text"; //$NON-NLS-1$

/** Create a TextMessage */
public static final String TEXT_MSG_RSC = "jms_text_message"; //$NON-NLS-1$
Expand Down Expand Up @@ -111,6 +112,8 @@ public class JMSPublisherGui extends AbstractSamplerGui implements ChangeListene

private final JLabeledRadioI18N msgChoice = new JLabeledRadioI18N("jms_message_type", MSGTYPES_ITEMS, TEXT_MSG_RSC); //$NON-NLS-1$

private JLabeledChoice fileEncoding;

private final JCheckBox useNonPersistentDelivery = new JCheckBox(JMeterUtils.getResString("jms_use_non_persistent_delivery"),false); //$NON-NLS-1$

// These are the names of properties used to define the labels
Expand Down Expand Up @@ -180,6 +183,7 @@ private void setupSamplerProperties(final PublisherSampler sampler) {
sampler.setInputFile(messageFile.getFilename());
sampler.setRandomPath(randomFile.getFilename());
sampler.setConfigChoice(configChoice.getText());
sampler.setFileEncoding(fileEncoding.getText());
sampler.setMessageChoice(msgChoice.getText());
sampler.setIterations(iterations.getText());
sampler.setUseAuth(useAuth.isSelected());
Expand Down Expand Up @@ -218,6 +222,13 @@ private void init() { // WARNING: called from ctor so must not be overridden (i.
mainPanel.add(configChoice);
msgChoice.setLayout(new BoxLayout(msgChoice, BoxLayout.X_AXIS));
mainPanel.add(msgChoice);

fileEncoding = new JLabeledChoice(JMeterUtils.getResString("content_encoding") + "\u00A0\u00A0", // $NON-NLS-1$
PublisherSampler.getSupportedEncodings(), true, false);
fileEncoding.setLayout(new BoxLayout(fileEncoding, BoxLayout.X_AXIS));
fileEncoding.add(Box.createHorizontalGlue());
mainPanel.add(fileEncoding);

mainPanel.add(messageFile);
mainPanel.add(randomFile);

Expand Down Expand Up @@ -249,6 +260,7 @@ public void clearGui(){
messageFile.setFilename(""); // $NON-NLS-1$
randomFile.setFilename(""); // $NON-NLS-1$
msgChoice.setText(""); // $NON-NLS-1$
fileEncoding.setSelectedIndex(0);
configChoice.setText(USE_TEXT_RSC);
updateConfig(USE_TEXT_RSC);
msgChoice.setText(TEXT_MSG_RSC);
Expand Down Expand Up @@ -281,6 +293,7 @@ public void configure(TestElement el) {
randomFile.setFilename(sampler.getRandomPath());
configChoice.setText(sampler.getConfigChoice());
msgChoice.setText(sampler.getMessageChoice());
fileEncoding.setText(sampler.getFileEncoding());
iterations.setText(sampler.getIterations());
expiration.setText(sampler.getExpiration());
jmsErrorReconnectOnCodes.setText(sampler.getReconnectionErrorCodes());
Expand Down Expand Up @@ -315,6 +328,12 @@ public void stateChanged(ChangeEvent event) {
jmsPwd.setEnabled(useAuth.isSelected() && useAuth.isEnabled());
}
}

private void updateFileEncoding() {
boolean isTextMode = USE_TEXT_RSC.equals(configChoice.getText());
boolean isObjectType = OBJECT_MSG_RSC.equals(msgChoice.getText());
fileEncoding.setChoiceListEnabled(!isTextMode && !isObjectType);
}
/**
* Update choice contains the actual logic for hiding or showing Textarea if Bytes message
* is selected
Expand All @@ -333,6 +352,7 @@ private void updateChoice(String command) {
configChoice.resetButtons(CONFIG_ITEMS, oldChoice);
textMessage.setEnabled(true);
}
updateFileEncoding();
validate();
}
/**
Expand All @@ -355,6 +375,7 @@ private void updateConfig(String command) {
messageFile.enableFile(true);
randomFile.enableFile(false);
}
updateFileEncoding();
}

/**
Expand Down
Loading