package redis.clients.jedis.tests;

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPipeline;
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;

public class PipeliningTest extends Assert {
    private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);

    private Jedis jedis;

    @Before
    public void setUp() throws Exception {
	jedis = new Jedis(hnp.host, hnp.port, 500);
	jedis.connect();
	jedis.auth("foobared");
	jedis.flushAll();
    }

    @Test
    public void pipeline() throws UnknownHostException, IOException {
	List<Object> results = jedis.pipelined(new JedisPipeline() {
	    public void execute() {
		client.set("foo", "bar");
		client.get("foo");
	    }
	});

	assertEquals(2, results.size());
	assertEquals("OK", results.get(0));
	assertEquals("bar", results.get(1));
    }
}

@@ -130,24 +130,18 @@
 ort 
+org.
 junit.
-framework.
 Asse
@@ -270,16 +270,53 @@
 peline;%0A
+import redis.clients.jedis.Protocol;%0A
 import r
@@ -956,32 +956,37 @@
 size());%0A%09assert
+Array
 Equals(%22OK%22, res
@@ -980,18 +980,50 @@
 als(%22OK%22
-, 
+.getBytes(Protocol.UTF8), (byte%5B%5D)
 results.
@@ -1034,24 +1034,29 @@
 0));%0A%09assert
+Array
 Equals(%22bar%22
@@ -1055,18 +1055,50 @@
 ls(%22bar%22
-, 
+.getBytes(Protocol.UTF8), (byte%5B%5D)
 results.

Fix some more U tests ...