Skip to content

Commit 7c0520a

Browse files
author
hongwei.quhw
committed
add test
1 parent d9961d4 commit 7c0520a

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.alipay.rdf.file.validator;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
6+
import org.junit.After;
7+
import org.junit.Before;
8+
import org.junit.Test;
9+
10+
import com.alipay.rdf.file.interfaces.FileFactory;
11+
import com.alipay.rdf.file.interfaces.FileValidator;
12+
import com.alipay.rdf.file.model.FileConfig;
13+
import com.alipay.rdf.file.model.StorageConfig;
14+
import com.alipay.rdf.file.model.ValidateResult;
15+
import com.alipay.rdf.file.util.TemporaryFolderUtil;
16+
17+
import junit.framework.Assert;
18+
19+
/**
20+
* 验证其test
21+
*
22+
* @author hongwei.quhw
23+
* @version $Id: ProtocolFileValidatorTest.java, v 0.1 2017年8月17日 下午5:30:52 hongwei.quhw Exp $
24+
*/
25+
public class ProtocolFileValidatorTest5 {
26+
TemporaryFolderUtil tf = new TemporaryFolderUtil();
27+
28+
@Before
29+
public void setUp() throws IOException {
30+
tf.create();
31+
}
32+
33+
@Test
34+
public void test() {
35+
String filePath = File.class.getResource("/validator/data/de_all6.txt").getPath();
36+
FileConfig config = new FileConfig(filePath, "/validator/template/de6.json",
37+
new StorageConfig("nas"));
38+
39+
FileValidator fileValidator = FileFactory.createValidator(config);
40+
41+
ValidateResult result = fileValidator.validate();
42+
43+
Assert.assertTrue(result.isSuccess());
44+
System.out.println(result.getErrorMsg());
45+
}
46+
47+
@After
48+
public void after() {
49+
tf.delete();
50+
}
51+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
300.03
2+
seq_0|inst_seq_0|2013-11-09 12:34:56|20131109|20131112 12:23:34|23.33|10.22|22|12345|true|备注1
3+
seq_1|inst_seq_1|2013-11-10 15:56:12|20131110|20131113 12:33:34|23.34|11.88|33|56789|false|
4+
OFDCFEND|20131109|100
5+
6+
7+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"head":[
3+
"totalAmount|总金额|BigDecimal|Required"
4+
],
5+
"body":[
6+
"seq|流水号",
7+
"instSeq|基金公司订单号|Required",
8+
"gmtApply|订单申请时间|Date:yyyy-MM-dd HH:mm:ss",
9+
"date|普通日期|Date:yyyyMMdd",
10+
"dateTime|普通日期时间|Date:yyyyMMdd HH:mm:ss",
11+
"applyNumber|普通数字|BigDecimal",
12+
"amount|金额|BigDecimal",
13+
"age|年龄|Integer",
14+
"longN|长整型|Long",
15+
"bol|布尔值|Boolean",
16+
"memo|备注"
17+
],
18+
"tail": [
19+
"fileEnd|数据文件尾部字符",
20+
"date|普通日期|Date:yyyyMMdd",
21+
"amount|总金额|BigDecimal"
22+
],
23+
"protocol":"SP"
24+
}
25+

0 commit comments

Comments
 (0)