Search in sources :

Example 11 with DeployHistoryPO

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());
}
Also used : ProjectModule(com.ibeiliao.deployment.admin.vo.project.ProjectModule) ServerGroup(com.ibeiliao.deployment.admin.vo.server.ServerGroup) Server(com.ibeiliao.deployment.admin.vo.server.Server) ServerDeployHistoryPO(com.ibeiliao.deployment.admin.po.deploy.ServerDeployHistoryPO) DeployHistoryPO(com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO) ServerDeployHistoryPO(com.ibeiliao.deployment.admin.po.deploy.ServerDeployHistoryPO) AdminAccount(com.ibeiliao.deployment.admin.vo.account.AdminAccount)

Example 12 with DeployHistoryPO

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;
}
Also used : DeployHistoryPO(com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO) Date(java.util.Date)

Example 13 with DeployHistoryPO

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);
}
Also used : DeployHistoryPO(com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO) Test(org.junit.Test)

Aggregations

DeployHistoryPO (com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO)13 ServerDeployHistoryPO (com.ibeiliao.deployment.admin.po.deploy.ServerDeployHistoryPO)10 DeployHistory (com.ibeiliao.deployment.admin.vo.deploy.DeployHistory)2 ServerDeployHistory (com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory)2 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)2 Server (com.ibeiliao.deployment.admin.vo.server.Server)2 Test (org.junit.Test)2 AdminAccount (com.ibeiliao.deployment.admin.vo.account.AdminAccount)1 Project (com.ibeiliao.deployment.admin.vo.project.Project)1 ServerGroup (com.ibeiliao.deployment.admin.vo.server.ServerGroup)1 Date (java.util.Date)1 Transactional (org.springframework.transaction.annotation.Transactional)1