Browse Source

Hexagon: use another JSON serializer (#7576)

* Fix error with URLs in JEE servers

* Clean up

* Avoid classpath URLs

* Fix template loading error

* Fix template loading error

* Chores

* Fix template loading error

* Delete MongoDB DB support

Storage support in Hexagon will be moved outside the Toolkit, and so, it will be left outside the benchmark.

* Fix runtime problem

* Update Hexagon version

* Make Jackson Blackbird module optional

* Add variation with Blackbird module enabled

* Upgrade Hexagon version

* Enable blackbird Jackson module by default

* Update dependencies

* Use Hexagon version 2.0.0-B1 (and a little cleanup)

* Use Hexagon version 2.0.0-B1 (and a little cleanup)

* Use Tomcat instead Resin to test JEE integration

* Remove unused environment variable

* Clean Tomcat dockerfile

* Minor improvements

* Minor improvements

* Update to release version

* Update to the latest Hexagon release

* Add Netty adapter test

* Remove Gradle Wrapper

* Update version

* Update version

* Minimize template

* Skip Hexagon checks in the container

* Add Netty Epoll benchmark

* Database and template improvements

* Update Hexagon version

* Update Hexagon version

* Update DB settings

* Use a single store and template engine to simplify benchmark

* Bump mysql-connector-java in /frameworks/Java/wicket

Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.27 to 8.0.28.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.27...8.0.28)

---
updated-dependencies:
- dependency-name: mysql:mysql-connector-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump mongodb-driver-sync from 4.2.0 to 4.2.1 in /frameworks/Java/javalin

Bumps [mongodb-driver-sync](https://github.com/mongodb/mongo-java-driver) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/mongodb/mongo-java-driver/releases)
- [Commits](https://github.com/mongodb/mongo-java-driver/compare/r4.2.0...r4.2.1)

---
updated-dependencies:
- dependency-name: org.mongodb:mongodb-driver-sync
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/starlette

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/django

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/routerling

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/japronto

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/fastapi

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/uvicorn

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/flask

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.1 to 5.4.0 in /frameworks/Python/aiohttp

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.1 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](https://github.com/ultrajson/ultrajson/compare/5.1.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump rails-html-sanitizer from 1.4.2 to 1.4.3 in /frameworks/Ruby/rails

Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump jetty-server in /frameworks/Java/jetty

Bumps [jetty-server](https://github.com/eclipse/jetty.project) from 9.4.41.v20210516 to 10.0.10.
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.41.v20210516...jetty-10.0.10)

---
updated-dependencies:
- dependency-name: org.eclipse.jetty:jetty-server
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump undertow-core in /frameworks/Java/undertow

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.11.Final to 2.2.15.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](https://github.com/undertow-io/undertow/compare/2.2.11.Final...2.2.15.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update versions

* Update README.md

* Bump sanic from 22.3.1 to 22.6.1 in /frameworks/Python/sanic

Bumps [sanic](https://github.com/sanic-org/sanic) from 22.3.1 to 22.6.1.
- [Release notes](https://github.com/sanic-org/sanic/releases)
- [Changelog](https://github.com/sanic-org/sanic/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/sanic-org/sanic/compare/v22.3.1...v22.6.1)

---
updated-dependencies:
- dependency-name: sanic
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/light-java

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/rapidoid

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/jooby

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/servlet

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/spring-webflux

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/smart-socket

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/act

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Kotlin/kooby

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/dropwizard

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/hserver

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.4.0 to 42.4.1 in /frameworks/Java/undertow

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.4.0 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.4.0...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.2.23 to 42.4.1 in /frameworks/Kotlin/ktor/ktor

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.23 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.23...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update dependencies

* Bump undertow-core in /frameworks/Java/light-java

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.15.Final to 2.2.19.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](https://github.com/undertow-io/undertow/compare/2.2.15.Final...2.2.19.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump undertow-core in /frameworks/Java/undertow

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.18.Final to 2.2.19.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](https://github.com/undertow-io/undertow/compare/2.2.18.Final...2.2.19.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Delete Gradle Wrapper

* Use different JSON serializer

* Restore non Hexagon files

* Update Hexagon version

* Run pipeline

* Run pipeline

* Bump axum-core from 0.2.7 to 0.2.8 in /frameworks/Rust/axum

Bumps [axum-core](https://github.com/tokio-rs/axum) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/tokio-rs/axum/releases)
- [Changelog](https://github.com/tokio-rs/axum/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/axum/compare/axum-core-v0.2.7...axum-core-v0.2.8)

---
updated-dependencies:
- dependency-name: axum-core
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Revert "Bump axum-core from 0.2.7 to 0.2.8 in /frameworks/Rust/axum"

This reverts commit 4422de8915e70cdca67a07c2e0fdb0610757924b.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Juanjo Aguililla 2 years ago
parent
commit
7d0d2ad542

+ 4 - 4
frameworks/Kotlin/hexagon/build.gradle

@@ -4,12 +4,12 @@ plugins {
 }
 
 ext {
-    hexagonVersion = "2.0.17"
+    hexagonVersion = "2.0.23"
     hikariVersion = "5.0.1"
     jettyVersion = "11.0.11"
-    postgresqlVersion = "42.4.0"
+    postgresqlVersion = "42.5.0"
     cache2kVersion = "2.6.1.Final"
-    nettyVersion = "4.1.79.Final"
+    nettyVersion = "4.1.80.Final"
 
     gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/$hexagonVersion/gradle"
 }
@@ -36,7 +36,7 @@ dependencies {
     implementation("com.hexagonkt:http_server_jetty:$hexagonVersion")
     implementation("com.hexagonkt:templates_pebble:$hexagonVersion")
     implementation("com.hexagonkt:logging_slf4j_jul:$hexagonVersion")
-    implementation("com.hexagonkt:serialization_jackson_json:$hexagonVersion")
+    implementation("com.hexagonkt:serialization_dsl_json:$hexagonVersion")
 
     implementation("io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64")
     implementation("org.cache2k:cache2k-core:$cache2kVersion")

+ 22 - 6
frameworks/Kotlin/hexagon/src/main/kotlin/Controller.kt

@@ -1,5 +1,6 @@
 package com.hexagonkt
 
+import com.hexagonkt.core.fieldsMapOf
 import com.hexagonkt.core.media.ApplicationMedia.JSON
 import com.hexagonkt.core.media.TextMedia.HTML
 import com.hexagonkt.core.media.TextMedia.PLAIN
@@ -10,7 +11,7 @@ import com.hexagonkt.http.server.handlers.HttpServerContext
 import com.hexagonkt.http.server.handlers.PathHandler
 import com.hexagonkt.http.server.handlers.path
 import com.hexagonkt.http.toHttpFormat
-import com.hexagonkt.serialization.jackson.json.Json
+import com.hexagonkt.serialization.dsl.json.Json
 import com.hexagonkt.serialization.serialize
 import com.hexagonkt.store.BenchmarkStore
 import com.hexagonkt.templates.TemplatePort
@@ -47,7 +48,7 @@ class Controller(
             }
 
             get("/plaintext") { ok(settings.textMessage, contentType = plain) }
-            get("/json") { ok(Message(settings.textMessage).serialize(Json.raw), contentType = json) }
+            get("/json") { ok(Message(settings.textMessage).toMap().serialize(Json.raw), contentType = json) }
             get("/fortunes") { listFortunes(store, templateUrl, templateEngine) }
             get("/db") { dbQuery(store) }
             get("/query") { getWorlds(store) }
@@ -71,7 +72,7 @@ class Controller(
     private fun HttpServerContext.dbQuery(store: BenchmarkStore): HttpServerContext {
         val ids = listOf(randomWorld())
         val worlds = store.findWorlds(ids)
-        val world = worlds.first()
+        val world = worlds.first().toMap()
 
         return sendJson(world)
     }
@@ -79,7 +80,7 @@ class Controller(
     private fun HttpServerContext.getWorlds(store: BenchmarkStore): HttpServerContext {
         val worldsCount = getWorldsCount(queriesParam)
         val ids = (1..worldsCount).map { randomWorld() }
-        val worlds = store.findWorlds(ids)
+        val worlds = store.findWorlds(ids).map { it.toMap() }
 
         return sendJson(worlds)
     }
@@ -87,7 +88,7 @@ class Controller(
     private fun HttpServerContext.getCachedWorlds(store: BenchmarkStore): HttpServerContext {
         val worldsCount = getWorldsCount(cachedQueriesParam)
         val ids = (1..worldsCount).map { randomWorld() }
-        val worlds = store.findCachedWorlds(ids)
+        val worlds = store.findCachedWorlds(ids).map { it.toMap() }
 
         return sendJson(worlds)
     }
@@ -98,7 +99,7 @@ class Controller(
 
         store.replaceWorlds(worlds)
 
-        return sendJson(worlds)
+        return sendJson(worlds.map { it.toMap() })
     }
 
     private fun HttpServerContext.sendJson(body: Any): HttpServerContext =
@@ -116,4 +117,19 @@ class Controller(
 
     private fun randomWorld(): Int =
         ThreadLocalRandom.current().nextInt(worldRows) + 1
+
+    private fun Message.toMap(): Map<String, *> =
+        fieldsMapOf(Message::message to message)
+
+    private fun World.toMap(): Map<String, *> =
+        fieldsMapOf(
+            World::id to id,
+            World::randomNumber to randomNumber,
+        )
+
+    private fun CachedWorld.toMap(): Map<String, *> =
+        fieldsMapOf(
+            CachedWorld::id to id,
+            CachedWorld::randomNumber to randomNumber,
+        )
 }