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

2,直接上代码:

package com.mytest.functions;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
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 sun.misc.BASE64Encoder; public class Base64DecodeString extends AbstractFunction
{
private static final List<String> desc = new LinkedList();
private static final String KEY = "__Base64_string";
private Object[] values; public synchronized String execute(SampleResult paramSampleResult, Sampler paramSampler)
throws InvalidVariableException
{
JMeterVariables localJMeterVariables = getVariables();
String str1 = ((CompoundVariable)this.values[]).execute(); String str2 = new BASE64Encoder().encode(str1.getBytes()); if ((localJMeterVariables != null) && (this.values.length > )) {
String str3 = ((CompoundVariable)this.values[]).execute().trim();
localJMeterVariables.put(str3, str2);
} return str2;
} public synchronized void setParameters(Collection<CompoundVariable> paramCollection)
throws InvalidVariableException
{
checkMinParameterCount(paramCollection, );
this.values = paramCollection.toArray();
} public String getReferenceKey()
{
return "__Base64_string";
} public List<String> getArgumentDesc()
{
return desc;
} static
{
desc.add("String to calculate Base64 hash ");
desc.add("Name of variable in which to store the result (optional),作者:guanyf");
}
}

jmeter添加自定义扩展函数之Strng---base64解密的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  9. base64解密

    问题 : base64解密 时间限制: 1 Sec  内存限制: 128 MB 题目描述 Base64编码要求把3个8位字节(3*8=24)转化为4个6位的字节(4*6=24),之后在6位的前面补两个 ...

随机推荐

  1. SQL的一对多,多对一,一对一,多对多

    1.一对多:比如说一个班级有很多学生,可是这个班级只有一个班主任.在这个班级中随便找一个人,就会知道他们的班主任是谁:知道了这个班主任就会知道有哪几个学生.这里班主任和学生的关系就是一对多. 2.多对 ...

  2. JavaWeb学习——session总结

    一.session简介 sesion也就是会话,Session对象存储特定用户会话所需的属性及配置信息.这样,当用户在应用程序的Web页之间跳转时,存储在Session对象中的变量将不会丢失,而是在整 ...

  3. python开发之路-day03

    一 文件操作一 介绍 计算机系统分为:计算机硬件,操作系统,应用程序三部分. 我们用python或其他语言编写的应用程序若想要把数据永久保存下来,必须要保存于硬盘中,这就涉及到应用程序要操作硬件,众所 ...

  4. Spark链接hive时 “HikariCP” 问题

    IDE本地调试和spark-shell调试报错: Caused by: org.datanucleus.exceptions.NucleusUserException: The connection ...

  5. 阿里云云监控agent插件 - Linux版

    阿里云云监控agent插件使用指南 1.安装(注意,要以“root”权限运行,复制 sudo后面的就行,别把#也复制进去) #64位 # sudo bash -c "wget -e 'htt ...

  6. 求解:为什么impala实现hive查询 可以使用ifnull()函数,不可以使用length() 函数

    求大神解惑,找了很久都没有找到为什么??? hive支持length() 函数,不支持ifnull()函数??? impala实现hive查询 支持ifnull()函数,不支持length()  函数 ...

  7. 【学习总结】Eclipse常用快捷键

    相关博文 [JAVA]eclipse-Introduction

  8. Python-编码这趟浑水

    最近听Alex讲到python编码,还特意用博客讲解,觉得问题严重了,于是翻看各种博客,先简单的对编码错误做一个总结,其他的后续慢慢补上,还得上班.还得学习.还得写博客?感觉有点吃不消了.各位大神不喜 ...

  9. Matomo(Piwik)安装说明-----------基于LNPM环境

    Matomo(Piwik)安装说明 安装前环境检查 Piwik要求PHP版本高于PHP5.5(选用PHP7.2) Piwik需要pdo和pdo_mysql或mysqli支持(选用mysqli) Piw ...

  10. Android】Retrofit网络请求参数注解,@Path、@Query、@QueryMap...(转)

    对Retrofit已经使用了一点时间了,是时候归纳一下各种网络请求的service了. 下面分为GET.POST.DELETE还有PUT的请求,说明@Path.@Query.@QueryMap.@Bo ...