package com.seecoder.dataanalysis; import com.seecoder.dataanalysis.data.dao.competency.CompetencyTreeDao; import com.seecoder.dataanalysis.data.entity.competency.CompetencyTree; import com.seecoder.dataanalysis.data.entity.competency.DScore; import com.seecoder.dataanalysis.data.entity.competency.KSDScore; import com.seecoder.dataanalysis.data.entity.competency.KSScore; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.*; @SpringBootTest class DataAnalysisApplicationTests { @Test void contextLoads() { } @Autowired private CompetencyTreeDao competencyTreeDao; @Test void saveTree(){ List L1 = new ArrayList<>(); List L2 = new ArrayList<>(); KSScore ksScore = new KSScore() .setKnowledge("test1") .setSkillsAndScore(null); DScore dScore = new DScore() .setName("active") .setScore(10.0); L1.add(ksScore); L2.add(dScore); KSDScore ksdScore = new KSDScore() .setCompetency("test") .setTotalScore(1000.0) .setDScore(L2) .setKSScore(L1); List L3 = new ArrayList<>(); L3.add(ksdScore); CompetencyTree competencyTree = new CompetencyTree() .setCompetencyId(1) .setStudentId(1) .setSubCompetencyTree(L3); competencyTreeDao.save(competencyTree); } // @Autowired // private TestMongoDBStudentDao testMongoDBStudentDao; // // @Test // void addOneStudent(){ //// 插入10行 // TestMongoDBStudent pre = null; // for (Integer count = 0; count < 10; count++) { // TestMongoDBStudent student = new TestMongoDBStudent() // .setStudentId("student_"+count) //如果自己不去设置id则系统会分配给一个id // .setStudentName("Godfery"+count) // .setStudentAge(count) // .setStudentScore(98.5-count) // .setStudentBirthday(new Date()) // .setDeskMate(pre); // pre = student; // testMongoDBStudentDao.save(student); // } // } // @Test // void deleteOneStudentByStudentId(){ //// 删除id为student_0的学生 // studentDaoTypeOne.deleteById("student_0"); // } // // @Test // void updateOneStudent(){ //// 修改姓名为Godfery1的Student年龄为22 // Student student = studentDaoTypeOne.getAllByStudentName("Godfery1"); // student.setStudentAge(22); // studentDaoTypeOne.save(student); // // } // // @Test // void getOneStudentByStudentId(){ // System.out.println(testMongoDBStudentDao.findById("student_2")); // } // // @Test // void getAllStudent(){ // List studentList = studentDaoTypeOne.findAll(); // studentList.forEach(System.out::println); // } }