removed the empty AbstractTransactionalIoSource
This commit is contained in:
@@ -31,7 +31,6 @@ import org.springframework.batch.io.file.mapping.FieldSet;
|
||||
import org.springframework.batch.io.file.mapping.FieldSetCreator;
|
||||
import org.springframework.batch.io.file.transform.DelimitedLineAggregator;
|
||||
import org.springframework.batch.io.file.transform.LineAggregator;
|
||||
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
@@ -66,7 +65,7 @@ import org.springframework.util.Assert;
|
||||
* @author Robert Kasanicky
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class FlatFileItemWriter extends AbstractTransactionalIoSource implements ItemWriter, ItemStream,
|
||||
public class FlatFileItemWriter implements ItemWriter, ItemStream,
|
||||
InitializingBean {
|
||||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.io.support;
|
||||
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.stream.ItemStreamSupport;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Abstract class that abstracts away transaction handling from input and
|
||||
* output. Any {@link ItemReader} or {@link ItemWriter} that wants to be
|
||||
* notified of transaction events to maintain the contract that all calls to
|
||||
* read or write can extend this base class to ensure that correct ordering is
|
||||
* maintained regardless of rollbacks.
|
||||
* </p>
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class AbstractTransactionalIoSource extends ItemStreamSupport {
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.io.support;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class AbstractTransactionalIoSourceTests extends TestCase {
|
||||
|
||||
private MockIoSource source;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
source = new MockIoSource();
|
||||
if(TransactionSynchronizationManager.isSynchronizationActive()){
|
||||
TransactionSynchronizationManager.clearSynchronization();
|
||||
}
|
||||
TransactionSynchronizationManager.initSynchronization();
|
||||
}
|
||||
|
||||
public void testCommit(){
|
||||
source.mark();
|
||||
assertTrue(source.commitCalled);
|
||||
assertFalse(source.rollbackCalled);
|
||||
}
|
||||
|
||||
public void testRollback(){
|
||||
source.reset();
|
||||
assertFalse(source.commitCalled);
|
||||
assertTrue(source.rollbackCalled);
|
||||
}
|
||||
|
||||
private static class MockIoSource extends AbstractTransactionalIoSource {
|
||||
|
||||
private boolean commitCalled = false;
|
||||
private boolean rollbackCalled = false;
|
||||
|
||||
public void mark() {
|
||||
Assert.isTrue(!commitCalled, "Commit aleady called");
|
||||
commitCalled = true;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
Assert.isTrue(!rollbackCalled, "Rollback aleady called");
|
||||
rollbackCalled = true;
|
||||
}
|
||||
|
||||
public Object read() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user