package com.tax.file.test;


import com.tax.file.model.DownFileModel;
import com.tax.file.model.TkTaxUser;
import com.tax.file.mq.rabbit.producer.RabbitMQMessageProducer;
import com.tax.file.service.async.apply.AsyncTkFileApplyService;
import com.tax.file.service.async.apply.FileApplyTask;
import com.tax.file.service.async.down.FileDownTask;
import com.tax.file.startup.FileStartupApplication;
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 java.util.Date;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = FileStartupApplication.class)
public class TestApplyDownFile {

    @Autowired
    private FileApplyTask fileApplyTask;
    @Autowired
    private FileDownTask downTask;

//    @Autowired
//    private RabbitMQMessageProducer producer;

    @Autowired
    private AsyncTkFileApplyService asyncTkFileApplyService;


    @Test
    public void testProducer(){
        DownFileModel model = new DownFileModel();
//        TkTaxUser model = new TkTaxUser();
//        producer.sendFixDownFileTopic(model);
//        producer.sendDownFileTopic(model);
//        producer.sendApplyDownFileTopic(model);
    }
    @Test
    public void testApply(){
        TkTaxUser taxUser = new TkTaxUser();
        taxUser.setTaxno("91330203MA2CJQDD5P");
        taxUser.setApplyDownDate(new Date());
        taxUser.setInit("1");
        taxUser.setServerNo("T00002");
        taxUser.setInvSpec("0");
        taxUser.setInvType("1=1=1=1=1=1=1=1=1=1=1=1=1");
        asyncTkFileApplyService.execute(taxUser);
    }


//    @Test
//    public void run(){
//        fileApplyTask.applyDownFile();
//    }
//
//    @Test
//    public void down(){
//        downTask.downFile();
//    }
}
