Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jiaqi.xu
2022-09-20 14:45:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6a93db5fae24a5a7c3488910fef3197f5c09f41
c6a93db5
1 parent
092771b5
Merge branch 'master' of E:\iClear-api with conflicts.
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
4 deletions
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
src/test/java/com/erry/iclear/dateInterface/IClearApiApplicationTests.java
src/test/java/com/erry/iclear/dateInterface/IClearCheckTest.java
src/test/java/com/erry/iclear/dateInterface/TokenTest.java
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
View file @
c6a93db
This diff is collapsed. Click to expand it.
src/test/java/com/erry/iclear/dateInterface/IClearApiApplicationTests.java
View file @
c6a93db
package
com
.
erry
.
iclear
.
dateInterface
;
import
com.alibaba.fastjson.JSONObject
;
import
com.arronlong.httpclientutil.HttpClientUtil
;
import
com.arronlong.httpclientutil.builder.HCB
;
import
com.arronlong.httpclientutil.common.HttpConfig
;
import
com.arronlong.httpclientutil.common.HttpHeader
;
import
com.arronlong.httpclientutil.common.SSLs
;
import
com.arronlong.httpclientutil.exception.HttpProcessException
;
import
com.erry.iclear.dateInterface.api.request.ConsignmentCode
;
import
com.erry.iclear.dateInterface.util.SHA256Util
;
import
com.google.gson.Gson
;
import
org.apache.http.Header
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -7,14 +19,74 @@ import org.springframework.test.context.ActiveProfiles;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.util.*
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@WebAppConfiguration
@ActiveProfiles
(
"dev"
)
class
IClearApiApplicationTests
{
@Test
public
void
contextLoads
()
{
public
static
void
main
(
String
[]
args
)
throws
HttpProcessException
{
Gson
gson
=
new
Gson
();
String
str
=
"{\"consignmentCode\":\""
+
"201907105,"
+
"202018092,"
+
"202108026,"
+
"192770847591,"
+
"201907099,"
+
"202017062,"
+
"770194186721,"
+
"201907109,"
+
"201907092,"
+
"201907096,"
+
"201907103,"
+
"201907093,"
+
"774439601,"
+
"774439602,"
+
"201907097,"
+
"281382086345,"
+
"202108100,"
+
"192770847477,"
+
"192770847478,"
+
"149148215190\"}"
;
// String str = "{\"consignmentCode\":\"110000011\"}";
String
timeStamp
=
"1634697153697"
;
//String timeStamp = "1624263798669";
System
.
out
.
println
(
new
Date
(
Long
.
valueOf
(
timeStamp
)));
//String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + "b92131f03f19a348" + timeStamp);
String
token
=
SHA256Util
.
getSHA256String
(
"BASF"
+
"iClearExportC"
+
"6db193cb4165a71b"
+
timeStamp
);
System
.
out
.
println
(
token
);
Header
[]
headers
=
HttpHeader
.
custom
()
.
other
(
"Content-Type"
,
"application/json"
)
.
other
(
"Appid"
,
"BASF"
)
.
other
(
"appKey"
,
"iClearExportC"
)
.
other
(
"TimeStamp"
,
timeStamp
)
.
other
(
"token"
,
"2D9F60B9ACE7A559CF1C21F34D543522F3520C7FF0F4A94FEC5A9700BC8589B8"
)
.
build
();
HCB
hcb
=
HCB
.
custom
()
.
timeout
(
20000
)
.
pool
(
100
,
10
)
.
sslpv
(
SSLs
.
SSLProtocolVersion
.
TLSv1_2
)
.
ssl
()
.
retry
(
3
);
//String url = "https://40.73.78.157:8780/customs/sendMawb";
String
url
=
"https://40.73.78.157:8780/basf/selectDecListBasf"
;
//String url = "https://40.73.78.157:8780/basf/selectChmListBasf";
HttpConfig
config
=
HttpConfig
.
custom
()
.
headers
(
headers
)
.
url
(
url
)
.
encoding
(
"utf-8"
)
.
client
(
hcb
.
build
())
// .json(new Gson().toJson(createMawb()));
.
json
(
str
);
System
.
out
.
println
(
HttpClientUtil
.
post
(
config
));
}
}
...
...
src/test/java/com/erry/iclear/dateInterface/IClearCheckTest.java
View file @
c6a93db
This diff is collapsed. Click to expand it.
src/test/java/com/erry/iclear/dateInterface/TokenTest.java
View file @
c6a93db
...
...
@@ -7,6 +7,8 @@ import com.erry.iclear.dateInterface.util.HttpUtils;
import
com.erry.iclear.dateInterface.util.JsonToJava
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Value
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -50,7 +52,7 @@ public class TokenTest extends IClearApiApplicationTests {
System
.
out
.
println
(
rs
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/*
public static void main(String[] args) throws Exception{
String url = "https://apictm.iclrccd-fedex.com/login";
Map<String,String> map = new HashMap<String,String>();
map.put("username", "iclear_export_prod");
...
...
@@ -66,7 +68,9 @@ public class TokenTest extends IClearApiApplicationTests {
map.put("token","eyJhbGciOiJSUzI1NiJ9.eyJleHBpcmVBdCI6MTY0Njg4MDc3NzY0NSwidXNlcklkIjoiaWNsZWFyX2V4cG9ydF9wcm9kIn0.fey8YVWL0wcxvCUMQR-ePyCXIh9AdoztIixtcYgGjtaUCxO3VVf9Jmut3ZVVelxigvTDzv-Iz097R2fgBSOBzStICTZGqxmRV7Av6R41HCTTQ8BL6aSPle2QszSkTt5T95cYiFYSv9CHmxSKBU_MrJk5WhCJb5XOAmWmdV94McFWTBi1oTIjVfgiczu0pzgA1berR1lfUIEDVEUxUoduVARzwUcDDljq0pf-rPhpAj-Iqbhc4fint4Th-BlO6Rg4ZWYB08-3Id9krl92TMJJ_rXMrhbna6833r8PcpdbXIFPkuopbrv9GL1Ds_vWL7Sd5BTSYtMRn2ku0GhAP6GNPg");
String rs = httpUtils.doPost(url,map);
System.out.println(rs);
}
}
*/
private
static
HttpUtils
httpUtils
=
new
HttpUtils
();
}
...
...
Please
register
or
login
to post a comment