Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
686bf764
Commit
686bf764
authored
Aug 20, 2024
by
jianglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
国结代码修改:移动测试方法到junit
parent
9dfad951
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
48 deletions
+41
-48
Element2MxForSSTF.java
...va/com/brilliance/swift/element2mx/Element2MxForSSTF.java
+0
-33
Mx2ElementForSSTF.java
...va/com/brilliance/swift/mx2element/Mx2ElementForSSTF.java
+0
-15
Element2MxTest.java
swiftCore/src/test/java/com/brilliance/Element2MxTest.java
+31
-0
Mx2ElementTest.java
swiftCore/src/test/java/com/brilliance/Mx2ElementTest.java
+10
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/element2mx/Element2MxForSSTF.java
View file @
686bf764
...
@@ -36,8 +36,6 @@ import java.util.regex.Pattern;
...
@@ -36,8 +36,6 @@ import java.util.regex.Pattern;
public
class
Element2MxForSSTF
{
public
class
Element2MxForSSTF
{
//测试要素报文
private
static
String
MSG_FILE
;
//xml报文临时目录
//xml报文临时目录
private
static
String
TEMPLATE_DIR
;
private
static
String
TEMPLATE_DIR
;
//存放env.yml
//存放env.yml
...
@@ -61,8 +59,6 @@ public class Element2MxForSSTF {
...
@@ -61,8 +59,6 @@ public class Element2MxForSSTF {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Element2MxForSSTF
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Element2MxForSSTF
.
class
);
static
{
static
{
MSG_FILE
=
"D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\0820\\snd_txt\\36350871-pacs009cov.txt"
;
if
(
StrUtil
.
isNotEmpty
(
System
.
getenv
(
"TD2HOME"
))){
if
(
StrUtil
.
isNotEmpty
(
System
.
getenv
(
"TD2HOME"
))){
TEMPLATE_DIR
=
System
.
getenv
(
"TD2HOME"
)+
File
.
separator
+
"tmp"
;
TEMPLATE_DIR
=
System
.
getenv
(
"TD2HOME"
)+
File
.
separator
+
"tmp"
;
}
else
{
}
else
{
...
@@ -72,35 +68,6 @@ public class Element2MxForSSTF {
...
@@ -72,35 +68,6 @@ public class Element2MxForSSTF {
getEnvMap
();
getEnvMap
();
}
}
/**
@Test
private void test1() throws Exception {
String mx=FileUtil.readString("D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\test.xml" ,StandardCharsets.UTF_8);
xmlFieldMap=new HashMap<>();
xmlFieldMap.put("t","t");
mx=addXmlField(mx,"pacs00800108",xmlFieldMap);
Map<String, Object> rtnMap = mt2MxWithFile(MSG_FILE);
rtnMap.forEach((key, value) -> {
System.out.println(key);
System.out.println(value);
});
}
*/
/**
* 测试方法:使用模拟的要素报文文件(TD产生)转换为xml报文
* 接口调用:直接调用mt2Mx(orgMsg)
*/
@Test
public
void
test
()
throws
Exception
{
Map
<
String
,
Object
>
rtnMap
=
mt2MxWithFile
(
MSG_FILE
);
rtnMap
.
forEach
((
key
,
value
)
->
{
System
.
out
.
println
(
key
);
System
.
out
.
println
(
value
);
});
}
/*
/*
功能:传入要素报文文件,返回结果,功能同mt2Mx()方法
功能:传入要素报文文件,返回结果,功能同mt2Mx()方法
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2element/Mx2ElementForSSTF.java
View file @
686bf764
...
@@ -30,8 +30,6 @@ import java.time.format.DateTimeFormatter;
...
@@ -30,8 +30,6 @@ import java.time.format.DateTimeFormatter;
import
java.util.*
;
import
java.util.*
;
public
class
Mx2ElementForSSTF
{
public
class
Mx2ElementForSSTF
{
//xml文件所在的目录
private
static
final
String
XML_FILE
;
//txt落地文件所在的目录
//txt落地文件所在的目录
private
static
String
TEMPLATE_DIR
;
private
static
String
TEMPLATE_DIR
;
//存放env.yml
//存放env.yml
...
@@ -51,8 +49,6 @@ public class Mx2ElementForSSTF {
...
@@ -51,8 +49,6 @@ public class Mx2ElementForSSTF {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Element2MxForSSTF
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Element2MxForSSTF
.
class
);
static
{
static
{
XML_FILE
=
"D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\ack.xml"
;
if
(
StrUtil
.
isNotEmpty
(
System
.
getenv
(
"TD2HOME"
))){
if
(
StrUtil
.
isNotEmpty
(
System
.
getenv
(
"TD2HOME"
))){
TEMPLATE_DIR
=
System
.
getenv
(
"TD2HOME"
)+
File
.
separator
+
"tmp"
;
TEMPLATE_DIR
=
System
.
getenv
(
"TD2HOME"
)+
File
.
separator
+
"tmp"
;
}
else
{
}
else
{
...
@@ -61,17 +57,6 @@ public class Mx2ElementForSSTF {
...
@@ -61,17 +57,6 @@ public class Mx2ElementForSSTF {
getEnvMap
();
getEnvMap
();
}
}
//测试方法
@Test
public
void
test
()
throws
Exception
{
Map
<
String
,
Object
>
resMap
=
mx2MtWithFile
(
XML_FILE
);
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
resMap
.
entrySet
())
{
System
.
out
.
println
(
entry
.
getKey
()
+
entry
.
getValue
().
toString
());
}
}
public
static
Map
<
String
,
Object
>
mx2MtWithFile
(
String
xmlFileNm
)
{
public
static
Map
<
String
,
Object
>
mx2MtWithFile
(
String
xmlFileNm
)
{
FileReader
fileReader
=
new
FileReader
(
xmlFileNm
);
FileReader
fileReader
=
new
FileReader
(
xmlFileNm
);
...
...
swiftCore/src/test/java/com/brilliance/Element2MxTest.java
View file @
686bf764
...
@@ -16,9 +16,40 @@ import java.util.List;
...
@@ -16,9 +16,40 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
com.brilliance.swift.element2mx.Element2MxForSSTF
;
public
class
Element2MxTest
{
public
class
Element2MxTest
{
/**
@Test
private void test1() throws Exception {
String mx=FileUtil.readString("D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\test.xml" ,StandardCharsets.UTF_8);
xmlFieldMap=new HashMap<>();
xmlFieldMap.put("t","t");
mx=addXmlField(mx,"pacs00800108",xmlFieldMap);
Map<String, Object> rtnMap = mt2MxWithFile(MSG_FILE);
rtnMap.forEach((key, value) -> {
System.out.println(key);
System.out.println(value);
});
}
*/
/**
* 测试方法:使用模拟的要素报文文件(TD产生)转换为xml报文
* 接口调用:直接调用mt2Mx(orgMsg)
*/
@Test
public
void
element2MxForSSTF
()
throws
Exception
{
String
MSG_FILE
=
"D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\0820\\snd_txt\\36350871-pacs009cov.txt"
;
Map
<
String
,
Object
>
rtnMap
=
Element2MxForSSTF
.
mt2MxWithFile
(
MSG_FILE
);
rtnMap
.
forEach
((
key
,
value
)
->
{
System
.
out
.
println
(
key
);
System
.
out
.
println
(
value
);
});
}
@Test
@Test
public
void
testElement2Pacs00800108
()
throws
IOException
,
ParseException
,
DatatypeConfigurationException
{
public
void
testElement2Pacs00800108
()
throws
IOException
,
ParseException
,
DatatypeConfigurationException
{
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxCamt05300108_950.xml"));
...
...
swiftCore/src/test/java/com/brilliance/Mx2ElementTest.java
View file @
686bf764
...
@@ -8,10 +8,20 @@ import java.io.File;
...
@@ -8,10 +8,20 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.util.Map
;
import
java.util.Map
;
import
com.brilliance.swift.mx2element.Mx2ElementForSSTF
;
public
class
Mx2ElementTest
{
public
class
Mx2ElementTest
{
@Test
@Test
public
void
mx2ElementForSSTF
()
throws
Exception
{
String
XML_FILE
=
"D:\\WorkArea\\Repositories_git\\swiftMx2Mt-sstf\\swiftCore\\src\\main\\resources\\temp\\ack.xml"
;
Map
<
String
,
Object
>
resMap
=
Mx2ElementForSSTF
.
mx2MtWithFile
(
XML_FILE
);
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
resMap
.
entrySet
())
{
System
.
out
.
println
(
entry
.
getKey
()
+
entry
.
getValue
().
toString
());
}
}
@Test
public
void
testPacs008001
()
{
public
void
testPacs008001
()
{
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/MxPacs00800108.xml"
));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/MxPacs00800108.xml"
));
String
elementStr
=
SwiftTransfer
.
mx2Element
(
file
);
String
elementStr
=
SwiftTransfer
.
mx2Element
(
file
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment