INT-2267
removed test compile warnings INT-2267 removed test compile warnings(2)
This commit is contained in:
@@ -84,8 +84,7 @@ public class StubRabbitConnectionFactory implements ConnectionFactory {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class StubChannel implements Channel {
|
||||
|
||||
public void addShutdownListener(ShutdownListener listener) {
|
||||
@@ -327,7 +326,8 @@ public class StubRabbitConnectionFactory implements ConnectionFactory {
|
||||
public RecoverOk basicRecover(boolean requeue) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public void basicRecoverAsync(boolean requeue) throws IOException {
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,12 @@ import org.springframework.integration.message.GenericMessage;
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class RemoteFileOutboundGatewayTests {
|
||||
|
||||
private String tmpDir = System.getProperty("java.io.tmpdir");
|
||||
|
||||
|
||||
@Test
|
||||
public void testLs() throws Exception {
|
||||
SessionFactory sessionFactory = mock(SessionFactory.class);
|
||||
@@ -247,7 +249,7 @@ public class RemoteFileOutboundGatewayTests {
|
||||
public boolean remove(String path) throws IOException {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public TestLsEntry[] list(String path) throws IOException {
|
||||
return new TestLsEntry[] {
|
||||
new TestLsEntry("f1", 1234, false, false, 12345, "-rw-r--r--")
|
||||
@@ -301,7 +303,7 @@ public class RemoteFileOutboundGatewayTests {
|
||||
public boolean remove(String path) throws IOException {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public TestLsEntry[] list(String path) throws IOException {
|
||||
return new TestLsEntry[] {
|
||||
new TestLsEntry("f1", 1234, false, false, modified.getTime(), "-rw-r--r--")
|
||||
@@ -353,7 +355,7 @@ public class RemoteFileOutboundGatewayTests {
|
||||
public boolean remove(String path) throws IOException {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
public TestLsEntry[] list(String path) throws IOException {
|
||||
return new TestLsEntry[] {
|
||||
new TestLsEntry("f1", 1234, false, false, 12345, "-rw-r--r--")
|
||||
@@ -407,6 +409,7 @@ public class RemoteFileOutboundGatewayTests {
|
||||
|
||||
class TestRemoteFileOutboundGateway extends AbstractRemoteFileOutboundGateway<TestLsEntry> {
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public TestRemoteFileOutboundGateway(SessionFactory sessionFactory,
|
||||
String command, String expression) {
|
||||
super(sessionFactory, command, expression);
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPClientConfig;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
|
||||
import org.springframework.integration.MessagingException;
|
||||
@@ -38,7 +39,7 @@ import org.springframework.util.Assert;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements SessionFactory {
|
||||
public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements SessionFactory<FTPFile> {
|
||||
|
||||
public static final String DEFAULT_REMOTE_WORKING_DIRECTORY = "/";
|
||||
|
||||
@@ -123,7 +124,7 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
this.clientMode = clientMode;
|
||||
}
|
||||
|
||||
public Session getSession() {
|
||||
public Session<FTPFile> getSession() {
|
||||
try {
|
||||
T client = this.createClient();
|
||||
if (client == null) {
|
||||
|
||||
@@ -108,6 +108,7 @@ public class FtpInboundChannelAdapterParserTests {
|
||||
|
||||
public static class TestSessionFactoryBean implements FactoryBean<DefaultFtpSessionFactory> {
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public DefaultFtpSessionFactory getObject() throws Exception {
|
||||
DefaultFtpSessionFactory factory = mock(DefaultFtpSessionFactory.class);
|
||||
Session session = mock(Session.class);
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.SpelParserConfiguration;
|
||||
@@ -74,7 +75,6 @@ public class FtpInboundRemoteFileSystemSynchronizerTest {
|
||||
ftpSessionFactory.setUsername("kermit");
|
||||
ftpSessionFactory.setPassword("frog");
|
||||
ftpSessionFactory.setHost("foo.com");
|
||||
|
||||
FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer(ftpSessionFactory));
|
||||
synchronizer.setDeleteRemoteFiles(true);
|
||||
synchronizer.setRemoteDirectory("remote-test-dir");
|
||||
|
||||
@@ -39,6 +39,7 @@ import static org.junit.Assert.assertEquals;
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes","unchecked"})
|
||||
public class SessionFactoryTests {
|
||||
|
||||
@Test
|
||||
@@ -63,6 +64,7 @@ public class SessionFactoryTests {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStaleConnection() throws Exception{
|
||||
SessionFactory sessionFactory = Mockito.mock(SessionFactory.class);
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
|
||||
*/
|
||||
public class CacheServerProcess {
|
||||
|
||||
@SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Properties props = new Properties();
|
||||
@@ -45,6 +46,7 @@ public class CacheServerProcess {
|
||||
props.setProperty("log-level", "info");
|
||||
|
||||
System.out.println("\nConnecting to the distributed system and creating the cache.");
|
||||
|
||||
DistributedSystem ds = DistributedSystem.connect(props);
|
||||
Cache cache = CacheFactory.create(ds);
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class HttpInboundChannelAdapterParserTests {
|
||||
headers.set("foo", "foo");
|
||||
headers.set("bar", "bar");
|
||||
headers.set("baz", "baz");
|
||||
Map<String, Object> map = (Map<String, Object>) headerMapper.toHeaders(headers);
|
||||
Map<String, Object> map = headerMapper.toHeaders(headers);
|
||||
assertTrue(map.size() == 2);
|
||||
assertEquals("foo", map.get("foo"));
|
||||
assertEquals("bar", map.get("bar"));
|
||||
|
||||
@@ -121,7 +121,7 @@ public class HttpInboundGatewayParserTests {
|
||||
headers.set("foo", "foo");
|
||||
headers.set("bar", "bar");
|
||||
headers.set("baz", "baz");
|
||||
Map<String, Object> map = (Map<String, Object>) headerMapper.toHeaders(headers);
|
||||
Map<String, Object> map = headerMapper.toHeaders(headers);
|
||||
assertTrue(map.size() == 2);
|
||||
assertEquals("foo", map.get("foo"));
|
||||
assertEquals("bar", map.get("bar"));
|
||||
@@ -145,7 +145,7 @@ public class HttpInboundGatewayParserTests {
|
||||
headers.set("foo", "foo");
|
||||
headers.set("bar", "bar");
|
||||
headers.set("baz", "baz");
|
||||
Map<String, Object> map = (Map<String, Object>) headerMapper.toHeaders(headers);
|
||||
Map<String, Object> map = headerMapper.toHeaders(headers);
|
||||
assertTrue(map.size() == 2);
|
||||
assertEquals("foo", map.get("foo"));
|
||||
assertEquals("bar", map.get("bar"));
|
||||
|
||||
@@ -55,22 +55,22 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests {
|
||||
@Autowired
|
||||
CreateUser createUser;
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
createUser.createUser(new User("myUsername", "myPassword", "myEmail"));
|
||||
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
List<Message<Collection<User>>> received = new ArrayList<Message<Collection<User>>>();
|
||||
|
||||
received.add(consumer.poll(2000));
|
||||
|
||||
Message<?> message = received.get(0);
|
||||
Message<Collection<User>> message = received.get(0);
|
||||
context.stop();
|
||||
assertNotNull(message);
|
||||
assertNotNull(message.getPayload());
|
||||
assertNotNull(message.getPayload() instanceof Collection<?>);
|
||||
|
||||
Collection<User> allUsers = (Collection<User>) message.getPayload();
|
||||
Collection<User> allUsers = message.getPayload();
|
||||
|
||||
assertTrue(allUsers.size() == 1);
|
||||
|
||||
@@ -98,14 +98,14 @@ public class StoredProcOutboundGatewayWithNamespaceIntegrationTests {
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<Message<?>>();
|
||||
private final BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<Message<Collection<User>>>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<?>message) {
|
||||
public void receive(Message<Collection<User>> message) {
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
Message<?> poll(long timeoutInMillis) throws InterruptedException {
|
||||
Message<Collection<User>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -27,11 +24,9 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -41,6 +36,9 @@ import org.springframework.integration.jdbc.storedproc.User;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
@@ -48,11 +46,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
|
||||
private static Logger logger = Logger.getLogger(StoredProcOutboundGatewayWithSpringContextIntegrationTests.class);
|
||||
|
||||
@Autowired
|
||||
private DataSource datasource;
|
||||
|
||||
@Autowired
|
||||
private AbstractApplicationContext context;
|
||||
|
||||
@@ -62,22 +55,22 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
@Autowired
|
||||
CreateUser createUser;
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
createUser.createUser(new User("myUsername", "myPassword", "myEmail"));
|
||||
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
List<Message<Collection<User>>> received = new ArrayList<Message<Collection<User>>>();
|
||||
|
||||
received.add(consumer.poll(2000));
|
||||
|
||||
Message<?> message = received.get(0);
|
||||
Message<Collection<User>> message = received.get(0);
|
||||
context.stop();
|
||||
assertNotNull(message);
|
||||
assertNotNull(message.getPayload());
|
||||
assertNotNull(message.getPayload() instanceof Collection<?>);
|
||||
|
||||
Collection<User> allUsers = (Collection<User>) message.getPayload();
|
||||
Collection<User> allUsers = message.getPayload();
|
||||
|
||||
assertTrue(allUsers.size() == 1);
|
||||
|
||||
@@ -99,14 +92,14 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<Message<?>>();
|
||||
private final BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<Message<Collection<User>>>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<?>message) {
|
||||
public void receive(Message<Collection<User>> message) {
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
Message<?> poll(long timeoutInMillis) throws InterruptedException {
|
||||
Message<Collection<User>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
@@ -26,9 +23,9 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -36,6 +33,9 @@ import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
@@ -43,27 +43,26 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StoredProcPollingChannelAdapterWithNamespace2IntegrationTests {
|
||||
|
||||
private static Logger logger = Logger.getLogger(StoredProcPollingChannelAdapterWithNamespace2IntegrationTests.class);
|
||||
|
||||
@Autowired
|
||||
private AbstractApplicationContext context;
|
||||
|
||||
@Autowired
|
||||
private Consumer consumer;
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
public void pollH2DatabaseUsingStoredProcedureCall() throws Exception {
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
List<Message<List<Integer>>> received = new ArrayList<Message<List<Integer>>>();
|
||||
|
||||
received.add(consumer.poll(60000));
|
||||
|
||||
Message<?> message = received.get(0);
|
||||
Message<List<Integer>> message = received.get(0);
|
||||
context.stop();
|
||||
assertNotNull(message);
|
||||
assertNotNull(message.getPayload());
|
||||
assertTrue(message.getPayload() instanceof List<?>);
|
||||
|
||||
List<Integer> resultList = (List<Integer>) message.getPayload();
|
||||
List<Integer> resultList = message.getPayload();
|
||||
|
||||
assertTrue(resultList.size() == 1);
|
||||
|
||||
@@ -85,14 +84,14 @@ public class StoredProcPollingChannelAdapterWithNamespace2IntegrationTests {
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<Message<?>>();
|
||||
private final BlockingQueue<Message<List<Integer>>> messages = new LinkedBlockingQueue<Message<List<Integer>>>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<?>message) {
|
||||
public void receive(Message<List<Integer>>message) {
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
Message<?> poll(long timeoutInMillis) throws InterruptedException {
|
||||
Message<List<Integer>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -27,9 +24,9 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -37,6 +34,9 @@ import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
@@ -44,15 +44,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests {
|
||||
|
||||
private static Logger logger = Logger.getLogger(StoredProcPollingChannelAdapterWithNamespaceIntegrationTests.class);
|
||||
|
||||
@Autowired
|
||||
private AbstractApplicationContext context;
|
||||
|
||||
@Autowired
|
||||
private Consumer consumer;
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void pollH2DatabaseUsingStoredProcedureCall() throws Exception {
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -27,11 +24,9 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
@@ -39,6 +34,9 @@ import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
*/
|
||||
@@ -46,30 +44,25 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
|
||||
private static Logger logger = Logger.getLogger(StoredProcPollingChannelAdapterWithSpringContextIntegrationTests.class);
|
||||
|
||||
@Autowired
|
||||
private DataSource datasource;
|
||||
|
||||
@Autowired
|
||||
private AbstractApplicationContext context;
|
||||
|
||||
@Autowired
|
||||
private Consumer consumer;
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
List<Message<Collection<Integer>>> received = new ArrayList<Message<Collection<Integer>>>();
|
||||
|
||||
received.add(consumer.poll(2000));
|
||||
|
||||
Message<?> message = received.get(0);
|
||||
Message<Collection<Integer>> message = received.get(0);
|
||||
context.stop();
|
||||
assertNotNull(message);
|
||||
assertNotNull(message.getPayload());
|
||||
assertNotNull(message.getPayload() instanceof Collection<?>);
|
||||
|
||||
Collection<Integer> primeNumbers = (Collection<Integer>) message.getPayload();
|
||||
Collection<Integer> primeNumbers = message.getPayload();
|
||||
|
||||
assertTrue(primeNumbers.size() == 4);
|
||||
|
||||
@@ -91,14 +84,14 @@ public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<Message<?>>();
|
||||
private final BlockingQueue<Message<Collection<Integer>>> messages = new LinkedBlockingQueue<Message<Collection<Integer>>>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<?>message) {
|
||||
public void receive(Message<Collection<Integer>>message) {
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
Message<?> poll(long timeoutInMillis) throws InterruptedException {
|
||||
Message<Collection<Integer>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ public class StoredProcMessageHandlerParserTests {
|
||||
assertEquals("Resolution Required should be 'testProcedure1' but was " + testProcedure1, "testProcedure1", testProcedure1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testProcedurepParametersAreSet() throws Exception {
|
||||
setUp("basicStoredProcOutboundChannelAdapterTest.xml", getClass());
|
||||
|
||||
@@ -99,7 +100,8 @@ public class StoredProcMessageHandlerParserTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSqlParametersAreSet() throws Exception {
|
||||
setUp("basicStoredProcOutboundChannelAdapterTest.xml", getClass());
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ public class StoredProcOutboundGatewayParserTests {
|
||||
assertFalse(skipUndeclaredResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testProcedurepParametersAreSet() throws Exception {
|
||||
setUp("storedProcOutboundGatewayParserTest.xml", getClass());
|
||||
|
||||
@@ -133,7 +134,8 @@ public class StoredProcOutboundGatewayParserTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testReturningResultSetRowMappersAreSet() throws Exception {
|
||||
setUp("storedProcOutboundGatewayParserTest.xml", getClass());
|
||||
|
||||
@@ -158,7 +160,8 @@ public class StoredProcOutboundGatewayParserTests {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSqlParametersAreSet() throws Exception {
|
||||
setUp("storedProcOutboundGatewayParserTest.xml", getClass());
|
||||
|
||||
|
||||
@@ -13,11 +13,6 @@
|
||||
|
||||
package org.springframework.integration.jdbc.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -25,6 +20,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -36,6 +32,11 @@ import org.springframework.jdbc.core.SqlInOutParameter;
|
||||
import org.springframework.jdbc.core.SqlOutParameter;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @since 2.1
|
||||
@@ -73,7 +74,8 @@ public class StoredProcPollingChannelAdapterParserTests {
|
||||
assertTrue("skipUndeclaredResults was not set and should default to 'true'", skipUndeclaredResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testProcedurepParametersAreSet() throws Exception {
|
||||
setUp("storedProcPollingChannelAdapterParserTest.xml", getClass());
|
||||
|
||||
@@ -112,7 +114,8 @@ public class StoredProcPollingChannelAdapterParserTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testReturningResultSetRowMappersAreSet() throws Exception {
|
||||
setUp("storedProcPollingChannelAdapterParserTest.xml", getClass());
|
||||
|
||||
@@ -137,7 +140,8 @@ public class StoredProcPollingChannelAdapterParserTests {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSqlParametersAreSet() throws Exception {
|
||||
setUp("storedProcPollingChannelAdapterParserTest.xml", getClass());
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.Proxy;
|
||||
import com.jcraft.jsch.SocketFactory;
|
||||
@@ -38,7 +39,7 @@ import com.jcraft.jsch.UserInfo;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class DefaultSftpSessionFactory implements SessionFactory {
|
||||
public class DefaultSftpSessionFactory implements SessionFactory<LsEntry> {
|
||||
|
||||
private volatile String host;
|
||||
|
||||
@@ -141,7 +142,7 @@ public class DefaultSftpSessionFactory implements SessionFactory {
|
||||
}
|
||||
|
||||
|
||||
public Session getSession() {
|
||||
public Session<LsEntry> getSession() {
|
||||
Assert.hasText(this.host, "host must not be empty");
|
||||
Assert.hasText(this.user, "user must not be empty");
|
||||
Assert.isTrue(this.port >= 0, "port must be a positive number");
|
||||
|
||||
@@ -16,17 +16,6 @@
|
||||
|
||||
package org.springframework.integration.sftp.inbound;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Vector;
|
||||
@@ -44,6 +33,17 @@ import com.jcraft.jsch.ChannelSftp;
|
||||
import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
import com.jcraft.jsch.SftpATTRS;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
@@ -75,6 +75,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
|
||||
ftpSessionFactory.setPassword("frog");
|
||||
ftpSessionFactory.setHost("foo.com");
|
||||
|
||||
|
||||
SftpInboundFileSynchronizer synchronizer = spy(new SftpInboundFileSynchronizer(ftpSessionFactory));
|
||||
synchronizer.setDeleteRemoteFiles(true);
|
||||
synchronizer.setRemoteDirectory("remote-test-dir");
|
||||
@@ -103,7 +104,9 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
|
||||
|
||||
public static class TestSftpSessionFactory extends DefaultSftpSessionFactory {
|
||||
|
||||
public Session getSession() {
|
||||
|
||||
@Override
|
||||
public Session<LsEntry> getSession() {
|
||||
try {
|
||||
ChannelSftp channel = mock(ChannelSftp.class);
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.integration.sftp.session.SftpTestSessionFactory;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -55,7 +56,7 @@ public class SftpSendingMessageHandlerTests {
|
||||
if (file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
SessionFactory sessionFactory = new TestSftpSessionFactory();
|
||||
SessionFactory<LsEntry> sessionFactory = new TestSftpSessionFactory();
|
||||
FileTransferringMessageHandler handler = new FileTransferringMessageHandler(sessionFactory);
|
||||
DefaultFileNameGenerator fGenerator = new DefaultFileNameGenerator();
|
||||
fGenerator.setExpression("payload + '.test'");
|
||||
@@ -66,21 +67,20 @@ public class SftpSendingMessageHandlerTests {
|
||||
assertTrue(new File("remote-target-dir", "template.mf.test").exists());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test
|
||||
public void testHandleStringMessage() throws Exception {
|
||||
File file = new File("remote-target-dir", "foo.txt");
|
||||
if (file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
SessionFactory sessionFactory = new TestSftpSessionFactory();
|
||||
SessionFactory<LsEntry> sessionFactory = new TestSftpSessionFactory();
|
||||
FileTransferringMessageHandler handler = new FileTransferringMessageHandler(sessionFactory);
|
||||
DefaultFileNameGenerator fGenerator = new DefaultFileNameGenerator();
|
||||
fGenerator.setExpression("'foo.txt'");
|
||||
handler.setFileNameGenerator(fGenerator);
|
||||
handler.setRemoteDirectoryExpression(new LiteralExpression("remote-target-dir"));
|
||||
|
||||
handler.handleMessage(new GenericMessage("hello"));
|
||||
handler.handleMessage(new GenericMessage<String>("hello"));
|
||||
assertTrue(new File("remote-target-dir", "foo.txt").exists());
|
||||
}
|
||||
|
||||
@@ -104,12 +104,12 @@ public class SftpSendingMessageHandlerTests {
|
||||
|
||||
public static class TestSftpSessionFactory extends DefaultSftpSessionFactory {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Session getSession() {
|
||||
@Override
|
||||
public Session<LsEntry> getSession() {
|
||||
try {
|
||||
ChannelSftp channel = mock(ChannelSftp.class);
|
||||
|
||||
doAnswer(new Answer() {
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation)
|
||||
throws Throwable {
|
||||
File file = new File((String)invocation.getArguments()[1]);
|
||||
@@ -120,7 +120,7 @@ public class SftpSendingMessageHandlerTests {
|
||||
|
||||
}).when(channel).put(Mockito.any(InputStream.class), Mockito.anyString());
|
||||
|
||||
doAnswer(new Answer() {
|
||||
doAnswer(new Answer<Object>() {
|
||||
public Object answer(InvocationOnMock invocation)
|
||||
throws Throwable {
|
||||
File file = new File((String) invocation.getArguments()[0]);
|
||||
|
||||
@@ -17,13 +17,15 @@ package org.springframework.integration.sftp.session;
|
||||
|
||||
import org.springframework.integration.file.remote.session.Session;
|
||||
|
||||
import com.jcraft.jsch.ChannelSftp.LsEntry;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class SftpTestSessionFactory {
|
||||
|
||||
public static Session createSftpSession(com.jcraft.jsch.Session jschSession) {
|
||||
public static Session<LsEntry> createSftpSession(com.jcraft.jsch.Session jschSession) {
|
||||
SftpSession sftpSession = new SftpSession(jschSession);
|
||||
sftpSession.connect();
|
||||
return sftpSession;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class XmppHeaderEnricherParserTests {
|
||||
doAnswer(new Answer() {
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
Message message = (Message) invocation.getArguments()[0];
|
||||
String chatToUser = (String) message.getHeaders().get(XmppHeaders.CHAT_TO);
|
||||
String chatToUser = (String) message.getHeaders().get(XmppHeaders.TO);
|
||||
assertNotNull(chatToUser);
|
||||
assertEquals("test1@example.org", chatToUser);
|
||||
return null;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class XmppMessageProducer implements MessageSource<String> {
|
||||
|
||||
logger.info("sending message to recipient " + recipient);
|
||||
|
||||
return MessageBuilder.withPayload(msg).setHeader(XmppHeaders.CHAT_TO, recipient).build();
|
||||
return MessageBuilder.withPayload(msg).setHeader(XmppHeaders.TO, recipient).build();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
logger.debug("exception thrown when trying to receive a message", e);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ChatMessageSendingMessageHandlerTests {
|
||||
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler(connection);
|
||||
handler.afterPropertiesSet();
|
||||
Message<?> message = MessageBuilder.withPayload("Test Message").
|
||||
setHeader(XmppHeaders.CHAT_TO, "kermit@frog.com").
|
||||
setHeader(XmppHeaders.TO, "kermit@frog.com").
|
||||
build();
|
||||
// first Message new
|
||||
handler.handleMessage(message);
|
||||
@@ -67,8 +67,8 @@ public class ChatMessageSendingMessageHandlerTests {
|
||||
|
||||
// assuming we know thread ID although currently we do not provide this capability
|
||||
message = MessageBuilder.withPayload("Hello Kitty").
|
||||
setHeader(XmppHeaders.CHAT_TO, "kermit@frog.com").
|
||||
setHeader(XmppHeaders.CHAT_THREAD_ID, "123").
|
||||
setHeader(XmppHeaders.TO, "kermit@frog.com").
|
||||
setHeader(XmppHeaders.THREAD, "123").
|
||||
build();
|
||||
|
||||
class EqualSmackMessageWithThreadId extends ArgumentMatcher<org.jivesoftware.smack.packet.Message> {
|
||||
|
||||
Reference in New Issue
Block a user