Throw translated Exception on SRP conn failure

DATAREDIS-234
This commit is contained in:
Jennifer Hickey
2013-08-16 15:19:02 -07:00
parent 6290cbad06
commit e94fa9a35a
2 changed files with 16 additions and 0 deletions

View File

@@ -17,8 +17,10 @@ package org.springframework.data.redis.connection.srp;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.redis.RedisConnectionFailureException;
import org.springframework.data.redis.SettingsUtils;
import org.springframework.data.redis.connection.RedisConnection;
import static org.junit.Assert.fail;
/**
* Integration test of {@link SrpConnectionFactory}
@@ -37,6 +39,18 @@ public class SrpConnectionFactoryTests {
connection.ping();
}
@Test
public void testConnectInvalidHost() {
SrpConnectionFactory factory = new SrpConnectionFactory();
factory.setHostName("fakeHost");
factory.afterPropertiesSet();
try {
factory.getConnection();
fail("Expected a connection failure exception");
} catch(RedisConnectionFailureException e) {
}
}
@Ignore("Redis must have requirepass set to run this test")
@Test
public void testConnectWithPassword() {