Skip to content

Commit 8692b23

Browse files
committed
Introduce WildFly module
Signed-off-by: Philip Riecks <mail@philipriecks.de>
1 parent 3808c15 commit 8692b23

6 files changed

Lines changed: 85 additions & 4 deletions

File tree

modules/wildfly/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ext.title = "MicroShed Testing Framework :: WildFly extensions"
2+
description = "Extensions for using MicroShed Testing with WildFly servers"
3+
4+
dependencies {
5+
compile project(':microshed-testing-testcontainers')
6+
}
7+
8+
apply from: publishScript
9+
10+
publishToMavenLocal.dependsOn ':microshed-testing-testcontainers:publishToMavenLocal'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2019 IBM Corporation and others
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* You may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package org.testcontainers.containers.wildfly;
20+
21+
import org.microshed.testing.testcontainers.spi.ServerAdapter;
22+
import org.testcontainers.images.builder.ImageFromDockerfile;
23+
24+
import java.io.File;
25+
import java.util.Optional;
26+
27+
public class WildFlyAdapter implements ServerAdapter {
28+
29+
@Override
30+
public int getPriority() {
31+
return PRIORITY_RUNTIME_MODULE;
32+
}
33+
34+
@Override
35+
public int getDefaultHttpPort() {
36+
return 8080;
37+
}
38+
39+
@Override
40+
public int getDefaultHttpsPort() {
41+
return 8443;
42+
}
43+
44+
@Override
45+
public ImageFromDockerfile getDefaultImage(File appFile) {
46+
String appName = appFile.getName();
47+
// Compose a docker image equivalent to doing:
48+
// FROM jboss/wildfly:18.0.1.Final
49+
// ADD target/myservice.war /opt/jboss/wildfly/standalone/deployments
50+
ImageFromDockerfile image = new ImageFromDockerfile()
51+
.withDockerfileFromBuilder(builder -> builder.from("jboss/wildfly:18.0.1.Final")
52+
.add(appName, "/opt/jboss/wildfly/standalone/deployments")
53+
.build())
54+
.withFileFromFile(appName, appFile);
55+
return image;
56+
57+
}
58+
59+
@Override
60+
public Optional<String> getReadinessPath() {
61+
return Optional.of("/health");
62+
}
63+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.testcontainers.containers.wildfly.WildFlyAdapter
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
log4j.rootLogger=INFO, stdout
2+
3+
log4j.appender=org.apache.log4j.ConsoleAppender
4+
log4j.appender.layout=org.apache.log4j.PatternLayout
5+
6+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
7+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
8+
log4j.appender.stdout.layout.ConversionPattern=%r %p %c %x - %m%n
9+
10+
log4j.logger.org.aguibert.liberty=DEBUG

sample-apps/wildfly-app/Dockerfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

sample-apps/wildfly-app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
dependencies {
66
providedCompile 'javax:javaee-api:8.0.1'
77
providedCompile 'org.eclipse.microprofile:microprofile:2.1'
8-
testCompile project(':microshed-testing-testcontainers')
8+
testCompile project(':microshed-testing-wildfly')
99
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.29'
1010
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
1111
}

0 commit comments

Comments
 (0)