Skip to content

Commit

Permalink
3.x: Enable tests that were disabled during renaming to jakarta packa…
Browse files Browse the repository at this point in the history
…ges work (#7606)

Signed-off-by: tvallin <[email protected]>
  • Loading branch information
tvallin authored Oct 3, 2023
1 parent 5a84914 commit 5f90f74
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 44 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 Down Expand Up @@ -28,13 +28,11 @@
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

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

@Disabled("3.0.0-JAKARTA") // persistence.xml failure
class MainTest {

private static Server server;
Expand Down
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
@@ -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,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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import jakarta.ws.rs.client.ClientBuilder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.neo4j.harness.Neo4j;
import org.neo4j.harness.Neo4jBuilders;
Expand All @@ -37,8 +36,6 @@
/**
* Main tests of the application done here.
*/
@Disabled("3.0.0-JAKARTA") // OpenAPI
// Caused by: java.lang.NoSuchMethodError: 'java.util.List org.jboss.jandex.ClassInfo.unsortedFields()'
class MainTest {
private static Server server;
private static Neo4j embeddedDatabaseServer;
Expand Down Expand Up @@ -70,11 +67,11 @@ void testMovies() {

Client client = ClientBuilder.newClient();

JsonArray jsorArray = client
JsonArray jsonArray = client
.target(getConnectionString("/movies"))
.request()
.get(JsonArray.class);
JsonObject first = jsorArray.getJsonObject(0);
JsonObject first = jsonArray.getJsonObject(0);
assertThat(first.getString("title"), is("The Matrix"));

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021 Oracle and/or its affiliates.
* Copyright (c) 2018, 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 @@ -21,7 +21,6 @@
import jakarta.inject.Inject;
import jakarta.json.JsonObject;
import jakarta.ws.rs.client.WebTarget;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -32,8 +31,6 @@
* Unit test for {@link HelloWorldResource}.
*/
@HelidonTest
@Disabled("3.0.0-JAKARTA") // OpenAPI: Caused by: java.lang.NoSuchMethodError:
// 'java.util.List org.jboss.jandex.ClassInfo.unsortedFields()'
class ImplicitHelloWorldTest {
private final WebTarget target;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

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

@Disabled("3.0.0-JAKARTA") // OpenAPI: Caused by: java.lang.NoSuchMethodError:
// 'java.util.List org.jboss.jandex.ClassInfo.unsortedFields()'
class MainTest {
private static Server server;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022 Oracle and/or its affiliates.
* Copyright (c) 2018, 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 Down Expand Up @@ -32,14 +32,11 @@
import jakarta.json.JsonString;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

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

@Disabled("3.0.0-JAKARTA") // OpenAPI: org.yaml.snakeyaml.constructor.ConstructorException:
// Cannot create property=paths for JavaBean=io.smallrye.openapi.api.models.OpenAPIImpl@5dcd8c7a
public class MainTest {

private static WebServer webServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import io.helidon.microprofile.tests.junit5.AddBean;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -36,7 +35,6 @@
*/
@AddBean(RetryBean.class)
@AddBean(SyntheticRetryBean.class)
@Disabled("3.0.0-JAKARTA")
public class RetryTest extends FaultToleranceTest {

static Stream<Arguments> createBeans() {
Expand Down
20 changes: 15 additions & 5 deletions openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ private Optional<MediaType> chooseResponseMediaType(ServerRequest req) {
private static class HelidonAnnotationScannerExtension implements AnnotationScannerExtension {

@Override
public Object parseExtension(String key, String value) {

public Object parseValue(String value) {
// Inspired by SmallRye's JsonUtil#parseValue method.
if (value == null) {
return null;
Expand Down Expand Up @@ -594,10 +593,9 @@ public Object parseExtension(String key, String value) {
JsonValue jsonValue = reader.readValue();
return convertJsonValue(jsonValue);
} catch (Exception ex) {
LOGGER.log(Level.SEVERE, String.format("Error parsing extension key: %s, value: %s", key, value), ex);
LOGGER.log(Level.SEVERE, String.format("Error parsing value: %s", value), ex);
throw ex;
}
break;

default:
break;
}
Expand All @@ -606,6 +604,18 @@ public Object parseExtension(String key, String value) {
return value;
}

@Override
public Object parseExtension(String key, String value) {
try {
return parseValue(value);
} catch (Exception ex) {
LOGGER.log(Level.SEVERE,
String.format("Error parsing extension key: %s, value: %s", key, value),
ex);
return null;
}
}

private static Object convertJsonValue(JsonValue jsonValue) {
switch (jsonValue.getValueType()) {
case ARRAY:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021 Oracle and/or its affiliates.
* Copyright (c) 2019, 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 Down Expand Up @@ -46,7 +46,6 @@
import jakarta.json.JsonObject;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -255,13 +254,11 @@ void basicTestMetricsHealthJackson() throws Exception {
}

@Test
@Disabled("3.0.0-JAKARTA")
void basicTestMetricsHealthSEModules() throws Exception {
runMetricsAndHealthTest("se", "jsonp", true);
}

@Test
@Disabled("3.0.0-JAKARTA")
void basicTestMetricsHealthMPModules() throws Exception {
runMetricsAndHealthTest("mp", "", true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 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 @@ -23,7 +23,6 @@
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.not;
Expand All @@ -33,7 +32,6 @@
import static org.hamcrest.Matchers.hasKey;

@HelidonTest
@Disabled("3.0.0-JAKARTA")
class MainTest {

@Inject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021 Oracle and/or its affiliates.
* Copyright (c) 2019, 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 @@ -25,7 +25,6 @@
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.hamcrest.CoreMatchers.is;
Expand Down Expand Up @@ -59,7 +58,6 @@ void testZipkin() {
}

@Test
@Disabled("3.0.0-JAKARTA") // java.lang.IllegalStateException: No RestClientBuilderResolver implementation found!
void invokeEndpoint() {
MpResource client = RestClientBuilder.newBuilder()
.baseUri(URI.create("http://localhost:" + port))
Expand Down

0 comments on commit 5f90f74

Please sign in to comment.