DataAnalysisApplicationTests.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.seecoder.dataanalysis;
  2. import com.seecoder.dataanalysis.data.dao.competency.CompetencyTreeDao;
  3. import com.seecoder.dataanalysis.data.entity.competency.CompetencyTree;
  4. import com.seecoder.dataanalysis.data.entity.competency.DScore;
  5. import com.seecoder.dataanalysis.data.entity.competency.KSDScore;
  6. import com.seecoder.dataanalysis.data.entity.competency.KSScore;
  7. import org.junit.jupiter.api.Test;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.boot.test.context.SpringBootTest;
  10. import java.util.*;
  11. @SpringBootTest
  12. class DataAnalysisApplicationTests {
  13. @Test
  14. void contextLoads() {
  15. }
  16. @Autowired
  17. private CompetencyTreeDao competencyTreeDao;
  18. @Test
  19. void saveTree(){
  20. List<KSScore> L1 = new ArrayList<>();
  21. List<DScore> L2 = new ArrayList<>();
  22. KSScore ksScore = new KSScore()
  23. .setKnowledge("test1")
  24. .setSkillsAndScore(null);
  25. DScore dScore = new DScore()
  26. .setName("active")
  27. .setScore(10.0);
  28. L1.add(ksScore);
  29. L2.add(dScore);
  30. KSDScore ksdScore = new KSDScore()
  31. .setCompetency("test")
  32. .setTotalScore(1000.0)
  33. .setDScore(L2)
  34. .setKSScore(L1);
  35. List<KSDScore> L3 = new ArrayList<>();
  36. L3.add(ksdScore);
  37. CompetencyTree competencyTree = new CompetencyTree()
  38. .setCompetencyId(1)
  39. .setStudentId(1)
  40. .setSubCompetencyTree(L3);
  41. competencyTreeDao.save(competencyTree);
  42. }
  43. // @Autowired
  44. // private TestMongoDBStudentDao testMongoDBStudentDao;
  45. //
  46. // @Test
  47. // void addOneStudent(){
  48. //// 插入10行
  49. // TestMongoDBStudent pre = null;
  50. // for (Integer count = 0; count < 10; count++) {
  51. // TestMongoDBStudent student = new TestMongoDBStudent()
  52. // .setStudentId("student_"+count) //如果自己不去设置id则系统会分配给一个id
  53. // .setStudentName("Godfery"+count)
  54. // .setStudentAge(count)
  55. // .setStudentScore(98.5-count)
  56. // .setStudentBirthday(new Date())
  57. // .setDeskMate(pre);
  58. // pre = student;
  59. // testMongoDBStudentDao.save(student);
  60. // }
  61. // }
  62. // @Test
  63. // void deleteOneStudentByStudentId(){
  64. //// 删除id为student_0的学生
  65. // studentDaoTypeOne.deleteById("student_0");
  66. // }
  67. //
  68. // @Test
  69. // void updateOneStudent(){
  70. //// 修改姓名为Godfery1的Student年龄为22
  71. // Student student = studentDaoTypeOne.getAllByStudentName("Godfery1");
  72. // student.setStudentAge(22);
  73. // studentDaoTypeOne.save(student);
  74. //
  75. // }
  76. //
  77. // @Test
  78. // void getOneStudentByStudentId(){
  79. // System.out.println(testMongoDBStudentDao.findById("student_2"));
  80. // }
  81. //
  82. // @Test
  83. // void getAllStudent(){
  84. // List<Student> studentList = studentDaoTypeOne.findAll();
  85. // studentList.forEach(System.out::println);
  86. // }
  87. }