package com.nokia;

import java.io.FileReader;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.nokia.pojo.TousuSheet;
import com.nokia.service.EsbNettyService;

@SpringBootTest
public class EsbSocketApplicationTest {

    @Autowired
    private EsbNettyService service;

    @Autowired
    private ObjectMapper objectMapper;

    @Test
    void test1() throws IOException, InterruptedException {
        TousuSheet tousuSheet = objectMapper.readValue(new FileReader("D:/src/toususheet.json"), TousuSheet.class);
        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        for (int i = 0; i < 1; i++) {
            tousuSheet.setKfsn("kfsn" + format.format(new Date()) + i);
            service.send(tousuSheet);
            Thread.sleep(10);
            // System.out.println("发送。。。" + tousuSheet.getKfsn());
        }
        System.in.read();
    }

}
