Vorbereitung Release 0.2.0
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package de.thpeetz
|
||||
|
||||
import jakarta.ws.rs.GET
|
||||
import jakarta.ws.rs.Path
|
||||
import jakarta.ws.rs.Produces
|
||||
import jakarta.ws.rs.core.MediaType
|
||||
|
||||
@Path("/hello")
|
||||
class GreetingResource {
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
fun hello() = "Hello from Quarkus REST"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package de.thpeetz.kontor
|
||||
|
||||
import jakarta.ws.rs.core.Application
|
||||
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition
|
||||
import org.eclipse.microprofile.openapi.annotations.info.Info
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag
|
||||
|
||||
@OpenAPIDefinition(
|
||||
info = Info(
|
||||
title = "Kontor",
|
||||
version = "0.2.0"
|
||||
)
|
||||
)
|
||||
class KontorApplication: Application()
|
||||
@@ -0,0 +1,25 @@
|
||||
package de.thpeetz.kontor.comics.domain
|
||||
|
||||
import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntityBase
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.Id
|
||||
import jakarta.persistence.Table
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@Entity
|
||||
@Table(name = "comic")
|
||||
class Comic: PanacheEntityBase {
|
||||
@Id
|
||||
lateinit var id: String
|
||||
lateinit var createdDate: LocalDateTime
|
||||
lateinit var lastModifiedDate: LocalDateTime
|
||||
lateinit var version: Integer
|
||||
lateinit var title: String
|
||||
lateinit var webLink: String
|
||||
var completed: Boolean = false
|
||||
var currentOrder: Boolean = false
|
||||
lateinit var publisherId: String
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.thpeetz.kontor.comics.resource
|
||||
|
||||
import de.thpeetz.kontor.comics.domain.Comic
|
||||
import jakarta.ws.rs.GET
|
||||
import jakarta.ws.rs.Path
|
||||
import jakarta.ws.rs.PathParam
|
||||
import jakarta.ws.rs.Produces
|
||||
import jakarta.ws.rs.core.MediaType
|
||||
import org.eclipse.microprofile.openapi.annotations.tags.Tag
|
||||
|
||||
@Path("/api/comics/comics")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Tag(name = "comics", description = "Comics")
|
||||
class ComicsResource {
|
||||
|
||||
@GET
|
||||
fun findAll(): List<Comic> = emptyList<Comic>()
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
fun findById(@PathParam("id") id: String): Comic? = null
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
quarkus.http.port=8800
|
||||
quarkus.swagger-ui.always-include=true
|
||||
quarkus.datasource.db-kind=postgresql
|
||||
quarkus.datasource.username=kontor
|
||||
quarkus.datasource.password=kontor
|
||||
quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/kontor
|
||||
#prod
|
||||
%prod.quarkus.datasource.db-kind=postgresql
|
||||
%prod.quarkus.datasource.username=kontor
|
||||
%prod.quarkus.datasource.password=kontor
|
||||
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/kontor
|
||||
# dev
|
||||
%dev.quarkus.datasource.db-kind=h2
|
||||
%dev.quarkus.datasource.username=sa
|
||||
%dev.quarkus.datasource.password=password
|
||||
%dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
|
||||
%dev.quarkus.hibernate-orm.database.generation=update
|
||||
# test
|
||||
%test.quarkus.datasource.db-kind=h2
|
||||
%test.quarkus.datasource.username=sa
|
||||
%test.quarkus.datasource.password=password
|
||||
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
|
||||
%test.quarkus.hibernate-orm.database.generation=update
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.thpeetz
|
||||
|
||||
import io.quarkus.test.junit.QuarkusIntegrationTest
|
||||
|
||||
@QuarkusIntegrationTest
|
||||
class GreetingResourceIT : GreetingResourceTest()
|
||||
@@ -0,0 +1,20 @@
|
||||
package de.thpeetz
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest
|
||||
import io.restassured.RestAssured.given
|
||||
import org.hamcrest.CoreMatchers.`is`
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@QuarkusTest
|
||||
class GreetingResourceTest {
|
||||
|
||||
@Test
|
||||
fun testHelloEndpoint() {
|
||||
given()
|
||||
.`when`().get("/hello")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(`is`("Hello from Quarkus REST"))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user