Skip to content

Commit 568692e

Browse files
committed
test compile integration test outputs
1 parent e9153f3 commit 568692e

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ testing {
2929

3030
testInt(JvmTestSuite) {
3131
useJUnitJupiter(libs.versions.junit.get())
32-
testType = TestSuiteType.INTEGRATION_TEST
3332

3433
dependencies {
3534
implementation(project())
@@ -138,6 +137,8 @@ dependencies {
138137
testIntImplementation (libs.mockk)
139138
testIntImplementation (libs.logback)
140139
testIntImplementation (libs.jimfs)
140+
testIntImplementation (libs.micronaut.web)
141+
testIntImplementation (libs.micronaut.data)
141142
}
142143

143144
tasks.named("dependencyUpdates").configure {

gradle/libs.versions.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ base = "2025.3-SNAPSHOT"
99
junit = "5.9.3"
1010
jacoco = "0.8.7"
1111

12+
micronaut = "3.7.1"
13+
1214
[libraries]
1315
openapi-processor-api = { module = "io.openapiprocessor:openapi-processor-api", version.ref = "api" }
1416
openapi-processor-test-base = { module = "io.openapiprocessor:openapi-processor-test", version.ref = "base" }
@@ -18,6 +20,9 @@ openapi-processor-parser-api = { module = "io.openapiprocessor:openapi-processor
1820
openapi-processor-parser-swagger = { module = "io.openapiprocessor:openapi-processor-core-parser-swagger", version.ref = "base" }
1921
openapi-processor-parser-openapi4j = { module ="io.openapiprocessor:openapi-processor-core-parser-openapi4j", version.ref = "base" }
2022

23+
micronaut-web = { module ="io.micronaut:micronaut-http", version.ref = "micronaut" }
24+
micronaut-data = { module ="io.micronaut.data:micronaut-data-model", version.ref = "micronaut" }
25+
2126
checker = "org.checkerframework:checker:3.49.0"
2227
jimfs = "com.google.jimfs:jimfs:1.3.0"
2328
slf4j = "org.slf4j:slf4j-api:2.0.16"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-processor-micronaut
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiprocessor.micronaut
7+
8+
import io.kotest.core.spec.style.StringSpec
9+
import io.kotest.engine.spec.tempdir
10+
import io.kotest.matchers.booleans.shouldBeTrue
11+
import io.openapiprocessor.core.parser.ParserType
12+
import io.openapiprocessor.test.*
13+
import kotlin.collections.filter
14+
import kotlin.collections.map
15+
import kotlin.collections.plus
16+
import kotlin.jvm.java
17+
18+
19+
class CompileExpectedSpec: StringSpec({
20+
21+
for (testSet in sources()) {
22+
"compile - $testSet".config(enabled = true) {
23+
val folder = tempdir()
24+
val reader = ResourceReader(CompileExpectedSpec::class.java)
25+
26+
val testFiles = TestFilesNative(folder, reader)
27+
28+
TestSetCompiler(testSet, testFiles)
29+
.run(
30+
setOf(
31+
"src/testInt/resources/compile/Generated.java"
32+
)
33+
)
34+
.shouldBeTrue()
35+
}
36+
}
37+
})
38+
39+
private fun sources(): Collection<TestSet> {
40+
val compile30 = ALL_30.map {
41+
testSet(it.name, ParserType.INTERNAL, it.openapi, model = "default", outputs = it.outputs, expected = it.expected)
42+
}
43+
44+
val compile31 = ALL_31.map {
45+
testSet(it.name, ParserType.INTERNAL, it.openapi, model = "default", outputs = it.outputs, expected = it.expected)
46+
}
47+
48+
val compile30r = ALL_30.filter { it.modelTypes.contains(ModelTypes.RECORD) }.map {
49+
testSet(it.name, ParserType.INTERNAL, it.openapi, model = "record", outputs = it.outputs, expected = it.expected)
50+
}
51+
52+
val compile31r = ALL_31.filter { it.modelTypes.contains(ModelTypes.RECORD) }.map {
53+
testSet(it.name, ParserType.INTERNAL, it.openapi, model = "record", outputs = it.outputs, expected = it.expected)
54+
}
55+
56+
return compile30 + compile31 + compile30r + compile31r
57+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package generated.support;
2+
3+
import java.lang.annotation.*;
4+
import static java.lang.annotation.ElementType.*;
5+
import static java.lang.annotation.RetentionPolicy.*;
6+
7+
@Documented
8+
@Retention(CLASS)
9+
@Target({TYPE, METHOD})
10+
@Generated(value = "openapi-processor-spring", version = "test")
11+
public @interface Generated {
12+
/**
13+
* The name of the source code generator, i.e. openapi-processor-*.
14+
*
15+
* @return name of the generator
16+
*/
17+
String value();
18+
19+
/**
20+
* @return version of the generator
21+
*/
22+
String version();
23+
24+
/**
25+
* The date &amp; time of generation (ISO 8601) or "-" if no date was set.
26+
*
27+
* @return date of generation
28+
*/
29+
String date() default "-";
30+
31+
/**
32+
* The url of the generator.
33+
*
34+
* @return url of generator
35+
*/
36+
String url() default "https://openapiprocessor.io";
37+
}

0 commit comments

Comments
 (0)