|
@@ -0,0 +1,70 @@
|
|
|
|
|
+package seecoder.devcloud.web.dao.project;
|
|
|
|
|
+
|
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
+import org.mybatis.spring.annotation.MapperScan;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
+import seecoder.devcloud.web.model.enums.CommitRelatedType;
|
|
|
|
|
+import seecoder.devcloud.web.model.po.project.CommitPO;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author PuHong Weng
|
|
|
|
|
+ * @date 2021/3/24
|
|
|
|
|
+ * @description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
|
|
+@SpringBootTest
|
|
|
|
|
+@MapperScan(basePackages = {"seecoder.devcloud.web.dao"})
|
|
|
|
|
+class CommitMapperTest {
|
|
|
|
|
+
|
|
|
|
|
+ private final CommitMapper commitMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ CommitMapperTest(CommitMapper commitMapper) {
|
|
|
|
|
+ this.commitMapper = commitMapper;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void insert() {
|
|
|
|
|
+ CommitPO commitPO = CommitPO.builder()
|
|
|
|
|
+ .id("esdadafs")
|
|
|
|
|
+ .gitlabUsername("cool")
|
|
|
|
|
+ .message("fefefefeat")
|
|
|
|
|
+ .title("feat: nononono")
|
|
|
|
|
+ .projectId(2)
|
|
|
|
|
+ .relatedId(3)
|
|
|
|
|
+ .relatedType(CommitRelatedType.BUG_ID)
|
|
|
|
|
+ .timestamp("2012-01-03T23:36:29+02:00")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ commitMapper.insert(commitPO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void update() {
|
|
|
|
|
+ CommitPO commitPO = CommitPO.builder()
|
|
|
|
|
+ .id("esdadafs")
|
|
|
|
|
+ .gitlabUsername("not cool")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ commitMapper.update(commitPO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void selectByProjectIdAndType() {
|
|
|
|
|
+ System.out.println(commitMapper.selectByProjectIdAndType(2,CommitRelatedType.BUG_ID));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void isExist() {
|
|
|
|
|
+ System.out.println(commitMapper.isExist("esdadafs"));
|
|
|
|
|
+ System.out.println(commitMapper.isExist("12"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void timestamp() {
|
|
|
|
|
+ String t = "2012-01-03T23:36:29+02:00";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|