Skip to content

Commit

Permalink
Merge pull request #1973 from quarkus-qe/dependabot/maven/quarkus.qe.…
Browse files Browse the repository at this point in the history
…framework.version-1.6.0.Beta2

Bump quarkus.qe.framework.version from 1.6.0.Beta1 to 1.6.0.Beta2
  • Loading branch information
michalvavrik committed Sep 4, 2024
2 parents 8a130aa + 3d32003 commit 30ee7f5
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 99 deletions.
30 changes: 17 additions & 13 deletions http/grpc/src/test/java/io/quarkus/ts/http/grpc/GRPCIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import io.grpc.Channel;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.ts.grpc.GreeterGrpc;
import io.quarkus.ts.grpc.HelloReply;
Expand All @@ -21,7 +21,7 @@ public interface GRPCIT {

RestService app();

Channel getChannel();
CloseableManagedChannel getChannel();

@Test
default void grpcClient() {
Expand All @@ -32,20 +32,24 @@ default void grpcClient() {

@Test
default void grpcServer() throws ExecutionException, InterruptedException {
HelloRequest request = HelloRequest.newBuilder().setName("server").build();
HelloReply response = GreeterGrpc.newFutureStub(getChannel()).sayHello(request).get();
Assertions.assertEquals("Hello server", response.getMessage());
try (var channel = getChannel()) {
HelloRequest request = HelloRequest.newBuilder().setName("server").build();
HelloReply response = GreeterGrpc.newFutureStub(channel).sayHello(request).get();
Assertions.assertEquals("Hello server", response.getMessage());
}
}

@Test
default void serverStream() {
HelloRequest request = HelloRequest.newBuilder().setName("ServerStream").build();
Iterator<HelloReply> stream = StreamingGrpc.newBlockingStub(getChannel()).serverStream(request);
AtomicInteger counter = new AtomicInteger(0);
stream.forEachRemaining((reply) -> {
Assertions.assertEquals("Hello ServerStream", reply.getMessage());
counter.incrementAndGet();
});
Assertions.assertEquals(GrpcStreamingService.SERVER_STREAM_MESSAGES_COUNT, counter.get());
try (var channel = getChannel()) {
HelloRequest request = HelloRequest.newBuilder().setName("ServerStream").build();
Iterator<HelloReply> stream = StreamingGrpc.newBlockingStub(channel).serverStream(request);
AtomicInteger counter = new AtomicInteger(0);
stream.forEachRemaining((reply) -> {
Assertions.assertEquals("Hello ServerStream", reply.getMessage());
counter.incrementAndGet();
});
Assertions.assertEquals(GrpcStreamingService.SERVER_STREAM_MESSAGES_COUNT, counter.get());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;

import io.grpc.Channel;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.OpenShiftDeploymentStrategy;
import io.quarkus.test.scenarios.OpenShiftScenario;
Expand All @@ -19,7 +19,7 @@ public RestService app() {
}

@Override
public Channel getChannel() {
public CloseableManagedChannel getChannel() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Disabled;

import io.grpc.Channel;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.OpenShiftScenario;

Expand All @@ -16,7 +16,7 @@ public RestService app() {
}

@Override
public Channel getChannel() {
public CloseableManagedChannel getChannel() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.google.protobuf.Descriptors;
import com.google.protobuf.InvalidProtocolBufferException;

import io.grpc.Channel;
import io.grpc.reflection.v1.FileDescriptorResponse;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.ts.grpc.GreeterGrpc;
Expand All @@ -26,8 +25,6 @@ public interface ReflectionHttpIT {

RestService app();

Channel getChannel();

@Test
default void testReflectionServices() {
GrpcReflectionResponse response = app().given().when().get("/http/reflection/service/info")
Expand Down
22 changes: 3 additions & 19 deletions http/grpc/src/test/java/io/quarkus/ts/http/grpc/SameServerIT.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package io.quarkus.ts.http.grpc;

import org.junit.jupiter.api.AfterAll;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.GrpcService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
Expand All @@ -15,27 +11,15 @@ public class SameServerIT implements GRPCIT, ReflectionHttpIT, StreamingHttpIT {

@QuarkusApplication(grpc = true)
static final GrpcService app = new GrpcService();
private static ManagedChannel channel;

@Override
public Channel getChannel() {
if (channel == null) {
channel = ManagedChannelBuilder.forAddress(
app.getURI().getHost(),
app.getURI().getPort())
.usePlaintext()
.build();
}
return channel;
public CloseableManagedChannel getChannel() {
return app.grpcChannel();
}

@Override
public RestService app() {
return app;
}

@AfterAll
static void afterAll() {
channel.shutdown();
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
package io.quarkus.ts.http.grpc;

import org.junit.jupiter.api.DisplayName;

import io.grpc.Channel;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.GrpcService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
@DisplayName("SeparateServer")
//This test should be the last, or we get complains, that the channel was not shut down before closure. This is a bug in our framework.
public class XeparateServerIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT {
public class SeparateServerIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT {

@QuarkusApplication(grpc = true)
static final GrpcService app = (GrpcService) new GrpcService()
.withProperty("quarkus.grpc.server.use-separate-server", "true")
.withProperty("quarkus.grpc.clients.plain.port", "${quarkus.grpc.server.port}");

@Override
public Channel getChannel() {
public CloseableManagedChannel getChannel() {
return app.grpcChannel();
}

Expand Down
19 changes: 4 additions & 15 deletions http/grpc/src/test/java/io/quarkus/ts/http/grpc/TLSIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import java.io.IOException;
import java.io.InputStream;

import org.junit.jupiter.api.AfterAll;

import io.grpc.Channel;
import io.grpc.ChannelCredentials;
import io.grpc.Grpc;
import io.grpc.ManagedChannel;
import io.grpc.TlsChannelCredentials;
import io.quarkus.test.bootstrap.CloseableManagedChannel;
import io.quarkus.test.bootstrap.GrpcService;
import io.quarkus.test.bootstrap.Protocol;
import io.quarkus.test.bootstrap.RestService;
Expand All @@ -20,23 +17,19 @@
@QuarkusScenario
public class TLSIT implements GRPCIT, StreamingHttpIT, ReflectionHttpIT {

private static ManagedChannel channel;
@QuarkusApplication(grpc = true, ssl = true)
static final GrpcService app = (GrpcService) new GrpcService()
.withProperty("quarkus.profile", "ssl");

public Channel getChannel() {
if (channel != null) {
return channel;
}
public CloseableManagedChannel getChannel() {
try (InputStream caCertificate = app.getClass().getClassLoader().getResourceAsStream("tls/ca.pem")) {
ChannelCredentials credentials = TlsChannelCredentials.newBuilder()
.trustManager(caCertificate)
.build();
channel = Grpc.newChannelBuilderForAddress(app().getURI(Protocol.GRPC).getHost(),
var channel = Grpc.newChannelBuilderForAddress(app().getURI(Protocol.GRPC).getHost(),
app().getURI(Protocol.HTTPS).getPort(), credentials)
.build();
return channel;
return new CloseableManagedChannel(channel);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -52,8 +45,4 @@ public RequestSpecification given() {
return app().relaxedHttps().given();
}

@AfterAll
static void afterAll() {
channel.shutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.quarkus.test.bootstrap.Protocol;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.DevModeQuarkusApplication;
import io.quarkus.test.services.URILike;

@Tag("QUARKUS-1026")
@Tag("QUARKUS-1094")
Expand All @@ -49,23 +48,19 @@ public class DevModeGrpcIntegrationReactiveIT {
};

@DevModeQuarkusApplication(grpc = true)
static final GrpcService app = (GrpcService) new GrpcService() {
@Override
public URILike getGrpcHost() {
// TODO: make app.grpcChannel() support gRPC on same HTTP server
return super.getGrpcHost().withPort(app.getURI().getPort());
}
}
static final GrpcService app = (GrpcService) new GrpcService()
.withProperty("quarkus.oidc.enabled", "false")
.withProperty("quarkus.keycloak.policy-enforcer.enable", "false")
.withProperty("quarkus.keycloak.devservices.enabled", "false");

@Test
public void testGrpcAsClient() throws ExecutionException, InterruptedException {
HelloRequest request = HelloRequest.newBuilder().setName(NAME).build();
HelloReply response = GreeterGrpc.newFutureStub(app.grpcChannel()).sayHello(request).get();
try (var channel = app.grpcChannel()) {
HelloReply response = GreeterGrpc.newFutureStub(channel).sayHello(request).get();

assertEquals("Hello " + NAME, response.getMessage());
assertEquals("Hello " + NAME, response.getMessage());
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@QuarkusScenario
public class DevModeHttpsIT extends AbstractDevModeIT {

@DevModeQuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true))
@DevModeQuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, useTlsRegistry = false, configureHttpServer = true))
static RestService app = new DevModeQuarkusService()
.withProperty("quarkus.oidc.enabled", "false")
.withProperty("quarkus.keycloak.policy-enforcer.enable", "false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class Http2IT {
@QuarkusApplication(ssl = true, classes = { MorningResource.class,
CustomFramesResource.class }, properties = "http2.properties", certificates = @Certificate(configureKeystore = true))
CustomFramesResource.class }, properties = "http2.properties", certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService();

private static URILike baseUri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class HttpAdvancedReactiveIT extends BaseHttpAdvancedReactiveIT {
static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH)
.withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false");

@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true))
@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url",
keycloak::getRealmUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class OpenShiftHttpAdvancedReactiveIT extends BaseHttpAdvancedReactiveIT
static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH)
.withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false");

@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true))
@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url",
keycloak::getRealmUrl);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.quarkus.test.bootstrap.Protocol;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.DevModeQuarkusApplication;
import io.quarkus.test.services.URILike;

@Tag("QUARKUS-1026")
@Tag("QUARKUS-1094")
Expand All @@ -47,23 +46,19 @@ public class DevModeGrpcIntegrationIT {
};

@DevModeQuarkusApplication(grpc = true)
static final GrpcService app = (GrpcService) new GrpcService() {
@Override
public URILike getGrpcHost() {
// TODO: make app.grpcChannel() support gRPC on same HTTP server
return super.getGrpcHost().withPort(app.getURI().getPort());
}
}
static final GrpcService app = (GrpcService) new GrpcService()
.withProperty("quarkus.oidc.enabled", "false")
.withProperty("quarkus.keycloak.policy-enforcer.enable", "false")
.withProperty("quarkus.keycloak.devservices.enabled", "false");

@Test
public void testGrpcAsClient() {
HelloRequest request = HelloRequest.newBuilder().setName(NAME).build();
HelloReply response = GreeterGrpc.newBlockingStub(app.grpcChannel()).sayHello(request);
try (var channel = app.grpcChannel()) {
HelloReply response = GreeterGrpc.newBlockingStub(channel).sayHello(request);

assertEquals("Hello " + NAME, response.getMessage());
assertEquals("Hello " + NAME, response.getMessage());
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class HttpAdvancedIT extends BaseHttpAdvancedIT {
static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH)
.withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false");

@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true))
@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class OpenShiftHttpAdvancedIT extends BaseHttpAdvancedIT {
static KeycloakService keycloak = new KeycloakService(DEFAULT_REALM_FILE, DEFAULT_REALM, DEFAULT_REALM_BASE_PATH)
.withProperty("JAVA_OPTS", "-Dcom.redhat.fips=false");

@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true))
@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService().withProperty("quarkus.oidc.auth-server-url", keycloak::getRealmUrl);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class LocalOptionsIT {
static final RestService custom = new RestService()
.withProperty("quarkus.management.port", "9002");

@QuarkusApplication(certificates = @Certificate(configureKeystoreForManagementInterface = true))
@QuarkusApplication(certificates = @Certificate(configureManagementInterface = true, configureKeystore = true, useTlsRegistry = false))
static final RestService tls = new RestService()
.withProperty("quarkus.management.port", "9003");

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<quarkus.ide.version>3.14.1</quarkus.ide.version>
<quarkus.qe.framework.version>1.6.0.Beta1</quarkus.qe.framework.version>
<quarkus.qe.framework.version>1.6.0.Beta2</quarkus.qe.framework.version>
<quarkus-qpid-jms.version>2.6.1</quarkus-qpid-jms.version>
<confluent.kafka-avro-serializer.version>7.5.1</confluent.kafka-avro-serializer.version>
<formatter-maven-plugin.version>2.24.1</formatter-maven-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class EnabledHttpsSecurityIT {

@QuarkusApplication(ssl = true, certificates = {
@Certificate(configureKeystore = true, configureTruststore = true, password = CLIENT_PASSWORD, clientCertificates = {
@Certificate(configureKeystore = true, configureTruststore = true, useTlsRegistry = false, configureHttpServer = true, password = CLIENT_PASSWORD, clientCertificates = {
@Certificate.ClientCertificate(cnAttribute = CLIENT_CN),
@Certificate.ClientCertificate(cnAttribute = UNKNOWN_CLIENT_CN, unknownToServer = true)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@QuarkusScenario
public class RedirectHttpsSecurityIT {

@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureTruststore = true))
@QuarkusApplication(ssl = true, certificates = @Certificate(configureKeystore = true, configureTruststore = true, configureHttpServer = true, useTlsRegistry = false))
static RestService app = new RestService()
.withProperty("quarkus.http.insecure-requests", HttpConfiguration.InsecureRequests.REDIRECT.name());

Expand Down
Loading

0 comments on commit 30ee7f5

Please sign in to comment.