Skip to content

Commit

Permalink
Merge pull request #30 from averak/revert-19-feature/16-setup-testtuils
Browse files Browse the repository at this point in the history
Revert "テスティングユーティリティを作成"
  • Loading branch information
averak authored Nov 9, 2023
2 parents c8596c2 + 6fa1f41 commit c1add85
Show file tree
Hide file tree
Showing 22 changed files with 28 additions and 463 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPANNER_DATABASE_ID=gsync

.PHONY: build
build:
./gradlew quarkusBuild
./gradlew build -x test

.PHONY: build_native
build_native:
Expand Down
30 changes: 18 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
kotlin("jvm") version libs.versions.kotlin
kotlin("plugin.allopen") version libs.versions.kotlin

alias(libs.plugins.versions)
alias(libs.plugins.version.catalog.update)
Expand All @@ -16,8 +17,15 @@ plugins {
idea
}

buildscript {
dependencies {
classpath("com.github.ben-manes:gradle-versions-plugin:0.47.0")
}
}

repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()
}

Expand Down Expand Up @@ -47,28 +55,27 @@ dependencies {
implementation(libs.jackson.module.kotlin)

// Test Framework & utils
testImplementation(project(":testkit"))
testImplementation(libs.quarkus.junit5)
testImplementation(libs.spock.core)
testImplementation(libs.spock.junit4)
testImplementation(libs.groovy)
testImplementation(libs.groovy.sql)
testImplementation(libs.easy.random)
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlin {
sourceSets {
all {
languageSettings {
languageVersion = "2.0"
}
}
}
jvmToolchain(17)
}

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

spotless {
Expand All @@ -86,7 +93,6 @@ sonar {
property("sonar.projectKey", "averak_gsync")
property("sonar.organization", "averak")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.exclusions", "testkit/**")
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[versions]
easy-random = "6.2.1"
groovy = "4.0.7"
kotlin = "1.9.20"
kotlin = "1.9.10"
quarkus = "3.5.0"
spock = "2.4-M1-groovy-4.0"

[libraries]
commons-lang3 = "org.apache.commons:commons-lang3:3.13.0"
easy-random = { module = "io.github.dvgaba:easy-random-core", version.ref = "easy-random" }
groovy = { module = "org.apache.groovy:groovy", version.ref = "groovy" }
groovy-sql = { module = "org.apache.groovy:groovy-sql", version.ref = "groovy" }
Expand All @@ -24,6 +23,7 @@ quarkus-logging-json = { module = "io.quarkus:quarkus-logging-json", version.ref
quarkus-resteasy-reactive = { module = "io.quarkus:quarkus-resteasy-reactive", version.ref = "quarkus" }
quarkus-resteasy-reactive-jackson = { module = "io.quarkus:quarkus-resteasy-reactive-jackson", version.ref = "quarkus" }
spock-core = { module = "org.spockframework:spock-core", version.ref = "spock" }
spock-junit4 = { module = "org.spockframework:spock-junit4", version.ref = "spock" }

[plugins]
gradle-git-properties = "com.gorylenko.gradle-git-properties:2.4.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = "gsync"
include(":testkit")
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net.averak.gsync.core.exception.ErrorCode

data class ErrorResponse(
val code: String,
val summary: String,
val description: String,
) {
constructor(errorCode: ErrorCode) : this(errorCode.name, errorCode.summary)
constructor(errorCode: ErrorCode) : this(errorCode.name, errorCode.description)
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package net.averak.gsync.adapter.handler.exception

import jakarta.ws.rs.NotFoundException
import jakarta.ws.rs.core.MediaType
import jakarta.ws.rs.core.Response
import jakarta.ws.rs.ext.ExceptionMapper
import jakarta.ws.rs.ext.Provider
import net.averak.gsync.core.exception.ErrorCode
import org.apache.http.HttpStatus

@Provider
class NotFoundExceptionMapper : ExceptionMapper<NotFoundException> {
override fun toResponse(exception: NotFoundException?): Response {
return Response
.status(Response.Status.NOT_FOUND)
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(ErrorResponse(ErrorCode.NOT_FOUND_API))
.build()
return Response.status(HttpStatus.SC_NOT_FOUND).entity(ErrorResponse(ErrorCode.NOT_FOUND_API)).build()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.averak.gsync.core.exception

enum class ErrorCode(val summary: String) {
enum class ErrorCode(val description: String) {
// 400 Bad Request
VALIDATION_ERROR("Request validation exception was thrown."),
INVALID_REQUEST_PARAMETERS("Request parameters is invalid."),
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/kotlin/net/averak/gsync/domain/model/Echo.kt

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/kotlin/net/averak/gsync/domain/primitive/common/ID.kt

This file was deleted.

11 changes: 0 additions & 11 deletions src/main/kotlin/net/averak/gsync/usecase/EchoUsecase.kt

This file was deleted.

23 changes: 0 additions & 23 deletions src/test/groovy/net/averak/gsync/AbstractSpec.groovy
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
package net.averak.gsync

import io.quarkus.arc.All
import io.quarkus.test.junit.QuarkusTest
import jakarta.annotation.PostConstruct
import jakarta.inject.Inject
import net.averak.gsync.core.exception.GsyncException
import net.averak.gsync.testkit.Faker
import net.averak.gsync.testkit.IRandomizer
import spock.lang.Specification

@QuarkusTest
abstract class AbstractSpec extends Specification {

@Inject
@All
List<IRandomizer> randomizers

@PostConstruct
void init() {
Faker.init(randomizers)
}

/**
* 例外を検証
*/
static void verify(final GsyncException actual, final GsyncException expected) {
assert actual.errorCode == expected.errorCode
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package net.averak.gsync.adapter.handler.controller

import net.averak.gsync.AbstractSpec

abstract class AbstractController_IT extends AbstractSpec {
class AbstractController_IT extends AbstractSpec {
}

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/groovy/net/averak/gsync/usecase/EchoUsecase_UT.groovy

This file was deleted.

24 changes: 0 additions & 24 deletions testkit/build.gradle.kts

This file was deleted.

Loading

0 comments on commit c1add85

Please sign in to comment.