|
|
@@ -5,13 +5,13 @@ import cn.reghao.devops.web.mgr.app.db.repository.AppBuildingRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.AppDeployingRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.config.AppConfigRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.config.AppDeployConfigRepository;
|
|
|
+import cn.reghao.devops.web.mgr.app.db.repository.log.BuildLogRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.AppDeploying;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.AppDeployingNode;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.config.AppConfig;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.config.AppDeployConfig;
|
|
|
-import cn.reghao.devops.web.admin.sys.service.NotifyService;
|
|
|
-import cn.reghao.devops.web.admin.sys.db.repository.EmailAccountRepository;
|
|
|
-import cn.reghao.devops.web.admin.sys.db.repository.NotifyReceiverRepository;
|
|
|
+import cn.reghao.devops.web.mgr.app.model.po.log.BuildConsumed;
|
|
|
+import cn.reghao.devops.web.mgr.app.model.po.log.BuildLog;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
@@ -31,21 +31,6 @@ import java.util.List;
|
|
|
@SpringBootTest(classes = WebApplication.class)
|
|
|
@RunWith(SpringRunner.class)
|
|
|
public class AppConfigTest {
|
|
|
- @Autowired
|
|
|
- NotifyReceiverRepository notifyReceiverRepository;
|
|
|
- @Autowired
|
|
|
- EmailAccountRepository emailAccountRepository;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void initNotifyTest() throws InterruptedException {
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- NotifyService notifyService;
|
|
|
- @Test
|
|
|
- public void notifyTest() throws InterruptedException {
|
|
|
- }
|
|
|
-
|
|
|
@Autowired
|
|
|
AppBuildingRepository buildingRepository;
|
|
|
@Autowired
|
|
|
@@ -88,4 +73,43 @@ public class AppConfigTest {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ BuildLogRepository buildLogRepository;
|
|
|
+ @Test
|
|
|
+ public void buildLogTest() {
|
|
|
+ List<BuildLog> buildLogs = buildLogRepository.findAll();
|
|
|
+ buildLogs.forEach(buildLog -> {
|
|
|
+ BuildConsumed buildConsumed = buildLog.getBuildConsumed();
|
|
|
+ if (buildConsumed == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Long l1 = buildConsumed.getPullConsumed();
|
|
|
+ Long l2 = buildConsumed.getCompileConsumed();
|
|
|
+ Long l3 = buildConsumed.getPackConsumed();
|
|
|
+ Long l4 = buildConsumed.getPushConsumed();
|
|
|
+
|
|
|
+ Long total = 0L;
|
|
|
+ if (l1 != null) {
|
|
|
+ total += l1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (l2 != null) {
|
|
|
+ total += l2;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (l3 != null) {
|
|
|
+ total += l3;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (l4 != null) {
|
|
|
+ total += l3;
|
|
|
+ }
|
|
|
+
|
|
|
+ buildConsumed.setTotal(total/1000);
|
|
|
+ });
|
|
|
+
|
|
|
+ buildLogRepository.saveAll(buildLogs);
|
|
|
+ }
|
|
|
}
|