use of com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO in project Corgi by kevinYin.
the class DeployHistoryServiceImpl method createAndSaveRestart.
private DeployHistoryPO createAndSaveRestart(long accountId, String title, int serverId) {
Server server = serverService.getById(serverId);
AdminAccount account = adminAccountService.getById(accountId);
Assert.notNull(server, "服务器不存在");
Assert.notNull(account, "管理员不存在");
ServerGroup serverGroup = serverGroupService.getById(server.getGroupId());
ProjectModule module = projectModuleService.getByModuleId(serverGroup.getModuleId());
DeployHistoryPO po = new DeployHistoryPO();
po.setTagName("");
po.setAccountId(accountId);
po.setAuditorId(0);
po.setTitle(title);
po.setCreateTime(new Date());
po.setDeployStatus(DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
po.setAuditTime(po.getCreateTime());
po.setDeployServers(1);
po.setProjectId(module.getProjectId());
po.setModuleId(module.getModuleId());
po.setModuleName(module.getModuleName());
po.setVersionNo("");
po.setIsRestart(Constants.TRUE);
po.setEnvId(serverGroup.getEnvId());
po.setRealName(account.getRealname());
deployHistoryDao.insert(po);
ServerDeployHistoryPO serverDeployHistoryPO = new ServerDeployHistoryPO();
serverDeployHistoryPO.setHistoryId(po.getHistoryId());
serverDeployHistoryPO.setServerId(serverId);
serverDeployHistoryPO.setServerName(server.getServerName());
serverDeployHistoryPO.setServerIp(server.getIp());
serverDeployHistoryPO.setDeployStatus(ServerDeployResult.WAITING_FOR_DEPLOYMENT.getValue());
serverDeployHistoryDao.insert(serverDeployHistoryPO);
return deployHistoryDao.get(po.getHistoryId());
}
use of com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO in project Corgi by kevinYin.
the class DeployHistoryDaoTest method createDeployHistoryPO.
private DeployHistoryPO createDeployHistoryPO() {
DeployHistoryPO po = new DeployHistoryPO();
po.setRealName("andy");
po.setProjectId(1);
po.setVersionNo("123");
po.setEnvId(1);
po.setAccountId(1);
po.setConcurrentServerPercentage((short) 50);
po.setTitle("test-1");
po.setTagName("/tags/20170201");
po.setDeployStatus(DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
po.setResult(DeployResult.NONE.getValue());
po.setModuleId(1);
po.setModuleName("module-1");
po.setDeployTimeInterval((short) 20);
po.setDeployServers(1);
po.setSuccessCount(0);
po.setCreateTime(new Date());
return po;
}
use of com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO in project Corgi by kevinYin.
the class DeployHistoryDaoTest method testUpdateStatusAndResult.
@Test
public void testUpdateStatusAndResult() {
DeployHistoryPO po = createDeployHistoryPO();
deployHistoryDao.insert(po);
assertTrue(po.getHistoryId() > 0);
DeployHistoryPO tmp = deployHistoryDao.get(po.getHistoryId());
assertEq(po, tmp);
short newStatus = DeployStatus.DEPLOYED.getValue();
short result = DeployResult.SUCCESS.getValue();
int success = po.getDeployServers();
int rows = deployHistoryDao.updateResultAndStatus(po.getHistoryId(), result, po.getDeployServers(), success, newStatus, po.getDeployStatus());
assertTrue(rows > 0);
tmp = deployHistoryDao.get(po.getHistoryId());
assertTrue(tmp.getDeployStatus() == newStatus);
assertTrue(tmp.getResult() == result);
assertTrue(tmp.getSuccessCount() == success);
}
Aggregations