Skip to content

Commit

Permalink
Merge branch 'main' into feat_customize_jaxb
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgitario committed Jun 9, 2022
2 parents 8cbeb80 + 2deaf45 commit 1b90462
Show file tree
Hide file tree
Showing 24 changed files with 207 additions and 40 deletions.
17 changes: 16 additions & 1 deletion bom/application/pom.xml
Expand Up @@ -186,7 +186,7 @@
<log4j2-api.version>2.17.2</log4j2-api.version>
<log4j-jboss-logmanager.version>1.3.0.Final</log4j-jboss-logmanager.version>
<avro.version>1.11.0</avro.version>
<apicurio-registry.version>2.2.3.Final</apicurio-registry.version>
<apicurio-registry.version>2.2.4.Final</apicurio-registry.version>
<apicurio-common-rest-client.version>0.1.9.Final</apicurio-common-rest-client.version> <!-- must be the version Apicurio Registry uses -->
<jacoco.version>0.8.8</jacoco.version>
<testcontainers.version>1.17.2</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
Expand Down Expand Up @@ -1385,16 +1385,31 @@
<artifactId>quarkus-smallrye-reactive-messaging-amqp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-amqp-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-mqtt</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-mqtt-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-rabbitmq</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-rabbitmq-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-metrics</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions build-parent/pom.xml
Expand Up @@ -89,13 +89,13 @@
<opensearch.protocol>http</opensearch.protocol>

<!-- Database images for JDBC/Reactive/Hibernate tests and devservices -->
<postgres.image>docker.io/postgres:14.2</postgres.image>
<mariadb.image>docker.io/mariadb:10.7</mariadb.image>
<postgres.image>docker.io/postgres:14</postgres.image>
<mariadb.image>docker.io/mariadb:10.6</mariadb.image>
<db2.image>docker.io/ibmcom/db2:11.5.7.0a</db2.image>
<mssql.image>mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04</mssql.image>
<mssql.image>mcr.microsoft.com/mssql/server:2019-latest</mssql.image>
<mysql.image>docker.io/mysql:8.0</mysql.image>
<oracle.image>docker.io/gvenzl/oracle-xe:21-slim</oracle.image>
<mongo.image>docker.io/mongo:4.4.13</mongo.image>
<mongo.image>docker.io/mongo:4.4</mongo.image>

<!-- Align various dependencies that are not really part of the bom-->
<junit4.version>4.13.2</junit4.version>
Expand Down
Expand Up @@ -186,39 +186,47 @@ void processTemplateErrors(TemplatesAnalysisBuildItem analysis, List<IncorrectEx
errors.add(TemplateException.builder()
.code(Code.INCORRECT_EXPRESSION)
.origin(incorrectExpression.origin)
.message("Incorrect expression found: \\{{}\\}\n\t- {}\n\t- at {}:{}")
.arguments(incorrectExpression.expression, incorrectExpression.reason,
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()),
incorrectExpression.origin.getLine())
.message(
"{templatePath.or(origin.templateId)}:{origin.line}:{origin.lineCharacterStart} - \\{{expression}\\}: {reason}")
.argument("templatePath",
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()))
.argument("expression", incorrectExpression.expression)
.argument("reason", incorrectExpression.reason)
.build());
} else if (incorrectExpression.clazz != null) {
errors.add(TemplateException.builder()
.code(Code.INCORRECT_EXPRESSION)
.origin(incorrectExpression.origin)
.message(
"Incorrect expression found: \\{{}}\n\t- property/method [{}] not found on class [{}] nor handled by an extension method\n\t- at {}:{}")
.arguments(incorrectExpression.expression, incorrectExpression.property, incorrectExpression.clazz,
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()),
incorrectExpression.origin.getLine())
"{templatePath.or(origin.templateId)}:{origin.line}:{origin.lineCharacterStart} - \\{{expression}}: Property/method [{property}] not found on class [{clazz}] nor handled by an extension method")
.argument("templatePath",
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()))
.argument("expression", incorrectExpression.expression)
.argument("property", incorrectExpression.property)
.argument("clazz", incorrectExpression.clazz)
.build());
} else {
errors.add(TemplateException.builder()
.code(Code.INCORRECT_EXPRESSION)
.origin(incorrectExpression.origin)
.message("Incorrect expression found: \\{{}}\n\t- @Named bean not found for [{}]\n\t- at {}:{}")
.arguments(incorrectExpression.expression, incorrectExpression.property,
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()),
incorrectExpression.origin.getLine())
.message(
"{templatePath.or(origin.templateId)}:{origin.line}:{origin.lineCharacterStart} - \\{{expression}}: @Named bean not found for [{property}]")
.argument("templatePath",
findTemplatePath(analysis, incorrectExpression.origin.getTemplateGeneratedId()))
.argument("expression", incorrectExpression.expression)
.argument("property", incorrectExpression.property)
.build());
}
}

if (!errors.isEmpty()) {
StringBuilder message = new StringBuilder("Found template problems (").append(errors.size()).append("):");
StringBuilder message = new StringBuilder("Found incorrect expressions (").append(errors.size())
.append("):");
int idx = 1;
for (TemplateException error : errors) {
message.append("\n").append("[").append(idx++).append("] ").append(error.getMessage());
message.append("\n\t").append("[").append(idx++).append("] ").append(error.getMessage());
}
message.append("\n");
TemplateException exception = new TemplateException(message.toString());
for (TemplateException error : errors) {
exception.addSuppressed(error);
Expand Down Expand Up @@ -832,7 +840,7 @@ static Match validateNestedExpressions(QuteConfig config, TemplateAnalysis templ
} else {
// No namespace extension method found - incorrect expression
incorrectExpressions.produce(new IncorrectExpressionBuildItem(expression.toOriginalString(),
String.format("no matching namespace [%s] extension method found", namespace), expression.getOrigin()));
String.format("No matching namespace [%s] extension method found", namespace), expression.getOrigin()));
match.clearValues();
return putResult(match, results, expression);
}
Expand Down
Expand Up @@ -32,7 +32,7 @@ public class TemplateDataValidationTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (1)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(te.getMessage().contains("foo_My:BAZ"), te.getMessage());
});

Expand Down
Expand Up @@ -32,7 +32,7 @@ public class TemplateEnumValidationFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (1)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(te.getMessage().contains("TransactionType:BAR.scores"), te.getMessage());
});

Expand Down
Expand Up @@ -33,9 +33,9 @@ public class NamespaceTemplateExtensionValidationFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (2)"), te.getMessage());
assertTrue(te.getMessage().contains("no matching namespace [bro] extension method found"), te.getMessage());
assertTrue(te.getMessage().contains("property/method [bubu] not found on class [java.lang.String]"),
assertTrue(te.getMessage().contains("Found incorrect expressions (2)"), te.getMessage());
assertTrue(te.getMessage().contains("No matching namespace [bro] extension method found"), te.getMessage());
assertTrue(te.getMessage().contains("Property/method [bubu] not found on class [java.lang.String]"),
te.getMessage());
});

Expand Down
Expand Up @@ -33,11 +33,10 @@ public class TemplateGlobalValidationFailureTest {
}
assertNotNull(te);
assertTrue(
te.getMessage().contains("Incorrect expression found: {user.name}"),
te.getMessage());
te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(
te.getMessage().contains(
"property/method [name] not found on class [java.lang.String] nor handled by an extension method"),
"Property/method [name] not found on class [java.lang.String] nor handled by an extension method"),
te.getMessage());
});

Expand Down
Expand Up @@ -36,7 +36,7 @@ public class MessageBundleExpressionValidationTest {
if (te == null) {
fail("No template exception thrown: " + t);
}
assertTrue(te.getMessage().contains("Found template problems (5)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (5)"), te.getMessage());
assertTrue(te.getMessage().contains("item.foo"), te.getMessage());
assertTrue(te.getMessage().contains("bar"), te.getMessage());
assertTrue(te.getMessage().contains("foo"), te.getMessage());
Expand Down
Expand Up @@ -34,7 +34,7 @@ public class MessageBundleTemplateExpressionValidationTest {
if (te == null) {
fail("No template exception thrown: " + t);
}
assertTrue(te.getMessage().contains("Found template problems (4)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (4)"), te.getMessage());
assertTrue(te.getMessage().contains("msg:hello('foo')"), te.getMessage());
assertTrue(te.getMessage().contains("msg:hello_and_bye"), te.getMessage());
assertTrue(te.getMessage().contains("msg:hello(1,2)"), te.getMessage());
Expand Down
Expand Up @@ -35,7 +35,7 @@ public class NamedBeanValidationFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (2)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (2)"), te.getMessage());
assertTrue(te.getMessage().contains("it.ping"), te.getMessage());
assertTrue(te.getMessage().contains("cdi:foo.bar"), te.getMessage());
});
Expand Down
Expand Up @@ -46,7 +46,7 @@ public class CheckedTemplateRequireTypeSafeTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (3)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (3)"), te.getMessage());
assertTrue(te.getMessage().contains("any"), te.getMessage());
assertTrue(te.getMessage().contains("identifier"), te.getMessage());
assertTrue(te.getMessage().contains("index"), te.getMessage());
Expand Down
Expand Up @@ -33,7 +33,7 @@ public class InterfaceValidationFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (1)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(te.getMessage().contains("{metrics.responses.values}"), te.getMessage());
});

Expand Down
Expand Up @@ -33,7 +33,7 @@ public class TypeSafeLoopFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (1)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(te.getMessage().contains("foo.ages"), te.getMessage());
});

Expand Down
Expand Up @@ -48,7 +48,7 @@ public class ValidationFailuresTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (10)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (10)"), te.getMessage());
assertTrue(te.getMessage().contains("movie.foo"), te.getMessage());
assertTrue(te.getMessage().contains("movie.getName('foo')"), te.getMessage());
assertTrue(te.getMessage().contains("movie.findService(age)"), te.getMessage());
Expand Down
Expand Up @@ -34,7 +34,7 @@ public class WhenValidationFailureTest {
e = e.getCause();
}
assertNotNull(te);
assertTrue(te.getMessage().contains("Found template problems (1)"), te.getMessage());
assertTrue(te.getMessage().contains("Found incorrect expressions (1)"), te.getMessage());
assertTrue(te.getMessage().contains("{WRONG}"), te.getMessage());
});

Expand Down
Expand Up @@ -20,7 +20,7 @@ public class TypeErrorTest {
.addAsResource("templates/HelloResource/typedTemplatePrimitives.txt")
.addAsResource(new StringAsset("Hello {name}!"), "templates/hello.txt"))
.assertException(t -> {
assertTrue(t.getMessage().contains("Incorrect expression"));
assertTrue(t.getMessage().contains("Found incorrect expressions"));
assertTrue(t.getMessage().contains("name.foo()"));
});

Expand Down
Expand Up @@ -20,7 +20,7 @@ public class TypeErrorTest {
.addAsResource("templates/HelloResource/typedTemplatePrimitives.txt")
.addAsResource(new StringAsset("Hello {name}!"), "templates/hello.txt"))
.assertException(t -> {
assertTrue(t.getMessage().contains("Incorrect expression"));
assertTrue(t.getMessage().contains("Found incorrect expressions"));
assertTrue(t.getMessage().contains("name.foo()"));
});

Expand Down
Expand Up @@ -22,7 +22,7 @@ public class QuteErrorPageTest {
public void testErrorPage() {
config.modifyResourceFile("templates/hello.txt", file -> "{@java.lang.String hello}{hello.foo}");
RestAssured.when().get("/hello").then()
.body(containsString("Incorrect expression found: {hello.foo}"))
.body(containsString("hello.txt:1"), containsString("{hello.foo}"))
.statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode());
}

Expand Down
22 changes: 22 additions & 0 deletions integration-tests/oidc-token-propagation-reactive/pom.xml
Expand Up @@ -15,6 +15,15 @@
<description>Module that contains OpenID Connect Token Propagation Reactive tests</description>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-security-oidc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand All @@ -34,6 +43,19 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-deployment</artifactId>
Expand Down
@@ -0,0 +1,52 @@
package io.quarkus.it.keycloak;

import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;

import org.eclipse.microprofile.jwt.JsonWebToken;

import io.quarkus.security.Authenticated;
import io.quarkus.security.identity.SecurityIdentity;

@Path("/web-app")
@Authenticated
public class ProtectedJwtResource {

@Inject
SecurityIdentity identity;

@Inject
JsonWebToken accessToken;

@Context
SecurityContext securityContext;

@GET
@Path("test-security")
@RolesAllowed("viewer")
public String testSecurity() {
return securityContext.getUserPrincipal().getName();
}

@POST
@Path("test-security")
@Consumes("application/json")
@RolesAllowed("viewer")
public String testSecurityJson(User user) {
return user.getName() + ":" + securityContext.getUserPrincipal().getName();
}

@GET
@Path("test-security-jwt")
@RolesAllowed("viewer")
public String testSecurityJwt() {
return accessToken.getName() + ":" + accessToken.getGroups().iterator().next()
+ ":" + accessToken.getClaim("email");
}
}
@@ -0,0 +1,15 @@
package io.quarkus.it.keycloak;

public class User {

private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}

0 comments on commit 1b90462

Please sign in to comment.