测试代码整理
This commit is contained in:
parent
385e77b766
commit
88f4bdf603
30
assembly.xml
Normal file
30
assembly.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
|
||||||
|
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
|
<id>assembled-test-jar</id>
|
||||||
|
<formats>
|
||||||
|
<format>jar</format>
|
||||||
|
</formats>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<!-- 打包主代码 -->
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.build.outputDirectory}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
<!-- 打包测试代码 -->
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.build.testOutputDirectory}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
<!-- 打包依赖的Jar包 -->
|
||||||
|
<dependencySets>
|
||||||
|
<dependencySet>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<unpack>true</unpack>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependencySet>
|
||||||
|
</dependencySets>
|
||||||
|
</assembly>
|
||||||
21
pom.xml
21
pom.xml
@ -182,22 +182,6 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<addClasspath>true</addClasspath>
|
|
||||||
<classpathPrefix>lib/</classpathPrefix>
|
|
||||||
<mainClass>com.xxx.uploadFile</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
@ -224,9 +208,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>com.Sample.TestDemo</mainClass>
|
<mainClass>sample.TestDemo</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class FunctionTest {
|
|||||||
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||||
|
|
||||||
// 建立链接(单台)
|
// 建立链接(单台)
|
||||||
this.api = (SydApi4j) new SydApi4j().connect("192.168.21.166", 8889, null, 1000);
|
this.api = (SydApi4j) new SydApi4j().connect("192.168.21.166", 8889, null, 5000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,6 @@ import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
|
|||||||
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
|
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
|
||||||
import org.apache.jmeter.samplers.SampleResult;
|
import org.apache.jmeter.samplers.SampleResult;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
public class JmeterTest extends AbstractJavaSamplerClient {
|
public class JmeterTest extends AbstractJavaSamplerClient {
|
||||||
|
|
||||||
@ -18,19 +16,13 @@ public class JmeterTest extends AbstractJavaSamplerClient {
|
|||||||
@Override
|
@Override
|
||||||
public Arguments getDefaultParameters() {
|
public Arguments getDefaultParameters() {
|
||||||
Arguments params = new Arguments();
|
Arguments params = new Arguments();
|
||||||
params.addArgument("publicKeyBase64", "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE...");
|
params.addArgument("function", "sleep");
|
||||||
params.addArgument("plainText", "Hello JMeter");
|
params.addArgument("sleep", "1");
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setupTest(JavaSamplerContext context) {
|
public void setupTest(JavaSamplerContext context) {
|
||||||
// 初始化:将 Base64 参数转为字节数组,避免每个循环都转换
|
|
||||||
String pubBase64 = context.getParameter("publicKeyBase64");
|
|
||||||
String plainText = context.getParameter("plainText");
|
|
||||||
publicKey = Base64.getDecoder().decode(pubBase64);
|
|
||||||
plainData = plainText.getBytes(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
// 校准测试
|
// 校准测试
|
||||||
sleep = context.getIntParameter("sleep", 1);
|
sleep = context.getIntParameter("sleep", 1);
|
||||||
|
|
||||||
@ -57,7 +49,7 @@ public class JmeterTest extends AbstractJavaSamplerClient {
|
|||||||
case "SYD_SM2_Sign":
|
case "SYD_SM2_Sign":
|
||||||
break;
|
break;
|
||||||
case "sleep":
|
case "sleep":
|
||||||
Thread.sleep(1);
|
Thread.sleep( this.sleep );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class SignatureVerifyTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||||
this.api = (SydApi4j) new SydApi4j().connect("192.168.0.100", 8889, null, 1000);
|
this.api = (SydApi4j) new SydApi4j().connect("192.168.21.166", 8889, null, 2000);
|
||||||
this.orgData = "Hello, World! 测试数据".getBytes();
|
this.orgData = "Hello, World! 测试数据".getBytes();
|
||||||
this.SM2dn = "C=CN,ST=北京,L=北京,O=信雅达,CN=172.1.40.188";
|
this.SM2dn = "C=CN,ST=北京,L=北京,O=信雅达,CN=172.1.40.188";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.Sample;
|
package sample;
|
||||||
|
|
||||||
import racal.sunyard.main.SydApi4j;
|
import racal.sunyard.main.SydApi4j;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.sample;
|
package sample;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
@ -1,10 +1,7 @@
|
|||||||
package sample;
|
package sample;
|
||||||
|
|
||||||
import cn.hutool.core.date.StopWatch;
|
import cn.hutool.core.date.StopWatch;
|
||||||
import com.Sample.SydUtils;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.sunyard.RetWrap;
|
|
||||||
import com.sunyard.SydApi;
|
|
||||||
import com.sunyard.SydApiException;
|
import com.sunyard.SydApiException;
|
||||||
import com.sunyard.entity.ImportResult;
|
import com.sunyard.entity.ImportResult;
|
||||||
import com.sunyard.proto.Util;
|
import com.sunyard.proto.Util;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.Sample;
|
package sample;
|
||||||
|
|
||||||
import com.sunyard.RetWrap;
|
import com.sunyard.RetWrap;
|
||||||
import com.sunyard.proto.Util;
|
import com.sunyard.proto.Util;
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package com.jmeter.test;
|
package test;
|
||||||
|
|
||||||
import com.Sample.SydUtils;
|
import sample.SydUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.sunyard.SydApiException;
|
import com.sunyard.SydApiException;
|
||||||
import com.sunyard.entity.ImportResult;
|
import com.sunyard.entity.ImportResult;
|
||||||
Loading…
Reference in New Issue
Block a user