use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class InitTestDataService method createModule.
private ProjectModule createModule(long accountId, Project project, List<ProjectEnv> envs) {
ProjectModule module = new ProjectModule();
module.setProjectId(project.getProjectId());
module.setCompileShell("mvn -P=dev");
module.setNeedAudit(Constants.TRUE);
module.setModuleName("test-module");
module.setModuleNameZh("测试模块");
module.setModuleType(ModuleType.SERVICE.getValue());
module.setLogName("");
module.setPreShell("");
module.setPostShell("");
module.setRestartShell("/usr/local/resinpro/bin/resin.sh restart");
module.setRepoUrl("https://a.b.com/test-project");
module.setRepoType(ModuleRepoType.SVN.getValue());
module.setSrcPath("");
module.setStopShell("");
module.setSvnAccount("test-account");
module.setSvnPassword("test-password");
module.setNeedAudit(Constants.TRUE);
ProjectEnv env = envs.get(0);
List<ServerGroup> serverGroups = new ArrayList<>();
ServerGroup group1 = new ServerGroup();
group1.setEnvId(env.getEnvId());
group1.setGroupName("dev test");
serverGroups.add(group1);
projectModuleService.saveProjectModule(accountId, module);
List<Server> servers = new ArrayList<>();
final int MAX_SERVERS = 8;
for (int i = 0; i < MAX_SERVERS; i++) {
servers.add(createServer(i));
}
group1.setServers(servers);
module.setServerGroups(serverGroups);
projectModuleService.saveProjectModule(accountId, module);
ProjectModule tmpModule = projectModuleService.getByModuleId(module.getModuleId());
Assert.notNull(tmpModule);
Assert.isTrue(tmpModule.getNeedAudit() == Constants.TRUE);
// 要重新读一次数据
List<ServerGroup> newServerGroups = serverGroupService.getByModuleIds(Lists.newArrayList(module.getModuleId()), false);
module.setServerGroups(newServerGroups);
for (ServerGroup tmpGroup : newServerGroups) {
List<Integer> groupIds = new LinkedList<>();
groupIds.add(tmpGroup.getGroupId());
List<Server> newServers = serverService.getByGroupIds(groupIds);
tmpGroup.setServers(newServers);
}
return module;
}
use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class ModuleServiceTest method testSave.
@Test
public void testSave() {
ProjectModule module = new ProjectModule();
buildModuleBaseInfo(module);
fillServerGroupInfo(module);
moduleService.saveProjectModule(1L, module);
}
Aggregations