package testJRedis;

import org.apache.log4j.xml.DOMConfigurator;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.stereotype.Service;
import springJredisCache.JRedisCache;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * @author 石头哥哥</br>
 *         Date:1/19/14</br>
 *         Time:8:40 PM</br>
 *         Package:testJRedis</br>
 *         Comment：
 */
@Service("test")
@SuppressWarnings("unchecked")
public class Test {
    @Resource
    private JRedisCache jRedisCache;


    @org.junit.Test
    public void  testJRedis(){
        DOMConfigurator.configure("res/appConfig/log4j.xml");

        System.setProperty("java.net.preferIPv4Stack", "true"); //Disable IPv6 in JVM
        /**初始化spring容器*/
        BeanFactory springContext = new FileSystemXmlApplicationContext("res/springConfig/spring-context.xml");
        Test test= (Test) springContext.getBean("test");
        ArrayList<Integer> list=new ArrayList<Integer>();
        list.add(1);
        list.add(2);
        list.add(3);

        //set
        test.jRedisCache.putList("list", list);

        // get
        list= (ArrayList<Integer>) test.jRedisCache.getList("list");

        for(int value:list){
            System.out.println("get value from redis:" + value);
        }
    }


}

@@ -74,49 +74,44 @@
 org.
-springframework.beans.factory.BeanFactory
+junit.After;%0Aimport org.junit.Before
 ;%0Aim
@@ -599,28 +599,79 @@
 e;%0A%0A
-%0A
    
- @org.junit.Test
+private  FileSystemXmlApplicationContext springContext ;%0A    @Before
 %0A   
@@ -683,26 +683,22 @@
 ic void 
- testJRedi
+IntiRe
 s()%7B%0A   
@@ -752,25 +752,24 @@
 og4j.xml%22);%0A
-%0A
         Syst
@@ -854,45 +854,8 @@
     
-/**%E5%88%9D%E5%A7%8B%E5%8C%96spring%E5%AE%B9%E5%99%A8*/%0A        BeanFactory 
 spri
@@ -934,32 +934,116 @@
 -context.xml%22);%0A
+    %7D%0A%0A%0A    @org.junit.Test%0A    public void  testJRedis()%7B%0A        /**%E5%88%9D%E5%A7%8B%E5%8C%96spring%E5%AE%B9%E5%99%A8*/%0A
         Test tes
@@ -1317,22 +1317,22 @@
 nteger%3E)
- 
 test.
+ 
 jRedisCa
@@ -1465,10 +1465,88 @@
     %7D%0A%0A%0A
+    @After%0A    public void closeApp()%7B%0A        springContext.close();%0A    %7D%0A%0A%0A
 %7D%0A

添加JRedis 测试用例 junit