Skip to content

Commit

Permalink
4.x Enable tests that were disabled during renaming to jakarta packag…
Browse files Browse the repository at this point in the history
…es work (#7949)

Signed-off-by: tvallin <thibault.vallin@oracle.com>
  • Loading branch information
tvallin committed Nov 7, 2023
1 parent f45b9e3 commit b9103ab
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,8 @@

package io.helidon.examples.integrations.micronaut.data;

import jakarta.validation.ConstraintViolationException;
import javax.validation.ConstraintViolationException;

import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

package io.helidon.examples.integrations.micronaut.data;

import javax.validation.constraints.Pattern;

import io.helidon.examples.integrations.micronaut.data.model.Pet;

import jakarta.inject.Inject;
import jakarta.validation.constraints.Pattern;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@
import jakarta.json.JsonObject;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@HelidonTest
@Disabled("3.0.0-JAKARTA") // Micronaut - validation Error instantiating bean of type
// [io.helidon.examples.integrations.micronaut.data.DbPopulateData$ApplicationEventListener$init1$Intercepted]:
// Error loading bean [io.micronaut.validation.ValidatingInterceptor]: javax/validation/Validator
class MicronautExampleTest {
@Inject
private WebTarget webTarget;
Expand Down
5 changes: 5 additions & 0 deletions examples/microprofile/cors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
<artifactId>helidon-webclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.http.media</groupId>
<artifactId>helidon-http-media-jsonb</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public GreetingMessage getMessage(@PathParam("name") String name) {
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequestBody(name = "greeting",
@RequestBody(name = "message",
required = true,
content = @Content(mediaType = "application/json",
schema = @Schema(type = SchemaType.OBJECT, requiredProperties = { "greeting" })))
schema = @Schema(type = SchemaType.OBJECT, requiredProperties = { "message" })))
@APIResponses({
@APIResponse(name = "normal", responseCode = "204", description = "Greeting updated"),
@APIResponse(name = "missing 'greeting'", responseCode = "400",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.helidon.http.HeaderNames;
import io.helidon.http.Headers;
import io.helidon.http.Method;
import io.helidon.http.media.jsonb.JsonbSupport;
import io.helidon.microprofile.server.Server;
import io.helidon.webclient.http1.Http1Client;
import io.helidon.webclient.http1.Http1ClientRequest;
Expand All @@ -46,16 +47,15 @@
import static org.hamcrest.Matchers.not;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@Disabled("3.0.0-JAKARTA") // OpenAPI: Caused by: java.lang.NoSuchMethodError:
// 'java.util.List io.smallrye.jandex.ClassInfo.unsortedFields()'
public class TestCORS {

private static Http1Client client;
private static Server server;

@BeforeAll
static void init() {
Config serverConfig = Config.create().get("server");
Config config = Config.create();
Config serverConfig = config.get("server");
Server.Builder serverBuilder = Server.builder();
serverConfig.ifExists(serverBuilder::config);
server = serverBuilder
Expand All @@ -64,6 +64,7 @@ static void init() {
.start();
client = Http1Client.builder()
.baseUri("http://localhost:" + server.port())
.addMediaSupport(JsonbSupport.create(config))
.build();
}

Expand Down Expand Up @@ -184,7 +185,7 @@ void testNamedGreetWithCors() {
@Test
void testGreetingChangeWithCorsAndOtherOrigin() {
Http1ClientRequest req = client.put()
.header(HeaderNames.ORIGIN, "http://foo.com")
.header(HeaderNames.ORIGIN, "http://other.com")
.header(HeaderNames.HOST, "here.com");

try (Http1ClientResponse r = putResponse("/greet/greeting", "Ahoy", req)) {
Expand Down Expand Up @@ -213,7 +214,7 @@ private static String fromPayload(Http1ClientResponse response) {
}

private static GreetingMessage toPayload(String message) {
return new GreetingMessage(message);
return new GreetingMessage(message);
}

private static Http1ClientResponse putResponse(String path, String message) {
Expand Down

0 comments on commit b9103ab

Please sign in to comment.