package cd.casic.server;

import cd.casic.ci.process.util.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;

@SpringBootTest(classes = {OpsServerApplication.class})
@ActiveProfiles("local")
@Slf4j
public class FileUtilTest {
    @Test
    public void testMd5() throws IOException, NoSuchAlgorithmException {
        FileInputStream fis = new FileInputStream("D:\\博彦科技-项目相关\\ops-pro\\ops-server\\target\\ops-server.jar");
        String md5Str = FileUtil.getMD5Str(fis);
        System.out.println(md5Str);
        FileInputStream fis2 = new FileInputStream("D:\\博彦科技-项目相关\\ops-pro\\ops-server\\src\\test\\resources\\javaaaaa.zip");
        String md5Str2 = FileUtil.getMD5Str(fis2);
        System.out.println(md5Str2);
        System.out.println(md5Str.equals(md5Str2));
    }
}
