测试文件修改

This commit is contained in:
junj2.liang
2022-09-05 10:25:36 +08:00
parent f77b5daa93
commit 602781686b
5 changed files with 141 additions and 11 deletions
@@ -17,6 +17,9 @@ public class BytesQueue {
private int index = 0;
// 维护实时长度
private int length = 0;
public int getLength() {
return length;
}
/**
* 尾部添加
@@ -27,13 +27,13 @@ public class LogFactory {
public static final String logName = "sge-hsm-sydapi-log";
// 日志级别
public static int iLogLevel = Consts.LogLevelOFF;
public static int iLogLevel = Consts.LogLevelOFF;
// Levels
public static final Level[] levels = new Level[]{ Level.OFF, Level.ERROR, Level.INFO, Level.DEBUG };
private static final Level[] levels = new Level[]{ Level.OFF, Level.ERROR, Level.INFO, Level.DEBUG };
// 日志目录
public static String pcLogPath = "./sydapi-logs/";
private static String pcLogPath = "./sydapi-logs/";
// // 日期格式
// private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+19
View File
@@ -0,0 +1,19 @@
package test;
import java.nio.ByteBuffer;
public class ByteBuffTest {
public static void main(String[] args) {
ByteBuffer bb = ByteBuffer.allocate(1024);
bb.put( new byte[16] );
bb.flip();
ByteBuffer b2 = ByteBuffer.allocate(1024);
b2.put( bb );
System.out.println( b2.position() );
}
}
+8 -8
View File
@@ -1,9 +1,7 @@
package test;
import com.sunyard.sge.database.Consts;
import com.sunyard.sge.database.SydApi;
import com.sunyard.sge.database.SydApi4Database;
import com.sunyard.sge.database.SydApiBuilder;
import com.sunyard.proto.Util;
import com.sunyard.sge.database.*;
import com.sunyard.sge.database.pool.HsmLinkInfo;
import com.sunyard.sge.database.pool.SydApiPool;
import com.sunyard.sge.log.LogFactory;
@@ -11,6 +9,7 @@ import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
@@ -29,7 +28,7 @@ public class FuncTest {
@Test
public void syd_Short_Connect_Ex(){
String[] pcipList = {"127.0.0.1", "192.168.0.200" };
String[] pcipList = {"127.0.0.1", "192.168.0.100" };
int[] iportList ={8080,8889};
SydApi api = new SydApi4Database();
try {
@@ -52,6 +51,7 @@ public class FuncTest {
);
api = builder.build();
}
@@ -77,14 +77,14 @@ public class FuncTest {
public void originShort() throws Exception {
SydApi.SYD_SetLogConfig("./logs/",3);
Logger log = LogFactory.getLogger();
String[] pcipList = {"192.168.0.200", "192.168.0.200", "192.168.0.200" };
int[] iportList ={8080,8889,8889};
String[] pcipList = {"192.168.0.100", "192.168.0.100", "192.168.0.100","192.168.0.100" };
int[] iportList ={8080,8889,8889,8889};
for (int i = 0; i < 1000; i++) {
int tmp = i;
new Thread(() -> {
SydApi api = new SydApi4Database();
try {
SydApi api = new SydApi4Database();
for (int j = 0; j < 20; j++) {
api.SYD_Short_Connect_Ex(pcipList,iportList,10,15);
byte[] bytes = api.SYD_SM4_ShortData(0, (tmp + "t" + j).getBytes(), Consts.ECB_ENC);