Merge pull request #350 from usbharu/feature/owl

ジョブキューを自作のものに変更
This commit is contained in:
usbharu 2024-05-12 01:52:16 +09:00 committed by GitHub
commit a51593b142
729 changed files with 4014 additions and 3316 deletions

View File

@ -61,7 +61,7 @@ jobs:
- name: Build - name: Build
uses: gradle/gradle-build-action@v3.3.2 uses: gradle/gradle-build-action@v3.3.2
with: with:
arguments: testClasses arguments: :hideout-core:testClasses
unit-test: unit-test:
name: Unit Test name: Unit Test
@ -113,7 +113,7 @@ jobs:
- name: Unit Test - name: Unit Test
uses: gradle/gradle-build-action@v3.3.2 uses: gradle/gradle-build-action@v3.3.2
with: with:
arguments: test arguments: :hideout-core:test
- name: Save Test Report - name: Save Test Report
if: always() if: always()
@ -177,7 +177,7 @@ jobs:
- name: Unit Test - name: Unit Test
uses: gradle/gradle-build-action@v3.3.2 uses: gradle/gradle-build-action@v3.3.2
with: with:
arguments: integrationTest arguments: :hideout-core:integrationTest
- name: Save Test Report - name: Save Test Report
if: always() if: always()
@ -236,7 +236,7 @@ jobs:
- name: Run Kover - name: Run Kover
uses: gradle/gradle-build-action@v3.3.2 uses: gradle/gradle-build-action@v3.3.2
with: with:
arguments: koverXmlReport -x integrationTest -x e2eTest --rerun-tasks arguments: :hideout-core:koverXmlReport -x :hideout-core:integrationTest -x :hideout-core:e2eTest --rerun-tasks
- name: Add coverage report to PR - name: Add coverage report to PR
if: always() if: always()
@ -331,7 +331,7 @@ jobs:
- name: Build with Gradle - name: Build with Gradle
uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff
with: with:
arguments: detektMain arguments: :hideout-core:detektMain
- name: "reviewdog-suggester: Suggest any code changes based on diff with reviewdog" - name: "reviewdog-suggester: Suggest any code changes based on diff with reviewdog"
if: ${{ always() }} if: ${{ always() }}
@ -401,7 +401,7 @@ jobs:
- name: E2E Test - name: E2E Test
uses: gradle/gradle-build-action@v3.3.2 uses: gradle/gradle-build-action@v3.3.2
with: with:
arguments: e2eTest arguments: :hideout-core:e2eTest
- name: Save Test Report - name: Save Test Report

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ out/
/files/ /files/
*.log *.log
/hideout-core/files/

View File

@ -1,367 +1,28 @@
import com.github.jk1.license.filter.DependencyFilter /*
import com.github.jk1.license.filter.LicenseBundleNormalizer * Copyright (C) 2024 usbharu
import com.github.jk1.license.importer.DependencyDataImporter *
import com.github.jk1.license.importer.XmlReportImporter * Licensed under the Apache License, Version 2.0 (the "License");
import com.github.jk1.license.render.* * you may not use this file except in compliance with the License.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile * You may obtain a copy of the License at
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask *
* http://www.apache.org/licenses/LICENSE-2.0
val ktor_version: String by project *
val kotlin_version: String by project * Unless required by applicable law or agreed to in writing, software
val exposed_version: String by project * distributed under the License is distributed on an "AS IS" BASIS,
val h2_version: String by project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
val koin_version: String by project * See the License for the specific language governing permissions and
val coroutines_version: String by project * limitations under the License.
val serialization_version: String by project */
plugins { plugins {
kotlin("jvm") version "1.9.24" alias(libs.plugins.kotlin.jvm)
id("io.gitlab.arturbosch.detekt") version "1.23.6"
id("org.springframework.boot") version "3.2.5"
kotlin("plugin.spring") version "1.9.24"
id("org.openapi.generator") version "7.4.0"
id("org.jetbrains.kotlinx.kover") version "0.7.6"
id("com.github.jk1.dependency-license-report") version "2.7"
} }
apply {
plugin("io.spring.dependency-management")
}
group = "dev.usbharu"
version = "0.0.1"
sourceSets {
create("intTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
create("e2eTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
val intTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val intTestRuntimeOnly by configurations.getting {
extendsFrom(configurations.runtimeOnly.get())
}
val e2eTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val e2eTestRuntimeOnly by configurations.getting {
extendsFrom(configurations.runtimeOnly.get())
}
val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
}
val e2eTest = task<Test>("e2eTest") {
description = "Runs e2e tests."
group = "verification"
testClassesDirs = sourceSets["e2eTest"].output.classesDirs
classpath = sourceSets["e2eTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
}
tasks.check {
dependsOn(integrationTest)
dependsOn(e2eTest)
}
tasks.withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.naming/javax.naming=ALL-UNNAMED",
).toMutableList()
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
}
dependsOn("openApiGenerateMastodonCompatibleApi")
mustRunAfter("openApiGenerateMastodonCompatibleApi")
}
tasks.clean {
delete += listOf("$rootDir/src/main/resources/static")
}
tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask::class) {
generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
outputDir.set("$buildDir/generated/sources/mastodon")
apiPackage.set("dev.usbharu.hideout.controller.mastodon.generated")
modelPackage.set("dev.usbharu.hideout.domain.mastodon.model.generated")
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
configOptions.put("reactive", "true")
additionalProperties.put("useTags", "true")
importMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
schemaMappings.put(
"StatusesRequest",
"dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest"
)
templateDir.set("$rootDir/templates")
}
repositories {
mavenCentral()
maven {
url = uri("https://git.usbharu.dev/api/packages/usbharu/maven")
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/usbharu/http-signature")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
maven {
name = "GitHubPackages2"
url = uri("https://maven.pkg.github.com/multim-dev/emoji-kt")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
}
kotlin {
target {
compilations.all {
kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString()
}
}
}
sourceSets.main {
kotlin.srcDirs(
"$buildDir/generated/ksp/main",
"$buildDir/generated/sources/openapi/src/main/kotlin",
"$buildDir/generated/sources/mastodon/src/main/kotlin"
)
}
val os = org.gradle.nativeplatform.platform.internal
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies { dependencies {
implementation("io.ktor:ktor-serialization-jackson:$ktor_version") implementation("dev.usbharu:hideout-core:0.0.1")
implementation("org.jetbrains.exposed:exposed-core:$exposed_version") implementation("dev.usbharu:hideout-worker:0.0.1")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
developmentOnly("com.h2database:h2:$h2_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-oauth2-authorization-server")
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("jakarta.validation:jakarta.validation-api")
implementation("jakarta.annotation:jakarta.annotation-api:3.0.0")
implementation("io.swagger.core.v3:swagger-annotations:2.2.21")
implementation("io.swagger.core.v3:swagger-models:2.2.21")
implementation("org.jetbrains.exposed:exposed-java-time:$exposed_version")
testImplementation("org.springframework.boot:spring-boot-starter-test")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.springframework.security:spring-security-oauth2-jose")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("org.jetbrains.exposed:exposed-spring-boot-starter:$exposed_version")
implementation("io.trbl:blurhash:1.0.0")
implementation("software.amazon.awssdk:s3:2.25.47")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutines_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$coroutines_version")
implementation("dev.usbharu:http-signature:1.0.0")
implementation("org.postgresql:postgresql:42.7.3")
implementation("com.twelvemonkeys.imageio:imageio-webp:3.10.1")
implementation("org.apache.tika:tika-core:2.9.2")
implementation("org.apache.tika:tika-parsers:2.9.2")
implementation("net.coobird:thumbnailator:0.4.20")
implementation("org.bytedeco:javacv:1.5.10") {
exclude(module = "opencv")
exclude(module = "flycapture")
exclude(module = "artoolkitplus")
exclude(module = "libdc1394")
exclude(module = "librealsense")
exclude(module = "librealsense2")
exclude(module = "tesseract")
exclude(module = "libfreenect")
exclude(module = "libfreenect2")
}
if (os.isWindows) {
implementation("org.bytedeco", "ffmpeg", "6.1.1-1.5.10", classifier = "windows-x86_64")
} else {
implementation("org.bytedeco", "ffmpeg", "6.1.1-1.5.10", classifier = "linux-x86_64")
}
implementation("org.flywaydb:flyway-core")
implementation("dev.usbharu:emoji-kt:2.0.0")
implementation("org.jsoup:jsoup:1.17.2")
implementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20240325.1")
implementation("io.ktor:ktor-client-logging-jvm:$ktor_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-cio:$ktor_version")
implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
testImplementation("io.ktor:ktor-client-mock:$ktor_version")
testImplementation("com.h2database:h2:$h2_version")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
testImplementation("org.mockito:mockito-inline:5.2.0")
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.16.1")
testImplementation("com.jparams:to-string-verifier:1.4.8")
implementation("org.drewcarlson:kjob-core:0.6.0")
implementation("org.drewcarlson:kjob-mongo:0.6.0")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
intTestImplementation("org.springframework.boot:spring-boot-starter-test")
intTestImplementation("org.springframework.security:spring-security-test")
intTestImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
intTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
intTestImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
intTestImplementation("com.h2database:h2:$h2_version")
e2eTestImplementation("org.springframework.boot:spring-boot-starter-test")
e2eTestImplementation("org.springframework.security:spring-security-test")
e2eTestImplementation("org.springframework.boot:spring-boot-starter-webflux")
e2eTestImplementation("org.jsoup:jsoup:1.17.2")
e2eTestImplementation("com.intuit.karate:karate-junit5:1.4.1")
e2eTestImplementation("com.h2database:h2:$h2_version")
} }
detekt { tasks.register("run") {
parallel = true dependsOn(gradle.includedBuild("hideout-core").task(":run"))
config = files("detekt.yml")
buildUponDefaultConfig = true
basePath = "${rootDir.absolutePath}/src/main/kotlin"
autoCorrect = true
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**")
doFirst {
}
setSource("src/main/kotlin")
exclude("build/")
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
configurations {
all {
exclude("org.springframework.boot", "spring-boot-starter-logging")
exclude("ch.qos.logback", "logback-classic")
}
}
project.gradle.taskGraph.whenReady {
println(this.allTasks)
this.allTasks.map { println(it.name) }
if (this.hasTask(":koverGenerateArtifact")) {
println("has task")
val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true
}
}
kover {
excludeSourceSets {
names("aot", "e2eTest", "intTest")
}
}
koverReport {
filters {
excludes {
packages(
"dev.usbharu.hideout.activitypub.domain.exception",
"dev.usbharu.hideout.core.domain.exception",
"dev.usbharu.hideout.core.domain.exception.media",
"dev.usbharu.hideout.core.domain.exception.resource",
"dev.usbharu.hideout.core.domain.exception.resource.local"
)
annotatedBy("org.springframework.context.annotation.Configuration")
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
packages(
"dev.usbharu.hideout.controller.mastodon.generated",
"dev.usbharu.hideout.domain.mastodon.model.generated"
)
packages("org.springframework")
packages("org.jetbrains")
}
}
}
springBoot {
buildInfo()
}
licenseReport {
excludeOwnGroup = true
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
renderers = arrayOf<ReportRenderer>(
InventoryHtmlReportRenderer(),
CsvReportRenderer(),
JsonReportRenderer(),
XmlReportRenderer()
)
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
allowedLicensesFile = File("$projectDir/allowed-licenses.json")
configurations = arrayOf("productionRuntimeClasspath")
} }

View File

@ -1,10 +1,3 @@
ktor_version=2.3.10
kotlin_version=1.9.24
coroutines_version=1.8.0
serialization_version=1.6.3
kotlin.code.style=official
exposed_version=0.49.0
h2_version=2.2.224
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.caching=true org.gradle.caching=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

20
gradlew.bat vendored
View File

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail

View File

@ -0,0 +1,343 @@
import com.github.jk1.license.filter.DependencyFilter
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.importer.DependencyDataImporter
import com.github.jk1.license.importer.XmlReportImporter
import com.github.jk1.license.render.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
val ktor_version: String by project
val kotlin_version: String by project
val h2_version: String by project
val coroutines_version: String by project
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.detekt)
alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.spring)
alias(libs.plugins.openapi.generator)
alias(libs.plugins.kover)
alias(libs.plugins.license.report)
}
apply {
plugin("io.spring.dependency-management")
}
group = "dev.usbharu"
version = "0.0.1"
sourceSets {
create("intTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
create("e2eTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
val intTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val intTestRuntimeOnly by configurations.getting {
extendsFrom(configurations.runtimeOnly.get())
}
val e2eTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val e2eTestRuntimeOnly by configurations.getting {
extendsFrom(configurations.runtimeOnly.get())
}
val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
}
val e2eTest = task<Test>("e2eTest") {
description = "Runs e2e tests."
group = "verification"
testClassesDirs = sourceSets["e2eTest"].output.classesDirs
classpath = sourceSets["e2eTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
}
tasks.check {
dependsOn(integrationTest)
dependsOn(e2eTest)
}
tasks.withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.naming/javax.naming=ALL-UNNAMED",
).toMutableList()
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
}
dependsOn("openApiGenerateMastodonCompatibleApi")
mustRunAfter("openApiGenerateMastodonCompatibleApi")
}
tasks.clean {
delete += listOf("$rootDir/src/main/resources/static")
}
tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask::class) {
generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
outputDir.set("$buildDir/generated/sources/mastodon")
apiPackage.set("dev.usbharu.hideout.controller.mastodon.generated")
modelPackage.set("dev.usbharu.hideout.domain.mastodon.model.generated")
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
configOptions.put("reactive", "true")
additionalProperties.put("useTags", "true")
importMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
schemaMappings.put(
"StatusesRequest",
"dev.usbharu.hideout.mastodon.interfaces.api.status.StatusesRequest"
)
templateDir.set("$rootDir/templates")
}
repositories {
mavenCentral()
maven {
url = uri("https://git.usbharu.dev/api/packages/usbharu/maven")
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/usbharu/http-signature")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
maven {
name = "GitHubPackages2"
url = uri("https://maven.pkg.github.com/multim-dev/emoji-kt")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
}
kotlin {
target {
compilations.all {
kotlinOptions.jvmTarget = JavaVersion.VERSION_21.toString()
}
}
}
sourceSets.main {
kotlin.srcDirs(
"$buildDir/generated/ksp/main",
"$buildDir/generated/sources/openapi/src/main/kotlin",
"$buildDir/generated/sources/mastodon/src/main/kotlin"
)
}
val os = org.gradle.nativeplatform.platform.internal
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies {
developmentOnly("com.h2database:h2:$h2_version")
detektPlugins(libs.detekt.formatting)
implementation(libs.bundles.exposed)
implementation(libs.bundles.coroutines)
implementation(libs.bundles.ktor.client)
implementation(libs.bundles.apache.tika)
implementation(libs.bundles.openapi)
implementation(libs.bundles.owl.producer)
implementation(libs.bundles.owl.broker)
implementation(libs.bundles.spring.boot.oauth2)
implementation(libs.bundles.spring.boot.data.mongodb)
implementation(libs.bundles.spring.boot.data.mongodb)
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("dev.usbharu:owl-common-serialize-jackson:0.0.1")
implementation("io.trbl:blurhash:1.0.0")
implementation("software.amazon.awssdk:s3:2.25.23")
implementation("org.jsoup:jsoup:1.17.2")
implementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20240325.1")
implementation("org.postgresql:postgresql:42.7.3")
implementation("com.twelvemonkeys.imageio:imageio-webp:3.10.1")
implementation("net.coobird:thumbnailator:0.4.20")
implementation("org.flywaydb:flyway-core")
implementation(libs.javacv) {
exclude(module = "opencv")
exclude(module = "flycapture")
exclude(module = "artoolkitplus")
exclude(module = "libdc1394")
exclude(module = "librealsense")
exclude(module = "librealsense2")
exclude(module = "tesseract")
exclude(module = "libfreenect")
exclude(module = "libfreenect2")
}
if (os.isWindows) {
implementation(variantOf(libs.javacv.ffmpeg) { classifier("windows-x86_64") })
} else {
implementation(variantOf(libs.javacv.ffmpeg) { classifier("linux-x86_64") })
}
implementation("dev.usbharu:http-signature:1.0.0")
implementation("dev.usbharu:emoji-kt:2.0.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
testImplementation("io.ktor:ktor-client-mock:$ktor_version")
testImplementation("com.h2database:h2:$h2_version")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
testImplementation("org.mockito:mockito-inline:5.2.0")
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.16.1")
testImplementation("com.jparams:to-string-verifier:1.4.8")
intTestImplementation("org.springframework.boot:spring-boot-starter-test")
intTestImplementation("org.springframework.security:spring-security-test")
intTestImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
intTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version")
intTestImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
intTestImplementation("com.h2database:h2:$h2_version")
e2eTestImplementation("org.springframework.boot:spring-boot-starter-test")
e2eTestImplementation("org.springframework.security:spring-security-test")
e2eTestImplementation("org.springframework.boot:spring-boot-starter-webflux")
e2eTestImplementation("org.jsoup:jsoup:1.17.2")
e2eTestImplementation("com.intuit.karate:karate-junit5:1.4.1")
e2eTestImplementation("com.h2database:h2:$h2_version")
}
detekt {
parallel = true
config = files("../detekt.yml")
buildUponDefaultConfig = true
basePath = "${rootDir.absolutePath}/src/main/kotlin"
autoCorrect = true
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**")
doFirst {
}
setSource("src/main/kotlin")
exclude("build/")
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
configurations {
all {
exclude("org.springframework.boot", "spring-boot-starter-logging")
exclude("ch.qos.logback", "logback-classic")
}
}
project.gradle.taskGraph.whenReady {
println(this.allTasks)
this.allTasks.map { println(it.name) }
if (this.hasTask(":koverGenerateArtifact")) {
println("has task")
val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true
}
}
kover {
excludeSourceSets {
names("aot", "e2eTest", "intTest")
}
}
koverReport {
filters {
excludes {
packages(
"dev.usbharu.hideout.activitypub.domain.exception",
"dev.usbharu.hideout.core.domain.exception",
"dev.usbharu.hideout.core.domain.exception.media",
"dev.usbharu.hideout.core.domain.exception.resource",
"dev.usbharu.hideout.core.domain.exception.resource.local"
)
annotatedBy("org.springframework.context.annotation.Configuration")
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
packages(
"dev.usbharu.hideout.controller.mastodon.generated",
"dev.usbharu.hideout.domain.mastodon.model.generated"
)
packages("org.springframework")
packages("org.jetbrains")
}
}
}
springBoot {
buildInfo()
}
licenseReport {
excludeOwnGroup = true
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
renderers = arrayOf<ReportRenderer>(
InventoryHtmlReportRenderer(),
CsvReportRenderer(),
JsonReportRenderer(),
XmlReportRenderer()
)
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
allowedLicensesFile = File("$projectDir/allowed-licenses.json")
configurations = arrayOf("productionRuntimeClasspath")
}

View File

@ -0,0 +1,24 @@
#
# Copyright (C) 2024 usbharu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ktor_version=2.3.9
kotlin_version=1.9.23
coroutines_version=1.8.0
kotlin.code.style=official
h2_version=2.2.224
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Fri May 03 17:44:28 JST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
hideout-core/gradlew vendored Normal file
View File

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

89
hideout-core/gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1,18 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
}
rootProject.name = "hideout-core"
includeBuild("../owl")
dependencyResolutionManagement {
repositories {
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../libs.versions.toml"))
}
}
}

View File

@ -18,6 +18,8 @@ package activitypub.inbox
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.util.Base64Util import dev.usbharu.hideout.util.Base64Util
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -150,9 +152,12 @@ class InboxTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -17,6 +17,8 @@
package activitypub.note package activitypub.note
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -230,9 +232,12 @@ class NoteTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -18,6 +18,8 @@ package activitypub.webfinger
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.application.external.Transaction import dev.usbharu.hideout.application.external.Transaction
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -103,9 +105,12 @@ class WebFingerTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -20,6 +20,8 @@ import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.domain.mastodon.model.generated.Status import dev.usbharu.hideout.domain.mastodon.model.generated.Status
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
@ -152,9 +154,13 @@ class AccountApiPaginationTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -19,6 +19,8 @@ package mastodon.account
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.infrastructure.exposedquery.FollowerQueryServiceImpl import dev.usbharu.hideout.core.infrastructure.exposedquery.FollowerQueryServiceImpl
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
@ -462,9 +464,12 @@ class AccountApiTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -18,6 +18,8 @@ package mastodon.apps
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient import dev.usbharu.hideout.core.infrastructure.springframework.oauth2.RegisteredClient
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.selectAll
@ -107,9 +109,12 @@ class AppTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -22,6 +22,8 @@ import dev.usbharu.hideout.domain.mastodon.model.generated.FilterKeywordsPostReq
import dev.usbharu.hideout.domain.mastodon.model.generated.FilterPostRequest import dev.usbharu.hideout.domain.mastodon.model.generated.FilterPostRequest
import dev.usbharu.hideout.domain.mastodon.model.generated.FilterPostRequestKeyword import dev.usbharu.hideout.domain.mastodon.model.generated.FilterPostRequestKeyword
import dev.usbharu.hideout.domain.mastodon.model.generated.V1FilterPostRequest import dev.usbharu.hideout.domain.mastodon.model.generated.V1FilterPostRequest
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
@ -702,9 +704,12 @@ class FilterTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -20,6 +20,8 @@ import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.core.service.media.MediaDataStore import dev.usbharu.hideout.core.service.media.MediaDataStore
import dev.usbharu.hideout.core.service.media.MediaSaveRequest import dev.usbharu.hideout.core.service.media.MediaSaveRequest
import dev.usbharu.hideout.core.service.media.SuccessSavedMedia import dev.usbharu.hideout.core.service.media.SuccessSavedMedia
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
@ -131,9 +133,12 @@ class MediaTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }

View File

@ -20,6 +20,8 @@ import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.hideout.domain.mastodon.model.generated.Notification import dev.usbharu.hideout.domain.mastodon.model.generated.Notification
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
@ -172,9 +174,12 @@ class ExposedNotificationsApiPaginationTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -23,6 +23,8 @@ import dev.usbharu.hideout.domain.mastodon.model.generated.Notification
import dev.usbharu.hideout.mastodon.domain.model.MastodonNotification import dev.usbharu.hideout.mastodon.domain.model.MastodonNotification
import dev.usbharu.hideout.mastodon.domain.model.NotificationType import dev.usbharu.hideout.mastodon.domain.model.NotificationType
import dev.usbharu.hideout.mastodon.infrastructure.mongorepository.MongoMastodonNotificationRepository import dev.usbharu.hideout.mastodon.infrastructure.mongorepository.MongoMastodonNotificationRepository
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.assertj.core.api.Assertions import org.assertj.core.api.Assertions
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
@ -178,7 +180,7 @@ class MongodbNotificationsApiPaginationTest {
@JvmStatic @JvmStatic
@BeforeAll @BeforeAll
fun setupMongodb( fun setupMongodb(
@Autowired mongoMastodonNotificationRepository: MongoMastodonNotificationRepository @Autowired mongoMastodonNotificationRepository: MongoMastodonNotificationRepository,
) { ) {
mongoMastodonNotificationRepository.deleteAll() mongoMastodonNotificationRepository.deleteAll()
@ -203,11 +205,14 @@ class MongodbNotificationsApiPaginationTest {
@AfterAll @AfterAll
fun dropDatabase( fun dropDatabase(
@Autowired flyway: Flyway, @Autowired flyway: Flyway,
@Autowired mongodbMastodonNotificationRepository: MongoMastodonNotificationRepository @Autowired mongodbMastodonNotificationRepository: MongoMastodonNotificationRepository,
@Autowired owlProducer: OwlProducer,
) { ) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
mongodbMastodonNotificationRepository.deleteAll() mongodbMastodonNotificationRepository.deleteAll()
} }
} }

View File

@ -22,6 +22,8 @@ import dev.usbharu.hideout.core.domain.model.emoji.UnicodeEmoji
import dev.usbharu.hideout.core.infrastructure.exposedrepository.CustomEmojis import dev.usbharu.hideout.core.infrastructure.exposedrepository.CustomEmojis
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Reactions import dev.usbharu.hideout.core.infrastructure.exposedrepository.Reactions
import dev.usbharu.hideout.core.infrastructure.exposedrepository.toReaction import dev.usbharu.hideout.core.infrastructure.exposedrepository.toReaction
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.and
@ -236,9 +238,12 @@ class StatusTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

@ -17,6 +17,8 @@
package mastodon.timelines package mastodon.timelines
import dev.usbharu.hideout.SpringApplication import dev.usbharu.hideout.SpringApplication
import dev.usbharu.owl.producer.api.OwlProducer
import kotlinx.coroutines.runBlocking
import org.flywaydb.core.Flyway import org.flywaydb.core.Flyway
import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@ -123,9 +125,12 @@ class TimelineApiTest {
companion object { companion object {
@JvmStatic @JvmStatic
@AfterAll @AfterAll
fun dropDatabase(@Autowired flyway: Flyway) { fun dropDatabase(@Autowired flyway: Flyway, @Autowired owlProducer: OwlProducer) {
flyway.clean() flyway.clean()
flyway.migrate() flyway.migrate()
runBlocking {
owlProducer.stop()
}
} }
} }
} }

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Some files were not shown because too many files have changed in this diff Show More