Skip to content

Commit

Permalink
chore(server): move all gateways to a dedicated module
Browse files Browse the repository at this point in the history
  • Loading branch information
clementguillot committed Oct 22, 2024
1 parent 3e8fef5 commit 69c575b
Show file tree
Hide file tree
Showing 39 changed files with 164 additions and 78 deletions.
7 changes: 0 additions & 7 deletions .vscode/extensions.json

This file was deleted.

1 change: 1 addition & 0 deletions apps/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation("com.github.ajalt.clikt:clikt:$cliktVersion")

implementation(project(":libs:server:domain"))
implementation(project(":libs:server:gateway"))
implementation(project(":libs:server:persistence"))
implementation(project(":libs:server:storage:azure"))
implementation(project(":libs:server:storage:core"))
Expand Down
8 changes: 2 additions & 6 deletions apps/server/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"targets": {
"build": {
"executor": "@jnxplus/nx-gradle:run-task",
"outputs": ["{projectRoot}/build"],
"outputs": ["{projectRoot}/build/classes", "{projectRoot}/build/libs"],
"options": {
"task": "quarkusBuild"
}
Expand Down Expand Up @@ -58,11 +58,7 @@
"options": {
"task": "test"
},
"outputs": [
"{projectRoot}/build/classes",
"{projectRoot}/build/reports",
"{projectRoot}/build/test-results"
]
"outputs": ["{projectRoot}/build/jacoco-report"]
},
"integration-test": {
"executor": "@jnxplus/nx-gradle:run-task",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import org.nxcloudce.server.domain.workspace.interactor.GetWorkspaceAccessTokenI
import org.nxcloudce.server.domain.workspace.usecase.CreateOrgAndWorkspace
import org.nxcloudce.server.domain.workspace.usecase.CreateWorkspace
import org.nxcloudce.server.domain.workspace.usecase.GetWorkspaceAccessToken
import org.nxcloudce.server.persistence.gateway.*
import org.nxcloudce.server.storage.gateway.StorageServiceImpl
import org.nxcloudce.server.gateway.persistence.*
import org.nxcloudce.server.gateway.storage.StorageServiceImpl

@ApplicationScoped
class DomainUseCaseProducers(
Expand Down
3 changes: 1 addition & 2 deletions apps/server/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
quarkus:
http:
port:
8080
port: 8080
root-path: "/nx-cloud"
mongodb:
database: nx-cloud-ce
Expand Down
8 changes: 2 additions & 6 deletions libs/server/domain/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"options": {
"task": "build"
},
"outputs": ["{projectRoot}/build"]
"outputs": ["{projectRoot}/build/classes", "{projectRoot}/build/libs"]
},
"lint": {
"executor": "@jnxplus/nx-gradle:run-task",
Expand All @@ -28,11 +28,7 @@
"options": {
"task": "test"
},
"outputs": [
"{projectRoot}/build/classes",
"{projectRoot}/build/reports",
"{projectRoot}/build/test-results"
]
"outputs": ["{projectRoot}/build/jacoco-report"]
}
},
"tags": []
Expand Down
5 changes: 5 additions & 0 deletions libs/server/gateway/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# libs/server/gateway

This library is part of [`apps/server`](../../../apps/server) application.

It contains all implementation of `gateway`s defined by the `libs/server/domain` layer.
80 changes: 80 additions & 0 deletions libs/server/gateway/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("jvm")
kotlin("plugin.allopen")
id("io.quarkus")
id("com.diffplug.spotless")
}

repositories {
mavenCentral()
mavenLocal()
}

val javaVersion: String by project
val quarkusPlatformGroupId: String by project
val quarkusPlatformArtifactId: String by project
val quarkusPlatformVersion: String by project
val ktlintVersion: String by project
val atriumVersion: String by project
val mockkVersion: String by project
val quarkusMockkVersion: String by project

dependencies {
implementation(enforcedPlatform("$quarkusPlatformGroupId:$quarkusPlatformArtifactId:$quarkusPlatformVersion"))
implementation("io.quarkus:quarkus-kotlin")
implementation("io.quarkus:quarkus-mongodb-panache-kotlin")

implementation(project(":libs:server:domain"))
implementation(project(":libs:server:persistence"))
implementation(project(":libs:server:storage:core"))

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
testImplementation("ch.tutteli.atrium:atrium-fluent:$atriumVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("io.quarkiverse.mockk:quarkus-junit5-mockk:$quarkusMockkVersion")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.quarkus:quarkus-jacoco")
testImplementation("io.quarkus:quarkus-test-hibernate-reactive-panache")
}

group = "org.nxcloudce.server"
version = "0.4.2"

java {
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}

tasks.withType<Jar> {
archiveBaseName = "${project.group}.${project.name}"
}

tasks.withType<Test> {
systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager")
}

allOpen {
annotation("jakarta.enterprise.context.ApplicationScoped")
annotation("io.quarkus.test.junit.QuarkusTest")
}

kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
jvmTarget = JvmTarget.fromTarget(javaVersion)
javaParameters = true
}
}

spotless {
kotlin {
ktlint(ktlintVersion)
}

kotlinGradle {
target("*.gradle.kts")
ktlint(ktlintVersion)
}
}
35 changes: 35 additions & 0 deletions libs/server/gateway/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "libs/server/gateway",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/server/gateway/src",
"targets": {
"build": {
"executor": "@jnxplus/nx-gradle:run-task",
"options": {
"task": "build"
},
"outputs": ["{projectRoot}/build/classes", "{projectRoot}/build/libs"]
},
"lint": {
"executor": "@jnxplus/nx-gradle:run-task",
"options": {
"task": "spotlessCheck"
}
},
"format": {
"executor": "@jnxplus/nx-gradle:run-task",
"options": {
"task": "spotlessApply"
}
},
"test": {
"executor": "@jnxplus/nx-gradle:run-task",
"options": {
"task": "test"
},
"outputs": ["{projectRoot}/build/jacoco-report"]
}
},
"tags": []
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.nxcloudce.server.domain.workspace.model.*
import org.nxcloudce.server.persistence.entity.AccessTokenEntity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.Uni
import io.smallrye.mutiny.coroutines.awaitSuspending
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.nxcloudce.server.domain.run.model.Artifact
import org.nxcloudce.server.domain.run.model.ArtifactId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.coroutines.awaitSuspending
import jakarta.enterprise.context.ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.nxcloudce.server.domain.organization.model.Organization
import org.nxcloudce.server.domain.organization.model.OrganizationId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.Uni
import io.smallrye.mutiny.coroutines.awaitSuspending
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.bson.types.ObjectId
import org.nxcloudce.server.domain.run.model.*
Expand Down Expand Up @@ -49,7 +49,7 @@ fun RunEntity.toDomain(): Run =
this@toDomain.projectGraph?.let { projectGraph ->
ProjectGraph(
nodes =
projectGraph.nodes?.let {
projectGraph.nodes.let {
it.mapValues { (_, node) ->
ProjectGraph.Project(
type = node.type,
Expand Down Expand Up @@ -82,7 +82,7 @@ fun RunEntity.toDomain(): Run =
}
},
dependencies =
projectGraph.dependencies?.let {
projectGraph.dependencies.let {
it.mapValues { (_, dependencies) ->
dependencies.map { dependency ->
ProjectGraph.Dependency(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.coroutines.asFlow
import io.smallrye.mutiny.coroutines.awaitSuspending
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.bson.types.ObjectId
import org.nxcloudce.server.domain.run.model.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.coroutines.asFlow
import io.smallrye.mutiny.coroutines.awaitSuspending
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.bson.types.ObjectId
import org.nxcloudce.server.domain.metric.model.TaskRunnerMetric
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.coroutines.awaitSuspending
import jakarta.enterprise.context.ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import org.bson.types.ObjectId
import org.nxcloudce.server.domain.organization.model.OrganizationId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import io.smallrye.mutiny.Uni
import io.smallrye.mutiny.coroutines.awaitSuspending
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.storage.gateway
package org.nxcloudce.server.gateway.storage

import jakarta.enterprise.context.ApplicationScoped
import jakarta.enterprise.inject.Instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.its
import ch.tutteli.atrium.api.fluent.en_GB.notToEqualNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.its
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.its
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.persistence.gateway
package org.nxcloudce.server.gateway.persistence

import ch.tutteli.atrium.api.fluent.en_GB.its
import ch.tutteli.atrium.api.fluent.en_GB.toEqual
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.nxcloudce.server.storage.gateway
package org.nxcloudce.server.gateway.storage

import ch.tutteli.atrium.api.fluent.en_GB.toEqual
import ch.tutteli.atrium.api.verbs.expect
Expand Down
8 changes: 2 additions & 6 deletions libs/server/persistence/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"options": {
"task": "build"
},
"outputs": ["{projectRoot}/build"]
"outputs": ["{projectRoot}/build/classes", "{projectRoot}/build/libs"]
},
"lint": {
"executor": "@jnxplus/nx-gradle:run-task",
Expand All @@ -28,11 +28,7 @@
"options": {
"task": "test"
},
"outputs": [
"{projectRoot}/build/classes",
"{projectRoot}/build/reports",
"{projectRoot}/build/test-results"
]
"outputs": ["{projectRoot}/build/jacoco-report"]
}
},
"tags": []
Expand Down
Loading

0 comments on commit 69c575b

Please sign in to comment.