Skip to content

Commit

Permalink
Bring some consistency in Dev Services startup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Aug 23, 2021
1 parent 7eb76b4 commit 2d915e6
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Optional;
import java.util.OptionalInt;

import org.jboss.logging.Logger;
import org.testcontainers.containers.Db2Container;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -19,6 +20,8 @@

public class DB2DevServicesProcessor {

private static final Logger LOG = Logger.getLogger(DB2DevServicesProcessor.class);

/**
* If you update this remember to update the container-license-acceptance.txt in the tests
*/
Expand All @@ -39,6 +42,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
.withDatabaseName(datasourceName.orElse("default"));
additionalProperties.forEach(container::withUrlParam);
container.start();

LOG.info("Dev Services for IBM Db2 started.");

return new RunningDevServicesDatasource(container.getJdbcUrl(), container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.OptionalInt;

import org.apache.derby.drda.NetworkServerControl;
import org.jboss.logging.Logger;

import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.deployment.spi.DevServicesDatasourceProvider;
Expand All @@ -18,6 +19,8 @@

public class DerbyDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(DerbyDevServicesProcessor.class);

static final int NUMBER_OF_PINGS = 10;
static final int SLEEP_BETWEEN_PINGS = 500;

Expand Down Expand Up @@ -50,6 +53,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
}
}
}

LOG.info("Dev Services for Derby started.");

StringBuilder additionalArgs = new StringBuilder();
for (Map.Entry<String, String> i : additionalProperties.entrySet()) {
additionalArgs.append(";");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.OptionalInt;

import org.h2.tools.Server;
import org.jboss.logging.Logger;

import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.deployment.spi.DevServicesDatasourceProvider;
Expand All @@ -20,6 +21,8 @@

public class H2DevServicesProcessor {

private static final Logger LOG = Logger.getLogger(H2DevServicesProcessor.class);

@BuildStep
DevServicesDatasourceProviderBuildItem setupH2() {
return new DevServicesDatasourceProviderBuildItem(DatabaseKind.H2, new DevServicesDatasourceProvider() {
Expand All @@ -39,8 +42,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
additionalArgs.append("=");
additionalArgs.append(i.getValue());
}
System.out
.println("[INFO] H2 database started in TCP server mode; server status: " + tcpServer.getStatus());

LOG.info("Dev Services for H2 started.");

String connectionUrl = "jdbc:h2:tcp://localhost:" + tcpServer.getPort() + "/mem:"
+ datasourceName.orElse("default")
+ ";DB_CLOSE_DELAY=-1" + additionalArgs.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Optional;
import java.util.OptionalInt;

import org.jboss.logging.Logger;
import org.testcontainers.containers.MariaDBContainer;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -19,6 +20,8 @@

public class MariaDBDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MariaDBDevServicesProcessor.class);

public static final String TAG = "10.5.9";
public static final Integer PORT = 3306;

Expand All @@ -37,6 +40,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
.withDatabaseName(datasourceName.orElse("default"));
additionalProperties.forEach(container::withUrlParam);
container.start();

LOG.info("Dev Services for MariaDB started.");

return new RunningDevServicesDatasource(container.getJdbcUrl(), container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Optional;
import java.util.OptionalInt;

import org.jboss.logging.Logger;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.MSSQLServerContainer;
import org.testcontainers.utility.DockerImageName;
Expand All @@ -20,6 +21,8 @@

public class MSSQLDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MSSQLDevServicesProcessor.class);

/**
* If you update this remember to update the container-license-acceptance.txt in the tests
*/
Expand All @@ -38,6 +41,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
.withPassword(password.orElse("Quarkuspassword1"));
additionalProperties.forEach(container::withUrlParam);
container.start();

LOG.info("Dev Services for Microsoft SQL Server started.");

return new RunningDevServicesDatasource(container.getJdbcUrl(), container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Optional;
import java.util.OptionalInt;

import org.jboss.logging.Logger;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -19,6 +20,8 @@

public class MySQLDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MySQLDevServicesProcessor.class);

public static final String TAG = "8.0.24";

@BuildStep
Expand All @@ -36,6 +39,9 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
.withDatabaseName(datasourceName.orElse("default"));
additionalProperties.forEach(container::withUrlParam);
container.start();

LOG.info("Dev Services for MySQL started.");

return new RunningDevServicesDatasource(container.getJdbcUrl(), container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Optional;
import java.util.OptionalInt;

import org.jboss.logging.Logger;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -19,6 +20,8 @@

public class PostgresqlDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(PostgresqlDevServicesProcessor.class);

public static final String TAG = "13.2";

@BuildStep
Expand All @@ -38,6 +41,8 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt

container.start();

LOG.info("Dev Services for PostgreSQL started.");

return new RunningDevServicesDatasource(container.getJdbcUrl(), container.getUsername(),
container.getPassword(),
new Closeable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ public void run() {
vertxInstance = Vertx.vertx();
}
capturedRealmFileLastModifiedDate = getRealmFileLastModifiedDate(capturedDevServicesConfiguration.realmPath);

LOG.info("Dev Services for Keycloak started.");

return prepareConfiguration(!startResult.realmFileExists, devServices);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
* It uses https://quay.io/repository/artemiscloud/activemq-artemis-broker as image.
* See https://artemiscloud.io/ for details.
*/
public class DevServicesAmqpProcessor {
public class AmqpDevServicesProcessor {

private static final Logger log = Logger.getLogger(DevServicesAmqpProcessor.class);
private static final Logger log = Logger.getLogger(AmqpDevServicesProcessor.class);

/**
* Label to add to shared Dev Service for AMQP running in containers.
Expand Down Expand Up @@ -86,8 +86,8 @@ public DevServicesAmqpBrokerBuildItem startAmqpDevService(
artemis = new DevServicesAmqpBrokerBuildItem(broker.host, broker.port, broker.user, broker.password);

if (broker.isOwner()) {
log.infof(
"Dev Services for AMQP started. Other Quarkus applications in dev mode will find the "
log.info("Dev Services for AMQP started.");
log.infof("Other Quarkus applications in dev mode will find the "
+ "broker automatically. For Quarkus applications in production mode, you can connect to"
+ " this by starting your application with -Damqp.host=%s -Damqp.port=%d -Damqp.user=%s -Damqp.password=%s",
broker.host, broker.port, broker.user, broker.password);
Expand Down Expand Up @@ -127,19 +127,19 @@ private void shutdownBroker() {
private AmqpBroker startAmqpBroker(AmqpDevServiceCfg config, LaunchModeBuildItem launchMode) {
if (!config.devServicesEnabled) {
// explicitly disabled
log.debug("Not starting dev services for AMQP, as it has been disabled in the config.");
log.debug("Not starting Dev Services for AMQP, as it has been disabled in the config.");
return null;
}

// Check if amqp.port or amqp.host are set
if (ConfigUtils.isPropertyPresent(AMQP_HOST_PROP) || ConfigUtils.isPropertyPresent(AMQP_PORT_PROP)) {
log.debug("Not starting dev services for AMQP, the amqp.host and/or amqp.port are configured.");
log.debug("Not starting Dev Services for AMQP, the amqp.host and/or amqp.port are configured.");
return null;
}

// Verify that we have AMQP channels without host and port
if (!hasAmqpChannelWithoutHostAndPort()) {
log.debug("Not starting dev services for AMQP, all the channels are configured.");
log.debug("Not starting Dev Services for AMQP, all the channels are configured.");
return null;
}

Expand Down

0 comments on commit 2d915e6

Please sign in to comment.