refactor(项目管理): 修改初始化项目的sql

This commit is contained in:
wxg0103 2023-09-22 15:58:47 +08:00 committed by wxg0103
parent be3622ba00
commit 5d348c144e
4 changed files with 11 additions and 9 deletions

View File

@ -4,7 +4,7 @@ SET SESSION innodb_lock_wait_timeout = 7200;
-- 初始化组织
INSERT INTO organization (id, num, name, description, create_user, update_user, create_time, update_time) VALUES ('100001', 100001, '默认组织', '系统默认创建的组织', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
-- 初始化项目
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time) VALUES ('100001100001', 100001, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000);
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting) VALUES ('100001100001', 100001, (SELECT id FROM organization WHERE name LIKE '默认组织'), '默认项目', '系统默认创建的项目', 'admin', 'admin', unix_timestamp() * 1000, unix_timestamp() * 1000,'["workstation","loadTest","testPlan","bugManagement","caseManagement","apiTest","uiTest"]');
-- 初始化用户
insert into user(id, name, email, password, create_time, update_time, language, last_organization_id, phone, source, last_project_id, create_user, update_user,deleted)

View File

@ -8,7 +8,6 @@ import io.metersphere.project.dto.environment.host.HostConfig;
import io.metersphere.project.dto.environment.http.HttpConfig;
import io.metersphere.project.dto.environment.script.post.EnvironmentPostScript;
import io.metersphere.project.dto.environment.script.pre.EnvironmentPreScript;
import io.metersphere.project.dto.environment.ssl.KeyStoreConfig;
import io.metersphere.project.dto.environment.tcp.TCPConfig;
import io.metersphere.project.dto.environment.variables.CommonVariables;
import io.swagger.v3.oas.annotations.media.Schema;
@ -37,8 +36,6 @@ public class EnvironmentConfig implements Serializable {
private TCPConfig tcpConfig;
@Schema(description = "认证配置")
private AuthConfig authConfig;
@Schema(description = "SSL配置")
private KeyStoreConfig sslConfig;
@Schema(description = "全局前置脚本")
private EnvironmentPreScript preScript;
@Schema(description = "全局后置脚本")
@ -58,7 +55,6 @@ public class EnvironmentConfig implements Serializable {
this.preScript = new EnvironmentPreScript();
this.postScript = new EnvironmentPostScript();
this.assertions = new EnvironmentAssertions();
this.sslConfig = new KeyStoreConfig();
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.project.dto.environment.auth;
import io.metersphere.project.dto.environment.ssl.KeyStoreConfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -13,9 +14,12 @@ public class AuthConfig implements Serializable {
@Schema(description = "密码")
private String password;
@Schema(description = "认证方式 No Auth、Basic Auth、Digest Auth、ssl")
@Schema(description = "认证方式 No Auth、Basic Auth、Digest Auth、ssl证书")
private String verification;
@Schema(description = "SSL配置")
private KeyStoreConfig sslConfig;
@Serial
private static final long serialVersionUID = 1L;
}

View File

@ -582,7 +582,9 @@ public class EnvironmentControllerTests extends BaseTest {
checkLog(response.getId(), OperationLogType.ADD);
//ssl配置
envConfig.setSslConfig(createKeyStoreConfig());
AuthConfig authConfig = envConfig.getAuthConfig();
authConfig.setSslConfig(createKeyStoreConfig());
envConfig.setAuthConfig(authConfig);
request.setName("sslConfig");
request.setConfig(envConfig);
paramMap.set("request", JSON.toJSONString(request));
@ -600,8 +602,8 @@ public class EnvironmentControllerTests extends BaseTest {
if (StringUtils.isNotBlank(config)) {
EnvironmentConfig environmentConfig = JSON.parseObject(config, EnvironmentConfig.class);
Assertions.assertNotNull(environmentConfig);
Assertions.assertNotNull(environmentConfig.getSslConfig());
Assertions.assertEquals(envConfig.getSslConfig(), environmentConfig.getSslConfig());
Assertions.assertNotNull(environmentConfig.getAuthConfig());
Assertions.assertEquals(envConfig.getAuthConfig().getSslConfig(), environmentConfig.getAuthConfig().getSslConfig());
}
//校验日志
checkLog(response.getId(), OperationLogType.ADD);