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.dao.WaveBillDMapper;
import com.prolog.cs.biz.outbound.model.entity.WaveBillDDO;
import com.prolog.framework.authority.util.HystrixVarUtil;
import com.prolog.framework.core.restriction.Criteria;
import com.prolog.framework.core.restriction.RestrictionBuilder;
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.Arrays;
import java.util.HashSet;
import java.util.List;

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

    @Autowired
    private WaveDistributeServiceImpl WaveDistributeServiceImpl;


    @Autowired
    WaveBillDMapper billDMapper;
    
    @Before
    public void before() throws Exception { 
        HystrixRequestContext context = HystrixRequestContext.initializeContext();
        HystrixVarUtil.setUserKey("kzywms-admin");
    } 
    
    @After
    public void after() throws Exception { 
    } 

    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.init()));
    public void testInit() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.getWavesAll()));
    public void testGetWavesAll() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.distributeWave()));
    public void testDistributeWave() throws Exception { 
        
    } 
    @Test//
    public void testAlertNear() throws Exception {
        Criteria crt = Criteria.forClass(WaveBillDDO.class);
        RestrictionBuilder builder = crt.restrictionBuilder();
        builder.in("billId", new String[]{"721049212015480832","721055010628177920"});
        crt.buildRestriction();
        List<WaveBillDDO> billDDOS = billDMapper.findByCriteria(crt);
        System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.
                alertNear("599581702716788736","E23A4BUUPPW", billDDOS)));
    }
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.waveTaskTrial()));
    public void testWaveTaskTrial() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.processTaskNum()));
    public void testProcessTaskNum() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.getTaskNum()));
    public void testGetTaskNum() throws Exception { 
        
    } 
    @Test//System.out.println(JSON.toJSONString(WaveDistributeServiceImpl.calculusWorkspaces()));
    public void testCalculusWorkspaces() throws Exception { 
        
    } 
        
} 
