|
@@ -0,0 +1,77 @@
|
|
|
+/*
|
|
|
+ * *************************************************
|
|
|
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
|
|
|
+ * Created by Deason on 2018-10-29 14:38:16.
|
|
|
+ * *************************************************
|
|
|
+ */
|
|
|
+
|
|
|
+package cn.com.qmth.examcloud.core.print.test;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.core.print.PrintApplication;
|
|
|
+import cn.com.qmth.examcloud.core.print.common.utils.JsonMapper;
|
|
|
+import cn.com.qmth.examcloud.core.print.entity.ProjectBackupSetting;
|
|
|
+import cn.com.qmth.examcloud.core.print.entity.ProjectOtherSetting;
|
|
|
+import cn.com.qmth.examcloud.core.print.enums.BackupGroupType;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.ProjectBackupSettingService;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.ProjectOtherSettingService;
|
|
|
+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.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: fengdesheng
|
|
|
+ * @since: 2018/10/17
|
|
|
+ */
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest(classes = PrintApplication.class)
|
|
|
+public class ProjectSettingServiceTest {
|
|
|
+ @Autowired
|
|
|
+ private ProjectBackupSettingService projectBackupSettingService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectOtherSettingService projectOtherSettingService;
|
|
|
+ private final Long projectId = 1L;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void saveProjectBackupSettingTest() throws Exception {
|
|
|
+ ProjectBackupSetting setting = new ProjectBackupSetting();
|
|
|
+ setting.setProjectId(projectId);
|
|
|
+ setting.setPkgPercent(0.5D);
|
|
|
+ setting.setPkgMax(0.5D);
|
|
|
+ setting.setPkgMin(0.5D);
|
|
|
+ setting.setGroupType(BackupGroupType.EXAM_SITE);
|
|
|
+ setting.setPkgSinglePercent(0.5D);
|
|
|
+ setting.setPkgSingleMax(0.5D);
|
|
|
+ setting.setPkgSingleMin(0.5D);
|
|
|
+ projectBackupSettingService.saveProjectBackupSetting(setting);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void getProjectBackupSettingTest() throws Exception {
|
|
|
+ ProjectBackupSetting setting = projectBackupSettingService.getProjectBackupSettingById(projectId);
|
|
|
+ System.out.println(new JsonMapper().toJson(setting));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void saveProjectOtherSettingTest() throws Exception {
|
|
|
+ ProjectOtherSetting setting = new ProjectOtherSetting();
|
|
|
+ setting.setId(1L);
|
|
|
+ setting.setProjectId(projectId);
|
|
|
+ setting.setRemark("test");
|
|
|
+ projectOtherSettingService.saveProjectOtherSetting(setting);
|
|
|
+ //projectOtherSettingService.deleteProjectOtherSettingById(1L);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void getProjectOtherSettingTest() throws Exception {
|
|
|
+ List<ProjectOtherSetting> settings = projectOtherSettingService.getProjectOtherSettingList(projectId);
|
|
|
+ System.out.println(new JsonMapper().toJson(settings));
|
|
|
+
|
|
|
+ ProjectOtherSetting setting = projectOtherSettingService.getProjectOtherSettingById(1L);
|
|
|
+ System.out.println(new JsonMapper().toJson(setting));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|