package io.geekidea.springbootplus.test;
import java.util.Date;

import cn.hutool.core.codec.Base64;
import com.wecloud.im.entity.ImClient;
import com.wecloud.im.entity.ImIosApns;
import com.wecloud.im.friend.entity.ImFriend;
import com.wecloud.im.friend.service.ImFriendService;
import com.wecloud.im.service.ImClientService;
import com.wecloud.im.service.ImIosApnsService;
import com.wecloud.utils.SnowflakeUtil;
import io.geekidea.springbootplus.SpringBootPlusApplication;
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.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;


@SpringBootTest(classes = SpringBootPlusApplication.class)
@RunWith(SpringRunner.class)
public class AddUserTest {


    @Autowired
    private ImClientService imClientService;

    @Autowired
    private ImFriendService imFriendService;

    @Test
    public void test() throws Exception {

        Long begin = 300000000000000003L;
        Long end = 300000000000000203L;

        int a = 3;
        for (long i= begin; i <= end; i++) {
            ImClient imClient = new ImClient();
            imClient.setId(begin);
            imClient.setCreateTime(new Date());
            imClient.setLastOfflineTime(new Date());
            imClient.setUpdateTime(new Date());
            imClient.setFkAppid(1L);
            imClient.setAttributes(null);
            imClient.setClientId(begin+"");
            imClient.setHeadPortrait(null);
            imClient.setNickname("阿萨姆" + a);
            a ++;
            imClientService.save(imClient);

            ImFriend imFriend1 = new ImFriend();
            imFriend1.setId(SnowflakeUtil.getId());
            imFriend1.setClientId(begin + "");
            imFriend1.setClientIdFriend("1588082807551512576");
            imFriend1.setClientIdClaimer("1588082807551512576");
            imFriend1.setFriendName("");
            imFriend1.setRejectRemark("");
            imFriend1.setRequestRemark("");
            imFriend1.setState(2);
            imFriend1.setCreateTime(new Date());
            imFriend1.setUpdateTime(new Date());
            imFriendService.save(imFriend1);

            ImFriend imFriend2 = new ImFriend();
            imFriend1.setId(SnowflakeUtil.getId());
            imFriend1.setClientId("1588082807551512576");
            imFriend1.setClientIdFriend(begin + "");
            imFriend1.setClientIdClaimer("1588082807551512576");
            imFriend1.setFriendName("");
            imFriend1.setRejectRemark("");
            imFriend1.setRequestRemark("");
            imFriend1.setState(2);
            imFriend1.setCreateTime(new Date());
            imFriend1.setUpdateTime(new Date());
            imFriendService.save(imFriend2);
        }

    }
}
