1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这里就不再赘述

2,代码如下:

package com.mytest.functions;

import org.apache.jmeter.engine.util.CompoundVariable;

import org.apache.jmeter.functions.AbstractFunction;

import org.apache.jmeter.functions.InvalidVariableException;

import org.apache.jmeter.samplers.SampleResult;

import org.apache.jmeter.samplers.Sampler;

import org.apache.jmeter.threads.JMeterVariables;

import java.util.Collection;

import java.util.LinkedList;

import java.util.List;

public class LowerCase extends AbstractFunction {

    private static final List<String> desc = new LinkedList<String>();

    private static final String KEY = "__lowercase";

    static {

        desc.add("String to convert to lowercase");

        desc.add("Name of variable in which to store the result (optional),The author is guanyf");

    }

    private Object[] values;

    /**

     * No-arg constructor.

     */

    public LowerCase() {

    }

    /**

     * {@inheritDoc}

     */

    @Override

    public synchronized String execute(SampleResult previousResult, Sampler currentSampler)

            throws InvalidVariableException {

        JMeterVariables vars = getVariables();

        String res = ((CompoundVariable) values[0]).execute().toLowerCase();

        if (vars != null && values.length > 1) {

            String varName = ((CompoundVariable) values[1]).execute().trim();

            vars.put(varName, res);

        }

        return res;

    }

    /**

     * {@inheritDoc}

     */

    @Override

    public synchronized void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {

        checkMinParameterCount(parameters, 1);

        values = parameters.toArray();

    }

    /**

     * {@inheritDoc}

     */

    @Override

    public String getReferenceKey() {

        return KEY;

    }

    /**

     * {@inheritDoc}

     */

    @Override

    public List<String> getArgumentDesc() {

        return desc;

    }

}

jmeter添加自定义扩展函数之大写转换小写的更多相关文章

  1. jmeter添加自定义扩展函数之小写转换大写

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  2. jmeter添加自定义扩展函数之图片base64编码

    打开eclipse,新建maven工程,在pom中引入jmeter核心jar包: <!-- https://mvnrepository.com/artifact/org.apache.jmete ...

  3. jmeter添加自定义扩展函数之DoubleSum

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  4. jmeter添加自定义扩展函数之if判断

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  5. jmeter添加自定义扩展函数之MD5加密

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  6. jmeter添加自定义扩展函数之Strng---base64解密

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  7. jmeter添加自定义扩展函数之String---base64加密

    1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...

  8. jmeter添加自定义扩展函数之图片base64

    原文连接:---------https://www.cnblogs.com/qiaoyeye/p/7218770.html----------- 打开eclipse,新建maven工程,在pom中引用 ...

  9. eclipse字母大写和小写转换的快捷键

    大写转换小写 ctrl+shift+y        小写转换大写 ctrl+shift+x   

随机推荐

  1. Vue3.0响应式实现

    基于Proxy // 弱引用映射表 es6 防止对象不能被回收 let toProxy = new WeakMap(); // 原对象: 代理过得对象 let toRaw = new WeakMap( ...

  2. MyBatis-Spring的sqlSessionTemplate

    转自:http://www.cnblogs.com/yhtboke/p/5611375.html SqlSessionTemplate SqlSessionTemplate是MyBatis-Sprin ...

  3. mybatis 批量update报语法错误解决方法

    1.为什么会报语法错误 原因:在 *.xml文件内使用了循环,在mybatis中默认是不允许使用批量修改. <update id="setMaxMin" parameterT ...

  4. Zepto v1.0-1源码注解

    /* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */ ;(funct ...

  5. 用bootstrap和css3制作按钮式下拉菜单

    利用bootstrap框架的字体图标和下拉菜单效果,以及css3的动画效果,可以做出比较优雅的按钮式下拉菜单样式 <style> .myBtnStyle .dropdown-menu sp ...

  6. P4542 [ZJOI2011]营救皮卡丘(Floyd+网络流)

    P4542 [ZJOI2011]营救皮卡丘 乍一看似乎没啥题相似的 仔细一看,$N<=150$ 边又是双向边,似乎可以用Floyd搞   先跑一遍Floyd处理出$dis[i][j]$ 注意到走 ...

  7. Centos7防火墙常用命令

    有些人安装的linux的系统默认防火墙不是iptables,而是firewall,那就得使用以下方式关闭防火墙了. >>>关闭防火墙 systemctl stop firewalld ...

  8. 攻防世界--crackme

    测试文件:https://adworld.xctf.org.cn/media/task/attachments/088c3bd10de44fa988a3601dc5585da8.exe 1.准备 获取 ...

  9. GeneXus笔记本——部分环境属性设置项

    这些属性的设置是我们在做项目的过程中都会设置的属性 当然也因项目而异 这里也只是单纯的记录一下 知识库 属性设置“Maximun numeric length" 效果:设置数值型最大值 版本 ...

  10. TMS320C6455BCTZA 原厂订购 原装正品

    作为一家科研公司,保证芯片的原厂品质和正规采购渠道是科学严谨的研发工作中重要的一环,更是保证研发产品可靠.稳定的基础.而研发中所遇到的各种不可预测的情况更是每个工程师向技术的山峰攀登中时会遇到的各种难 ...