Skip to content

Commit

Permalink
Update Hexagon version
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Aug 15, 2023
1 parent 828dafe commit 6356d05
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id("org.graalvm.buildtools.native") version("0.9.24")
}

val hexagonVersion = "3.0.0-B9"
val hexagonVersion = "3.0.0"
val gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/$hexagonVersion/gradle"

ext.set("options", "-Xmx48m")
Expand All @@ -23,7 +23,7 @@ group="org.example"
description="Service's description"

dependencies {
"implementation"("com.hexagonkt:http_server_jetty:$hexagonVersion")
"implementation"("com.hexagonkt:http_server_netty:$hexagonVersion")
"implementation"("org.slf4j:slf4j-nop:2.0.7")

"testImplementation"("com.hexagonkt:http_client_jetty:$hexagonVersion")
Expand All @@ -36,6 +36,7 @@ extensions.configure<GraalVMExtension> {
binaries {
named("main") {
listOfNotNull(
option("static") { "--static" },
option("enableMonitoring") { "--enable-monitoring" },
)
.forEach(buildArgs::add)
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ package org.example

import com.hexagonkt.core.ALL_INTERFACES
import com.hexagonkt.http.server.*
import com.hexagonkt.http.server.jetty.JettyServletAdapter
import com.hexagonkt.http.server.netty.NettyServerAdapter
import com.hexagonkt.core.logging.LoggingManager
import com.hexagonkt.core.media.TEXT_PLAIN
import com.hexagonkt.http.model.ContentType
import com.hexagonkt.http.model.Header

internal val settings = HttpServerSettings(ALL_INTERFACES, 9090)
internal val serverAdapter = JettyServletAdapter(minThreads = 4)
internal val serverAdapter = NettyServerAdapter(executorThreads = 4)

internal lateinit var server: HttpServer

internal fun main() {
LoggingManager.defaultLoggerName = "org.example"
server = serve(serverAdapter, settings) {
on("*") {
before("*") {
send(headers = response.headers + Header("server", "Hexagon/2.6"))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Args=--static -R:MaxHeapSize=16
Args=-R:MaxHeapSize=16
4 changes: 2 additions & 2 deletions src/test/kotlin/ApplicationTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.example

import com.hexagonkt.core.media.TEXT_PLAIN
import com.hexagonkt.core.urlOf
import com.hexagonkt.http.client.HttpClient
import com.hexagonkt.http.client.HttpClientSettings
import com.hexagonkt.http.client.jetty.JettyClientAdapter
Expand All @@ -9,15 +10,14 @@ import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
import java.net.URL
import kotlin.test.assertEquals
import kotlin.test.assertNotNull

@TestInstance(PER_CLASS)
internal class ApplicationTest {

private val client by lazy {
val clientSettings = HttpClientSettings(URL("http://localhost:${server.runtimePort}"))
val clientSettings = HttpClientSettings(urlOf("http://localhost:${server.runtimePort}"))
HttpClient(JettyClientAdapter(), clientSettings)
}

Expand Down

0 comments on commit 6356d05

Please sign in to comment.