Download
Magazine
Develop
Account
Download
Magazine
Develop
Login
Forgot Account/Password
Create Account
Language
Help
Language
Help
×
Login
Login Name
Password
×
Forgot Account/Password
Category:
Software
People
PersonalForge
Magazine
Wiki
Search
OSDN
>
Find Software
>
System
>
TERASOLUNA Framework
>
Forums
>
Open Discussion
>
【バッチFW】単体テストでのファイル内容の取得方法について
TERASOLUNA Framework
Description
Project Summary
Developer Dashboard
Web Page
Developers
Image Gallery
List of RSS Feeds
Activity
Statistics
History
Downloads
List of Releases
Stats
Source Code
Code Repository list
Subversion
View Repository
Ticket
Ticket List
Milestone List
Type List
Component List
List of frequently used tickets/RSS
Submit New Ticket
Documents
Wiki
FrontPage
Title index
Recent changes
Doc Mgr
List Docs
Communication
Forums
List of Forums
Open Discussion (1277)
Mailing Lists
list of ML
terasoluna-information
News
Forums:
Open Discussion
(Thread #24296)
Return to Thread list
RSS
【バッチFW】単体テストでのファイル内容の取得方法について (2009-10-20 15:17 by
Anonymous
#46554)
Reply
Create ticket
お世話になります。
単体テストを行っているのですが、単体テストクラスから、ファイルの情報を取得するにはどうすればよろしいのでしょうか。
http://sourceforge.jp/forum/message.php?msg_id=41385
を参照に通常のDBの値などは設定ファイル等に設定しqueryDAO等からexecuteForList等から情報を取得できるんですが。。。。
●要約すると、単体テストクラスからFixedFileQueryDAO(固定長ファイル形式)のDAOを使用して行数分値をデータを取得したいのですが、どうすればいいかわかりません。
下記、単体テストクラスからしたいことのサンプル
------------------------------------------
FileLineIterator<TelegramDto> fileLineIterator = fixedFileQueryDAO.execute(inputFileName, TelegramDto.class);
// 繰り返し
while(fileLineIterator.hasNext()) {
...test logic execute
}
------------------------------------------
どうぞよろしくお願い致します。
Reply to #46554
×
Subject
Body
Reply To Message #46554 > お世話になります。 > > 単体テストを行っているのですが、単体テストクラスから、ファイルの情報を取得するにはどうすればよろしいのでしょうか。 > > http://sourceforge.jp/forum/message.php?msg_id=41385 > > を参照に通常のDBの値などは設定ファイル等に設定しqueryDAO等からexecuteForList等から情報を取得できるんですが。。。。 > > ●要約すると、単体テストクラスからFixedFileQueryDAO(固定長ファイル形式)のDAOを使用して行数分値をデータを取得したいのですが、どうすればいいかわかりません。 > > 下記、単体テストクラスからしたいことのサンプル > ------------------------------------------ > > FileLineIterator<TelegramDto> fileLineIterator = fixedFileQueryDAO.execute(inputFileName, TelegramDto.class); > > // 繰り返し > while(fileLineIterator.hasNext()) { > > ...test logic execute > > } > ------------------------------------------ > > どうぞよろしくお願い致します。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: 【バッチFW】単体テストでのファイル内容の取得方法について (2009-10-20 17:49 by
taromaru
#46557)
Reply
Create ticket
http://sourceforge.jp/forum/message.php?msg_id=41385
が出来たのであれば、
fixedFileQueryDAOを使用するのに必要な定義
・Bean定義
・テストクラスのフィールドとsetter
を追加すれば動作すると思います。
(ただし未検証です。)
1. /batchapps/template/FileAccessBean.xmlを追加で取り込む。
@Override
protected String[] doGetConfigLocations() {
return new String[] {"/dao-test.xml"};
↓
return new String[] {"/dao-test.xml", "/template/FileAccessBean.xml"};
}
※「/batchapps」はソースフォルダの名前なので、クラスパス上は現れません。
2. テストクラスにフィールドとsetterを追加する。
private FixedFileQueryDAO fixedFileQueryDAO = null;
public void setFixedFileQueryDAO(FixedFileQueryDAO fixedFileQueryDAO){
this.fixedFileQueryDAO = fixedFileQueryDAO;
}
※このsetterの名前によって、bean定義された"fixedFileQueryDAO"がインジェクションされます。
大文字小文字を間違うとインジェクションされないので注意してください。
Reply to
#46554
Reply to #46557
×
Subject
Body
Reply To Message #46557 > http://sourceforge.jp/forum/message.php?msg_id=41385 > が出来たのであれば、 > fixedFileQueryDAOを使用するのに必要な定義 > ・Bean定義 > ・テストクラスのフィールドとsetter > を追加すれば動作すると思います。 > (ただし未検証です。) > > 1. /batchapps/template/FileAccessBean.xmlを追加で取り込む。 > > @Override > protected String[] doGetConfigLocations() { > return new String[] {"/dao-test.xml"}; > ↓ > return new String[] {"/dao-test.xml", "/template/FileAccessBean.xml"}; > } > ※「/batchapps」はソースフォルダの名前なので、クラスパス上は現れません。 > > > 2. テストクラスにフィールドとsetterを追加する。 > > private FixedFileQueryDAO fixedFileQueryDAO = null; > public void setFixedFileQueryDAO(FixedFileQueryDAO fixedFileQueryDAO){ > this.fixedFileQueryDAO = fixedFileQueryDAO; > } > ※このsetterの名前によって、bean定義された"fixedFileQueryDAO"がインジェクションされます。 > 大文字小文字を間違うとインジェクションされないので注意してください。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: 【バッチFW】単体テストでのファイル内容の取得方法について (2009-10-20 21:31 by
Anonymous
#46562)
Reply
Create ticket
早速のご回答ありがとうございます。
上記の通りしただけで、上手くできました。
>return new String[] {"/dao-test.xml", "/template/FileAccessBean.xml"};
このように設定すればよかったんですね。
本当にありがとうございました。
また何かありましたら、よろしくお願い致します。
Reply to
#46554
Reply to #46562
×
Subject
Body
Reply To Message #46562 > 早速のご回答ありがとうございます。 > > 上記の通りしただけで、上手くできました。 > > >return new String[] {"/dao-test.xml", "/template/FileAccessBean.xml"}; > > このように設定すればよかったんですね。 > > 本当にありがとうございました。 > > また何かありましたら、よろしくお願い致します。 > >
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel