fix some error
This commit is contained in:
@@ -114,7 +114,7 @@ public class Qos1PublishHandler extends QosPublishHandler {
|
|||||||
byte[] response = new byte[ackPayload.readableBytes()];
|
byte[] response = new byte[ackPayload.readableBytes()];
|
||||||
ackPayload.readBytes(response);
|
ackPayload.readBytes(response);
|
||||||
ReferenceCountUtil.release(ackPayload);
|
ReferenceCountUtil.release(ackPayload);
|
||||||
RPCCenter.getInstance().sendResponse(ERROR_CODE_SUCCESS.getCode(), response, from, requestId);
|
RPCCenter.getInstance().sendResponse(errorCode.getCode(), response, from, requestId);
|
||||||
}
|
}
|
||||||
}, isAdmin);
|
}, isAdmin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2479085966683186422L;
|
private static final long serialVersionUID = 2479085966683186422L;
|
||||||
|
|
||||||
private JLabeledChoice conversationTypeChoice;
|
private JLabeledChoice conversationTypeChoice = new JLabeledChoice("ConversationType:", new String[] { CONV_TYPE_SINGLE, CONV_TYPE_GROUP }, true, false);
|
||||||
private final JLabeledTextField target = new JLabeledTextField("Target:");
|
private final JLabeledTextField target = new JLabeledTextField("Target:");
|
||||||
// private JCheckBox timestamp = new JCheckBox("Add timestamp in payload");
|
// private JCheckBox timestamp = new JCheckBox("Add timestamp in payload");
|
||||||
|
|
||||||
@@ -62,13 +62,11 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
JPanel optsPanelCon = new VerticalPanel();
|
JPanel optsPanelCon = new VerticalPanel();
|
||||||
optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Send message options"));
|
optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Send message options"));
|
||||||
|
|
||||||
conversationTypeChoice = new JLabeledChoice("ConversationType:", new String[] { CONV_TYPE_SINGLE, CONV_TYPE_GROUP }, true, false);
|
|
||||||
conversationTypeChoice.addChangeListener(this);
|
conversationTypeChoice.addChangeListener(this);
|
||||||
|
|
||||||
JPanel optsPanel = new HorizontalPanel();
|
JPanel optsPanel = new HorizontalPanel();
|
||||||
optsPanel.add(conversationTypeChoice);
|
optsPanel.add(conversationTypeChoice);
|
||||||
optsPanel.add(target);
|
optsPanel.add(target);
|
||||||
// optsPanel.add(timestamp);
|
|
||||||
optsPanelCon.add(optsPanel);
|
optsPanelCon.add(optsPanel);
|
||||||
|
|
||||||
return optsPanelCon;
|
return optsPanelCon;
|
||||||
@@ -78,16 +76,10 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
JPanel optsPanelCon = new VerticalPanel();
|
JPanel optsPanelCon = new VerticalPanel();
|
||||||
optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Message Content"));
|
optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Message Content"));
|
||||||
|
|
||||||
// JPanel horizon1 = new HorizontalPanel();
|
|
||||||
//
|
|
||||||
// stringLength.setVisible(true);
|
|
||||||
// horizon1.add(stringLength);
|
|
||||||
|
|
||||||
JPanel horizon2 = new VerticalPanel();
|
JPanel horizon2 = new VerticalPanel();
|
||||||
messagePanel.setVisible(true);
|
messagePanel.setVisible(true);
|
||||||
horizon2.add(messagePanel);
|
horizon2.add(messagePanel);
|
||||||
|
|
||||||
// optsPanelCon.add(horizon1);
|
|
||||||
optsPanelCon.add(horizon2);
|
optsPanelCon.add(horizon2);
|
||||||
return optsPanelCon;
|
return optsPanelCon;
|
||||||
}
|
}
|
||||||
@@ -135,12 +127,16 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
|
|
||||||
connUI.configure(sampler);
|
connUI.configure(sampler);
|
||||||
// if(sampler.getQOS().trim().indexOf(JMETER_VARIABLE_PREFIX) == -1){
|
// if(sampler.getQOS().trim().indexOf(JMETER_VARIABLE_PREFIX) == -1){
|
||||||
this.conversationTypeChoice.setSelectedIndex(0);
|
if ("1".equals(sampler.getConvType())) {
|
||||||
|
this.conversationTypeChoice.setSelectedIndex(1);
|
||||||
|
} else {
|
||||||
|
this.conversationTypeChoice.setSelectedIndex(0);
|
||||||
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// this.conversationTypeChoice.setText(sampler.getQOS());
|
// this.conversationTypeChoice.setText(sampler.getQOS());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.target.setText(sampler.getTopic());
|
this.target.setText(sampler.getTarget());
|
||||||
// this.timestamp.setSelected(sampler.isAddTimestamp());
|
// this.timestamp.setSelected(sampler.isAddTimestamp());
|
||||||
// if(MESSAGE_TYPE_STRING.equalsIgnoreCase(sampler.getMessageType())) {
|
// if(MESSAGE_TYPE_STRING.equalsIgnoreCase(sampler.getMessageType())) {
|
||||||
// this.messageTypes.setSelectedIndex(0);
|
// this.messageTypes.setSelectedIndex(0);
|
||||||
@@ -168,27 +164,7 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
connUI.setupSamplerProperties(sampler);
|
connUI.setupSamplerProperties(sampler);
|
||||||
|
|
||||||
sampler.setTarget(this.target.getText());
|
sampler.setTarget(this.target.getText());
|
||||||
|
sampler.setConvType(this.conversationTypeChoice.getSelectedIndex() + "");
|
||||||
// if(this.conversationTypeChoice.getText().indexOf(JMETER_VARIABLE_PREFIX) == -1) {
|
|
||||||
// int qos = QOS_0;
|
|
||||||
// try {
|
|
||||||
// qos = Integer.parseInt(this.conversationTypeChoice.getText());
|
|
||||||
// if (qos < QOS_0 || qos > QOS_2) {
|
|
||||||
// qos = QOS_0;
|
|
||||||
// logger.info("Invalid QoS value, set to default QoS value 0.");
|
|
||||||
// }
|
|
||||||
// } catch (Exception ex) {
|
|
||||||
// logger.info("Invalid QoS value, set to default QoS value 0.");
|
|
||||||
// qos = QOS_0;
|
|
||||||
// }
|
|
||||||
// sampler.setQOS(String.valueOf(qos));
|
|
||||||
// } else {
|
|
||||||
// sampler.setQOS(this.conversationTypeChoice.getText());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// sampler.setAddTimestamp(this.timestamp.isSelected());
|
|
||||||
// sampler.setMessageType(this.messageTypes.getText());
|
|
||||||
// sampler.setMessageLength(this.stringLength.getText());
|
|
||||||
sampler.setMessage(this.sendMessage.getText());
|
sampler.setMessage(this.sendMessage.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,11 +175,7 @@ public class SendMessageSamplerUI extends AbstractSamplerGui implements Constant
|
|||||||
connUI.clearUI();
|
connUI.clearUI();
|
||||||
connUI.connNamePrefix.setText(DEFAULT_CONN_PREFIX_FOR_PUB);
|
connUI.connNamePrefix.setText(DEFAULT_CONN_PREFIX_FOR_PUB);
|
||||||
this.target.setText(DEFAULT_TARGET);
|
this.target.setText(DEFAULT_TARGET);
|
||||||
this.conversationTypeChoice.setText(CONV_TYPE_SINGLE);
|
this.conversationTypeChoice.setSelectedIndex(0);
|
||||||
// this.timestamp.setSelected(false);
|
|
||||||
|
|
||||||
// this.messageTypes.setSelectedIndex(0);
|
|
||||||
// this.stringLength.setText(String.valueOf(DEFAULT_MESSAGE_FIX_LENGTH));
|
|
||||||
this.sendMessage.setText("");
|
this.sendMessage.setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public abstract class AbstractMQTTSampler extends AbstractSampler implements Con
|
|||||||
protected String token;
|
protected String token;
|
||||||
|
|
||||||
protected boolean getToken(String userId, String clientId) {
|
protected boolean getToken(String userId, String clientId) {
|
||||||
String url = "http://" + getServer() + ":18080/admin/user/token";
|
String url = "http://" + getServer() + ":18080/admin/user/get_token";
|
||||||
String adminSecret = "123456";
|
String adminSecret = "123456";
|
||||||
HttpPost post = null;
|
HttpPost post = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -191,8 +191,11 @@ public class SendMessageSampler extends AbstractMQTTSampler implements ThreadLis
|
|||||||
result.sampleStart();
|
result.sampleStart();
|
||||||
|
|
||||||
final Object lock = new Object();
|
final Object lock = new Object();
|
||||||
|
int converType = 0;
|
||||||
WFCMessage.Conversation conversation = WFCMessage.Conversation.newBuilder().setType(0).setTarget(getTarget()).setLine(0).build();
|
if ("1".equals(getConvType())) {
|
||||||
|
converType = 1;
|
||||||
|
}
|
||||||
|
WFCMessage.Conversation conversation = WFCMessage.Conversation.newBuilder().setType(converType).setTarget(getTarget()).setLine(0).build();
|
||||||
WFCMessage.MessageContent messageContent = WFCMessage.MessageContent.newBuilder().setType(1).setSearchableContent(getMessage()).build();
|
WFCMessage.MessageContent messageContent = WFCMessage.MessageContent.newBuilder().setType(1).setSearchableContent(getMessage()).build();
|
||||||
|
|
||||||
final List<Long> ret = new ArrayList<>();
|
final List<Long> ret = new ArrayList<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user