Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: Update bookstore test for Nima to add jsonb and jackson media #6577

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tests/apps/bookstore/bookstore-nima/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
<groupId>io.helidon.nima.http.media</groupId>
<artifactId>helidon-nima-http-media-jsonp</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.nima.http.media</groupId>
<artifactId>helidon-nima-http-media-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.nima.http.media</groupId>
<artifactId>helidon-nima-http-media-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.nima.observe</groupId>
<artifactId>helidon-nima-observe-health</artifactId>
Expand All @@ -78,12 +86,6 @@
<groupId>io.helidon.health</groupId>
<artifactId>helidon-health-checks</artifactId>
</dependency>
<!-- does not exist yet
<dependency>
<groupId>io.helidon.nima.media</groupId>
<artifactId>helidon-nima-media-jackson</artifactId>
</dependency>
-->
<dependency>
<groupId>io.helidon.tests.apps.bookstore.common</groupId>
<artifactId>helidon-tests-apps-bookstore-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import io.helidon.health.checks.HeapMemoryHealthCheck;
import io.helidon.logging.common.LogConfig;
import io.helidon.nima.common.tls.Tls;
import io.helidon.nima.http.media.jackson.JacksonSupport;
import io.helidon.nima.http.media.jsonb.JsonbSupport;
import io.helidon.nima.http.media.jsonp.JsonpSupport;
import io.helidon.nima.observe.health.HealthFeature;
import io.helidon.nima.observe.metrics.MetricsFeature;
import io.helidon.nima.webserver.Routing;
Expand Down Expand Up @@ -104,18 +107,16 @@ static WebServer startServer(boolean ssl, boolean http2, boolean compression) {
private static void configureJsonSupport(WebServer.Builder wsBuilder, Config config) {
JsonLibrary jsonLibrary = getJsonLibrary(config);

/* Nima WebServer.Builder does not currently support programmatic way to set media support */
/* See issue https://github.com/helidon-io/helidon/issues/6278 */
switch (jsonLibrary) {
case JSONP:
//wsBuilder.addMediaSupport(JsonpSupport.create());
wsBuilder.addMediaSupport(JsonpSupport.create(config));
break;
case JSONB:
throw new RuntimeException(jsonLibrary + " is not a supported JSON Library. Only JSONP is supported at this time");
//wsBuilder.addMediaSupport(JsonbSupport.create());
wsBuilder.addMediaSupport(JsonbSupport.create(config));
break;
case JACKSON:
throw new RuntimeException(jsonLibrary + " is not a supported JSON Library. Only JSONP is supported at this time");
//wsBuilder.addMediaSupport(JacksonSupport.create());
wsBuilder.addMediaSupport(JacksonSupport.create(config));
break;
default:
throw new RuntimeException("Unknown JSON library " + jsonLibrary);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
requires io.helidon.nima.observe.metrics;
requires io.helidon.nima.observe.health;
requires io.helidon.nima.http.media.jsonp;
//requires io.helidon.nima.media.jackson;
requires io.helidon.nima.http.media.jackson;
requires io.helidon.nima.http.media.jsonb;
requires io.helidon.tests.apps.bookstore.common;
requires io.helidon.logging.common;
requires io.helidon.logging.jul;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,20 @@ private void runExitOnStartedTest(String edition) throws Exception {
@ParameterizedTest
@ValueSource(strings = {"se", "mp", "nima"})
void basicTestJson(String edition) throws Exception {
// Run using the default json library for the edition
runJsonFunctionalTest(edition, "");
}

@Test
void basicTestJsonB() throws Exception {
runJsonFunctionalTest("se", "jsonb");
@ParameterizedTest
@ValueSource(strings = {"se", "nima"})
void basicTestJsonB(String edition) throws Exception {
runJsonFunctionalTest(edition, "jsonb");
}

@Test
void basicTestJackson() throws Exception {
runJsonFunctionalTest("se", "jackson");
@ParameterizedTest
@ValueSource(strings = {"se", "nima"})
void basicTestJackson(String edition) throws Exception {
runJsonFunctionalTest(edition, "jackson");
}

@ParameterizedTest
Expand Down