package com.prolog.cs.biz.outbound.service.impl; 

import com.alibaba.fastjson.JSON;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;
import com.prolog.cs.biz.outbound.model.dto.WaveDistributeDTO;
import com.prolog.cs.biz.outbound.model.dto.WavesCreateDTO;
import com.prolog.framework.authority.util.HystrixVarUtil;
import org.junit.After;
import org.junit.Before;
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.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
@WebAppConfiguration 
public class WavesServiceImplTest { 

    @Autowired
    private WavesServiceImpl WavesServiceImpl;
    
    @Before
    public void before() throws Exception { 
        HystrixRequestContext context = HystrixRequestContext.initializeContext();
        HystrixVarUtil.setUserKey("jxyj");
    } 
    
    @After
    public void after() throws Exception { 
    } 

    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.init()));
    public void testInit() throws Exception { 
        
    }

    @Test//
    public void testWaveDistribute() throws Exception {//
        WaveDistributeDTO vo=new WaveDistributeDTO();
        //vo.setWavesIds(new ArrayList<String>(){{add("709151844726870016");}});
        //vo.setWavesIds(new ArrayList<String>(){{add("709086462968205312");}});
        vo.setWavesIds(new ArrayList<String>(){{add("712317094217256960");}});
        vo.setWavesIds(new ArrayList<String>(){{add("713402511263928320");}});
        System.out.println(JSON.toJSONString(WavesServiceImpl.waveDistribute(vo)));
    }
    @Test//
    public void testWaveTaskTrial() throws Exception {
        WaveDistributeDTO vo=new WaveDistributeDTO();
        //vo.setWavesIds(new ArrayList<String>(){{add("709151844726870016");}});
        //vo.setWavesIds(new ArrayList<String>(){{add("709086462968205312");}});
        //vo.setWavesIds(new ArrayList<String>(){{add("709151844726870016");}});
        //vo.setWavesIds(new ArrayList<String>(){{add("713434910022569984");}});
        vo.setWavesIds(new ArrayList<String>(){{add("821063390259712000");}});
        System.out.println(JSON.toJSONString(WavesServiceImpl.waveTaskTrial(vo)));
        System.out.println("11111");
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getWaves()));
    public void testGetWaves() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getBillsByWaveId()));
    public void testGetBillsByWaveId() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getBillVo()));
    public void testGetBillVo() throws Exception { 
        
    } 
    @Test//
    public void testGetItemsByBillId() throws Exception {
        System.out.println(JSON.toJSONString(WavesServiceImpl.getItemsByBillId("619532806070079489",1)));
    } 
    @Test//
    public void testCancelBillById() throws Exception {
        System.out.println(JSON.toJSONString(WavesServiceImpl.cancelBillById("706936350598893568")));
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.retryBillById()));
    public void testRetryBillById() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getStatistics()));
    public void testGetStatistics() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.queryWaveMonitor()));
    public void testQueryWaveMonitor() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.calculateMonitorQuantity()));
    public void testCalculateMonitorQuantity() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getWavesByStatus()));
    public void testGetWavesByStatus() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getWaveLocatorInfo()));
    public void testGetWaveLocatorInfo() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getWaveWorkStage()));
    public void testGetWaveWorkStage() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.deleteByWaveId()));
    public void testDeleteByWaveId() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getPendingBills()));
    public void testGetPendingBills() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.preCalculate()));
    public void testPreCalculate() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.wavesCreate()));
    public void testWavesCreate() throws Exception {
        WavesCreateDTO wavesCreateVO=new WavesCreateDTO();
        wavesCreateVO.setWarehouseId("646346467442823168");
        wavesCreateVO.setWarehouseId("599581702716788736");
        List<String> paramList = new ArrayList<>();
//        paramList.add("BHZFT000006");
//        paramList.add("BHZFT000007");
        paramList.add("JXQ00008");
        wavesCreateVO.setBillIdList(paramList);
        WavesServiceImpl.wavesCreate(wavesCreateVO);
    }
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getBillHList()));
    public void testGetBillHList() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getBillDByBillId()));
    public void testGetBillDByBillId() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WavesServiceImpl.getWaveBills()));
    public void testGetWaveBills() throws Exception { 
        
    } 
        
} 
