Parcourir la source

修改测试用例

sunjh il y a 5 ans
Parent
commit
91e445f8f7

+ 0 - 1
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/service/impl/CaseExportServiceImpl.java

@@ -109,7 +109,6 @@ public class CaseExportServiceImpl implements CaseExportService {
         res.put("mysqlFile",maps);
         res.put("targetIds",targetIds);
         res.put("code",0);
-        //fileMap.put("mysqlFile", maps);
         return res;
     }
 

+ 0 - 8
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/CaseExportLogicImpl.java

@@ -18,18 +18,12 @@ import java.util.Map;
 public class CaseExportLogicImpl implements CaseExportLogic, Serializable {
 
     @Autowired
-    private MongoDBConfiguration mongoDBConfiguration;
-
-    @Autowired
     private CaseExportService caseExportService;
 
     @Override
     public Map<String, Object> exportCases(List<Long> caseIds, String filePath, String zipFileName, String fileName) {
         String ossFilePath = "download/";
         Map<String, Object> fileMap = new HashMap<>();
-        String mongoUrl = "http://" + mongoDBConfiguration.getHost() + ":" + mongoDBConfiguration.getPort() + "/";
-        String getCaseUrl = mongoUrl + mongoDBConfiguration.getDb() + "/" + mongoDBConfiguration.getCaseGraghCollection();
-        String getTargetUrl = mongoUrl + mongoDBConfiguration.getDb() + "/" + mongoDBConfiguration.getTargetGraphCollection();
         String tempFilePath = filePath + "temp/";
         String zipFilePath = filePath + zipFileName;
         Map<String, Object> res = new HashMap<>();
@@ -41,7 +35,6 @@ public class CaseExportLogicImpl implements CaseExportLogic, Serializable {
         }
         try {
             //导出msyql
-            //TODO 去掉tempFilePath参数
             HashMap<String, Object> map = caseExportService.exportMysql(caseIds);
             targetIds = (List<Long>) map.get("targetIds");
             fileMap.put("mysqlFile", map.get("mysqlFile"));
@@ -53,7 +46,6 @@ public class CaseExportLogicImpl implements CaseExportLogic, Serializable {
         }
         try {
             //导出mongo
-            //TODO 去掉tempFilePath参数
             HashMap<String, Object> map = caseExportService.exportMongo(caseIds, targetIds);
             fileMap.put("mongoCaseFile", map.get("mongoCaseFile"));
             fileMap.put("mongoTargetFile", map.get("mongoTargetFile"));

+ 2 - 2
mooctest-site-server/src/test/java/cn/iselab/mooctest/site/service/impl/CaseExportServiceImplTest.java

@@ -68,7 +68,7 @@ public class CaseExportServiceImplTest {
         when(caseExtends2Service.getCaseExtends2ById(anyLong())).thenReturn(new CaseExtends2());
         when(targetService.getTargetByCaseId(anyLong())).thenReturn(new Target());
         when(targetService.getTargetProperties(anyLong())).thenReturn(new LinkedList<>());
-        HashMap<String,Object> res = caseExportServiceImpl.exportMysql(caseIds,"");
+        HashMap<String,Object> res = caseExportServiceImpl.exportMysql(caseIds);
         Assert.assertEquals((int) expectMysqlMap.get("code"),(int) res.get("code"), 0);
 
     }
@@ -90,7 +90,7 @@ public class CaseExportServiceImplTest {
         caseIds.add(670L);
         targetIds.add(662L);
         try {
-            Map<String,Object> res = caseExportServiceImpl.exportMongo(caseIds,targetIds,"","","");
+            Map<String,Object> res = caseExportServiceImpl.exportMongo(caseIds,targetIds);
             Assert.assertEquals(0,res.get("code"));
         }catch (Exception e){
 

+ 2 - 2
mooctest-site-server/src/test/java/cn/iselab/mooctest/site/web/logic/impl/CaseExportLogicImplTest.java

@@ -63,8 +63,8 @@ public class CaseExportLogicImplTest extends AbstractShiroTest {
 
     @Test
     public void should_returnStringObjectMap_when_exportCases() throws Exception {
-        when(caseExportService.exportMysql(anyList(),anyString())).thenReturn(expectMysqlMap);
-        when(caseExportService.exportMongo(anyList(),anyList(),anyString(),anyString(),anyString())).thenReturn(exceptMongoMap);
+        when(caseExportService.exportMysql(anyList())).thenReturn(expectMysqlMap);
+        when(caseExportService.exportMongo(anyList(),anyList())).thenReturn(exceptMongoMap);
         when(mongoDBConfiguration.getHost()).thenReturn("");
         when(mongoDBConfiguration.getDb()).thenReturn("");
         when(mongoDBConfiguration.getCaseGraghCollection()).thenReturn("");