org.testcontainers.containers.output.Slf4jLogConsumer Java Examples
The following examples show how to use
org.testcontainers.containers.output.Slf4jLogConsumer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InfinispanServerTestResource.java From kogito-runtimes with Apache License 2.0 | 6 votes |
@Override public Map<String, String> start() { if (INFINISPAN_IMAGE == null) { throw new RuntimeException("Please define a valid Infinispan image in system property container.image.infinispan"); } LOGGER.info("Using Infinispan image: {}", INFINISPAN_IMAGE); infinispan = new FixedHostPortGenericContainer(INFINISPAN_IMAGE) .withFixedExposedPort(11232, 11222) //wait for the server to be fully started .waitingFor(Wait.forLogMessage(".*\\bstarted\\b.*", 1)) .withEnv("USER", "admin") .withEnv("PASS", "admin") .withLogConsumer(new Slf4jLogConsumer(LOGGER)); infinispan.start(); return Collections.emptyMap(); }
Example #2
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 6 votes |
@Test public void testWithAdditionalUrlParamMultiQueries() throws SQLException { MySQLContainer mysql = (MySQLContainer) new MySQLContainer() .withUrlParam("allowMultiQueries", "true") .withLogConsumer(new Slf4jLogConsumer(logger)); mysql.start(); try(Connection connection = mysql.createConnection("")) { Statement statement = connection.createStatement(); String multiQuery = "DROP TABLE IF EXISTS bar; " + "CREATE TABLE bar (foo VARCHAR(20)); " + "INSERT INTO bar (foo) VALUES ('hello world');"; statement.execute(multiQuery); statement.execute("SELECT foo FROM bar;"); try(ResultSet resultSet = statement.getResultSet()) { resultSet.next(); String firstColumnValue = resultSet.getString(1); assertEquals("Value from bar should equal real value", "hello world", firstColumnValue); } } finally { mysql.stop(); } }
Example #3
Source File: SyndesisServerContainer.java From syndesis with Apache License 2.0 | 6 votes |
public SyndesisServerContainer build() { SyndesisServerContainer container; if (ObjectHelper.isEmpty(serverJarPath)) { container = new SyndesisServerContainer(serverJarPath, getJavaOptionString(), deleteOnExit); } else { container = new SyndesisServerContainer(imageTag, getJavaOptionString()); } if (enableLogging) { container.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("SERVER_CONTAINER"))); } container.withCreateContainerCmdModifier(createContainerCmd -> createContainerCmd.withName("syndesis-server")); if (enableDebug) { container.withExposedPorts(SERVER_PORT, JOLOKIA_PORT, SyndesisTestEnvironment.getDebugPort()); container.withCreateContainerCmdModifier(cmd -> cmd.withPortBindings(new PortBinding(Ports.Binding.bindPort(SyndesisTestEnvironment.getDebugPort()), new ExposedPort(SyndesisTestEnvironment.getDebugPort())))); } else { container.withExposedPorts(SERVER_PORT, JOLOKIA_PORT); } container.waitingFor(new HttpWaitStrategy().forPort(SERVER_PORT) .withStartupTimeout(Duration.ofMinutes(3))); return container; }
Example #4
Source File: SyndesisIntegrationRuntimeContainer.java From syndesis with Apache License 2.0 | 6 votes |
public SyndesisIntegrationRuntimeContainer build() { CustomizedIntegrationSource source = new CustomizedIntegrationSource(integrationSource, customizers); Project project = getProjectBuilder().build(source); SyndesisIntegrationRuntimeContainer container = getContainer(project); if (enableLogging) { container.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("INTEGRATION_RUNTIME_CONTAINER"))); } if (enableDebug) { container.withExposedPorts(SyndesisTestEnvironment.getDebugPort()); container.withCreateContainerCmdModifier(cmd -> cmd.withPortBindings(new PortBinding(Ports.Binding.bindPort(SyndesisTestEnvironment.getDebugPort()), new ExposedPort(SyndesisTestEnvironment.getDebugPort())))); } container.waitingFor(SyndesisTestEnvironment.getIntegrationRuntime().getReadinessProbe().withStartupTimeout(startupTimeout)); return container; }
Example #5
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 6 votes |
@Test public void testWithAdditionalUrlParamInJdbcUrl() { MySQLContainer mysql = (MySQLContainer) new MySQLContainer() .withUrlParam("allowMultiQueries", "true") .withUrlParam("rewriteBatchedStatements", "true") .withLogConsumer(new Slf4jLogConsumer(logger)); try { mysql.start(); String jdbcUrl = mysql.getJdbcUrl(); assertThat(jdbcUrl, containsString("?")); assertThat(jdbcUrl, containsString("&")); assertThat(jdbcUrl, containsString("rewriteBatchedStatements=true")); assertThat(jdbcUrl, containsString("allowMultiQueries=true")); } finally { mysql.stop(); } }
Example #6
Source File: ContainerUtils.java From Mahuta with Apache License 2.0 | 6 votes |
public static void startContainer(String name, ContainerType type, Map<String, String> customEnvVars) { GenericContainer<?> container = new GenericContainer<>(containersRegistry.get(type).image) .withExposedPorts(containersRegistry.get(type).exposedPorts); if(containersRegistry.get(type).waitStrategy != null) { container.waitingFor(containersRegistry.get(type).waitStrategy); } if(containersRegistry.get(type).envVars != null) { containersRegistry.get(type).envVars.forEach((key, value) -> { container.addEnv(key, value); }); } if(customEnvVars != null) { customEnvVars.forEach((key, value) -> { container.addEnv(key, value); }); } container.withLogConsumer(new Slf4jLogConsumer(log)); container.start(); containers.put(name, container); }
Example #7
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 6 votes |
@Test public void testWithAdditionalUrlParamTimeZone() throws SQLException { MySQLContainer mysql = (MySQLContainer) new MySQLContainer() .withUrlParam("serverTimezone", "Europe/Zurich") .withEnv("TZ", "Europe/Zurich") .withLogConsumer(new Slf4jLogConsumer(logger)); mysql.start(); try(Connection connection = mysql.createConnection("")) { Statement statement = connection.createStatement(); statement.execute("SELECT NOW();"); try (ResultSet resultSet = statement.getResultSet()) { resultSet.next(); // checking that the time_zone MySQL is Europe/Zurich LocalDateTime localDateTime = resultSet.getObject(1, LocalDateTime.class); ZonedDateTime actualDateTime = localDateTime.atZone(ZoneId.of("Europe/Zurich")) .truncatedTo(ChronoUnit.MINUTES); ZonedDateTime expectedDateTime = ZonedDateTime.now(ZoneId.of("Europe/Zurich")) .truncatedTo(ChronoUnit.MINUTES); String message = String.format("MySQL time zone is not Europe/Zurich. MySQL date:%s, current date:%s", actualDateTime, expectedDateTime); assertTrue(message, actualDateTime.equals(expectedDateTime)); } } finally { mysql.stop(); } }
Example #8
Source File: StatefulFunctionsAppContainers.java From flink-statefun with Apache License 2.0 | 6 votes |
private static GenericContainer<?> masterContainer( ImageFromDockerfile appImage, Network network, List<GenericContainer<?>> dependents, int numWorkers, @Nullable Logger masterLogger) { final GenericContainer<?> master = new GenericContainer(appImage) .withNetwork(network) .withNetworkAliases(MASTER_HOST) .withEnv("ROLE", "master") .withEnv("MASTER_HOST", MASTER_HOST) .withCommand("-p " + numWorkers) .withExposedPorts(8081); for (GenericContainer<?> dependent : dependents) { master.dependsOn(dependent); } if (masterLogger != null) { master.withLogConsumer(new Slf4jLogConsumer(masterLogger, true)); } return master; }
Example #9
Source File: ElasticSearchTestResource.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public Map<String, String> start() { LOGGER.info(TestcontainersConfiguration.getInstance().toString()); try { container = new GenericContainer(ELASTICSEARCH_IMAGE) .withExposedPorts(ELASTICSEARCH_PORT) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .withEnv("discovery.type", "single-node") .waitingFor(Wait.forListeningPort()); container.start(); return CollectionHelper.mapOf( "camel.component.elasticsearch-rest.host-addresses", String.format("localhost:%s", container.getMappedPort(ELASTICSEARCH_PORT))); } catch (Exception e) { throw new RuntimeException(e); } }
Example #10
Source File: NexusPaxExamSupport.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
protected static Option[] configureDatabase() { switch (getValidTestDatabase()) { case POSTGRES: postgresContainer = new GenericContainer(POSTGRES_IMAGE) //NOSONAR .withExposedPorts(POSTGRES_PORT) .withEnv("POSTGRES_USER", DB_USER) .withEnv("POSTGRES_PASSWORD", DB_PASSWORD) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(NexusPaxExamSupport.class))) .withClasspathResourceMapping("initialize-postgres.sql", "/docker-entrypoint-initdb.d/initialize-postgres.sql", READ_ONLY) .waitingFor(Wait.forLogMessage(".*database system is ready to accept connections.*", 1)); return combine(null, editConfigurationFilePut(NEXUS_PROPERTIES_FILE, "nexus.orient.enabled", "false"), systemProperty(TEST_JDBC_URL_PROPERTY).value(configurePostgres()) ); case H2: return combine(null, editConfigurationFilePut(NEXUS_PROPERTIES_FILE, "nexus.orient.enabled", "false") ); case ORIENT: return new Option[0]; default: throw new IllegalStateException("No case defined for " + getValidTestDatabase()); } }
Example #11
Source File: ActiveMQTestResource.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public Map<String, String> start() { LOGGER.info(TestcontainersConfiguration.getInstance().toString()); try { container = new GenericContainer(ACTIVEMQ_IMAGE) .withExposedPorts(AMQP_PORT) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100") .waitingFor(Wait.forListeningPort()); container.start(); String brokerUrl = String.format("amqp://127.0.0.1:%d", container.getMappedPort(AMQP_PORT)); return CollectionHelper.mapOf( "quarkus.qpid-jms.url", brokerUrl, "quarkus.qpid-jms.username", ACTIVEMQ_USERNAME, "quarkus.qpid-jms.password", ACTIVEMQ_PASSWORD); } catch (Exception e) { throw new RuntimeException(e); } }
Example #12
Source File: ActiveMQTestResource.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public Map<String, String> start() { LOGGER.info(TestcontainersConfiguration.getInstance().toString()); try { container = new GenericContainer<>(ACTIVEMQ_IMAGE) .withExposedPorts(TCP_PORT) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .waitingFor(Wait.forListeningPort()); container.start(); return Collections.singletonMap( "camel.component.activemq.broker-url", String.format("tcp://%s:%d", container.getContainerIpAddress(), container.getMappedPort(TCP_PORT))); } catch (Exception e) { throw new RuntimeException(e); } }
Example #13
Source File: AzureTestResource.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public Map<String, String> start() { try { container = new GenericContainer<>(AZURITE_IMAGE) .withExposedPorts(BLOB_SERVICE_PORT, QUEUE_SERVICE_PORT) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .waitingFor(Wait.forListeningPort()); container.start(); String baseServiceUrl = "http://%s:%d/devstoreaccount1/"; String blobServiceUrl = String.format(baseServiceUrl, container.getContainerIpAddress(), container.getMappedPort(BLOB_SERVICE_PORT)); String queueServiceUrl = String.format(baseServiceUrl, container.getContainerIpAddress(), container.getMappedPort(QUEUE_SERVICE_PORT)); Map<String, String> configuration = new HashMap<>(); configuration.put("azurite.blob.service.url", blobServiceUrl); configuration.put("azurite.queue.service.url", queueServiceUrl); configuration.put("azurite.credentials", String.format(AZURITE_CREDENTIALS, blobServiceUrl, queueServiceUrl)); return configuration; } catch (Exception e) { throw new RuntimeException(e); } }
Example #14
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 5 votes |
@Test public void testSpecificVersion() throws SQLException { try (MySQLContainer<?> mysqlOldVersion = new MySQLContainer<>("mysql:5.5") .withConfigurationOverride("somepath/mysql_conf_override") .withLogConsumer(new Slf4jLogConsumer(logger))) { mysqlOldVersion.start(); ResultSet resultSet = performQuery(mysqlOldVersion, "SELECT VERSION()"); String resultSetString = resultSet.getString(1); assertTrue("The database version can be set using a container rule parameter", resultSetString.startsWith("5.5")); } }
Example #15
Source File: DcpIntegrationTestBase.java From java-dcp-client with Apache License 2.0 | 5 votes |
protected static AgentContainer startAgent(Network network) throws Exception { File appFile = new File("target/dcp-test-agent-0.1.0.jar"); AgentContainer agentContainer = new AgentContainer(appFile, AGENT_UI_PORT).withNetwork(network) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("container.agent"))); agentContainer.start(); return agentContainer; }
Example #16
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 5 votes |
@Test public void testExplicitInitScript() throws SQLException { try (MySQLContainer<?> container = new MySQLContainer<>() .withInitScript("somepath/init_mysql.sql") .withLogConsumer(new Slf4jLogConsumer(logger))) { container.start(); ResultSet resultSet = performQuery(container, "SELECT foo FROM bar"); String firstColumnValue = resultSet.getString(1); assertEquals("Value from init script should equal real value", "hello world", firstColumnValue); } }
Example #17
Source File: SimpleMySQLTest.java From testcontainers-java with MIT License | 5 votes |
@Test public void testSimple() throws SQLException { try (MySQLContainer<?> mysql = new MySQLContainer<>() .withConfigurationOverride("somepath/mysql_conf_override") .withLogConsumer(new Slf4jLogConsumer(logger))) { mysql.start(); ResultSet resultSet = performQuery(mysql, "SELECT 1"); int resultSetInt = resultSet.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); } }
Example #18
Source File: AsciidocConfluencePublisherMojoIntegrationTest.java From confluence-publisher with Apache License 2.0 | 5 votes |
private static void startProxy(String dockerImageName, String proxyHost, int proxyPort, Map<String, String> env, PortAwareRunnable runnable) throws Exception { try (GenericContainer<?> proxy = new GenericContainer<>(dockerImageName) .withEnv(env) .withNetwork(SHARED) .withNetworkAliases(proxyHost) .withExposedPorts(proxyPort) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(AsciidocConfluencePublisherMojoIntegrationTest.class))) .waitingFor(forListeningPort())) { proxy.start(); runnable.run(proxy.getMappedPort(proxyPort)); } }
Example #19
Source File: DockerComposeContainer.java From testcontainers-java with MIT License | 5 votes |
private void createServiceInstance(Container container) { String serviceName = getServiceNameFromContainer(container); final ComposeServiceWaitStrategyTarget containerInstance = new ComposeServiceWaitStrategyTarget(container, ambassadorContainer, ambassadorPortMappings.getOrDefault(serviceName, new HashMap<>())); String containerId = containerInstance.getContainerId(); if (tailChildContainers) { followLogs(containerId, new Slf4jLogConsumer(log).withPrefix(container.getNames()[0])); } //follow logs using registered consumers for this service logConsumers.getOrDefault(serviceName, Collections.emptyList()).forEach(consumer -> followLogs(containerId, consumer)); serviceInstanceMap.putIfAbsent(serviceName, containerInstance); }
Example #20
Source File: DockerComposeContainer.java From testcontainers-java with MIT License | 5 votes |
@Override public void invoke() { super.start(); this.followOutput(new Slf4jLogConsumer(logger())); // wait for the compose container to stop, which should only happen after it has spawned all the service containers logger().info("Docker Compose container is running for command: {}", Joiner.on(" ").join(this.getCommandParts())); while (this.isRunning()) { logger().trace("Compose container is still running"); Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } logger().info("Docker Compose has finished running"); AuditLogger.doComposeLog(this.getCommandParts(), this.getEnv()); final Integer exitCode = this.dockerClient.inspectContainerCmd(getContainerId()) .exec() .getState() .getExitCode(); if (exitCode == null || exitCode != 0) { throw new ContainerLaunchException( "Containerised Docker Compose exited abnormally with code " + exitCode + " whilst running command: " + StringUtils.join(this.getCommandParts(), ' ')); } }
Example #21
Source File: OutputStreamTest.java From testcontainers-java with MIT License | 5 votes |
@Test(timeout = 60_000L) public void testLogConsumer() throws TimeoutException { WaitingConsumer waitingConsumer = new WaitingConsumer(); Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LOGGER); Consumer<OutputFrame> composedConsumer = logConsumer.andThen(waitingConsumer); container.followOutput(composedConsumer); waitingConsumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("seq=2")); }
Example #22
Source File: OutputStreamWithTTYTest.java From testcontainers-java with MIT License | 5 votes |
@Test public void testLogConsumer() throws TimeoutException { WaitingConsumer waitingConsumer = new WaitingConsumer(); Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(log); Consumer<OutputFrame> composedConsumer = logConsumer.andThen(waitingConsumer); container.followOutput(composedConsumer); waitingConsumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("home")); }
Example #23
Source File: SkyWalkingAnnotations.java From skywalking with Apache License 2.0 | 5 votes |
private static void initLoggers(final List<File> files, final DockerComposeContainer<?> compose) { files.forEach(file -> { try { load(file).as(DockerComposeFile.class).getServices().forEach( (service, ignored) -> compose.withLogConsumer( service, new Slf4jLogConsumer(new ContainerLogger(LOG_DIR, service + ".log")) ) ); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } }); }
Example #24
Source File: InformixConnectionIT.java From pinpoint with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { Assume.assumeTrue("Docker not enabled", DockerMachineClient.instance().isInstalled()); container.withPrivilegedMode(true); container.withExposedPorts(9088, 9089, 27017, 27018, 27883); container.withEnv("LICENSE", "accept"); container.withEnv("DB_INIT", "1"); container.withLogConsumer(new Slf4jLogConsumer(LOGGER)); container.start(); driverClass = new InformixJDBCDriverClass(); Driver driver = driverClass.getDriver().newInstance(); DriverManager.registerDriver(driver); Connection connection = null; try { connection = createConnection("localhost:" + container.getFirstMappedPort() + "/sysmaster", "informix", "in4mix"); Statement statement = connection.createStatement(); List<String> tableQuery = createTableQuery(); for (String query : tableQuery) { statement.execute(query); } } finally { if (connection != null) { connection.close(); } } }
Example #25
Source File: DockerBasedPublishingIntegrationTest.java From confluence-publisher with Apache License 2.0 | 5 votes |
private static void startProxy(String dockerImageName, String proxyHost, int proxyPort, Map<String, String> env, Runnable runnable) { try (GenericContainer<?> proxy = new GenericContainer<>(dockerImageName) .withEnv(env) .withNetwork(SHARED) .withNetworkAliases(proxyHost) .withExposedPorts(proxyPort) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(DockerBasedPublishingIntegrationTest.class))) .waitingFor(forListeningPort())) { proxy.start(); runnable.run(); } }
Example #26
Source File: DockerBasedPublishingIntegrationTest.java From confluence-publisher with Apache License 2.0 | 5 votes |
private static void publishAndVerify(String pathToContent, Map<String, String> env, Runnable runnable) { try (GenericContainer<?> publisher = new GenericContainer<>("confluencepublisher/confluence-publisher:0.0.0-SNAPSHOT") .withEnv(env) .withNetwork(SHARED) .withClasspathResourceMapping("/" + pathToContent, "/var/asciidoc-root-folder", READ_ONLY) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(DockerBasedPublishingIntegrationTest.class))) .waitingFor(forLogMessage(".*Documentation successfully published to Confluence.*", 1))) { publisher.start(); runnable.run(); } catch (ConflictException ignored) { // avoid test failures due to issues with already terminated confluence publisher container } }
Example #27
Source File: AsciidocConfluencePublisherCommandLineClientIntegrationTest.java From confluence-publisher with Apache License 2.0 | 5 votes |
private static void startProxy(String dockerImageName, String proxyHost, int proxyPort, Map<String, String> env, PortAwareRunnable runnable) throws Exception { try (GenericContainer<?> proxy = new GenericContainer<>(dockerImageName) .withEnv(env) .withNetwork(SHARED) .withNetworkAliases(proxyHost) .withExposedPorts(proxyPort) .withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(AsciidocConfluencePublisherCommandLineClientIntegrationTest.class))) .waitingFor(forListeningPort())) { proxy.start(); runnable.run(proxy.getMappedPort(proxyPort)); } }
Example #28
Source File: MainIT.java From dockerfile-maven with Apache License 2.0 | 5 votes |
@Before public void setUp() { backend = httpUri(backendJob, BACKEND_PORT); frontend = httpUri(frontendJob, FRONTEND_PORT); backendJob.followOutput(new Slf4jLogConsumer( LoggerFactory.getLogger(MainIT.class.getName() + ".backend"))); frontendJob.followOutput(new Slf4jLogConsumer( LoggerFactory.getLogger(MainIT.class.getName() + ".frontend"))); }
Example #29
Source File: DockerPostgresDatabaseProvider.java From embedded-database-spring-test with Apache License 2.0 | 5 votes |
private DatabaseInstance(DatabaseConfig config) { String initdbArgs = config.initdbProperties.entrySet().stream() .map(e -> String.format("--%s=%s", e.getKey(), e.getValue())) .collect(Collectors.joining(" ")); Map<String, String> serverProperties = new HashMap<>(config.configProperties); serverProperties.putIfAbsent("fsync", "off"); serverProperties.putIfAbsent("full_page_writes", "off"); serverProperties.putIfAbsent("max_connections", "300"); String postgresArgs = serverProperties.entrySet().stream() .map(e -> String.format("-c %s=%s", e.getKey(), e.getValue())) .collect(Collectors.joining(" ")); container = new PostgreSQLContainer(config.dockerImage) { @Override protected void configure() { super.configure(); addEnv("POSTGRES_INITDB_ARGS", "--nosync " + initdbArgs); setCommand("postgres " + postgresArgs); } }; if (config.tmpfsEnabled) { Consumer<CreateContainerCmd> consumer = cmd -> cmd.getHostConfig() .withTmpFs(ImmutableMap.of("/var/lib/postgresql/data", config.tmpfsOptions)); container.withCreateContainerCmdModifier(consumer); } container.withUsername(DEFAULT_POSTGRES_USERNAME); container.withPassword(DEFAULT_POSTGRES_PASSWORD); config.customizers.forEach(c -> c.customize(container)); container.start(); container.followOutput(new Slf4jLogConsumer(LoggerFactory.getLogger(DockerPostgresDatabaseProvider.class))); semaphore = new Semaphore(Integer.parseInt(serverProperties.get("max_connections"))); }
Example #30
Source File: ActiveMQTestResource.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Override public Map<String, String> start() { LOGGER.info(TestcontainersConfiguration.getInstance().toString()); try { container = new GenericContainer<>(ACTIVEMQ_IMAGE) .withExposedPorts(ACTIVEMQ_PORT) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100") .waitingFor(Wait.forListeningPort()); container.start(); String brokerUrlTcp = String.format("tcp://127.0.0.1:%d", container.getMappedPort(ACTIVEMQ_PORT)); String brokerUrlWs = String.format("ws://127.0.0.1:%d", container.getMappedPort(ACTIVEMQ_PORT)); return CollectionHelper.mapOf( "quarkus.artemis.url", brokerUrlTcp, "quarkus.artemis.username", ACTIVEMQ_USERNAME, "quarkus.artemis.password", ACTIVEMQ_PASSWORD, "camel.component.paho.brokerUrl", brokerUrlTcp, "camel.component.paho.username", ACTIVEMQ_USERNAME, "camel.component.paho.password", ACTIVEMQ_PASSWORD, "broker-url.ws", brokerUrlWs); } catch (Exception e) { throw new RuntimeException(e); } }