This commit is contained in:
junj2.liang
2022-08-08 18:10:48 +08:00
parent 6949bd4b21
commit 6ad20cd905
7 changed files with 106 additions and 19 deletions
+25
View File
@@ -0,0 +1,25 @@
package sample;
import com.sunyard.sge.database.SydApi;
import com.sunyard.sge.database.SydApi4Database;
public class ShortLinkSample {
public static void main(String[] args) {
// 路径要以 / 或 \\ 结尾表示目录
SydApi.SYD_SetLogConfig("./logs/",3);
String[] pcipList = {"127.0.0.1", "192.168.0.200" };
int[] iportList ={8080,8889};
SydApi api = new SydApi4Database();
try {
api.SYD_Short_Connect_Ex(pcipList,iportList,10,10);
} finally {
if ( null != api ) {
api.SYD_Disconnect_Ex();
}
}
}
}
+38
View File
@@ -1,9 +1,13 @@
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.sge.database.pool.HsmLinkInfo;
import com.sunyard.sge.database.pool.SydApiPool;
import com.sunyard.sge.log.LogFactory;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
@@ -23,6 +27,21 @@ public class FuncTest {
}
@Test
public void syd_Short_Connect_Ex(){
String[] pcipList = {"127.0.0.1", "192.168.0.200" };
int[] iportList ={8080,8889};
SydApi api = new SydApi4Database();
try {
api.SYD_Short_Connect_Ex(pcipList,iportList,10,10);
} finally {
if ( null != api ) {
api.SYD_Disconnect_Ex();
}
}
}
@Test
public void sm3(){
SydApiBuilder builder = new SydApiBuilder(
@@ -35,4 +54,23 @@ public class FuncTest {
api = builder.build();
}
@Test
public void origin() throws Exception {
SydApiBuilder builder = new SydApiBuilder(new String[]{"192.168.0.200"}, new int[]{8889}, 10, 15);
SydApi.SYD_SetLogConfig("./logs/",3);
Logger log = LogFactory.getLogger();
final SydApi api = builder.build();
for (int i = 0; i < 1000; i++) {
int tmp = i;
new Thread(() -> {
for (int j = 0; j < 20; j++) {
byte[] bytes = api.SYD_SM4_ShortData(0, (tmp + "t" + j).getBytes(), Consts.ECB_ENC);
byte[] result = api.SYD_SM4_ShortData(0, bytes, Consts.ECB_DEC);
System.out.println(Thread.currentThread().getName() + "," + new String(result));
}
}, i + "t").start();
}
}
}
+1
View File
@@ -14,5 +14,6 @@ public class LogTest {
log.error("error");
log.info("info");
log.debug("debug");
System.out.println(new byte[0].length);
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ public class PrefTest
final SydApi api = new SydApi4Database();
try {
api.SYD_Connect_Ex(
api.SYD_Short_Connect_Ex(
new String[]{ "192.168.0.200" },
new int[]{ 8889 },
10,