Skip to content

Commit

Permalink
Merge pull request #12624 from gsmet/1.8.3-backports-1
Browse files Browse the repository at this point in the history
1.8.3 backports 1
  • Loading branch information
gsmet authored Oct 9, 2020
2 parents 3dd626a + 62528fb commit 32f62d3
Show file tree
Hide file tree
Showing 36 changed files with 638 additions and 66 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ jobs:
grpc-interceptors
grpc-mutual-auth
grpc-plain-text
grpc-plain-text-mutiny
grpc-proto-v2
grpc-streaming
grpc-tls
Expand Down
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<wildfly.openssl.version>1.0.6.Final</wildfly.openssl.version>
<jboss-logging-annotations.version>2.1.0.Final</jboss-logging-annotations.version>
<slf4j.version>1.7.30</slf4j.version>
<slf4j-jboss-logging.version>1.2.1.Final</slf4j-jboss-logging.version>
<slf4j-jboss-logging.version>1.2.0.Final</slf4j-jboss-logging.version>
<wildfly-common.version>1.5.4.Final-format-001</wildfly-common.version>
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>1.12.1.Final</wildfly-elytron.version>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/amazon-lambda-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ as a dependencies. The extension automatically generates everything you might n
NOTE: In previous versions of this extension you had to set up your pom or gradle
to zip up your executable for native deployments, but this is not the case anymore.

Also, at least in the generated maven archetype `pom.xml`, the `quarkus-resteasy`, `quarkus-vertx-web`, and `quarkus-underdow`
Also, at least in the generated maven archetype `pom.xml`, the `quarkus-resteasy`, `quarkus-vertx-web`, and `quarkus-undertow`
dependencies are all optional. Pick which http framework(s) you want to use (JAX-RS, Vertx Web, and/or Servlet) and
remove the other dependencies to shrink your deployment.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/cdi-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ It's possible to annotate a non-private static method with an interceptor bindin
class Services {
@Logged <1>
static BigDecimal computePrice(long amout) { <2>
static BigDecimal computePrice(long amount) { <2>
BigDecimal price;
// Perform computations...
return price;
Expand Down Expand Up @@ -690,7 +690,7 @@ import io.quarkus.arc.Lock;
@ApplicationScoped
class SharedService {
void addAmount(BigDecimal amout) {
void addAmount(BigDecimal amount) {
// ...changes some internal state of the bean
}
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/cdi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public class Translator {

A: Yes, you can.
In fact, in CDI the "setter injection" is superseded by more powerful https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#initializer_methods[initializer methods, window="_blank"].
Intializers may accept multiple parameters and don't have to follow the JavaBean naming conventions.
Initializers may accept multiple parameters and don't have to follow the JavaBean naming conventions.

.Initialized and Constructor Injection Example
[source,java]
Expand Down Expand Up @@ -183,13 +183,13 @@ A: You can use all the built-in scopes mentioned by the specification except for
|`@javax.inject.Singleton` | Just like `@ApplicationScoped` except that no client proxy is used. The instance is created when an injection point that resolves to a @Singleton bean is being injected.
|`@javax.enterprise.context.RequestScoped` | The bean instance is associated with the current _request_ (usually an HTTP request).
|`@javax.enterprise.context.Dependent` | This is a pseudo-scope. The instances are not shared and every injection point spawns a new instance of the dependent bean. The lifecycle of dependent bean is bound to the bean injecting it - it will be created and destroyed along with the bean injecting it.
|`@javax.enterprise.context.SessionScoped` | This scope is backed by an `javax.servlet.http.HttpSession` object. It's only available if the `quarkus-undertow` extension is used.
|`@javax.enterprise.context.SessionScoped` | This scope is backed by a `javax.servlet.http.HttpSession` object. It's only available if the `quarkus-undertow` extension is used.
|===
NOTE: There can be other custom scopes provided by Quarkus extensions. For example, `quarkus-narayana-jta` provides `javax.transaction.TransactionScoped`.
[[client_proxies]]
== _Q: I don't undestand the concept of client proxies._
== _Q: I don't understand the concept of client proxies._
Indeed, the https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#client_proxies[client proxies, window="_blank"] could be hard to grasp but they provide some useful functionality.
A client proxy is basically an object that delegates all method invocations to a target bean instance.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/command-mode-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ As command mode applications will often require arguments to be passed on the co
mvn compile quarkus:dev -Dquarkus.args='--help'
----

The same can be achived with Gradle:
The same can be achieved with Gradle:

----
./gradlew quarkusDev --quarkus-args='--help'
Expand Down
26 changes: 25 additions & 1 deletion docs/src/main/asciidoc/deploying-to-kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ quarkus.kubernetes.name=todo-rest
quarkus.kubernetes.version=1.0-rc.1
----

[NOTE]
====
As is described in detail in the <<#openshift, OpenShift>> section, customizing OpenShift (or Knative) properties is done in the same way, but replacing
`kubernetes` with `openshift` (or `knative`). The previous example for OpenShift would look like this:
[source]
----
quarkus.openshift.part-of=todo-app
quarkus.openshift.name=todo-rest
quarkus.openshift.version=1.0-rc.1
----
====

The labels in generated resources will look like:

[source, json]
Expand Down Expand Up @@ -352,6 +365,17 @@ It's also possible to use the value from another field to add a new environment
quarkus.kubernetes.env.fields.foo=metadata.name
----

[NOTE]
====
As is described in detail in the <<#openshift, OpenShift>> section, customizing OpenShift properties is done in the same way, but replacing
`kubernetes` with `openshift`. The previous example for OpenShift would look like this:
[source]
----
quarkus.openshift.env.fields.foo=metadata.name
----
====

===== Validation

A conflict between two definitions, e.g. mistakenly assigning both a value and specifying that a variable is derived from a field, will result in an error being thrown at build time so that you get the opportunity to fix the issue before you deploy your application to your cluster where it might be more difficult to diagnose the source of the issue.
Expand Down Expand Up @@ -1000,7 +1024,7 @@ spec:
- env:
- name: "FOO" <3>
value: "BAR"
image: "<<yourDockerUsernmae>>/kubernetes-quickstart:1.0-SNAPSHOT" <4>
image: "<<yourDockerUsername>>/kubernetes-quickstart:1.0-SNAPSHOT" <4>
imagePullPolicy: "Always"
name: "kubernetes-quickstart"
ports:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/funqy-knative-events.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ You'll need two different terminal windows. One to do a curl request to the Bro
files so you can see the messages flowing through the Funqy function event chain.

Make sure you have the `stern` tool installed. See the Knative Tutorial setup for information on that. Run stern
to look for logs outputed by our Funqy deployment
to look for logs outputted by our Funqy deployment

[source, shell]
----
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/gcp-functions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ gcloud components install beta

== Creating the functions

For this example project, we will create three functions, one `HttpFunction`, one `BackgroundFunction` (Storage event) and one `RawBakgroundFunction` (PubSub event).
For this example project, we will create three functions, one `HttpFunction`, one `BackgroundFunction` (Storage event) and one `RawBackgroundFunction` (PubSub event).

== Choose Your Function

The `quarkus-google-cloud-functions` extension scans your project for a class that directly implements the Google Cloud `HttpFunction`, `BackgroundFunction` or `RawBakgroundFunction` interface.
The `quarkus-google-cloud-functions` extension scans your project for a class that directly implements the Google Cloud `HttpFunction`, `BackgroundFunction` or `RawBackgroundFunction` interface.
It must find a class in your project that implements one of these interfaces or it will throw a build time failure.
If it finds more than one function classes, a build time exception will also be thrown.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/qute-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ class BigDecimalExtensions {
<1> `item.discountedPrice` is resolved to an instance of `BigDecimal`.

[[namespace_extension_methods]]
==== Namespace Extention Methods
==== Namespace Extension Methods

If `TemplateExtension#namespace()` is specified then the extension method is used to resolve expressions with the given <<expressions,namespace>>.
Template extension methods that share the same namespace are grouped in one resolver ordered by `TemplateExtension#priority()`.
Expand Down Expand Up @@ -1239,7 +1239,7 @@ NOTE: A warning message is logged for each _unused_ parameter.

The default locale of the Java Virtual Machine used to *build the application* is used for the `@MessageBundle` interface by default.
However, the `io.quarkus.qute.i18n.MessageBundle#locale()` can be used to specify a custom locale.
Additionaly, there are two ways to define a localized bundle:
Additionally, there are two ways to define a localized bundle:

1. Create an interface that extends the default interface that is annotated with `@Localized`
2. Create an UTF-8 encoded file located in `src/main/resources/messages`; e.g. `msg_de.properties`.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/scheduler-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class MyService {

== Programmatic Scheduling

If you need to schedule a job programmatically you'll need to add the link:quartz[Quartz extension] and use the Quartz API direcly.
If you need to schedule a job programmatically you'll need to add the link:quartz[Quartz extension] and use the Quartz API directly.

.Programmatic Scheduling with Quartz API
[source,java]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/scripting.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ hello quarkus
== Debugging

To debug the application you use `jbang --debug quarkusapp.java` and you can use your IDE to connect on port 4004; if you want to use the
more traditonal Quarkus debug port you can use `jbang --debug=5005 quarkusapp.java`.
more traditional Quarkus debug port you can use `jbang --debug=5005 quarkusapp.java`.

Note: `jbang` debugging always suspends thus you need to connect the debugger to have the application run.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/tests-with-coverage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -705,4 +705,4 @@ You should end up with something like this (note the addition of the `merge-resu
== Conclusion

You now have all the information you need to study the coverage of your tests!
But remember, some code that is not covered is certinaly not well tested. But some code that is covered is not necessarily *well* tested. Make sure to write good tests!
But remember, some code that is not covered is certainly not well tested. But some code that is covered is not necessarily *well* tested. Make sure to write good tests!
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/transaction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Does it work everywhere I want to?::
Yep, it works in your Quarkus application, in your IDE, in your tests, because all of these are Quarkus applications.
JTA has some bad press for some people.
I don't know why.
Let's just say that this is not your grand'pa's JTA implementation.
Let's just say that this is not your grandpa's JTA implementation.
What we have is perfectly embeddable and lean.

Does it do 2 Phase Commit and slow down my app?::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public String subject() {
@Override
public OffsetDateTime time() {
if (time == null) {
time = OffsetDateTime.parse(this.request.getHeader("ce-time"));
String t = this.request.getHeader("ce-time");
if (t != null) {
time = OffsetDateTime.parse(t);
}
}

return time;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ HealthBuildItem addHealthChecks(GrpcServerBuildTimeConfig config,
NativeImageConfigBuildItem nativeImageConfiguration() {
NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder()
.addRuntimeInitializedClass("io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder")
.addRuntimeInitializedClass("io.grpc.netty.Utils$ByteBufAllocatorPreferHeapHolder");
.addRuntimeInitializedClass("io.grpc.netty.Utils$ByteBufAllocatorPreferHeapHolder")
// substitutions are runtime-only, Utils have to be substituted until we cannot use EPoll
// in native. NettyServerBuilder and NettyChannelBuilder would "bring in" Utils in build time
// if they were not marked as runtime initialized:
.addRuntimeInitializedClass("io.grpc.netty.Utils")
.addRuntimeInitializedClass("io.grpc.netty.NettyServerBuilder")
.addRuntimeInitializedClass("io.grpc.netty.NettyChannelBuilder");
return builder.build();
}

Expand Down
4 changes: 4 additions & 0 deletions extensions/grpc/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-grpc</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ public static SslContextBuilder configure(SslContextBuilder builder, Provider jd

}

@TargetClass(className = "io.grpc.netty.Utils")
final class Target_io_grpc_netty_Utils {

@Substitute
static boolean isEpollAvailable() {
return false;
}

@Substitute
private static Throwable getEpollUnavailabilityCause() {
return null;
}
}

@SuppressWarnings("unused")
class GrpcNettySubstitutions {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class KubernetesClientErrorHanlder {
public static void handle(Exception e) {
if (e.getCause() instanceof SSLHandshakeException) {
LOG.error(
"The application could not be deployed to the cluster because the Kubernetes API Server certificates are not trusted. The certificates can be configured using the relevant configuration propertiers under the 'quarkus.kubernetes-client' config root, or \"quarkus.kubernetes-client.trust-certs=true\" can be set to explicitly trust the certificates (not recommended)");
"The application could not be deployed to the cluster because the Kubernetes API Server certificates are not trusted. The certificates can be configured using the relevant configuration properties under the 'quarkus.kubernetes-client' config root, or \"quarkus.kubernetes-client.trust-certs=true\" can be set to explicitly trust the certificates (not recommended)");
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ void processInterfaces(
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy,
BuildProducer<BeanRegistrarBuildItem> beanRegistrars,
BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport,
BuildProducer<ServiceProviderBuildItem> serviceProvider,
BuildProducer<RestClientBuildItem> restClient) {

Expand Down Expand Up @@ -254,9 +253,11 @@ public void register(RegistrationContext registrationContext) {
}
}
}));
}

// Indicates that this extension would like the SSL support to be enabled
extensionSslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.REST_CLIENT));
@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(Feature.REST_CLIENT);
}

// currently default methods on a rest-client interface
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package io.quarkus.resteasy.test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.LinkedBlockingDeque;

import javax.annotation.PreDestroy;
import javax.enterprise.event.Observes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;

import io.vertx.core.Handler;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;

@Path("/in")
public class InputStreamResource {

Timer timer = new Timer();

public static final LinkedBlockingDeque<Throwable> THROWABLES = new LinkedBlockingDeque<>();

@PreDestroy
void stop() {
timer.cancel();
}

@POST
public String read(InputStream inputStream) throws IOException {
try {
byte[] buf = new byte[1024];
int r;
ByteArrayOutputStream out = new ByteArrayOutputStream();
while ((r = inputStream.read(buf)) > 0) {
out.write(buf, 0, r);
}
return new String(out.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
THROWABLES.add(e);
throw e;
}
}

public void delayFilter(@Observes Router router) {
router.route().order(Integer.MIN_VALUE).handler(new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext event) {
timer.schedule(new TimerTask() {
@Override
public void run() {
event.next();
}
}, 1000);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.quarkus.resteasy.test;

import java.io.IOException;
import java.net.Socket;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;

import org.hamcrest.Matchers;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
import io.restassured.RestAssured;

public class VertxIOHangTestCase {

@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(InputStreamResource.class));

@TestHTTPResource
URI uri;

@Test
public void testDelayFilter() {
// makes sure that everything works as normal
RestAssured.given().body("hello world").post("/in").then().body(Matchers.is("hello world"));
}

@Test
public void testDelayFilterConnectionKilled() throws Exception {
// makes sure that everything works as normal
try (Socket s = new Socket(uri.getHost(), uri.getPort())) {
s.getOutputStream().write(
"POST /in HTTP/1.1\r\nHost:localhost\r\nContent-Length: 100\r\n\r\n".getBytes(StandardCharsets.UTF_8));
s.getOutputStream().flush();
}
Throwable exception = InputStreamResource.THROWABLES.poll(3, TimeUnit.SECONDS);
Assertions.assertTrue(exception instanceof IOException);
}
}
Loading

0 comments on commit 32f62d3

Please sign in to comment.