package com.liquidnet.service.galaxy;

import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.galaxy.constant.GalaxyConstant;
import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyUserInfoBo;
import com.liquidnet.service.galaxy.utils.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author AnJiabin <anjiabin@zhengzai.tv>
 * @version V1.0
 * @Description: TODO
 * @class: TestRedisUtil
 * @Package com.liquidnet.service.galaxy
 * @Copyright: LightNet @ Copyright (c) 2021
 * @date 2022/3/15 16:26
 */
@Slf4j
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class TestRedisUtil {
//    @Autowired
//    private RedisDataSourceUtil redisUtil;

    @Autowired
    private RedisUtil redisUtil;

    private long keyExpireTime = 3600*24*30;

    @Autowired
    private DataUtils dataUtils;


    @Test
    public void testSet(){
        String userId = "test123";
        GalaxyUserInfoBo userInfoBo = GalaxyUserInfoBo.getNew();
        userInfoBo.setUserId(userId);

        String key = GalaxyConstant.REDIS_KEY_GALAXY_USER.concat(GalaxyEnum.RouterTypeEnum.ZXINCHAIN.getCode()).concat(":") + userId;
//        redisUtil.getRedisGalaxyUtil().set(key,userInfoBo,keyExpireTime);
    }
    @Test
    public void testGetNftIdNo(){
        String routerType = "zxinchain";
        String skuId = "1234567890-sku-010";
//        redisUtil.set(GalaxyConstant.REDIS_KEY_GALAXY_PUBLISH_NFT.concat(routerType).concat(":").concat(skuId),2000);


        long nftIdNo = dataUtils.incrNftIdNo(routerType,skuId);
//        long nftIdNo = dataUtils.getNftIdNo(routerType,skuId);
        System.out.println("skuId:"+skuId+" no:"+nftIdNo+" ");
    }

}
