| | |
| | | |
| | | import org.junit.jupiter.api.Assertions; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springblade.mdm.gkw.task.entity.MachineBackTask; |
| | | import org.springblade.mdm.machinefile.entity.FileSendRecord; |
| | | import org.springblade.mdm.program.service.programannotation.AnnotationUtil; |
| | | import org.springblade.mdm.program.vo.MdmProgramImportVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class MdmProgramImportServiceTest { |
| | |
| | | System.out.println(list); |
| | | } |
| | | |
| | | @Test |
| | | public void testParseMachineBackTask() { |
| | | FileSendRecord record = new FileSendRecord(); |
| | | record.setMachineCode("123"); |
| | | record.setName("T-A-B-1-1.txt"); |
| | | record.setProgramStatus(AnnotationUtil.SQ); |
| | | |
| | | MdmProgramImportService service= new MdmProgramImportService(); |
| | | |
| | | List<MachineBackTask> tasks = service.parseMachineBackTask(List.of(record)); |
| | | |
| | | Assertions.assertEquals(1, tasks.size()); |
| | | MachineBackTask task = tasks.get(0); |
| | | Assertions.assertEquals("123", task.getMachineCode()); |
| | | Assertions.assertEquals("T-A-B",task.getProgramName()); |
| | | Assertions.assertEquals(1,task.getSegCount()); |
| | | FileSendRecord record2 = new FileSendRecord(); |
| | | BeanUtils.copyProperties(task, record2); |
| | | |
| | | //相同数据的文件,也是一个task |
| | | tasks = service.parseMachineBackTask(List.of(record,record2)); |
| | | Assertions.assertEquals(1, tasks.size()); |
| | | task = tasks.get(0); |
| | | Assertions.assertEquals("123", task.getMachineCode()); |
| | | Assertions.assertEquals("T-A-B",task.getProgramName()); |
| | | } |
| | | } |