當前位置: 首頁>>代碼示例>>Java>>正文


Java SampleResult.setSamplerData方法代碼示例

本文整理匯總了Java中org.apache.jmeter.samplers.SampleResult.setSamplerData方法的典型用法代碼示例。如果您正苦於以下問題:Java SampleResult.setSamplerData方法的具體用法?Java SampleResult.setSamplerData怎麽用?Java SampleResult.setSamplerData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.jmeter.samplers.SampleResult的用法示例。


在下文中一共展示了SampleResult.setSamplerData方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    Action action = Action.valueOf(sampler.getPropertyAsString(ACTION, Action.get_roster.toString()));
    Roster roster = sampler.getXMPPConnection().getRoster();
    String entry = sampler.getPropertyAsString(ENTRY);
    res.setSamplerData(action.toString() + ": " + entry);
    if (action == Action.get_roster) {
        res.setResponseData(rosterToString(roster).getBytes());
    } else if (action == Action.add_item) {
        roster.createEntry(entry, entry, new String[0]);
    } else if (action == Action.delete_item) {
        RosterEntry rosterEntry = roster.getEntry(entry);
        if (rosterEntry != null) {
            roster.removeEntry(rosterEntry);
        }
    }

    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:20,代碼來源:RosterAction.java

示例2: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@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;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:23,代碼來源:SendMessage.java

示例3: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    Presence.Type typeVal = Presence.Type.valueOf(sampler.getPropertyAsString(TYPE, Presence.Type.available.toString()));
    Presence.Mode modeVal = Presence.Mode.valueOf(sampler.getPropertyAsString(MODE, Presence.Mode.available.toString()));

    Presence presence = new Presence(typeVal);
    presence.setMode(modeVal);

    String to = sampler.getPropertyAsString(RECIPIENT);
    if (!to.isEmpty()) {
        presence.setTo(to);
    }

    String text = sampler.getPropertyAsString(STATUS_TEXT);
    if (!text.isEmpty()) {
        presence.setStatus(text);
    }

    sampler.getXMPPConnection().sendPacket(presence);
    res.setSamplerData(presence.toXML().toString());
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:23,代碼來源:SendPresence.java

示例4: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    String recipient = sampler.getPropertyAsString(FILE_RECIPIENT);
    String filePath = sampler.getPropertyAsString(FILE_PATH);

    res.setSamplerData("Recipient: " + recipient + "\r\nFile: " + filePath + "\r\n");

    OutgoingFileTransfer transfer = mgr.createOutgoingFileTransfer(recipient);

    transfer.sendFile(new File(filePath), filePath);
    waitForTransfer(transfer, sampler.getXMPPConnection().getPacketReplyTimeout());
    res.setResponseData(("Bytes sent: " + transfer.getBytesSent()).getBytes());
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:15,代碼來源:SendFileXEP0096.java

示例5: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(final JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    final String xml = sampler.getPropertyAsString(XML);
    res.setSamplerData(xml);
    sampler.getXMPPConnection().sendPacket(new Packet() {
        @Override
        public CharSequence toXML() {
            return xml;
        }
    });
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:13,代碼來源:RawXML.java

示例6: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    String entID = sampler.getPropertyAsString(ENTITY_ID);
    res.setSamplerData("Entity ID: " + entID);
    ServiceDiscoveryManager discoMgr = ServiceDiscoveryManager.getInstanceFor(sampler.getXMPPConnection());
    IQ info;
    if (Type.valueOf(sampler.getPropertyAsString(TYPE)) == Type.info) {
        info = discoMgr.discoverInfo(entID);
    } else {
        info = discoMgr.discoverItems(entID);
    }
    res.setResponseData(info.toXML().toString().getBytes());
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:15,代碼來源:ServiceDiscovery.java

示例7: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    String room = sampler.getPropertyAsString(ROOM);
    String nick = sampler.getPropertyAsString(NICKNAME);
    res.setSamplerData("Join Room: " + room + "/" + nick);
    MultiUserChat muc = new MultiUserChat(sampler.getXMPPConnection(), room);
    muc.join(nick);
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:10,代碼來源:MUC.java

示例8: perform

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    XMPPConnection conn = sampler.getXMPPConnection();
    String loginStr = sampler.getPropertyAsString(LOGIN);
    String pwdStr = sampler.getPropertyAsString(PASSWORD);
    String resStr = sampler.getPropertyAsString(RESOURCE);
    res.setSamplerData("Username: " + loginStr + "\nPassword: " + pwdStr + "\nResource: " + resStr);
    AbstractXMPPConnection absConn = (AbstractXMPPConnection) conn;
    if (loginStr.isEmpty()) {
        absConn.loginAnonymously();
    } else {
        absConn.login(loginStr, pwdStr, resStr);
    }
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:16,代碼來源:Login.java


注:本文中的org.apache.jmeter.samplers.SampleResult.setSamplerData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。