-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hongwei.quhw
committed
Sep 18, 2019
1 parent
d5729fb
commit 12afc0f
Showing
9 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
rdf-file-oss/src/test/java/com/alipay/rdf/file/reader/BodyEmptyReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.alipay.rdf.file.reader; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.alipay.rdf.file.interfaces.FileFactory; | ||
import com.alipay.rdf.file.interfaces.FileReader; | ||
import com.alipay.rdf.file.interfaces.FileStorage; | ||
import com.alipay.rdf.file.model.FileConfig; | ||
import com.alipay.rdf.file.model.StorageConfig; | ||
import com.alipay.rdf.file.storage.OssConfig; | ||
import com.alipay.rdf.file.util.OssTestUtil; | ||
import com.alipay.rdf.file.util.RdfFileUtil; | ||
import com.alipay.rdf.file.util.TemporaryFolderUtil; | ||
|
||
import junit.framework.Assert; | ||
|
||
public class BodyEmptyReader { | ||
private TemporaryFolderUtil temporaryFolder = new TemporaryFolderUtil(); | ||
private static final StorageConfig storageConfig = OssTestUtil.geStorageConfig(); | ||
private static String ossPathPrifx = "rdf/rdf-file/open/BodyEmptyReader"; | ||
private static FileStorage fileStorage = FileFactory.createStorage(storageConfig); | ||
private OssConfig ossConfig; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
temporaryFolder.create(); | ||
ossConfig = (OssConfig) storageConfig.getParam(OssConfig.OSS_STORAGE_CONFIG_KEY); | ||
ossConfig.setOssTempRoot(temporaryFolder.getRoot().getAbsolutePath()); | ||
System.out.println(temporaryFolder.getRoot().getAbsolutePath()); | ||
} | ||
|
||
@Test | ||
public void testRead() { | ||
String ossFilePath = RdfFileUtil.combinePath(ossPathPrifx, "test.txt"); | ||
fileStorage.upload(File.class.getResource("/reader/test.txt").getPath(), ossFilePath, true); | ||
|
||
FileConfig normalConfig = new FileConfig(ossFilePath, "/reader/template_Allocation.json", | ||
storageConfig); | ||
FileReader reader = FileFactory.createReader(normalConfig); | ||
|
||
Map<String, Object> row = null; | ||
while (null != (row = reader.readRow(HashMap.class))) { | ||
|
||
} | ||
|
||
Assert.assertNull(row); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
rdf-file-oss/src/test/resources/reader/template_Allocation.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"head": [ | ||
"totalCount|总笔数|Integer", | ||
"totalAmount|总金额|BigDecimal" | ||
], | ||
"body": [ | ||
"orderNo|流水号", | ||
"orderNo|支付宝订单号", | ||
"appSheetNo|基金公司订单号", | ||
"transInAmount|支付金额|BigDecimal", | ||
"tradeType|订单类型", | ||
"paymentStatus|支付状态", | ||
"payTime|创建日期|Date:yyyyMMdd HH:mm:ss", | ||
"memo|备注" | ||
], | ||
"totalCountKey": "totalCount", | ||
"summaryColumnPairs": [ | ||
"totalAmount|transInAmount" | ||
], | ||
"protocol":"DE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
总笔数:0|总金额:0.00 | ||
流水号|支付宝订单号|基金公司订单号|支付金额|订单类型|支付状态|创建日期|备注 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters