IN PROGRESS - BATCH-709: Change all collections to use generics
This commit is contained in:
@@ -46,15 +46,15 @@ public class MessagingTests extends AbstractDependencyInjectionSpringContextTest
|
||||
}
|
||||
|
||||
public void testMessaging() throws Exception {
|
||||
List list = getMessages();
|
||||
List<String> list = getMessages();
|
||||
System.err.println(list);
|
||||
assertEquals(2, list.size());
|
||||
assertTrue(list.contains("foo"));
|
||||
}
|
||||
|
||||
private List getMessages() {
|
||||
private List<String> getMessages() {
|
||||
String next = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (next != null) {
|
||||
next = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
if (next != null)
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class AbstractStaxEventReaderItemReaderTests extends TestCase {
|
||||
|
||||
public void testRead() throws Exception {
|
||||
Object result;
|
||||
List results = new ArrayList();
|
||||
List<Object> results = new ArrayList<Object>();
|
||||
while ((result = source.read()) != null) {
|
||||
results.add(result);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public abstract class AbstractStaxEventReaderItemReaderTests extends TestCase {
|
||||
/**
|
||||
* @param results list of domain objects returned by input source
|
||||
*/
|
||||
protected void checkResults(List results){
|
||||
protected void checkResults(List<Object> results){
|
||||
assertEquals(3, results.size());
|
||||
|
||||
Trade trade1 = (Trade) results.get(0);
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractStaxEventWriterItemWriterTests extends TestCase {
|
||||
|
||||
protected Resource expected = new ClassPathResource("expected-output.xml", getClass());
|
||||
|
||||
protected List objects = new ArrayList() {
|
||||
protected List<Trade> objects = new ArrayList<Trade>() {
|
||||
{
|
||||
add(new Trade("isin1", 1, new BigDecimal(1.0), "customer1"));
|
||||
add(new Trade("isin2", 2, new BigDecimal(2.0), "customer2"));
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractStaxEventWriterItemWriterTests extends TestCase {
|
||||
* Write list of domain objects and check the output file.
|
||||
*/
|
||||
public void testWrite() throws Exception {
|
||||
for (Iterator iterator = objects.listIterator(); iterator.hasNext();) {
|
||||
for (Iterator<?> iterator = objects.listIterator(); iterator.hasNext();) {
|
||||
writer.write(iterator.next());
|
||||
}
|
||||
writer.close(null);
|
||||
|
||||
@@ -108,9 +108,9 @@ public class ExternalRetryInBatchTests extends AbstractDependencyInjectionSpring
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
private List list = new ArrayList();
|
||||
private List<String> list = new ArrayList<String>();
|
||||
|
||||
private List recovered = new ArrayList();
|
||||
private List<Object> recovered = new ArrayList<Object>();
|
||||
|
||||
public void testExternalRetryRecoveryInBatch() throws Exception {
|
||||
assertInitialState();
|
||||
@@ -181,7 +181,7 @@ public class ExternalRetryInBatchTests extends AbstractDependencyInjectionSpring
|
||||
}
|
||||
}
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
System.err.println(msgs);
|
||||
|
||||
@@ -198,9 +198,9 @@ public class ExternalRetryInBatchTests extends AbstractDependencyInjectionSpring
|
||||
|
||||
}
|
||||
|
||||
private List getMessages() {
|
||||
private List<String> getMessages() {
|
||||
String next = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (next != null) {
|
||||
next = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
if (next != null)
|
||||
|
||||
@@ -89,7 +89,7 @@ public class AsynchronousTests extends AbstractDependencyInjectionSpringContextT
|
||||
}
|
||||
}
|
||||
|
||||
List list = new ArrayList();
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
private void assertInitialState() {
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -164,7 +164,7 @@ public class AsynchronousTests extends AbstractDependencyInjectionSpringContextT
|
||||
logger.debug("T_FOOS: "+jdbcTemplate.queryForList("select * from T_FOOS"));
|
||||
|
||||
String text = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (text != null) {
|
||||
text = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
msgs.add(text);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
List list = new ArrayList();
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
public void testCommit() throws Exception {
|
||||
|
||||
@@ -129,7 +129,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
startNewTransaction();
|
||||
|
||||
String text = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (text != null) {
|
||||
text = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
msgs.add(text);
|
||||
@@ -192,7 +192,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
startNewTransaction();
|
||||
|
||||
String text = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (text != null) {
|
||||
text = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
msgs.add(text);
|
||||
|
||||
@@ -94,9 +94,9 @@ public class ExternalRetryTests extends AbstractDependencyInjectionSpringContext
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
private List list = new ArrayList();
|
||||
private List<String> list = new ArrayList<String>();
|
||||
|
||||
private List recovered = new ArrayList();
|
||||
private List<Object> recovered = new ArrayList<Object>();
|
||||
|
||||
/**
|
||||
* Message processing is successful on the second attempt but must receive
|
||||
@@ -168,7 +168,7 @@ public class ExternalRetryTests extends AbstractDependencyInjectionSpringContext
|
||||
}
|
||||
});
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -234,7 +234,7 @@ public class ExternalRetryTests extends AbstractDependencyInjectionSpringContext
|
||||
// Last attempt should return last item.
|
||||
assertEquals("foo", result);
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
assertEquals(1, recovered.size());
|
||||
|
||||
@@ -247,9 +247,9 @@ public class ExternalRetryTests extends AbstractDependencyInjectionSpringContext
|
||||
|
||||
}
|
||||
|
||||
private List getMessages() {
|
||||
private List<String> getMessages() {
|
||||
String next = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (next != null) {
|
||||
next = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
if (next != null)
|
||||
|
||||
@@ -72,7 +72,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
List list = new ArrayList();
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
|
||||
/**
|
||||
* Message processing is successful on the second attempt without having to
|
||||
@@ -124,7 +124,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -180,7 +180,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -239,7 +239,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion rolled back...
|
||||
count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -290,7 +290,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -351,7 +351,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion rolled back...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -361,9 +361,9 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
assertTrue(msgs.contains("foo"));
|
||||
}
|
||||
|
||||
private List getMessages() {
|
||||
private List<String> getMessages() {
|
||||
String next = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (next != null) {
|
||||
next = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
if (next != null)
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
List list = new ArrayList();
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
|
||||
/**
|
||||
* Message processing is successful on the second attempt without having to
|
||||
@@ -117,7 +117,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -173,7 +173,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -232,7 +232,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion rolled back...
|
||||
count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -284,7 +284,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion committed once...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -342,7 +342,7 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
|
||||
startNewTransaction();
|
||||
|
||||
List msgs = getMessages();
|
||||
List<String> msgs = getMessages();
|
||||
|
||||
// The database portion rolled back...
|
||||
int count = jdbcTemplate.queryForInt("select count(*) from T_FOOS");
|
||||
@@ -352,9 +352,9 @@ public class SynchronousTests extends AbstractTransactionalDataSourceSpringConte
|
||||
assertTrue(msgs.contains("foo"));
|
||||
}
|
||||
|
||||
private List getMessages() {
|
||||
private List<String> getMessages() {
|
||||
String next = "";
|
||||
List msgs = new ArrayList();
|
||||
List<String> msgs = new ArrayList<String>();
|
||||
while (next != null) {
|
||||
next = (String) jmsTemplate.receiveAndConvert("queue");
|
||||
if (next != null)
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DerbyDataSourceFactoryBean extends AbstractFactoryBean {
|
||||
return ds;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<DataSource> getObjectType() {
|
||||
return DataSource.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package test.jdbc.datasource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -99,6 +98,7 @@ public class InitializingDataSourceFactoryBean extends AbstractFactoryBean {
|
||||
TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource));
|
||||
transactionTemplate.execute(new TransactionCallback() {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
String[] scripts;
|
||||
@@ -122,10 +122,9 @@ public class InitializingDataSourceFactoryBean extends AbstractFactoryBean {
|
||||
|
||||
}
|
||||
|
||||
private String stripComments(List list) {
|
||||
private String stripComments(List<String> list) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (Iterator iter = list.iterator(); iter.hasNext();) {
|
||||
String line = (String) iter.next();
|
||||
for (String line : list) {
|
||||
if (!line.startsWith("//") && !line.startsWith("--")) {
|
||||
buffer.append(line + "\n");
|
||||
}
|
||||
@@ -133,7 +132,7 @@ public class InitializingDataSourceFactoryBean extends AbstractFactoryBean {
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<DataSource> getObjectType() {
|
||||
return DataSource.class;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user