Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun CreateApplicationReqDto.toEntity(workspace: Workspace, externalPort: Int): A
Application(
name = this.name,
description = this.description,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
applicationType = this.applicationType,
workspace = workspace,
port = this.port,
Expand All @@ -30,7 +30,7 @@ fun Application.toDto(envList: List<ApplicationEnv>, initialScriptList: List<App
id = this.id,
name = this.name,
description = this.description,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
applicationType = this.applicationType,
env = envList.flatMap { it.details }.associate {
val envValue =
Expand Down Expand Up @@ -72,7 +72,7 @@ fun Application.toResDto(): ApplicationResDto =
name = this.name,
description = this.description,
applicationType = this.applicationType,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
port = this.port,
externalPort = this.externalPort,
version = this.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.dcd.server.core.domain.application.model.enums.ApplicationType
data class CreateApplicationReqDto(
val name: String,
val description: String?,
val githubUrl: String?,
val gitRepoUrl: String?,
val applicationType: ApplicationType,
val port: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.dcd.server.core.domain.application.model.enums.ApplicationType
data class UpdateApplicationReqDto(
val name: String,
val description: String?,
val githubUrl: String?,
val gitRepoUrl: String?,
val applicationType: ApplicationType,
val port: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class ApplicationDetailResDto(
val name: String,
val description: String?,
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
val env: Map<String, String>,
val port: Int,
val externalPort: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class ApplicationResDto(
val name: String,
val description: String?,
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
val port: Int,
val externalPort: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class Application(
val name: String,
val description: String?,
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
val version: String,
val workspace: Workspace,
val port: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class UpdateApplicationUseCase(
name = updateApplicationReqDto.name,
description = updateApplicationReqDto.description,
applicationType = updateApplicationReqDto.applicationType,
githubUrl = updateApplicationReqDto.githubUrl,
gitRepoUrl = updateApplicationReqDto.gitRepoUrl,
version = updateApplicationReqDto.version,
port = updateApplicationReqDto.port
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class ApplicationGitRepoAdapter(

override fun cloneApplicationRemoteRepo(application: Application) {
try {
application.githubUrl
?: throw IllegalArgumentException("GitHub URL is null for application: ${application.name}")
application.gitRepoUrl
?: throw IllegalArgumentException("Git Repo URL is null for application: ${application.name}")

Git.cloneRepository()
.setURI(application.githubUrl)
.setURI(application.gitRepoUrl)
.setDirectory(File("./${application.directoryName}"))
.call().use { log.debug("Git clone completed for application: ${application.name}") }
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun Application.toEntity(): ApplicationJpaEntity =
name = this.name,
description = this.description,
applicationType = this.applicationType,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
workspace = this.workspace.toEntity(),
port = this.port,
externalPort = this.externalPort,
Expand All @@ -32,7 +32,7 @@ fun ApplicationJpaEntity.toDomain(): Application =
name = this.name,
description = this.description,
applicationType = this.applicationType,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
workspace = this.workspace.toDomain(),
port = this.port,
externalPort = this.externalPort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ApplicationJpaEntity(
val description: String?,
@Enumerated(EnumType.STRING)
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "workspace_id")
val workspace: WorkspaceJpaEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun CreateApplicationRequest.toDto(): CreateApplicationReqDto =
CreateApplicationReqDto(
name = this.name,
description = this.description,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
applicationType = this.applicationType,
port = this.port,
version = this.version,
Expand All @@ -28,7 +28,7 @@ fun UpdateApplicationRequest.toDto(): UpdateApplicationReqDto =
name = this.name,
description = this.description,
applicationType = this.applicationType,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
version = this.version,
port = this.port,
initialScripts = this.initialScripts ?: emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun ApplicationDetailResDto.toResponse(): ApplicationDetailResponse =
id = this.id,
name = this.name,
description = this.description,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
applicationType = this.applicationType,
env = this.env,
port = this.port,
Expand Down Expand Up @@ -67,7 +67,7 @@ fun ApplicationResDto.toResponse(): ApplicationResponse =
name = this.name,
description = this.description,
applicationType = this.applicationType,
githubUrl = this.githubUrl,
gitRepoUrl = this.gitRepoUrl,
port = this.port,
externalPort = this.externalPort,
version = this.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data class CreateApplicationRequest(
@field:Pattern(regexp = "^[a-zA-Z0-9 ]{1,26}$")
val name: String,
val description: String?,
val githubUrl: String?,
val gitRepoUrl: String?,
val applicationType: ApplicationType,
val port: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data class UpdateApplicationRequest(
@field:Pattern(regexp = "^[a-zA-Z0-9 ]{1,26}$")
val name: String,
val description: String?,
val githubUrl: String?,
val gitRepoUrl: String?,
val applicationType: ApplicationType,
val port: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class ApplicationDetailResponse(
val name: String,
val description: String?,
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
val env: Map<String, String>,
val port: Int,
val externalPort: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data class ApplicationResponse(
val name: String,
val description: String?,
val applicationType: ApplicationType,
val githubUrl: String?,
val gitRepoUrl: String?,
val port: Int,
val externalPort: Int,
val version: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CreateApplicationUseCaseTest(
name = "testCreateApplication",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testGithub",
gitRepoUrl = "testGithub",
version = "17",
port = 8080,
initialScripts = listOf(),
Expand All @@ -83,7 +83,7 @@ class CreateApplicationUseCaseTest(
name = "testName",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testGithub",
gitRepoUrl = "testGithub",
version = "17",
port = 8080,
initialScripts = listOf(),
Expand All @@ -106,7 +106,7 @@ class CreateApplicationUseCaseTest(
name = "testCreateApplication",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testGithub",
gitRepoUrl = "testGithub",
version = "17",
port = 8080,
initialScripts = listOf(),
Expand Down Expand Up @@ -145,7 +145,7 @@ class CreateApplicationUseCaseTest(
name = "testCreateApplication",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testGithub",
gitRepoUrl = "testGithub",
version = "17",
port = 8080,
initialScripts = listOf(),
Expand Down Expand Up @@ -177,7 +177,7 @@ class CreateApplicationUseCaseTest(
name = "testCreateApplication",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testGithub",
gitRepoUrl = "testGithub",
version = "17",
port = 8080,
initialScripts = listOf("echo test"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class UpdateApplicationUseCaseTest(
) : BehaviorSpec({
val targetUserId = "923a6407-a5f8-4e1e-bffd-0621910ddfc8"

val updateReqDto = UpdateApplicationReqDto(name = "testName", description = "dldl", applicationType = ApplicationType.SPRING_BOOT, githubUrl = null, version = "11", port = 8080, initialScripts = listOf("echo test"))
val updateReqDto = UpdateApplicationReqDto(name = "testName", description = "dldl", applicationType = ApplicationType.SPRING_BOOT, gitRepoUrl = null, version = "11", port = 8080, initialScripts = listOf("echo test"))

given("애플리케이션 아이디가 주어지고") {
val targetUser = queryUserPort.findById(targetUserId)!!
Expand All @@ -57,7 +57,7 @@ class UpdateApplicationUseCaseTest(
result?.description shouldBe updateReqDto.description
result?.applicationType shouldBe updateReqDto.applicationType
result?.port shouldBe updateReqDto.port
result?.githubUrl shouldBe updateReqDto.githubUrl
result?.gitRepoUrl shouldBe updateReqDto.gitRepoUrl
result?.version shouldBe updateReqDto.version
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ApplicationPersistenceAdapterTest : BehaviorSpec({
name = "test",
description = "test description",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testUrl",
gitRepoUrl = "testUrl",
version = "17",
workspace = workspace,
port = 8080,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ApplicationWebAdapterTest : BehaviorSpec({
name = "testName",
description = "testDescription",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testUrl",
gitRepoUrl = "testUrl",
port = 8080,
initialScripts = emptyList(),
version = "17",
Expand All @@ -62,7 +62,7 @@ class ApplicationWebAdapterTest : BehaviorSpec({
name = "test",
description = "test",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testUrl",
gitRepoUrl = "testUrl",
port = 8080,
externalPort = 8080,
version = "latest",
Expand All @@ -89,7 +89,7 @@ class ApplicationWebAdapterTest : BehaviorSpec({
name = "test",
description = "test",
applicationType = ApplicationType.SPRING_BOOT,
githubUrl = "testUrl",
gitRepoUrl = "testUrl",
port = 8080,
externalPort = 8080,
version = "latest",
Expand Down Expand Up @@ -158,7 +158,7 @@ class ApplicationWebAdapterTest : BehaviorSpec({

given("UpdateRequest가 주어지고") {
val testId ="testId"
val request = UpdateApplicationRequest(name = "update", description = null, applicationType = ApplicationType.SPRING_BOOT, githubUrl = null, version = "11", port = 8080, initialScripts = emptyList())
val request = UpdateApplicationRequest(name = "update", description = null, applicationType = ApplicationType.SPRING_BOOT, gitRepoUrl = null, version = "11", port = 8080, initialScripts = emptyList())

`when`("updateApplication 메서드를 실행할때") {
val result = applicationWebAdapter.updateApplication(testWorkspaceId, testId, request)
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/util/application/ApplicationGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object ApplicationGenerator {
name: String = "testName",
description: String = "testDescription",
applicationType: ApplicationType = ApplicationType.SPRING_BOOT,
githubUrl: String = "testUrl",
gitRepoUrl: String = "testUrl",
version: String = "17",
workspace: Workspace = WorkspaceGenerator.generateWorkspace(),
port: Int = 8080,
Expand All @@ -29,7 +29,7 @@ object ApplicationGenerator {
name = name,
description = description,
applicationType = applicationType,
githubUrl = githubUrl,
gitRepoUrl = gitRepoUrl,
version = version,
workspace = workspace,
port = port,
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ drop table if exists application_env_matcher_entity cascade;
drop table if exists application_env_label_entity cascade;
drop table if exists volume_entity cascade;
drop table if exists volume_mount_entity cascade;
create table application_entity (external_port integer not null, port integer not null, application_type varchar(255) check (application_type in ('SPRING_BOOT','NEST_JS','MYSQL','MARIA_DB','REDIS')), description varchar(255), failure_case enum('CLONE_FAILURE', 'CREATE_DOCKER_FILE_FAILURE', 'IMAGE_BUILD_FAILURE', 'CREATE_CONTAINER_FAILURE', 'RUN_CONTAINER_FAILURE', 'STOP_CONTAINER_FAILURE', 'CONNECT_NETWORK_FAILURE', 'CREATE_DIRECTORY_FAILURE', 'DELETE_DIRECTORY_FAILURE', 'DELETE_CONTAINER_FAILURE', 'DELETE_IMAGE_FAILURE'), failure_reason_detail varchar(1200), github_url varchar(255), id binary(16) not null, name varchar(255), status enum('CREATED','PENDING','RUNNING','STOPPED','FAILURE'), version varchar(255), workspace_id binary(16), primary key (id));
create table application_entity (external_port integer not null, port integer not null, application_type varchar(255) check (application_type in ('SPRING_BOOT','NEST_JS','MYSQL','MARIA_DB','REDIS')), description varchar(255), failure_case enum('CLONE_FAILURE', 'CREATE_DOCKER_FILE_FAILURE', 'IMAGE_BUILD_FAILURE', 'CREATE_CONTAINER_FAILURE', 'RUN_CONTAINER_FAILURE', 'STOP_CONTAINER_FAILURE', 'CONNECT_NETWORK_FAILURE', 'CREATE_DIRECTORY_FAILURE', 'DELETE_DIRECTORY_FAILURE', 'DELETE_CONTAINER_FAILURE', 'DELETE_IMAGE_FAILURE'), failure_reason_detail varchar(1200), git_repo_url varchar(255), id binary(16) not null, name varchar(255), status enum('CREATED','PENDING','RUNNING','STOPPED','FAILURE'), version varchar(255), workspace_id binary(16), primary key (id));
create table application_label_entity (application_id binary(16) not null, label varchar(255));
create table application_initial_script_entity (id binary(16), script varchar(255), application_id binary(16) not null, primary key (id));
create table role_entity (roles varchar(255) check (roles in ('ROLE_ADMIN','ROLE_DEVELOPER','ROLE_USER')), user_id binary(16) not null);
Expand Down Expand Up @@ -53,4 +53,4 @@ insert into role_entity (user_id,roles) values (X'1e1973eb3fb947ac9342c16cd63ffc
insert into workspace_entity (description,owner_id,title,id) values ('testDescription', X'923a6407a5f84e1ebffd0621910ddfc8', 'testTitle', X'd57b42f55cc4440b8dceb4fc2e372eff');

-- 애플리케이션 생성
insert into application_entity (application_type,description,external_port,failure_case,failure_reason_detail,github_url,name,port,status,version,workspace_id,id) values ('SPRING_BOOT','testDescription', 8080, NULL, NULL, 'testUrl', 'testName', 8080, 'STOPPED','17', X'd57b42f55cc4440b8dceb4fc2e372eff', X'2fb0f3158272422f8e9fc4f765c022b2');
insert into application_entity (application_type,description,external_port,failure_case,failure_reason_detail,git_repo_url,name,port,status,version,workspace_id,id) values ('SPRING_BOOT','testDescription', 8080, NULL, NULL, 'testUrl', 'testName', 8080, 'STOPPED','17', X'd57b42f55cc4440b8dceb4fc2e372eff', X'2fb0f3158272422f8e9fc4f765c022b2');
Loading