packetTypeIcon = messagePacketIcon; messageType = "Message Sent"; type = ((Message) packet).getType().toString(); sentMessagePackets++;
packetTypeIcon = messagePacketIcon; messageType = "Message Received"; type = ((Message) packet).getType().toString(); receivedMessagePackets++;
@Override public void setGuiFieldsFromSampler(JMeterXMPPSampler sampler) { msgRecipient.setText(sampler.getPropertyAsString(RECIPIENT)); msgBody.setText(sampler.getPropertyAsString(BODY)); waitResponse.setSelected(sampler.getPropertyAsBoolean(WAIT_RESPONSE)); msgType.setSelectedItem(Message.Type.fromString(sampler.getPropertyAsString(TYPE, Message.Type.normal.toString()))); }
packetTypeIcon = messagePacketIcon; messageType = "Message Sent"; type = ((Message) packet).getType().toString(); sentMessagePackets++;
packetTypeIcon = messagePacketIcon; messageType = "Message Received"; type = ((Message) packet).getType().toString(); receivedMessagePackets++;
packetTypeIcon = messagePacketIcon; messageType = "Message Sent"; type = ((Message) packet).getType().toString(); sentMessagePackets++;
packetTypeIcon = messagePacketIcon; messageType = "Message Received"; type = ((Message) packet).getType().toString(); receivedMessagePackets++;
/** * Converts a String value into its Type representation. * * @param type the String value. * @return the Type corresponding to the String. */ public static Type fromString(String type) { if (type == null) { return NORMAL; } type = type.toLowerCase(); if (CHAT.toString().equals(type)) { return CHAT; } else if (GROUP_CHAT.toString().equals(type)) { return GROUP_CHAT; } else if (HEADLINE.toString().equals(type)) { return HEADLINE; } else if (ERROR.toString().equals(type)) { return ERROR; } else { return NORMAL; } }
@Override public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception { // sending message String recipient = sampler.getPropertyAsString(RECIPIENT); String body = sampler.getPropertyAsString(BODY); boolean wait_response = sampler.getPropertyAsBoolean(WAIT_RESPONSE); if (wait_response) { body += "\r\n" + System.currentTimeMillis() + "@" + NEED_RESPONSE_MARKER; } Message msg = new Message(recipient); msg.setType(Message.Type.fromString(sampler.getPropertyAsString(TYPE, Message.Type.normal.toString()))); msg.addBody("", body); res.setSamplerData(msg.toXML().toString()); sampler.getXMPPConnection().sendPacket(msg); res.setSamplerData(msg.toXML().toString()); // second time to reflect the changes made to packet by conn if (wait_response) { return waitResponse(res, recipient); } return res; }