Updated for various code warnings

This commit addresses a number of deprications and other code warnings.
There are still many more to address, but this is a start.
This commit is contained in:
Michael Minella
2017-04-21 16:20:46 -05:00
parent a2a856e64b
commit 263e978a1f
128 changed files with 658 additions and 680 deletions

View File

@@ -16,16 +16,8 @@
package org.springframework.batch.container.jms;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -35,11 +27,19 @@ import javax.jms.Session;
import org.aopalliance.aop.Advice;
import org.junit.Test;
import org.springframework.batch.repeat.interceptor.RepeatOperationsInterceptor;
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
import org.springframework.batch.repeat.support.RepeatTemplate;
import org.springframework.util.ReflectionUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class BatchMessageListenerContainerTests {
BatchMessageListenerContainer container;
@@ -186,13 +186,12 @@ public class BatchMessageListenerContainerTests {
}
private boolean doExecute(Session session, MessageConsumer consumer) throws IllegalAccessException {
Method method = ReflectionUtils.findMethod(container.getClass(), "receiveAndExecute", new Class[] {
Object.class, Session.class, MessageConsumer.class });
Method method = ReflectionUtils.findMethod(container.getClass(), "receiveAndExecute", Object.class, Session.class, MessageConsumer.class);
method.setAccessible(true);
boolean received;
try {
// A null invoker is not normal, but we don't care about the invoker for a unit test
received = ((Boolean) method.invoke(container, new Object[] { null, session, consumer })).booleanValue();
received = (Boolean) method.invoke(container, null, session, consumer);
}
catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) {

View File

@@ -16,13 +16,8 @@
package org.springframework.batch.repeat.jms;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
@@ -45,6 +40,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ClassUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/org/springframework/batch/jms/jms-context.xml")
@DirtiesContext
@@ -190,9 +189,9 @@ public class AsynchronousTests {
}
/**
* @param list
* @param timeout
* @throws InterruptedException
* @param list resource to monitor
* @param timeout how long to monitor for
* @throws InterruptedException If interrupted while waiting
*/
private void waitFor(List<String> list, int size, int timeout) throws InterruptedException {
int count = 0;

View File

@@ -79,7 +79,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean {
@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(dataSource);
Assert.notNull(dataSource, "DataSource is required");
logger.info("Initializing with scripts: " + Arrays.asList(initScripts));
if (!initialized && initialize) {
try {