Skip to content

Commit

Permalink
writeLogを非staticメソッドに変更 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
siosio authored and kiyohome committed Mar 15, 2017
1 parent 50996a2 commit b4df262
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = 'com.nablarch.framework'
version = '1.2.0'
version = '1.2.1'
description = 'バッチ処理方式を実現する'

buildscript {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public synchronized SqlRow read(ExecutionContext ctx) {
* @param inputDataIdentifier 要求識別情報
*/
@Published
protected static void writeLog(InputDataIdentifier inputDataIdentifier) {
protected void writeLog(InputDataIdentifier inputDataIdentifier) {
LOGGER.logInfo("read database record. key info: " + inputDataIdentifier);
}

Expand Down
25 changes: 25 additions & 0 deletions src/test/java/nablarch/fw/reader/DatabaseTableQueueReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,31 @@ public void writeInfoLog() throws Exception {
assertLog(log.get(2), "key info: {ID=3, STATUS=0}");
}

@Test
public void testOverrideWriteLog() throws Exception {

createTestData(1);

DatabaseRecordReader reader = new DatabaseRecordReader();
reader.setStatement(connection.prepareStatement(
"SELECT * FROM BATCH_REQUEST_TABLE WHERE STATUS = '0' ORDER BY ID"));
DatabaseTableQueueReader sut = new DatabaseTableQueueReader(reader, 1000, "ID", "STATUS") {
@Override
protected void writeLog(final InputDataIdentifier inputDataIdentifier) {
assertThat(inputDataIdentifier.get("ID")
.toString(), is("1"));
assertThat(inputDataIdentifier.get("STATUS")
.toString(), is("0"));
}
};

assertThat(sut.read(null)
.getBigDecimal("id")
.intValue(), is(1));
updateStatus();
assertThat(sut.read(null), is(nullValue()));
}

/**
* 待機時間分待機後にデータが取得できること
*
Expand Down

0 comments on commit b4df262

Please sign in to comment.