@Test public void testCreateUri01() throws Exception { RedisStorageClient client = createClient(); URI uri = client.createURI("redis: assertEquals(uri.getScheme(), "redis"); assertEquals(uri.getUserInfo(), "user:pwd"); assertEquals(uri.getHost(), "localhost"); assertTrue(uri.getPort() == 6379); uri = client.createURI("rediss: assertEquals(uri.getScheme(), "rediss"); assertEquals(uri.getUserInfo(), ":pwd"); assertTrue(uri.getPort() == 9999); uri = client.createURI("redis: assertEquals(uri.getScheme(), "redis"); assertNull(uri.getUserInfo()); assertTrue(uri.getPort() == 6379); }
URI createURI(String redisUrl) throws URISyntaxException { URI uri = new URI(redisUrl); if (uri.getPort() < 0) uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 6379, uri.getPath(), uri.getQuery(), uri.getFragment()); return uri; }
RedisStorageClient implements StorageClient { URI createURI(String redisUrl) throws URISyntaxException { URI uri = new URI(redisUrl); if (uri.getPort() < 0) uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 6379, uri.getPath(), uri.getQuery(), uri.getFragment()); return uri; } }
RedisStorageClient implements StorageClient { URI createURI(String redisUrl) throws URISyntaxException { URI uri = new URI(redisUrl); if (uri.getPort() < 0) uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 6379, uri.getPath(), uri.getQuery(), uri.getFragment()); return uri; } RedisStorageClient(String redisUrl, long operationTimeout); }
RedisStorageClient implements StorageClient { URI createURI(String redisUrl) throws URISyntaxException { URI uri = new URI(redisUrl); if (uri.getPort() < 0) uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 6379, uri.getPath(), uri.getQuery(), uri.getFragment()); return uri; } RedisStorageClient(String redisUrl, long operationTimeout); @Override Future<Boolean> add(final String key, final int exp, final byte[] o); @Override Future<Boolean> set(final String key, final int exp, final byte[] o); @Override byte[] get(final String key); @Override Future<Boolean> delete(final String key); @Override void shutdown(); }
RedisStorageClient implements StorageClient { URI createURI(String redisUrl) throws URISyntaxException { URI uri = new URI(redisUrl); if (uri.getPort() < 0) uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 6379, uri.getPath(), uri.getQuery(), uri.getFragment()); return uri; } RedisStorageClient(String redisUrl, long operationTimeout); @Override Future<Boolean> add(final String key, final int exp, final byte[] o); @Override Future<Boolean> set(final String key, final int exp, final byte[] o); @Override byte[] get(final String key); @Override Future<Boolean> delete(final String key); @Override void shutdown();  }