@@ -0,0 +1,2925 @@
+package com.gemstone.gemfire.redis;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0A%0Aimport java.io.IOException;%0Aimport java.util.Random;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0A%0Aimport redis.clients.jedis.Jedis;%0Aimport redis.clients.jedis.exceptions.JedisDataException;%0A%0Aimport com.gemstone.gemfire.cache.CacheFactory;%0Aimport com.gemstone.gemfire.cache.GemFireCache;%0Aimport com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;%0Aimport com.gemstone.gemfire.internal.AvailablePortHelper;%0Aimport com.gemstone.gemfire.test.junit.categories.IntegrationTest;%0A%0A@Category(IntegrationTest.class)%0Apublic class AuthJUnitTest %7B%0A%0A  private static final String PASSWORD = %22pwd%22;%0A  Jedis jedis;%0A  GemFireRedisServer server;%0A  GemFireCache cache;%0A  Random rand;%0A  int port;%0A%0A  int runs = 150;%0A%0A  @Before%0A  public void setUp() throws IOException %7B%0A    rand = new Random();%0A    port = AvailablePortHelper.getRandomAvailableTCPPort();%0A    this.jedis = new Jedis(%22localhost%22, port, 100000);%0A  %7D%0A%0A  @After%0A  public void tearDown() throws InterruptedException %7B%0A    server.shutdown();%0A    cache.close();%0A  %7D%0A  private void setupCacheWithPassword() %7B%0A    CacheFactory cf = new CacheFactory();%0A    cf.set(%22log-level%22, %22error%22);%0A    cf.set(%22mcast-port%22, %220%22);%0A    cf.set(%22locators%22, %22%22);%0A    cf.set(%22redis-password%22, PASSWORD);%0A    cache = cf.create();%0A    server = new GemFireRedisServer(%22localhost%22, port);%0A    server.start();%0A  %7D%0A%0A  @Test%0A  public void testAuthConfig() %7B%0A    setupCacheWithPassword();%0A    InternalDistributedSystem iD = (InternalDistributedSystem) cache.getDistributedSystem();%0A    assert(iD.getConfig().getRedisPassword().equals(PASSWORD));%0A  %7D%0A%0A  @Test%0A  public void testAuthRejectAccept() %7B%0A    setupCacheWithPassword();%0A    Exception ex = null;%0A    try %7B                        %0A      jedis.auth(%22wrongpwd%22);%0A    %7D catch (JedisDataException e) %7B%0A      ex = e;%0A    %7D%0A    assertNotNull(ex);%0A%0A    String res = jedis.auth(PASSWORD);%0A    assertEquals(res, %22OK%22);%0A  %7D%0A%0A  @Test%0A  public void testAuthNoPwd() %7B%0A    CacheFactory cf = new CacheFactory();%0A    cf.set(%22log-level%22, %22error%22);%0A    cf.set(%22mcast-port%22, %220%22);%0A    cf.set(%22locators%22, %22%22);%0A    cache = cf.create();%0A    server = new GemFireRedisServer(%22localhost%22, port);%0A    server.start();%0A%0A    Exception ex = null;%0A    try %7B                        %0A      jedis.auth(PASSWORD);%0A    %7D catch (JedisDataException e) %7B%0A      ex = e;%0A    %7D%0A    assertNotNull(ex);%0A  %7D%0A%0A  @Test%0A  public void testAuthAcceptRequests() %7B%0A    setupCacheWithPassword();%0A    Exception ex = null;%0A    try %7B                        %0A      jedis.set(%22foo%22, %22bar%22);%0A    %7D catch (JedisDataException e) %7B%0A      ex = e;%0A    %7D%0A    assertNotNull(ex);%0A%0A    String res = jedis.auth(PASSWORD);%0A    assertEquals(res, %22OK%22);%0A%0A    jedis.set(%22foo%22, %22bar%22); // No exception%0A  %7D%0A%0A%7D

Add test for GEODE-83