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: Enable disabled TCKs #7781

Merged
merged 39 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8fb7b06
Enable disabled TCKs
jbescos Oct 10, 2023
8935601
Remove unnecessary HelidonContainerConfiguration property
jbescos Oct 13, 2023
b9cf14d
Fixing restfull tcks
jbescos Oct 13, 2023
66f114f
Revert "Remove unnecessary HelidonContainerConfiguration property"
jbescos Oct 13, 2023
6e7368e
Include explicit rest apps
jbescos Oct 16, 2023
7bfe1e7
Defend agains 1+ deployments
jbescos Oct 17, 2023
bba4aa7
Fix matrix TCKs
jbescos Oct 24, 2023
2cf6c51
Decode path. Fix 1
jbescos Oct 25, 2023
6921bce
Fix encoded paths
jbescos Nov 14, 2023
e8d23e3
Exclude some root context paths
jbescos Nov 14, 2023
d5b1ff6
Check style
jbescos Nov 14, 2023
0f46502
JAXRSProvidersClientIT fix
jbescos Nov 15, 2023
45599b3
Fix JAXRSSigTestIT
jbescos Nov 15, 2023
dcf0cfb
Working in JaxRsApplicationVisibilityTest
jbescos Nov 15, 2023
96f7762
Remove bundle from pom
jbescos Nov 20, 2023
3e1c47b
Fix Datasource tests
jbescos Nov 20, 2023
3096765
Add JaxRsApplicationOrderFiltersTest
jbescos Nov 21, 2023
8d36e1c
Exclude tests that depends on Jersey PR
jbescos Nov 22, 2023
bd42885
Single thread WELD
jbescos Nov 22, 2023
877c924
Disbale some tests that has issues
jbescos Nov 22, 2023
634b89c
TCK Failure: ee.jakarta.tck.ws.rs.ee.rs.container.responsecontext.JAX…
jbescos Nov 24, 2023
a365b3f
Add SSE test
jbescos Nov 28, 2023
c05b735
Include ee/jakarta/tck/ws/rs/jaxrs21/ee/sse/sseeventsource/JAXRSClientIT
jbescos Dec 1, 2023
e0f2478
Remove CatchAllExceptionMapper
jbescos Dec 5, 2023
dc8fe29
Fix all tests
jbescos Dec 5, 2023
c4e5f73
Fix tck-metrics
jbescos Dec 5, 2023
a399332
Enable other excluded tests
jbescos Dec 6, 2023
8a36b14
Remove NoFlushOutputStream
jbescos Dec 6, 2023
205a6e3
Add test
jbescos Dec 7, 2023
b3d021b
JSONP TCK fixes
jbescos Dec 11, 2023
a3d6126
Include CDI Lang Model
jbescos Dec 11, 2023
0de038c
Merge branch 'main' into tckDisabled
jbescos Dec 11, 2023
e84bda1
Fix after merge with main
jbescos Dec 11, 2023
5b24e0d
Inject 50 tests
jbescos Dec 11, 2023
9027d19
CDI sigtest
jbescos Dec 12, 2023
4b65eca
Enabled disabled test
jbescos Dec 12, 2023
70b7223
Fix metrix HelloWorldTest
jbescos Dec 12, 2023
a4e968a
Improvements in ServerSseTest
jbescos Dec 13, 2023
76e6609
Unify CatchAllExceptionMapper
jbescos Dec 14, 2023
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
2 changes: 1 addition & 1 deletion dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<version.lib.jboss.classfilewriter>1.3.0.Final</version.lib.jboss.classfilewriter>
<version.lib.jboss.logging>3.5.3.Final</version.lib.jboss.logging>
<version.lib.jaxb-runtime>4.0.3</version.lib.jaxb-runtime>
<version.lib.jersey>3.1.3</version.lib.jersey>
<version.lib.jersey>3.1.4</version.lib.jersey>
<version.lib.jgit>6.7.0.202309050840-r</version.lib.jgit>
<version.lib.junit>5.9.3</version.lib.junit>
<version.lib.kafka>3.6.0</version.lib.kafka>
Expand Down
6 changes: 4 additions & 2 deletions http/http/src/main/java/io/helidon/http/PathMatchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.regex.Pattern;

import io.helidon.common.parameters.Parameters;
import io.helidon.common.uri.UriEncoding;
import io.helidon.common.uri.UriPath;

/**
Expand Down Expand Up @@ -276,8 +277,9 @@ static final class ExactPathMatcher implements PathMatcher {
private final String pathWithTrailingSlash;

ExactPathMatcher(String path) {
this.path = path;
this.pathWithTrailingSlash = path + "/";
// We work with decoded URIs
spericas marked this conversation as resolved.
Show resolved Hide resolved
this.path = UriEncoding.decodeUri(path);
this.pathWithTrailingSlash = this.path + "/";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.helidon.integrations.micrometer.cdi;

import java.lang.System.Logger.Level;

import io.helidon.webserver.http.ServerRequest;

import jakarta.annotation.Priority;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

/**
* Default mapper for exceptions that are not caught.
*/
@Provider
@Priority(5000)
public class CatchAllExceptionMapper implements ExceptionMapper<Exception> {

private static final System.Logger LOGGER = System.getLogger(CatchAllExceptionMapper.class.getName());
@Context
private ServerRequest serverRequest;

@Override
public Response toResponse(Exception exception) {
serverRequest.context().register("unmappedException", exception);
if (exception instanceof WebApplicationException wae) {
return wae.getResponse();
} else {
LOGGER.log(Level.WARNING, () -> "Internal server error", exception);
return Response.serverError().build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/
@HelidonTest
@AddBean(HelloWorldResource.class)
spericas marked this conversation as resolved.
Show resolved Hide resolved
@AddBean(CatchAllExceptionMapper.class)
public class HelloWorldTest {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Handler;
Expand All @@ -46,6 +45,8 @@
import jakarta.enterprise.context.BeforeDestroyed;
import jakarta.enterprise.context.Destroyed;
import jakarta.enterprise.context.Initialized;
import jakarta.enterprise.event.Startup;
import jakarta.enterprise.inject.Any;
import jakarta.enterprise.inject.se.SeContainer;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.CDI;
Expand Down Expand Up @@ -96,6 +97,8 @@ final class HelidonContainerImpl extends Weld implements HelidonContainer {
private static final Context ROOT_CONTEXT;
// whether the current shutdown was invoked by the shutdown hook
private static final AtomicBoolean FROM_SHUTDOWN_HOOK = new AtomicBoolean();
// Default Weld container id. TCKs assumes this value.
private static final String STATIC_INSTANCE = "STATIC_INSTANCE";

static {
HelidonFeatures.flavor(HelidonFlavor.MP);
Expand All @@ -119,7 +122,7 @@ final class HelidonContainerImpl extends Weld implements HelidonContainer {

HelidonContainerImpl() {
this.bootstrap = new WeldBootstrap();
id = UUID.randomUUID().toString();
this.id = STATIC_INSTANCE;
spericas marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -205,6 +208,7 @@ public Collection<URL> getResources(String name) {
}
deployment.getServices().add(ExternalConfiguration.class, configurationBuilder.build());

// CDI TCK tests expects SE to be excluded, which means Helidon may require to do things that Weld is supposed to do.
bootstrap.startContainer(id, Environments.SE, deployment);

bootstrap.startInitialization();
Expand Down Expand Up @@ -315,6 +319,7 @@ private HelidonContainerImpl doStart() {
keepLoggingActive(shutdownHook);

bm.getEvent().select(Initialized.Literal.APPLICATION).fire(new ContainerInitialized(id));
bm.getEvent().select(Any.Literal.INSTANCE).fire(new Startup());

now = System.currentTimeMillis() - now;
LOGGER.fine("Container started in " + now + " millis (this excludes the initialization time)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.context.spi.CreationalContext;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.Vetoed;
import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
import jakarta.enterprise.inject.spi.AfterDeploymentValidation;
import jakarta.enterprise.inject.spi.Annotated;
Expand Down Expand Up @@ -136,7 +137,7 @@ private void processAnnotatedType(@Observes @WithAnnotations(ConfigProperties.cl
private <X> void harvestConfigPropertyInjectionPointsFromEnabledObserverMethod(@Observes ProcessObserverMethod<?, X> event,
BeanManager beanManager) {
AnnotatedMethod<X> annotatedMethod = event.getAnnotatedMethod();
if (annotatedMethod != null) {
if (annotatedMethod != null && !annotatedMethod.getDeclaringType().isAnnotationPresent(Vetoed.class)) {
List<AnnotatedParameter<X>> annotatedParameters = annotatedMethod.getParameters();
if (annotatedParameters != null) {
for (AnnotatedParameter<?> annotatedParameter : annotatedParameters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.helidon.lra.coordinator.client.CoordinatorClient;
import io.helidon.lra.coordinator.client.PropagatedHeaders;
import io.helidon.microprofile.config.ConfigCdiExtension;
import io.helidon.microprofile.lra.resources.CatchAllExceptionMapper;
import io.helidon.microprofile.lra.resources.CdiNestedCompleteOrCompensate;
import io.helidon.microprofile.lra.resources.CommonAfter;
import io.helidon.microprofile.lra.resources.DontEnd;
Expand Down Expand Up @@ -95,6 +96,7 @@
// LRA client
@AddExtension(LraCdiExtension.class)
// Test resources
@AddBean(CatchAllExceptionMapper.class)
spericas marked this conversation as resolved.
Show resolved Hide resolved
@AddBean(JaxRsCompleteOrCompensate.class)
@AddBean(NonJaxRsCompleteOrCompensate.class)
@AddBean(NonJaxRsCompleteOrCompensateCS.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.helidon.microprofile.lra.resources;

import java.lang.System.Logger.Level;

import io.helidon.webserver.http.ServerRequest;

import jakarta.annotation.Priority;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

/**
* Default mapper for exceptions that are not caught.
*/
@Provider
@Priority(5000)
public class CatchAllExceptionMapper implements ExceptionMapper<Exception> {

private static final System.Logger LOGGER = System.getLogger(CatchAllExceptionMapper.class.getName());
@Context
private ServerRequest serverRequest;

@Override
public Response toResponse(Exception exception) {
serverRequest.context().register("unmappedException", exception);
if (exception instanceof WebApplicationException wae) {
return wae.getResponse();
} else {
LOGGER.log(Level.WARNING, () -> "Internal server error", exception);
return Response.serverError().build();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.helidon.microprofile.metrics;

import java.lang.System.Logger.Level;

import io.helidon.webserver.http.ServerRequest;

import jakarta.annotation.Priority;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

/**
* Default mapper for exceptions that are not caught.
*/
@Provider
@Priority(5000)
public class CatchAllExceptionMapper implements ExceptionMapper<Exception> {

private static final System.Logger LOGGER = System.getLogger(CatchAllExceptionMapper.class.getName());
@Context
private ServerRequest serverRequest;

@Override
public Response toResponse(Exception exception) {
serverRequest.context().register("unmappedException", exception);
if (exception instanceof WebApplicationException wae) {
return wae.getResponse();
} else {
LOGGER.log(Level.WARNING, () -> "Internal server error", exception);
return Response.serverError().build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.regex.Pattern;
import java.util.stream.IntStream;

import io.helidon.microprofile.testing.junit5.AddBean;
import io.helidon.microprofile.testing.junit5.AddConfig;
import io.helidon.microprofile.testing.junit5.HelidonTest;

Expand Down Expand Up @@ -55,6 +56,7 @@
@HelidonTest
@AddConfig(key = "metrics." + MetricsCdiExtension.REST_ENDPOINTS_METRIC_ENABLED_PROPERTY_NAME, value = "true")
@AddConfig(key = "metrics.permit-all", value = "true")
@AddBean(CatchAllExceptionMapper.class)
spericas marked this conversation as resolved.
Show resolved Hide resolved
class HelloWorldTest {

@Inject
Expand Down
5 changes: 5 additions & 0 deletions microprofile/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<name>Helidon Microprofile Server</name>
<description>Server of the microprofile implementation</description>

<properties>
<surefire.argLine>-Xmx1024m -Dfile.encoding=UTF-8 -Dorg.jboss.weld.construction.relaxed=false</surefire.argLine>
<failsafe.argLine>-Xmx1024m -Dfile.encoding=UTF-8 -Dorg.jboss.weld.construction.relaxed=false</failsafe.argLine>
</properties>

<dependencies>
<dependency>
<groupId>io.helidon.config</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,14 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import io.helidon.webserver.http.ServerRequest;

import jakarta.annotation.Priority;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.Initialized;
import jakarta.enterprise.event.Observes;
import jakarta.enterprise.inject.spi.Extension;
import jakarta.enterprise.inject.spi.ProcessManagedBean;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -277,29 +271,11 @@ JaxRsService toJerseySupport(JaxRsApplication jaxRsApplication,
InjectionManager injectionManager) {

ResourceConfig resourceConfig = jaxRsApplication.resourceConfig();
resourceConfig.register(new CatchAllExceptionMapper());

return JaxRsService.create(resourceConfig,
injectionManager);
}

@Provider
private static class CatchAllExceptionMapper implements ExceptionMapper<Exception> {
@Context
private ServerRequest serverRequest;

@Override
public Response toResponse(Exception exception) {
serverRequest.context().register("unmappedException", exception);
if (exception instanceof WebApplicationException wae) {
return wae.getResponse();
} else {
LOGGER.log(Level.WARNING, () -> "Internal server error", exception);
return Response.serverError().build();
}
}
}

Optional<String> findContextRoot(io.helidon.config.Config config, JaxRsApplication jaxRsApplication) {
return config.get(jaxRsApplication.appClassName() + "." + RoutingPath.CONFIG_KEY_PATH)
.asString()
Expand Down
Loading