BeihuoTests.java
5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package com.sy;
import com.sy.bwAnalysis.AnalysisRoute;
import com.sy.logic.LiftBar;
import com.sy.utils.XMLThreadPoolFactory;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BeihuoTests {
private static final Logger logger = Logger.getLogger(LiftBar.class);
private static ThreadPoolExecutor threadPoolEs = XMLThreadPoolFactory.instance("kakou");
private AnalysisRoute analysisRoute=new AnalysisRoute();
//车牌号
private String voNo = "豫A61CR7";
//备案重量
private String vo_weight = "2000";
//过卡重量
private String cross_weight= "2324";
//场站编号
private String areaID = "4604600000";
//通道编号
private String chnlNo = "4604601010";
//进出场类型I/E
private String ie = "I";
//二维码
private String barcode = "613f5c";
//进通道报文
private static String IMPORT_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<MSG>\n" +
"\t<META>\n" +
"\t\t<SNDR>KAO</SNDR>\n" +
"\t\t<RCVR/>\n" +
"\t\t<SEQN>20220624063157</SEQN>\n" +
"\t\t<DDTM>20220624063157</DDTM>\n" +
"\t\t<TYPE>KAKO</TYPE>\n" +
"\t\t<STYP>CARM</STYP>\n" +
"\t</META>\n" +
"\t<GATHER_INFO AREA_ID=\"${areaID}\" CHNL_NO=\"${chnlNo}\" I_E_TYPE=\"${IETYPE}\" SEQ_NO=\"20220624063118000004\">\n" +
"\t\t<IC>\n" +
"\t\t\t<DR_IC_NO/>\n" +
"\t\t\t<IC_DR_CUSTOMS_NO/>\n" +
"\t\t\t<IC_CO_CUSTOMS_NO/>\n" +
"\t\t\t<IC_BILL_NO/>\n" +
"\t\t\t<IC_FORM_TYPE/>\n" +
"\t\t\t<IC_GROSS_WT/>\n" +
"\t\t\t<IC_VE_CUSTOMS_NO/>\n" +
"\t\t\t<IC_VE_NAME/>\n" +
"\t\t\t<IC_CONTA_ID/>\n" +
"\t\t\t<IC_ESEAL_ID/>\n" +
"\t\t\t<IC_REG_DATETIME/>\n" +
"\t\t\t<IC_PER_DAY_DUE/>\n" +
"\t\t\t<GPS_ID/>\n" +
"\t\t</IC>\n" +
"\t\t<WEIGHT>\n" +
"\t\t\t<GROSS_WT>${cross_weight}</GROSS_WT>\n" +
"\t\t</WEIGHT>\n" +
"\t\t<CAR>\n" +
"\t\t\t<VE_NAME>${car}</VE_NAME>\n" +
"\t\t\t<CAR_EC_NO/>\n" +
"\t\t\t<CAR_EC_NO2/>\n" +
"\t\t\t<VE_CUSTOMS_NO/>\n" +
"\t\t\t<VE_WT/>\n" +
"\t\t</CAR>\n" +
"\t\t<CONTA>\n" +
"\t\t\t<CONTA_NUM/>\n" +
"\t\t\t<CONTA_RECO>1</CONTA_RECO>\n" +
"\t\t\t<CONTA_ID_F/>\n" +
"\t\t\t<CONTA_ID_B/>\n" +
"\t\t\t<CONTA_MODEL_F/>\n" +
"\t\t\t<CONTA_MODEL_B/>\n" +
"\t\t</CONTA>\n" +
"\t\t<ORDER_NUM/>\n" +
"\t\t<BAR_CODE>${barcode}</BAR_CODE>\n" +
"\t\t<SEAL>\n" +
"\t\t\t<ESEAL_ID/>\n" +
"\t\t\t<SEAL_KEY/>\n" +
"\t\t</SEAL>\n" +
"\t</GATHER_INFO>\n" +
"</MSG>";
/**
* 出口送货_进场测试
*/
@Test
public void exportDownload_I(){
logger.error("开始进场测试");
IMPORT_XML= IMPORT_XML.replace("${car}",voNo)
.replace("${cross_weight}",cross_weight)
.replace("${areaID}",areaID)
.replace("${chnlNo}",chnlNo)
.replace("${IETYPE}",ie)
.replace("${barcode}",barcode);
//进港提货测试
analysisRoute.setMessage(IMPORT_XML);
}
/**
* 出口送货_出场测试
*/
@Test
public void exportDownload_E(){
//车牌号
String voNo = "豫A61CR7";
//备案重量
String vo_weight = "2000";
//过卡重量
String cross_weight= "2324";
//场站编号
String areaID = "4604600000";
//通道编号
String chnlNo = "4604600011";
//进出场类型I/E
String ie = "E";
//二维码
String barcode = "613f5c";
logger.error("开始出口送货离场测试");
IMPORT_XML= IMPORT_XML.replace("${car}",voNo)
.replace("${cross_weight}",cross_weight)
.replace("${areaID}",areaID)
.replace("${chnlNo}",chnlNo)
.replace("${IETYPE}",ie)
.replace("${barcode}",barcode);
//进港提货测试
analysisRoute.setMessage(IMPORT_XML);
threadPoolEs.execute(analysisRoute);
System.out.println("[THREAD-INFI]-线程运行线程总数量 = " + threadPoolEs.getActiveCount());
System.out.println("[THREAD-INFI]-线程队列数量 = " + threadPoolEs.getQueue().size());
System.out.println("threadPoolEs.getCompletedTaskCount() = " + threadPoolEs.getCompletedTaskCount());
System.out.println("threadPoolEs.getKeepAliveTime(TimeUnit.SECONDS) = " + threadPoolEs.getKeepAliveTime(TimeUnit.SECONDS));
System.out.println("threadPoolEs.getTaskCount() = " + threadPoolEs.getTaskCount());
}
}