Search in sources :

Example 1 with DeployHistory

use of com.ibeiliao.deployment.admin.vo.deploy.DeployHistory in project Corgi by kevinYin.

the class DeployHistoryServiceImplTest method testAudit.

/**
 * 测试审核发布
 * @param accountId
 * @param historyId
 */
private void testAudit(long accountId, int historyId) {
    DeployHistory history = deployHistoryService.getByHistoryId(historyId);
    assertTrue(history.getDeployStatus() == DeployStatus.WAITING_FOR_AUDIT.getValue());
    deployHistoryService.audit(accountId, historyId);
    history = deployHistoryService.getByHistoryId(historyId);
    assertTrue(history.getDeployStatus() == DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
}
Also used : DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory)

Example 2 with DeployHistory

use of com.ibeiliao.deployment.admin.vo.deploy.DeployHistory in project Corgi by kevinYin.

the class DeployHistoryServiceImplTest method testCreateRestartHistory.

/**
 * 测试 restart
 * 期望:测试通过
 */
@Test
public void testCreateRestartHistory() {
    InitTestDataService.InitData data = initTestDataService.init();
    long accountId = data.account.getUid();
    int serverId = data.module.getServerGroups().get(0).getServers().get(0).getServerId();
    DeployHistory deployHistory = deployHistoryService.createRestartHistory(accountId, serverId);
    validateStopRestart(data, deployHistory.getHistoryId(), serverId);
}
Also used : DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory) InitTestDataService(com.ibeiliao.deployment.admin.service.InitTestDataService) Test(org.junit.Test)

Example 3 with DeployHistory

use of com.ibeiliao.deployment.admin.vo.deploy.DeployHistory in project Corgi by kevinYin.

the class DeployHistoryServiceImplTest method testGetDeployHistory.

private void testGetDeployHistory(int historyId, DeploymentOrder order) {
    DeployHistory history = deployHistoryService.getByHistoryId(historyId);
    assertNotNull(history);
    assertNotNull(history.getServerDeployHistories());
    assertTrue(history.getServerDeployHistories().size() == order.getServerId().length);
    Set<Integer> serverSet = new HashSet<>();
    for (int serverId : order.getServerId()) {
        serverSet.add(serverId);
    }
    for (ServerDeployHistory sdh : history.getServerDeployHistories()) {
        assertTrue(sdh.getHistoryId() == historyId);
        assertTrue(StringUtils.isNotEmpty(sdh.getServerIp()));
        assertTrue(StringUtils.isNotEmpty(sdh.getServerName()));
        assertTrue(sdh.getDeployStatus() == ServerDeployResult.WAITING_FOR_DEPLOYMENT.getValue());
        assertTrue(serverSet.contains(sdh.getServerId()));
    }
}
Also used : ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory) DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory) HashSet(java.util.HashSet)

Example 4 with DeployHistory

use of com.ibeiliao.deployment.admin.vo.deploy.DeployHistory in project Corgi by kevinYin.

the class DeployHistoryServiceImplTest method testCancel.

/**
 * 测试取消发布的功能
 * 期望:测试通过
 */
@Test
public void testCancel() {
    DeployHistory history = createDeployHistory();
    deployHistoryService.cancel(history.getAccountId(), history.getHistoryId());
    DeployHistory newHistory = deployHistoryService.getByHistoryId(history.getHistoryId());
    assertTrue(newHistory.getDeployStatus() == DeployStatus.CANCELLED.getValue());
}
Also used : DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory) Test(org.junit.Test)

Example 5 with DeployHistory

use of com.ibeiliao.deployment.admin.vo.deploy.DeployHistory in project Corgi by kevinYin.

the class DeployHistoryServiceImplTest method testQueryUnfinished.

/**
 * 仅测试SQL语法
 * 期望:测试通过
 */
@Test
public void testQueryUnfinished() {
    Date now = new Date();
    Date endTime = DateUtils.addSeconds(now, Constants.DEPLOY_TASK_TIMEOUT);
    Date startTime = DateUtils.addSeconds(now, Constants.DEPLOY_TASK_TIMEOUT * 12);
    final int MAX = 1000;
    List<DeployHistory> list = deployHistoryService.queryUnfinished(startTime, endTime, MAX);
    assertNotNull(list);
}
Also used : DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory) Date(java.util.Date) Test(org.junit.Test)

Aggregations

DeployHistory (com.ibeiliao.deployment.admin.vo.deploy.DeployHistory)20 ServerDeployHistory (com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory)14 Test (org.junit.Test)6 InitTestDataService (com.ibeiliao.deployment.admin.service.InitTestDataService)4 DeploymentOrder (com.ibeiliao.deployment.admin.vo.deploy.DeploymentOrder)3 ProjectEnv (com.ibeiliao.deployment.admin.vo.global.ProjectEnv)3 RestResult (com.ibeiliao.deployment.admin.common.RestResult)2 DeployHistoryPO (com.ibeiliao.deployment.admin.po.deploy.DeployHistoryPO)2 ServerDeployHistoryPO (com.ibeiliao.deployment.admin.po.deploy.ServerDeployHistoryPO)2 MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)2 Date (java.util.Date)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 DeployHistoryService (com.ibeiliao.deployment.admin.service.deploy.DeployHistoryService)1 AdminAccount (com.ibeiliao.deployment.admin.vo.account.AdminAccount)1 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)1 Server (com.ibeiliao.deployment.admin.vo.server.Server)1 ServerGroup (com.ibeiliao.deployment.admin.vo.server.ServerGroup)1 ShellLogRequestMessage (com.ibeiliao.deployment.admin.websocket.request.ShellLogRequestMessage)1 ShellLogResponseMessage (com.ibeiliao.deployment.admin.websocket.request.ShellLogResponseMessage)1 Redis (com.ibeiliao.deployment.common.util.redis.Redis)1