/*
 * Copyright 2015-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.nanoframework.orm.jedis.sharded;

import java.io.IOException;
import java.util.Properties;

import org.junit.Before;
import org.junit.Test;
import org.nanoframework.commons.loader.LoaderException;
import org.nanoframework.commons.loader.PropertiesLoader;
import org.nanoframework.commons.support.logging.Logger;
import org.nanoframework.commons.support.logging.LoggerFactory;
import org.nanoframework.orm.jedis.GlobalRedisClient;
import org.nanoframework.orm.jedis.RedisClient;
import org.nanoframework.orm.jedis.RedisClientPool;
import org.nanoframework.orm.jedis.cluster.HashTest;

import com.alibaba.fastjson.JSON;

/**
 *
 * @author yanghe
 * @since 1.3.15
 */
public class ShardedInfoTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(HashTest.class);

    protected RedisClient redisClient;

    @Before
    public void before() throws LoaderException, IOException {
        if (redisClient == null) {
            Properties prop = PropertiesLoader.load("/redis-test.properties");
            RedisClientPool.POOL.initRedisConfig(prop).createJedis();
            RedisClientPool.POOL.bindGlobal();
            redisClient = GlobalRedisClient.get("sharded");
        }
    }
    
    @Test
    public void infoTest() {
        LOGGER.debug(JSON.toJSONString(redisClient.info()));
    }
    
    @Test
    public void infoSectionTest() {
        LOGGER.debug(JSON.toJSONString(redisClient.info("memory")));
    }
}

@@ -1207,16 +1207,83 @@
 ashTest;
+%0Aimport org.nanoframework.orm.jedis.exception.RedisClientException;
 %0A%0Aimport
@@ -1929,32 +1929,50 @@
 id infoTest() %7B%0A
+        try %7B%0A    
         LOGGER.d
@@ -2012,24 +2012,229 @@
 t.info()));%0A
+        %7D catch (final Throwable e) %7B%0A            if (!(e instanceof RedisClientException)) %7B%0A                throw e;%0A            %7D%0A            %0A            LOGGER.error(%22Redis Server not up%22);%0A        %7D%0A
     %7D%0A    %0A 
@@ -2270,32 +2270,50 @@
 SectionTest() %7B%0A
+        try %7B%0A    
         LOGGER.d
@@ -2361,20 +2361,225 @@
 memory%22)));%0A
+        %7D catch (final Throwable e) %7B%0A            if (!(e instanceof RedisClientException)) %7B%0A                throw e;%0A            %7D%0A            %0A            LOGGER.error(%22Redis Server not up%22);%0A        %7D%0A
     %7D%0A%7D%0A

修改Jedis ShardedInfoTest中没有对异常处理导致travis编译失败的问题