Skip to content

Commit

Permalink
Merge pull request quarkus-qe#215 from pjgg/feat/remove-deprecated-code
Browse files Browse the repository at this point in the history
Vertx Logger and ConfigProperties was deprecated
  • Loading branch information
jsmrcka authored Jun 2, 2021
2 parents 4f9615a + 9b99d95 commit 7bfa0f6
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public String helloProtagonistFriend() {
@Path("/antagonist")
@Produces(MediaType.TEXT_PLAIN)
public String helloAntagonist() {
return antagonist.name + " says: " + antagonist.message;
return antagonist.name() + " says: " + antagonist.message();
}

@GET
@Path("/antagonist/wife")
@Produces(MediaType.TEXT_PLAIN)
public String helloAntagonistWife() {
return antagonist.wife.name + " says: " + antagonist.wife.message;
return antagonist.wife().name() + " says: " + antagonist.wife().message();
}

@GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package io.quarkus.qe.config;

import io.quarkus.arc.config.ConfigProperties;
import io.smallrye.config.ConfigMapping;

@ConfigProperties(prefix = "antagonist")
public class AntagonistConfiguration {
public String message;
public String name;
public AntagonistWifeConfig wife;
@ConfigMapping(prefix = "antagonist")
public interface AntagonistConfiguration {
String message();

public static class AntagonistWifeConfig {
public String name;
public String message;
String name();

AntagonistWifeConfig wife();

interface AntagonistWifeConfig {
String name();

String message();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import org.eclipse.microprofile.config.inject.ConfigProperty;

import io.quarkus.arc.config.ConfigProperties;
import io.smallrye.config.ConfigMapping;

@ConfigProperties(prefix = "protagonist")
@ConfigMapping(prefix = "protagonist")
public interface ProtagonistConfigurable extends IBiography {

@ConfigProperty(name = "name")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package io.quarkus.qe.vertx.webclient.config;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithName;

import io.quarkus.arc.config.ConfigProperties;
@ConfigMapping(prefix = "vertx.webclient")
public interface VertxWebClientConfig {

@ConfigProperties(prefix = "vertx.webclient")
public class VertxWebClientConfig {
@WithName("timeout-sec")
long timeout();

@ConfigProperty(name = "timeoutSec")
public long timeout;

@ConfigProperty(name = "retries")
public long retries;
long retries();
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ void initialize() {
@Route(methods = HttpMethod.GET, path = "/")
public Uni<Joke> getRandomJoke() {
return getChuckQuoteAsJoke()
.ifNoItem().after(Duration.ofSeconds(httpClientConf.timeout)).fail()
.onFailure().retry().atMost(httpClientConf.retries);
.ifNoItem().after(Duration.ofSeconds(httpClientConf.timeout())).fail()
.onFailure().retry().atMost(httpClientConf.retries());
}

@Route(methods = HttpMethod.GET, path = "/bodyCodec", produces = "application/json")
Expand All @@ -59,8 +59,8 @@ public Uni<Joke> getRandomJokeWithBodyCodec() {
.expect(ResponsePredicate.status(HttpURLConnection.HTTP_OK))
.send()
.map(HttpResponse::body)
.ifNoItem().after(Duration.ofSeconds(httpClientConf.timeout)).fail()
.onFailure().retry().atMost(httpClientConf.retries);
.ifNoItem().after(Duration.ofSeconds(httpClientConf.timeout())).fail()
.onFailure().retry().atMost(httpClientConf.retries());
}

@Route(methods = HttpMethod.GET, path = "/combine", produces = "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class VerticleDeployer {
StockPriceProducer producer;

public void run(@Observes StartupEvent e, Vertx vertx, Instance<AbstractVerticle> verticles) {
vertx.setPeriodic(config.delay, c -> producer.generate().subscribe());
vertx.setPeriodic(config.delay(), c -> producer.generate().subscribe());

// Deploy all abstract verticles example.
for (AbstractVerticle verticle : verticles) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package io.quarkus.qe.kafka.config;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithName;

import io.quarkus.arc.config.ConfigProperties;
@ConfigMapping(prefix = "vertx.kafka.producer")
public interface VertxKProducerConfig {

@ConfigProperties(prefix = "vertx.kafka.producer")
public class VertxKProducerConfig {

@ConfigProperty(name = "delayMs")
public long delay;

@ConfigProperty(name = "batchSize")
public int batchSize;
@WithName("delay-ms")
long delay();

int batchSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class StockPriceProducer {
private Random random = new Random();

public Uni<Void> generate() {
IntStream.range(0, config.batchSize).forEach(next -> {
IntStream.range(0, config.batchSize()).forEach(next -> {
StockPrice event = StockPrice.newBuilder().setId("IBM").setPrice(random.nextDouble()).setStatus(status.PENDING)
.build();
LOG.infov("PRODUCER -> ID: {0}, PRICE: {1}", event.getId(), event.getPrice());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ JWTAuth jwtAuth() {
private PubSecKeyOptions getPubSecKeyOptions() {
JsonObject authConfig = new JsonObject()
.put("symmetric", true)
.put("algorithm", authNConf.alg)
.put("publicKey", authNConf.secret);
.put("algorithm", authNConf.alg())
.put("publicKey", authNConf.secret());

return new PubSecKeyOptions(authConfig).setBuffer(authConfig.getBuffer("publicKey"));
}

private JWTOptions getJwtOptions() {
return new JWTOptions()
.setIgnoreExpiration(false)
.setIssuer(authNConf.claims.iss)
.setAudience(Arrays.asList((authNConf.claims.aud)))
.setSubject(authNConf.claims.sub)
.setExpiresInMinutes(authNConf.liveSpan)
.setAlgorithm(authNConf.alg);
.setIssuer(authNConf.claims().iss())
.setAudience(Arrays.asList((authNConf.claims().aud())))
.setSubject(authNConf.claims().sub())
.setExpiresInMinutes(authNConf.liveSpan())
.setAlgorithm(authNConf.alg());
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package io.quarkus.qe.vertx.web.config;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithName;

import io.quarkus.arc.config.ConfigProperties;
@ConfigMapping(prefix = "authN")
public interface AuthNConfig {
String alg();

@ConfigProperties(prefix = "authN")
public class AuthNConfig {
public String alg;
String secret();

public String secret;
@WithName("tokenLiveSpanMin")
int liveSpan();

@ConfigProperty(name = "tokenLiveSpanMin")
public int liveSpan;
@WithName("jwt.claims")
JwtClaims claims();

@ConfigProperty(name = "jwt.claims")
public JwtClaims claims;
interface JwtClaims {
String iss();

String sub();

String aud();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ app.name=Vertx-jwt

authN.alg=HS256
authN.secret=keepSecret
authN.tokenLiveSpanMin=10
authN.token-live-span-min=10
authN.jwt.claims.aud=third_party
authN.jwt.claims.iss=[email protected]
authN.jwt.claims.sub=bff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import io.quarkus.qe.vertx.sql.services.DbPoolService;
import io.quarkus.runtime.StartupEvent;
import io.quarkus.runtime.configuration.ProfileManager;
import io.vertx.core.impl.logging.Logger;
import io.vertx.core.impl.logging.LoggerFactory;
import io.vertx.core.json.jackson.DatabindCodec;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.mutiny.db2client.DB2Pool;
import io.vertx.mutiny.mysqlclient.MySQLPool;
import io.vertx.mutiny.pgclient.PgPool;
Expand Down

0 comments on commit 7bfa0f6

Please sign in to comment.